main driver routine. controls: integration of all grids. error estimation / regridding output counting updating of fine to coarse grids
11 implicit double precision (a-h,o-z)
14 logical vtime, dumpout/.false./, dumpchk/.false./
15 logical rest, dump_final
17 integer clock_start, clock_finish, clock_rate
18 integer tick_clock_start, tick_clock_finish, tick_clock_rate
48 call system_clock(tick_clock_start,tick_clock_rate)
49 call cpu_time(tick_cpu_start)
60 if (nstart .gt. 0)
then 63 if (
tout(ii) .gt. time)
then 77 if (
tchk(ii) .gt. time)
then 93 20
if (ncycle .ge.
nstop .or. time .ge.
tfinal)
goto 999
96 if (nextout .le.
nout)
then 97 outtime =
tout(nextout)
105 if (nextchk .le.
nchkpt)
then 106 chktime =
tchk(nextchk)
113 if (time.lt.outtime .and. time+1.001*
possk(1) .ge. outtime)
then 119 possk(1) = outtime - time
121 diffdt = oldposs -
possk(1)
125 write(*,122) diffdt,outtime
126 122
format(
" Adjusting timestep by ",e10.3,
127 .
" to hit output time of ",e13.6)
129 if (diffdt .lt. 0.)
then 130 pctincrease = -100.*diffdt/oldposs
131 write(*,123) pctincrease
132 123
format(
" New step is ",f8.2,
" % larger.",
133 .
" Should still be stable")
141 if (
nout .gt. 0)
then 142 nextout = nextout + 1
148 if (time.lt.chktime .and. time +
possk(1) .ge. chktime)
then 150 possk(1) = chktime - time
153 nextchk = nextchk + 1
179 else if (level+1 .ge.
mxnest)
then 183 else if (level+2 .ge.
mxnest)
then 190 if (lbase .eq.
mxnest .or. lbase .gt.
lfine)
go to 70
196 101
format(8h level ,i5,32h stays fixed during regridding )
198 call system_clock(clock_start,clock_rate)
199 call cpu_time(cpu_start)
200 call regrid(nvar,lbase,cut,naux,start_time)
201 call system_clock(clock_finish,clock_rate)
202 call cpu_time(cpu_finish)
217 do 80 i = lbase,
lfine 219 do 81 i = lbase+1,
lfine 220 81 tlevel(i) = tlevel(lbase)
224 do levnew = lbase+1,
lfine 227 1006
format(
' Refinement ratios... in x:', i3,
228 &
' in y:',i3,
' in t:',i3,
' for level ',i4)
240 call advanc(level,nvar,dtlevnew,vtime,naux)
245 timenew = tlevel(level)+
possk(level)
249 if (
method(4).ge.level)
then 252 100
format(
' AMRCLAW: level ',i2,
' CFL = ',e10.3,
253 &
' dt = ',e11.4,
' final t = ',e13.6)
261 ntogo(level) = ntogo(level) - 1
262 dtnew(level) = dmin1(dtnew(level),dtlevnew)
263 tlevel(level) = tlevel(level) +
possk(level)
266 if (level .lt.
lfine)
then 269 if (((
possk(level-1) - dtnew(level-1))/dtnew(level-1)) .gt.
271 dttemp = dtnew(level-1)/
kratio(level-1)
272 ntogo(level) = (tlevel(level-1)-tlevel(level))/dttemp+.9
274 ntogo(level) =
kratio(level-1)
280 105
if (level .eq. 1)
go to 110
281 if (ntogo(level) .gt. 0)
then 283 106
if ((
possk(level)-dtnew(level))/dtnew(level)
286 ntogo(level) = ntogo(level) + 1
287 possk(level) = (tlevel(level-1)-tlevel(level))/
294 call system_clock(clock_start,clock_rate)
295 call update(level,nvar,naux)
296 call system_clock(clock_finish,clock_rate)
306 time = time +
possk(1)
308 call conck(1,nvar,naux,time,rest)
315 dtnew(ii) = min(dtnew(ii),dtnew(ii+1)*
kratio(ii))
318 dtnew(1) = min(dtnew(1),dt_max)
327 call check(ncycle,time,nvar,naux)
331 if ((mod(ncycle,
iout).eq.0) .or. dumpout)
then 347 102
format(
'*** Computation halted after nv(1) = ',i8,
348 &
' steps on coarse grid')
354 if (.not. dumpout)
then 367 call system_clock(tick_clock_finish,tick_clock_rate)
368 call cpu_time(tick_cpu_finish)
378 if (.not. dumpchk)
call check(ncycle,time,nvar,naux)
380 if (num_gauges .gt. 0)
then 381 do ii = 1, num_gauges
389 write(6,*)
"Done integrating to time ",time
integer, dimension(7) method
integer, dimension(maxlv) kratio
real(kind=8), parameter rinfinity
subroutine regrid(nvar, lbase, cut, naux, start_time)
subroutine print_gauges_and_reset_nextloc(gauge_num)
real(kind=8), dimension(:), allocatable tout
subroutine conck(level, nvar, naux, time, rest)
Conservation check for specified level.
subroutine valout(lst, lend, time, nvar, naux)
subroutine check(nsteps, time, nvar, naux)
integer, dimension(maxlv) icheck
subroutine update(level, nvar, naux)
Synchronize between all grids on level level and grids on level level+1.
subroutine advanc(level, nvar, dtlevnew, vtime, naux)
Integrate all grids at the input level by one step of its delta(t)
integer, dimension(maxlv) lstart
integer, parameter iinfinity
integer, dimension(maxlv) intraty
real(kind=8), dimension(:), allocatable tchk
real(kind=8) timeregriddingcpu
integer, parameter outunit
real(kind=8), dimension(maxlv) possk
integer, dimension(maxlv) intratx
subroutine outtre(mlev, outgrd, nvar, naux)
Output a subtree of the grids.
The module contains the definition of a "node descriptor" as well as other global variables used duri...