Skip to content

Commit e15d70d

Browse files
committed
more chunks of code translated.
1 parent d2f7b3f commit e15d70d

File tree

1 file changed

+17
-100
lines changed

1 file changed

+17
-100
lines changed

examples/acoustics_1d_example1/claw1ez.jl

Lines changed: 17 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function claw1ez() # No arguments
5454
### character*12 fname
5555
### #
5656
### open(10,file='fort.info',status='unknown',form='formatted')
57+
58+
unit10 = open("fort.info", "w")
5759
###
5860
### #
5961
### # # Read the input in standard form from claw.data:
@@ -68,16 +70,6 @@ function claw1ez() # No arguments
6870
### #
6971
### # # Read the input in standard form from claw.data:
7072
### #
71-
###
72-
### read(55,*) ndim
73-
###
74-
### read(55,*) xlower
75-
### read(55,*) xupper
76-
### read(55,*) mx
77-
### read(55,*) meqn
78-
### read(55,*) mwaves
79-
### read(55,*) maux
80-
### read(55,*) t0
8173
###
8274
r = Reader("claw.data")
8375

@@ -92,16 +84,8 @@ function claw1ez() # No arguments
9284

9385
println("read from claw.data : ndim: $ndim xlower: $xlower xupper: $xupper mx: $mx meqn: $meqn mwaves: $mwaves maux: $maux t0: $t0")
9486

95-
### read(55,*) outstyle
96-
9787
outstyle = readint(r)
9888

99-
### if (outstyle == 1) then
100-
### read(55,*) nout
101-
### read(55,*) tfinal
102-
### read(55,*) output_t0 ! Not currently used
103-
### nstepout = 1
104-
10589
tout = Array(Float64, 1)
10690
if outstyle == 1
10791
nout = readint(r)
@@ -118,66 +102,25 @@ function claw1ez() # No arguments
118102
println("tout: $tout")
119103
nstepout = 1
120104

121-
122-
### else if (outstyle == 3) then
123-
### read(55,*) nstepout
124-
### read(55,*) nstop
125-
### read(55,*) output_t0
126-
### nout = nstop
127-
### else
128-
### print *, '*** Unrecognized output style ', outstyle
129-
### print *, '*** Exiting claw1ez'
130-
### go to 900
131-
### end if
132-
###
133-
134105
elseif outstyle == 3
106+
nstepout = readint(r)
107+
nstop = readint(r)
108+
output_t0 = readbool(r) # Not currently used
109+
nout = nstop
135110

136111
else
112+
println("nout: $nout tfinal: $tfinal output_t0: $output_t0")
137113
println("*** Unrecognized output style $outstyle")
138114
error("*** Exiting claw1ez")
139115
end
140116

141-
### read(55,*) output_format ! Not used yet
142117
output_format = readint(r) # Not used yet
143118

144-
### ! These iout variables are not currently used, but hang onto them
145-
### ! anyway in case somebody wants to use them at a future date. The
146-
### ! same goes for outaux_init_only.
147-
### allocate(iout_q(meqn), stat=allocate_status)
148-
### if (allocate_status .ne. 0) then
149-
### print *, '*** Error allocating iout_q array; exiting claw1ez'
150-
### go to 900 ! Exception handling, old school style
151-
### end if
152-
### read(55,*) (iout_q(i), i = 1, meqn)
153-
inout_q = readfltarray(r, meqn)
154-
println("inout_q: $inout_q")
155-
156-
# if maux > 0
157-
### allocate(iout_aux(maux), stat=allocate_status)
158-
### if (allocate_status .ne. 0) then
159-
### print *, '*** Error allocating iout_aux array;',
160-
### & ' exiting claw1ez'
161-
### go to 900
162-
### end if
119+
iout_q = readfltarray(r, meqn)
120+
println("iout_q: $iout_q")
163121

164122
# iout_aux
165123

