2D AMRCLAW
Functions/Subroutines
upbnd.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine upbnd (listbc, val, nvar, naux, mitot, mjtot, maxsp, mptr)
 Do conservation fix-up for cells on grid mptr that border finer grids. More...
 

Function/Subroutine Documentation

◆ upbnd()

subroutine upbnd ( dimension(5,maxsp)  listbc,
dimension(nvar,mitot,mjtot)  val,
  nvar,
  naux,
  mitot,
  mjtot,
  maxsp,
  mptr 
)

Do conservation fix-up for cells on grid mptr that border finer grids.

Do this by adding flux differences stored with each of the fine grids to these cells on grid mptr.

Parameters
[in,out]listbcan array that stores information of all cells that border a finer grids in grid mptr.
[in]valpointer to the solution on grid mptr
[in]nvarnumber of equations for the system
[in]nauxnumber of auxiliary variables
[in]mitottotal number of cells in i direction on grid mptr
[in]mjtottotal number of cells in j direction on grid mptr
[in]maxspmaximum number of segments lisbc can describe
[in]mptrthe grid being processed

Definition at line 20 of file upbnd.f.

References amr_module::alloc, amr_module::ffluxptr, amr_module::hxposs, amr_module::hyposs, amr_module::mcapa, amr_module::nestlevel, amr_module::node, amr_module::outunit, amr_module::storeaux, and amr_module::uprint.

Referenced by update().

20 c 1 maxsp,iused,mptr)
21 
22  use amr_module
23  implicit double precision (a-h,o-z)
24 
25 
26  dimension val(nvar,mitot,mjtot),listbc(5,maxsp),
27  1 iused(mitot,mjtot)
28 
29 c OLD INDEXING
30 c iaddaux(i,j) = locaux + i-1 + mitot*(j-1)
31 c 1 + mitot*mjtot*(mcapa-1)
32 c NEW INDEXING - SWITCHED ORDERING
33  iaddaux(i,j) = locaux + mcapa-1 + naux*(i-1)
34  1 + mitot*naux*(j-1)
35 
36 c
37 c :::::::::::::::::::::::::::: UPBND :::::::::::::::::::::::::::::
38 c We now correct the coarse grid with the flux differences stored
39 c with each of the fine grids. We use an array iused
40 c to indicate whether the flux has been updated or not for that zone.
41 c iused(i,j) = sum from (l=1,4) i(l)*2**(l-1), where i(l) = 1 if the
42 c flux for the l-th side of the (i,j)-th cell has already been
43 c updated, and i(l) = 0 if not.
44 
45 c if there is a capacity fn. it needs to be included in update formula
46 c indicated by mcapa not zero (is index of capacity fn.)
47 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
48 c
49 
50  do 10 j=1,mjtot
51  do 10 i=1,mitot
52  iused(i,j) = 0.
53  10 continue
54 
55  locaux = node(storeaux,mptr)
56  levc = node(nestlevel,mptr)
57  area = hxposs(levc)*hyposs(levc)
58 
59 
60  if (uprint) write(outunit,*)" upbnding grid ",mptr
61 
62  do 40 ispot = 1,maxsp
63  icrse = listbc(1,ispot)
64  if (icrse.eq.0) go to 99
65 
66  jcrse = listbc(2,ispot)
67  iside = listbc(3,ispot)
68 c continue to use iside1/norm for debugging, but should soon delete
69 c this if/then/else block needed due to new categories corresponding
70 c to mapped bcs. should still only have one update per side of coarse cell though
71  if (iside .lt. 5) then
72  iside1 = iside
73  elseif (iside .eq. 5) then
74  iside1 = 2
75  else ! iside is 6
76  iside1 = 4
77  endif
78  norm = 2**(iside1-1)
79  iflag =iused(icrse,jcrse)/norm
80  if (mod(iflag,2).eq.1) then
81  write(6,*)" *** double flux update CAN happen in upbnd ***"
82  go to 40
83  endif
84  mkid = listbc(4,ispot)
85  kidlst = node(ffluxptr,mkid)
86  lkid = listbc(5,ispot)
87 c if (mod(iside,4).gt.1) then
88 c modified to include other side options
89  if (iside .eq. 2 .or. iside .eq. 3 .or. iside .eq. 6) then
90 c (iside .eq. 2 .or. iside .eq. 3)
91  sgnm = -1.
92  else
93 c (iside .eq. 4 .or. iside .eq. 1)
94  sgnm = 1.
95  endif
96 
97 c ## debugging output
98  if (uprint) then
99  write(outunit,101) icrse,jcrse,
100  . (val(ivar,icrse,jcrse),ivar=1,nvar)
101  101 format(" old ",1x,2i4,4e15.7)
102  endif
103 
104  if (mcapa .gt. 0) then
105 c # capacity array: need to divide by capa in each cell.
106 c # modify sgnm which is reset for each grid cell.
107 c # Note capa is stored in aux(icrse,jcrse,mcapa)
108  sgnm = sgnm / alloc(iaddaux(icrse,jcrse))
109  endif
110 
111  do 20 ivar = 1,nvar
112  val(ivar,icrse,jcrse) = val(ivar,icrse,jcrse) +
113  1 sgnm*alloc(kidlst+nvar*(lkid-1)+ivar-1)/area
114  20 continue
115  iused(icrse,jcrse) = iused(icrse,jcrse) + norm
116 
117 c ## debugging output
118  if (uprint) then
119  write(outunit,102) mkid,
120  . (val(ivar,icrse,jcrse),ivar=1,nvar)
121  102 format(" new ","(grid",i3,")",4e15.7)
122  endif
123 
124  40 continue
125 c
126  99 return
real(kind=8), dimension(maxlv) hyposs
Definition: amr_module.f90:193
real(kind=8), dimension(maxlv) hxposs
Definition: amr_module.f90:193
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
integer, parameter nestlevel
AMR level of the grid.
Definition: amr_module.f90:44
integer mcapa
Definition: amr_module.f90:253
integer, parameter outunit
Definition: amr_module.f90:290
logical uprint
Definition: amr_module.f90:297
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
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
Here is the caller graph for this function: