2D AMRCLAW
amr_module.f90
Go to the documentation of this file.
1 
21 module amr_module
22 
23  implicit none
24 
25  save
26 
27  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
28  ! ::::: data structure info.
29  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
30  integer, parameter :: rsize = 5
31  integer, parameter :: nsize = 19
32 
33  ! ::::::: integer part of node descriptor
35  integer, parameter :: levelptr = 1
36 
38  integer, parameter :: tempptr = 2
39 
40  ! TODO
41  integer, parameter :: errptr = 3
42 
44  integer, parameter :: nestlevel = 4
45 
80  integer, parameter :: cfluxptr = 5
81 
97  integer, parameter :: ffluxptr = 6
98 
101  integer, parameter :: store1 = 7
102 
105  integer, parameter :: store2 = 8
106 
108  integer, parameter :: ndilo = 9
109 
111  integer, parameter :: ndihi = 10
112 
114  integer, parameter :: ndjlo = 11
115 
117  integer, parameter :: ndjhi = 12
118 
120  integer, parameter :: storeaux = 13
121 
123  integer, parameter :: storeflags = 14
124 
126  integer, parameter :: numflags = 15
127 
129  integer, parameter :: domflags_base = 16
130 
132  integer, parameter :: domflags2 = 17
133 
136  integer, parameter :: bndlistst = 18
137 
139  integer, parameter :: bndlistnum = 19
140 
141  ! ::::::: real part of node descriptor
143  integer, parameter :: cornxlo = 1
145  integer, parameter :: cornylo = 2
147  integer, parameter :: cornxhi = 3
149  integer, parameter :: cornyhi = 4
151  integer, parameter :: timemult = 5
152 
153  ! ::::::: for linking nodes
154  integer, parameter :: nextfree = 2
155  integer, parameter :: null = 0
156  integer, parameter :: nil = 0
157 
158  integer, parameter :: gridnbor = 1 !use 1st col, 2nd col is nextfree - the link
159 
160  ! ::::::: for flagging points
161  ! TODO: can use one bit for this instead of real?
162  ! needs no refine
163  real(kind=8), parameter :: goodpt = 0.0
164  ! needs refine
165  real(kind=8), parameter :: badpt = 2.0
166  real(kind=8), parameter :: badpro = 3.0
167 
168  real(kind=8), parameter :: needs_to_be_set = 10.e33
169  real(kind=8), parameter :: rinfinity = 10.e32
170  integer, parameter :: iinfinity = 999999999
171  integer, parameter :: horizontal = 1
172  integer, parameter :: vertical = 2
173  integer, parameter :: maxgr = 15000
174  integer, parameter :: maxlv = 10
175 
177  integer, parameter :: maxcl = 5000
178 
179  ! The max1d parameter should be changed if using OpenMP grid based
180  ! looping, usually set to max1d = 60
181  integer, parameter :: max1d = 60
182 
183  integer, parameter :: maxvar = 10
184  integer, parameter :: maxaux = 20
185  integer, parameter :: maxwave = 10
186 
187 
188  ! note use of sentinel in listStart
189  integer :: listofgrids(maxgr),liststart(0:maxlv+1)
190  integer,parameter :: bndlistsize = 8*maxgr
191  integer :: bndlist(bndlistsize,2) ! guess size, average # nbors 4? manage as linked list
192 
194 
195 
196 
197  real(kind=8) tol, tolsp
202  iregst(maxlv),jregst(maxlv), &
206 
207  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
208  ! :::: for alloc array/memory
209  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
210 
211  ! Static memory implementation
212  ! parameter (memsize = 10000000)
213  ! common /calloc/ alloc(memsize)
214 
215  ! Dynamic memory:
216  !real(kind=8), allocatable, target, dimension(:) :: storage
217  !real(kind=8), pointer, dimension(:) :: alloc ! old way, changed mjb Sept. 2014
218  real(kind=8), allocatable, dimension(:) :: alloc ! new way, use allocatable, not pointer
219  integer memsize
220 
221  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\
222  ! ::::: for space management of alloc array
223  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
224  integer, parameter :: lfdim=5000
225  integer lfree(lfdim,2),lenf
226 
227  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
228  ! ::::: domain description variables
229  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
231  real(kind=8) :: xupper, yupper, xlower, ylower
232  integer :: nghost, mthbc(4)
233 
234  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
235  ! ::::: collect stats
236  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
243  real(kind=8) tvollcpu(maxlv), timetickcpu
245  real(kind=8) timevaloutcpu
246 
248 
249  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
250  ! ::::: method parameters
251  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
252  character(len=10), allocatable :: auxtype(:)
254  integer, allocatable :: mthlim(:)
255  real(kind=8) cfl,cflmax,cflv1,cfl_level
256 
257  logical :: use_fwaves
259  integer :: verbosity_regrid
260 
261  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
262  ! ::::: Parameters and variables related to I/O and checkpointing
263  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
265 
266  ! variables for conservation checking:
267  real(kind=8) tmass0
268 
269  ! variables for specifying output format
270  integer :: output_style, nstop, nout, iout
271  real(kind=8), allocatable :: tout(:)
272  real(kind=8) :: t0, tfinal
273  real(kind=8) :: tstart_thisrun ! /= t0 in case of restart
275  integer, allocatable :: output_q_components(:)
276  integer, allocatable :: output_aux_components(:)
278 
279  ! checkpointing:
281  real(kind=8), allocatable :: tchk(:)
282 
283  integer :: matlabu
284 
285  ! USE UNITS NUMBERS < 89.
286  ! 89 and + numthreads taken by gauge output
287  integer, parameter :: parmunit = 12
288  integer, parameter :: chkunit = 10
289  integer, parameter :: inunit = 5
290  integer, parameter :: outunit = 66
291  integer, parameter :: pltunit1 = 3
292  integer, parameter :: rstunit = 9
293  integer, parameter :: dbugunit = 11
294  integer, parameter :: matunit = 70
295 
296  ! :::: Debugging flags (verbose output)
297  logical &
298  dprint, & ! domain flags output
299  eprint, & ! error estimation output
300  edebug, & ! even more error estimation output
301  gprint, & ! verbose grid generation (clustering,colating...)
302  nprint, & ! nestck reporting
303  pprint, & ! projec tagged pts.
304  rprint, & ! regridding - summary of new grids
305  sprint, & ! space (memory) output
306  tprint, & ! tick (time stepping) reporting
307  uprint ! updating/upbnding reporting
308 
309 
310  ! Restart file name:
311  character(len=200) :: rstfile
312  logical :: check_a
313 
314 end module amr_module
integer timetick
Definition: amr_module.f90:242
integer, parameter dbugunit
Definition: amr_module.f90:293
integer, dimension(7) method
Definition: amr_module.f90:253
integer, parameter timemult
current simulation time on this grid
Definition: amr_module.f90:151
integer timegrdfit2
Definition: amr_module.f90:240
integer, parameter maxvar
Definition: amr_module.f90:183
integer, dimension(maxlv) kratio
Definition: amr_module.f90:198
real(kind=8) t0
Definition: amr_module.f90:272
real(kind=8), parameter rinfinity
Definition: amr_module.f90:169
logical output_aux_onlyonce
Definition: amr_module.f90:277
integer, parameter rsize
Definition: amr_module.f90:30
integer lendim
Definition: amr_module.f90:247
real(kind=8) tfinal
Definition: amr_module.f90:272
integer, parameter cornxlo
x-coordinate of the left border of this grid
Definition: amr_module.f90:143
integer, dimension(maxlv) numcells
Definition: amr_module.f90:198
integer, parameter maxlv
Definition: amr_module.f90:174
integer ndfree
Definition: amr_module.f90:198
integer timegrdfitall
Definition: amr_module.f90:240
integer, parameter tempptr
temporary pointer
Definition: amr_module.f90:38
logical ncarout
Definition: amr_module.f90:264
integer, parameter bndlistnum
number of grids (on the same level) that border this grid
Definition: amr_module.f90:139
real(kind=8), dimension(:), allocatable tout
Definition: amr_module.f90:271
logical sprint
Definition: amr_module.f90:297
integer, parameter maxgr
Definition: amr_module.f90:173
real(kind=8) evol
Definition: amr_module.f90:237
integer timebound
Definition: amr_module.f90:241
real(kind=8) cfl
Definition: amr_module.f90:255
logical rprint
Definition: amr_module.f90:297
integer lenmax
Definition: amr_module.f90:247
integer timegrdfit3
Definition: amr_module.f90:240
integer, dimension(:), allocatable mthlim
Definition: amr_module.f90:254
real(kind=8), parameter badpro
Definition: amr_module.f90:166
integer, parameter max1d
Definition: amr_module.f90:181
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(:), allocatable output_q_components
Definition: amr_module.f90:275
integer, dimension(maxlv) newstl
Definition: amr_module.f90:198
integer, parameter ndihi
global i index of right border of this grid
Definition: amr_module.f90:111
real(kind=8) tstart_thisrun
Definition: amr_module.f90:273
integer timeflagger
Definition: amr_module.f90:242
integer checkpt_interval
Definition: amr_module.f90:280
logical use_fwaves
Definition: amr_module.f90:257
integer, dimension(maxlv) jregsz
Definition: amr_module.f90:198
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
integer, parameter lfdim
Definition: amr_module.f90:224
logical edebug
Definition: amr_module.f90:297
integer, dimension(maxlv) iregst
Definition: amr_module.f90:198
real(kind=8) cflv1
Definition: amr_module.f90:255
integer, parameter nestlevel
AMR level of the grid.
Definition: amr_module.f90:44
real(kind=8) xupper
Definition: amr_module.f90:231
integer memsize
Definition: amr_module.f90:219
logical gprint
Definition: amr_module.f90:297
integer, dimension(0:maxlv+1) liststart
Definition: amr_module.f90:189
real(kind=8), parameter goodpt
Definition: amr_module.f90:163
character(len=200) rstfile
Definition: amr_module.f90:311
integer, dimension(maxlv) numgrids
Definition: amr_module.f90:198
real(kind=8), dimension(rsize, maxgr) rnode
Definition: amr_module.f90:193
real(kind=8) xlower
Definition: amr_module.f90:231
integer ndfree_bnd
Definition: amr_module.f90:198
integer, dimension(maxlv) iregridcount
Definition: amr_module.f90:238
integer, dimension(maxgr) listofgrids
Definition: amr_module.f90:189
real(kind=8) timevaloutcpu
Definition: amr_module.f90:245
integer, parameter maxcl
maximum number of clusters (grids) on each grid level
Definition: amr_module.f90:177
integer lentot
Definition: amr_module.f90:247
logical flag_richardson
Definition: amr_module.f90:258
real(kind=8) tol
Definition: amr_module.f90:197
integer, parameter domflags_base
domain flags, indexed within base level (lbase) index space
Definition: amr_module.f90:129
integer, parameter gridnbor
Definition: amr_module.f90:158
integer, parameter errptr
Definition: amr_module.f90:41
logical check_a
Definition: amr_module.f90:312
real(kind=8) tolsp
Definition: amr_module.f90:197
integer timeupdating
Definition: amr_module.f90:239
integer iout
Definition: amr_module.f90:270
logical eprint
Definition: amr_module.f90:297
real(kind=8) cfl_level
Definition: amr_module.f90:255
integer, parameter bndlistsize
Definition: amr_module.f90:190
integer, parameter bndlistst
pointer (actually it&#39;s an index in the bndList array) to the first node of a linked list...
Definition: amr_module.f90:136
real(kind=8), dimension(maxlv) avenumgrids
Definition: amr_module.f90:237
integer naux_components
Definition: amr_module.f90:274
integer, parameter storeflags
pointer to the address of memory storing flags for refinement on this grid
Definition: amr_module.f90:123
logical yperdom
Definition: amr_module.f90:230
integer, dimension(maxlv) icheck
Definition: amr_module.f90:198
integer, parameter nsize
Definition: amr_module.f90:31
integer matlabu
Definition: amr_module.f90:283
integer, parameter vertical
Definition: amr_module.f90:172
integer, parameter horizontal
Definition: amr_module.f90:171
real(kind=8) ylower
Definition: amr_module.f90:231
real(kind=8) yupper
Definition: amr_module.f90:231
integer, dimension(maxlv) jregst
Definition: amr_module.f90:198
integer iorder
Definition: amr_module.f90:198
integer, parameter rstunit
Definition: amr_module.f90:292
integer, parameter domflags2
domain flags, indexed within level-of-this-grid level index space
Definition: amr_module.f90:132
integer, parameter ndilo
global i index of left border of this grid
Definition: amr_module.f90:108
real(kind=8), parameter needs_to_be_set
Definition: amr_module.f90:168
integer, parameter ndjlo
global j index of lower border of this grid
Definition: amr_module.f90:114
integer, parameter store1
pointer to the address of memory storing the first copy of solution data on this grid, usually for storing new solution
Definition: amr_module.f90:101
logical spheredom
Definition: amr_module.f90:230
integer, dimension(maxlv) lstart
Definition: amr_module.f90:198
real(kind=8) rvol
Definition: amr_module.f90:237
integer, parameter maxaux
Definition: amr_module.f90:184
real(kind=8) timetickcpu
Definition: amr_module.f90:243
integer dimensional_split
Definition: amr_module.f90:253
integer, parameter iinfinity
Definition: amr_module.f90:170
integer, parameter parmunit
Definition: amr_module.f90:287
integer ibuff
Definition: amr_module.f90:198
logical printout
Definition: amr_module.f90:264
real(kind=8) timeboundcpu
Definition: amr_module.f90:244
integer, parameter store2
pointer to the address of memory storing the second copy of solution data on this grid...
Definition: amr_module.f90:105
integer mcapa
Definition: amr_module.f90:253
real(kind=8), dimension(maxlv) tvollcpu
Definition: amr_module.f90:243
integer, dimension(maxlv) intraty
Definition: amr_module.f90:198
integer timebufnst
Definition: amr_module.f90:242
logical flag_gradient
Definition: amr_module.f90:258
integer output_format
Definition: amr_module.f90:274
logical matlabout
Definition: amr_module.f90:264
real(kind=8), parameter badpt
Definition: amr_module.f90:165
real(kind=8), dimension(:), allocatable tchk
Definition: amr_module.f90:281
logical nprint
Definition: amr_module.f90:297
real(kind=8) timeregriddingcpu
Definition: amr_module.f90:244
real(kind=8), dimension(maxlv) rvoll
Definition: amr_module.f90:237
integer nstop
Definition: amr_module.f90:270
integer, dimension(bndlistsize, 2) bndlist
Definition: amr_module.f90:191
integer nchkpt
Definition: amr_module.f90:280
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, parameter maxwave
Definition: amr_module.f90:185
integer, parameter nextfree
Definition: amr_module.f90:154
integer, dimension(maxlv) jregend
Definition: amr_module.f90:198
logical tprint
Definition: amr_module.f90:297
integer checkpt_style
Definition: amr_module.f90:280
integer, parameter inunit
Definition: amr_module.f90:289
integer, parameter ndjhi
global j index of upper border of this grid
Definition: amr_module.f90:117
integer timestepgrid
Definition: amr_module.f90:241
integer, dimension(maxlv) listsp
Definition: amr_module.f90:198
logical pprint
Definition: amr_module.f90:297
logical dprint
Definition: amr_module.f90:297
logical xperdom
Definition: amr_module.f90:230
integer lenf
Definition: amr_module.f90:225
real(kind=8) timestepgridcpu
Definition: amr_module.f90:244
integer, parameter cornylo
y-coordinate of the lower border of this grid
Definition: amr_module.f90:145
integer, dimension(maxlv) intratx
Definition: amr_module.f90:198
logical uprint
Definition: amr_module.f90:297
integer, parameter matunit
Definition: amr_module.f90:294
integer, parameter levelptr
node number (index) of next grid on the same level
Definition: amr_module.f90:35
integer, parameter null
Definition: amr_module.f90:155
integer mxnest
Definition: amr_module.f90:198
integer, dimension(4) mthbc
Definition: amr_module.f90:232
character(len=10), dimension(:), allocatable auxtype
Definition: amr_module.f90:252
integer, dimension(:), allocatable output_aux_components
Definition: amr_module.f90:276
integer, parameter cornxhi
x-coordinate of the right border of this grid
Definition: amr_module.f90:147
integer nghost
Definition: amr_module.f90:232
integer verbosity_regrid
Definition: amr_module.f90:259
integer timeflglvl
Definition: amr_module.f90:240
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 nout
Definition: amr_module.f90:270
integer mstart
Definition: amr_module.f90:198
integer, parameter pltunit1
Definition: amr_module.f90:291
integer kcheck
Definition: amr_module.f90:198
integer, parameter chkunit
Definition: amr_module.f90:288
integer, parameter cfluxptr
Pointer to an 5 by maxsp array, which has boundary information for this grid.
Definition: amr_module.f90:80
integer nq_components
Definition: amr_module.f90:274
integer, parameter numflags
number of flagged cells on this grid
Definition: amr_module.f90:126
integer output_style
Definition: amr_module.f90:270
integer lfine
Definition: amr_module.f90:198
integer, parameter nil
Definition: amr_module.f90:156
integer, parameter cornyhi
y-coordinate of the upper border of this grid
Definition: amr_module.f90:149
integer, parameter storeaux
pointer to the address of memory storing auxiliary data on this grid
Definition: amr_module.f90:120
integer mwaves
Definition: amr_module.f90:253
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
integer, parameter ffluxptr
pointer to the address of memory storing fluxes in a layer around the grid, to be used in conservatio...
Definition: amr_module.f90:97