166-
### read(55,*) (iout_aux(i), i = 1, maux)
167-
### read(55,*) outaux_init_only
168-
### ! Not implementing selective output of aux fields yet
169-
### if (any(iout_aux .ne. 0)) then
170-
### outaux_always = .not. outaux_init_only
171-
### else
172-
### outaux_always = .false.
173-
### outaux_init_only = .false.
174-
### end if
175-
### else
176-
### outaux_always = .false.
177-
### outaux_init_only = .false. ! Just to initialize
178-
# end
179-
180-
181124
iout_aux = Array(Int, 1)
182125
if maux > 0
183126
iout_aux = readintarray(r, maux)
@@ -197,26 +140,13 @@ function claw1ez() # No arguments
197140

198141
println("dtv: $dtv cflv: $cflv nv: $nv")
199142

200-
### read(55,*) dt_variable ! Variable or fixed dt
201-
### if (dt_variable) then
202-
### method(1) = 1
203-
### else
204-
### method(1) = 0
205-
### end if
206-
207143
dt_variable::Bool = readbool(r)
208144
method[1] = dt_variable ? 1 : 0
209145

210146
method[2] = readint(r) # Order
211147

212-
### ! method(3) (transverse order) not used in 1D
213-
### ! No dimensional splitting in 1D
214-
### read(55,*) method(4) ! Verbosity
215-
### read(55,*) method(5) ! Source term splitting style
216-
### read(55,*) method(6) ! Index into aux of capacity function
217-
### method(7) = maux ! Number of aux variables
218-
###
219-
148+
# method(3) (transverse order) not used in 1D
149+
# No dimensional splitting in 1D
220150

221151
method[4] = readint(r) # Verbosity
222152
method[5] = readint(r) # Source term splitting style
@@ -225,17 +155,8 @@ function claw1ez() # No arguments
225155

226156
println("method: $method")
227157

228-
### read(55,*) use_fwaves
229-
###
230158
use_fwaves::Bool = readbool(r)
231159

232-
### allocate(mthlim(mwaves), stat=allocate_status)
233-
### if (allocate_status .ne. 0) then
234-
### print *, '*** Error allocating mthlim array; exiting claw1ez'
235-
### go to 900
236-
### end if
237-
### read(55,*) (mthlim(i), i = 1, mwaves)
238-
239160
mthlim::Array{Int, 1} = readintarray(r, mwaves)
240161
println("mthlim: $mthlim")
241162

@@ -250,14 +171,6 @@ function claw1ez() # No arguments
250171
# just close the file now.
251172
close_reader(r)
252173

253-
### ! Check consistency for periodic BCs
254-
### if ((mthbc(1).eq.2 .and. mthbc(2).ne.2) .or.
255-
### & (mthbc(2).eq.2 .and. mthbc(1).ne.2)) then
256-
### write(6,*) '*** ERROR *** periodic boundary conditions'
257-
### write(6,*) ' require mthbc(1) and mthbc(2) BOTH be set to 2'
258-
### stop
259-
### endif
260-
261174
# Check consistency for periodic BCs
262175
if (mthbc[1] == 2 && mthbc[2] != 2) ||
263176
(mthbc[2] == 2 && mthbc[1] != 2)
@@ -360,9 +273,13 @@ function claw1ez() # No arguments
360273
aux,maux,outaux_always)
361274

362275
@printf("CLAW1EZ: Frame %4d output files done at time t = %12.4e\n", iframe,tend)
363-
@printf("tend = %15.4e \ninfo =%5d\nsmallest dt =%15.4e\nlargest dt =%15.4e\nlast dt =%15.4e\nlargest cfl =%15.4e\nlast cfl =%15.4e\nsteps taken =%4d\n",
364-
tend,info,dtv[3],dtv[4],dtv[5],cflv[3],cflv[4],nv[2])
276+
@printf(unit10,"tend = %15.4e \ninfo =%5d\nsmallest dt =%15.4e\nlargest dt =%15.4e\n",
277+
tend,info,dtv[3],dtv[4])
278+
@printf(unit10,"last dt =%15.4e\nlargest cfl =%15.4e\nlast cfl =%15.4e\nsteps taken =%4d\n",
279+
dtv[5],cflv[3],cflv[4],nv[2])
365280

366281
end
367282
end
283+
Base.close(unit10)
284+
368285
end # claw1ez

0 commit comments

Comments
 (0)