2D AMRCLAW
Functions/Subroutines
conck.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine conck (level, nvar, naux, time, rest)
 Conservation check for specified level. More...
 

Function/Subroutine Documentation

◆ conck()

subroutine conck (   level,
  nvar,
  naux,
  time,
logical  rest 
)

Conservation check for specified level.

This is mostly a debugging tool and assumes grids don't overlap

Definition at line 7 of file conck.f.

References amr_module::alloc, amr_module::hxposs, amr_module::hyposs, iadd(), amr_module::levelptr, amr_module::lstart, amr_module::mcapa, amr_module::ndihi, amr_module::ndilo, amr_module::ndjhi, amr_module::ndjlo, amr_module::nghost, amr_module::node, amr_module::outunit, amr_module::possk, amr_module::store1, amr_module::storeaux, amr_module::t0, and amr_module::tmass0.

Referenced by amr2(), and tick().

7 c
8  use amr_module
9  implicit double precision (a-h,o-z)
10 
11  logical rest
12 
13 c iadd(i,j,ivar) = loc + i - 1 + mitot*((ivar-1)*mjtot+j-1) OLD INDEXING
14 c iaddaux(i,j) = locaux + i - 1 + mitot*(j-1) +
15 c . mitot*mjtot*(mcapa-1)
16 
17 c ## indexing into mcapa assumes cell volume is in mcapa location
18  iadd(ivar,i,j) = loc + ivar - 1 + nvar*((j-1)*mitot+i-1)
19  iaddaux(i,j) = locaux + mcapa - 1 + naux*(i-1) +
20  . naux*mitot*(j-1)
21 c
22 c
23 c ******************************************************************
24 c conck - conservation check for specified level
25 c mostly a debugging tool
26 c this assumes grids don't overlap
27 c
28 c ******************************************************************
29 c
30 c
31 c grid loop for given level
32 c
33  hx = hxposs(level)
34  hy = hyposs(level)
35  dt = possk(level)
36  totmass = 0.d0
37 
38  mptr = lstart(level)
39  20 if (mptr .eq. 0) go to 85
40  loc = node(store1,mptr)
41  locaux = node(storeaux,mptr)
42  nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
43  ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
44  mitot = nx + 2*nghost
45  mjtot = ny + 2*nghost
46 c
47  if (mcapa .eq. 0) then
48  do 50 j = nghost+1, mjtot-nghost
49  do 50 i = nghost+1, mitot-nghost
50  totmass = totmass + alloc(iadd(1,i,j))
51  50 continue
52  else
53 c # with capa array:
54  do 60 j = nghost+1, mjtot-nghost
55  do 60 i = nghost+1, mitot-nghost
56  totmass = totmass + alloc(iadd(1,i,j))*alloc(iaddaux(i,j))
57  60 continue
58  endif
59 c
60  mptr = node(levelptr,mptr)
61  go to 20
62 c
63  85 totmass = totmass * hx * hy
64  if (time.eq. t0 .and. (level.eq.1) .and. .not. rest) then
65  tmass0 = totmass
66  write(6,*) 'Total mass at initial time: ',tmass0
67  endif
68  write(outunit,777) time, totmass, totmass-tmass0
69  777 format('time t = ',e12.5,', total mass = ',e22.15, ' diff = ',
70  & e11.4)
71 c
72  99 return
real(kind=8) t0
Definition: amr_module.f90:272
real(kind=8), dimension(maxlv) hyposs
Definition: amr_module.f90:193
real(kind=8) tmass0
Definition: amr_module.f90:267
real(kind=8), dimension(maxlv) hxposs
Definition: amr_module.f90:193
integer, parameter ndihi
global i index of right border of this grid
Definition: amr_module.f90:111
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
integer pure function iadd(ivar, i, j)
Definition: intfil.f90:294
integer, parameter ndilo
global i index of left border of this grid
Definition: amr_module.f90:108
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
integer, dimension(maxlv) lstart
Definition: amr_module.f90:198
integer mcapa
Definition: amr_module.f90:253
integer, parameter outunit
Definition: amr_module.f90:290
real(kind=8), dimension(maxlv) possk
Definition: amr_module.f90:193
integer, parameter ndjhi
global j index of upper border of this grid
Definition: amr_module.f90:117
integer, parameter levelptr
node number (index) of next grid on the same level
Definition: amr_module.f90:35
integer nghost
Definition: amr_module.f90:232
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
integer, parameter storeaux
pointer to the address of memory storing auxiliary data on this grid
Definition: amr_module.f90:120
real(kind=8), dimension(:), allocatable alloc
Definition: amr_module.f90:218
Here is the call graph for this function:
Here is the caller graph for this function: