2D AMRCLAW
conck.f
Go to the documentation of this file.
1 c
2 c -----------------------------------------------------------
3 c
4  subroutine conck(level, nvar, naux, time, rest)
5 c
6  use amr_module
7  implicit double precision (a-h,o-z)
8 
9  logical rest
10 
11 c iadd(i,j,ivar) = loc + i - 1 + mitot*((ivar-1)*mjtot+j-1) OLD INDEXING
12 c iaddaux(i,j) = locaux + i - 1 + mitot*(j-1) +
13 c . mitot*mjtot*(mcapa-1)
14 
15 c ## indexing into mcapa assumes cell volume is in mcapa location
16  iadd(ivar,i,j) = loc + ivar - 1 + nvar*((j-1)*mitot+i-1)
17  iaddaux(i,j) = locaux + mcapa - 1 + naux*(i-1) +
18  . naux*mitot*(j-1)
19 c
20 c
21 c ******************************************************************
22 c conck - conservation check for specified level
23 c mostly a debugging tool
24 c this assumes grids don't overlap
25 c
26 c ******************************************************************
27 c
28 c
29 c grid loop for given level
30 c
31  hx = hxposs(level)
32  hy = hyposs(level)
33  dt = possk(level)
34  totmass = 0.d0
35 
36  mptr = lstart(level)
37  20 if (mptr .eq. 0) go to 85
38  loc = node(store1,mptr)
39  locaux = node(storeaux,mptr)
40  nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
41  ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
42  mitot = nx + 2*nghost
43  mjtot = ny + 2*nghost
44 c
45  if (mcapa .eq. 0) then
46  do 50 j = nghost+1, mjtot-nghost
47  do 50 i = nghost+1, mitot-nghost
48  totmass = totmass + alloc(iadd(1,i,j))
49  50 continue
50  else
51 c # with capa array:
52  do 60 j = nghost+1, mjtot-nghost
53  do 60 i = nghost+1, mitot-nghost
54  totmass = totmass + alloc(iadd(1,i,j))*alloc(iaddaux(i,j))
55  60 continue
56  endif
57 c
58  mptr = node(levelptr,mptr)
59  go to 20
60 c
61  85 totmass = totmass * hx * hy
62  if (time.eq. t0 .and. (level.eq.1) .and. .not. rest) then
63  tmass0 = totmass
64  write(6,*) 'Total mass at initial time: ',tmass0
65  endif
66  write(outunit,777) time, totmass, totmass-tmass0
67  777 format('time t = ',e12.5,', total mass = ',e22.15, ' diff = ',
68  & e11.4)
69 c
70  99 return
71  end
subroutine conck(level, nvar, naux, time, rest)
Definition: conck.f:4
integer pure function iadd(ivar, i, j)
Definition: intfil.f90:293