2D AMRCLAW
check.f
Go to the documentation of this file.
1 c
2 c ---------------------------------------------------------
3 c
4  subroutine check(nsteps,time,nvar,naux)
5 c
6 c :::::::::::::::::::::: CHECK ::::::::::::::::::::::::::::::::;
8 c :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
9 
10  use amr_module
11  use gauges_module, only: num_gauges
13 
14  implicit double precision (a-h,o-z)
15  integer tchkunit
16  parameter(tchkunit = 13)
17  character chkname*13
18  character tchkname*13
19 
20  write(6,601) time,nsteps
21  601 format('Creating checkpoint file at t = ',e16.9,' nsteps = ',i5)
22 c
23  if (checkpt_style < 0) then
24 
25 c # Alternate between two sets of files, overwriting the oldest
26 c # one, so that files do not accumulate with frequent checkpoints.
27 c
28 c # Note that logical check_a is stored in amr_module, initialized
29 c # in amr2 and perhaps reset properly in restrt.
30 
31  if (check_a) then
32  chkname = 'fort.chkaaaaa'
33  tchkname = 'fort.tckaaaaa'
34  else
35  chkname = 'fort.chkbbbbb'
36  tchkname = 'fort.tckbbbbb'
37  endif
38  check_a = .not. check_a ! to use other file next time
39 
40  else
41 
42 c # make a new checkpoint file for this time
43 c ### make the file name showing the time step
44 c
45  chkname = 'fort.chkxxxxx'
46  tchkname = 'fort.tckxxxxx'
47  nstp = nsteps
48  do 20 ipos = 13, 9, -1
49  idigit = mod(nstp,10)
50  chkname(ipos:ipos) = char(ichar('0') + idigit)
51  tchkname(ipos:ipos) = char(ichar('0') + idigit)
52  nstp = nstp / 10
53  20 continue
54  endif
55 
56  open(unit=tchkunit,file=tchkname,status='unknown',
57  . form='formatted')
58  open(unit=chkunit,file=chkname,status='unknown',
59  . form='unformatted')
60 c
61 c ### dump the data
62 c
64  write(chkunit) (alloc(i),i=1,lendim)
66  write(chkunit) lfree,lenf
71  3 numgrids,kcheck,nsteps,
72  3 time,matlabu
80 c
81  close(chkunit)
82 
83 c # flush open running output files fort.amr, fort.gauge, fort.debug
84 c # so if code dies it will at least have output up to this checkpoint time
85 
86  flush(outunit) ! defined in amr_module.f90
87  flush(dbugunit) ! defined in amr_module.f90
88 c flush(OUTGAUGEUNIT) ! defined in gauges_module.f90
89  do ii = 1, num_gauges
91  end do
92 
93 c # write the time stamp file last so it's not updated until data is
94 c # all dumped, in case of crash mid-dump.
95  write(tchkunit,*) 'Checkpoint file at time t = ',time
96  write(tchkunit,*) 'alloc size memsize = ',memsize
97  write(tchkunit,*) 'Number of steps taken = ',nsteps
98  close(tchkunit)
99 c
100  return
101  end
integer timetick
Definition: amr_module.f90:242
integer, parameter dbugunit
Definition: amr_module.f90:293
integer, dimension(maxlv) kratio
Definition: amr_module.f90:198
subroutine print_gauges_and_reset_nextloc(gauge_num)
integer lendim
Definition: amr_module.f90:247
integer ndfree
Definition: amr_module.f90:198
real(kind=8) evol
Definition: amr_module.f90:237
integer timebound
Definition: amr_module.f90:241
integer lenmax
Definition: amr_module.f90:247
integer, dimension(maxlv) iregsz
Definition: amr_module.f90:198
real(kind=8), dimension(maxlv) hyposs
Definition: amr_module.f90:193
real(kind=8) tmass0
Definition: amr_module.f90:267
real(kind=8) cflmax
Definition: amr_module.f90:255
real(kind=8), dimension(maxlv) hxposs
Definition: amr_module.f90:193
integer, dimension(maxlv) newstl
Definition: amr_module.f90:198
integer, dimension(maxlv) jregsz
Definition: amr_module.f90:198
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
integer, dimension(maxlv) iregst
Definition: amr_module.f90:198
integer memsize
Definition: amr_module.f90:219
integer, dimension(maxlv) numgrids
Definition: amr_module.f90:198
real(kind=8), dimension(rsize, maxgr) rnode
Definition: amr_module.f90:193
integer ndfree_bnd
Definition: amr_module.f90:198
integer, dimension(maxlv) iregridcount
Definition: amr_module.f90:238
real(kind=8) timevaloutcpu
Definition: amr_module.f90:245
integer lentot
Definition: amr_module.f90:247
real(kind=8) tol
Definition: amr_module.f90:197
logical check_a
Definition: amr_module.f90:312
subroutine check(nsteps, time, nvar, naux)
Definition: check.f:5
real(kind=8), dimension(maxlv) avenumgrids
Definition: amr_module.f90:237
integer, dimension(maxlv) icheck
Definition: amr_module.f90:198
integer matlabu
Definition: amr_module.f90:283
integer, dimension(maxlv) jregst
Definition: amr_module.f90:198
integer iorder
Definition: amr_module.f90:198
integer, dimension(maxlv) lstart
Definition: amr_module.f90:198
real(kind=8) rvol
Definition: amr_module.f90:237
real(kind=8) timetickcpu
Definition: amr_module.f90:243
integer ibuff
Definition: amr_module.f90:198
real(kind=8) timeboundcpu
Definition: amr_module.f90:244
real(kind=8), dimension(maxlv) tvollcpu
Definition: amr_module.f90:243
integer, dimension(maxlv) intraty
Definition: amr_module.f90:198
real(kind=8) timeregriddingcpu
Definition: amr_module.f90:244
real(kind=8), dimension(maxlv) rvoll
Definition: amr_module.f90:237
integer, parameter outunit
Definition: amr_module.f90:290
real(kind=8), dimension(maxlv) possk
Definition: amr_module.f90:193
integer, dimension(lfdim, 2) lfree
Definition: amr_module.f90:225
integer, dimension(maxlv) jregend
Definition: amr_module.f90:198
integer num_gauges
integer checkpt_style
Definition: amr_module.f90:280
integer timestepgrid
Definition: amr_module.f90:241
integer, dimension(maxlv) listsp
Definition: amr_module.f90:198
integer lenf
Definition: amr_module.f90:225
real(kind=8) timestepgridcpu
Definition: amr_module.f90:244
integer, dimension(maxlv) intratx
Definition: amr_module.f90:198
integer mxnest
Definition: amr_module.f90:198
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
integer, dimension(maxlv) iregend
Definition: amr_module.f90:198
integer timevalout
Definition: amr_module.f90:239
integer mstart
Definition: amr_module.f90:198
integer kcheck
Definition: amr_module.f90:198
integer, parameter chkunit
Definition: amr_module.f90:288
integer lfine
Definition: amr_module.f90:198
integer, dimension(maxlv) tvoll
Definition: amr_module.f90:238
real(kind=8), dimension(:), allocatable alloc
Definition: amr_module.f90:218
integer timeregridding
Definition: amr_module.f90:239