4 subroutine valout (lst, lend, time, nvar, naux)
7 implicit double precision (a-h,o-z)
8 character*10 fname1, fname2, fname3, fname4, fname5
19 integer output_aux_num
20 integer clock_start, clock_finish, clock_rate
21 real(kind=8) cpu_start, cpu_finish
25 iadd(ivar,i,j) = loc + ivar - 1 + nvar*((j-1)*mitot+i-1)
26 iaddaux(iaux,i,j) = locaux + iaux-1 + naux*(i-1) +
30 call system_clock(clock_start,clock_rate)
31 call cpu_time(cpu_start)
36 output_aux_num = output_aux_num + output_aux_components(i)
40 outaux = ((output_aux_num > 0) .and.
41 . ((.not. output_aux_onlyonce) .or. (time==t0)))
59 do 55 ipos = 10, 7, -1
61 fname1(ipos:ipos) = char(ichar(
'0') + idigit)
62 fname2(ipos:ipos) = char(ichar(
'0') + idigit)
63 fname3(ipos:ipos) = char(ichar(
'0') + idigit)
64 fname4(ipos:ipos) = char(ichar(
'0') + idigit)
68 open(unit=matunit1,file=fname1,status=
'unknown',
71 if (output_format == 3)
then
73 open(unit=matunit4,file=fname4,status=
'unknown',
80 65
if (level .gt. lend) go to 90
82 70
if (mptr .eq. 0) go to 80
84 nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
85 ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
86 loc = node(store1, mptr)
87 locaux = node(storeaux,mptr)
91 write(matunit1,1001) mptr, level, nx, ny
94 write(matunit1,1003) mptr, level, nx
96 1001
format(i6,
' grid_number',/,
100 1003
format(i6,
' grid_number',/,
105 xlow = rnode(cornxlo,mptr)
106 ylow = rnode(cornylo,mptr)
109 & xlow,ylow,hxposs(level),hyposs(level)
114 1002
format(e26.16,
' xlow', /,
118 1004
format(e26.16,
' xlow', /,
122 if (output_format == 1)
then
123 do j = nghost+1, mjtot-nghost
124 do i = nghost+1, mitot-nghost
126 if (abs(alloc(
iadd(ivar,i,j))) < 1d-90)
then
127 alloc(
iadd(ivar,i,j)) = 0.d0
131 & (alloc(
iadd(ivar,i,j)), ivar=1,nvar)
133 write(matunit1,*)
' '
138 if (output_format == 3)
then
141 i2 =
iadd(nvar,mitot,mjtot)
143 write(matunit4) alloc(i1:i2)
146 mptr = node(levelptr, mptr)
161 165
if (level .gt. lfine) go to 190
163 170
if (mptr .eq. 0) go to 180
164 nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
165 ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
166 locaux = node(storeaux,mptr)
167 mitot = nx + 2*nghost
168 mjtot = ny + 2*nghost
171 if (output_format == 1)
then
172 open(unit=matunit3,file=fname3,status=
'unknown',
175 write(matunit3,1001) mptr, level, nx, ny
178 write(matunit3,1003) mptr, level, nx
180 xlow = rnode(cornxlo,mptr)
181 ylow = rnode(cornylo,mptr)
184 & xlow,ylow,hxposs(level),hyposs(level)
190 do j = nghost+1, mjtot-nghost
191 do i = nghost+1, mitot-nghost
193 if (abs(alloc(iaddaux(ivar,i,j))) .lt. 1d-90)
194 & alloc(iaddaux(ivar,i,j)) = 0.d0
196 write(matunit3,109) (alloc(iaddaux(ivar,i,j)),
199 write(matunit3,*)
' '
203 if (output_format == 3)
then
205 open(unit=matunit3,file=fname3,status=
'unknown',
208 i2 = iaddaux(naux,mitot,mjtot)
210 write(matunit3) alloc(i1:i2)
214 mptr = node(levelptr, mptr)
216 180 level = level + 1
228 open(unit=matunit2,file=fname2,status=
'unknown',
240 write(matunit2,1000) time,nvar,ngrids,naux,ndim,nghost
241 1000
format(e18.8,
' time', /,
249 write(6,601) matlabu,time
250 601
format(
'AMRCLAW: Frame ',i4,
251 &
' output files done at time t = ', d13.6,/)
253 matlabu = matlabu + 1
257 if (output_format == 3)
then
261 call system_clock(clock_finish,clock_rate)
262 call cpu_time(cpu_finish)
263 timevalout = timevalout + clock_finish - clock_start
264 timevaloutcpu = timevaloutcpu + cpu_finish - cpu_start
subroutine valout(lst, lend, time, nvar, naux)
integer pure function iadd(ivar, i, j)