2D AMRCLAW
fluxsv.f
Go to the documentation of this file.
1 
8 c ----------------------------------------------------------
9 c
10  subroutine fluxsv(mptr,xfluxm,xfluxp,yfluxm,yfluxp,listbc,
11  1 ndimx,ndimy,nvar,maxsp,dtc,hx,hy)
12 c
13  use amr_module
14  implicit double precision (a-h,o-z)
15 
16 
17  dimension xfluxp(nvar,ndimx,ndimy), yfluxp(nvar,ndimx,ndimy)
18  dimension xfluxm(nvar,ndimx,ndimy), yfluxm(nvar,ndimx,ndimy)
19  dimension listbc(5,maxsp)
20 c
21 c :::::::::::::::::::: fluxsv :::::::::::::::::::::::::
22 c
23 c coarse grids should save their fluxes in cells adjacent to
24 c their nested fine grids, for later conservation fixing.
25 c listbc holds info for where to save which fluxes.
26 c xflux holds 'f' fluxes, yflux holds 'g' fluxes.
27 c
28 c :::::::::::::::::::::::::::::;:::::::::::::::::::::::
29 
30 
31  ispot = 1
32  level = node(nestlevel,mptr)
33 
34  10 if (listbc(1,ispot).eq.0) go to 99
35 c
36  mkid = listbc(4,ispot)
37  intopl = listbc(5,ispot)
38  nx = node(ndihi,mkid) - node(ndilo,mkid) + 1
39  ny = node(ndjhi,mkid) - node(ndjlo,mkid) + 1
40  kidlst = node(ffluxptr,mkid)
41  i = listbc(1,ispot)
42  j = listbc(2,ispot)
43  inlist = kidlst + nvar*(intopl-1) - 1
44 c
45 c side k(listbc 3) has which side of coarse cell has interface
46 c so can save appropriate fluxes. (dont know why we didnt have
47 c which flux to save directly(i.e. put i+1,j to save that flux
48 c rather than putting in cell center coords).
49 
50  if (listbc(3,ispot) .eq. 1) then
51 c ::::: cell i,j is on right side of a fine grid
52  do 100 ivar = 1, nvar
53  alloc(inlist + ivar) = -xfluxp(ivar,i,j)*dtc*hy
54 100 continue
55 c write(dbugunit,901) i,j,1,(xfluxp(ivar,i,j),ivar=1,nvar)
56  endif
57 
58  if (listbc(3,ispot) .eq. 2) then
59 c ::::: cell i,j on bottom side of fine grid
60  do 200 ivar = 1, nvar
61  alloc(inlist + ivar) = -yfluxm(ivar,i,j+1)*dtc*hx
62 200 continue
63 c write(dbugunit,901) i,j,2,(yfluxm(ivar,i,j+1),ivar=1,nvar)
64  endif
65 
66  if (listbc(3,ispot) .eq. 3) then
67 c ::::: cell i,j on left side of fine grid
68  do 300 ivar = 1, nvar
69  alloc(inlist + ivar) = -xfluxm(ivar,i+1,j)*dtc*hy
70 300 continue
71 c write(dbugunit,901) i,j,3,(xfluxm(ivar,i+1,j),ivar=1,nvar)
72  endif
73 
74  if (listbc(3,ispot) .eq. 4) then
75 c ::::: cell i,j on top side of fine grid
76  do 400 ivar = 1, nvar
77  alloc(inlist + ivar) = -yfluxp(ivar,i,j)*dtc*hx
78 400 continue
79 c write(dbugunit,901) i,j,4,(yfluxp(ivar,i,j),ivar=1,nvar)
80  endif
81 c
82 c ### new bcs 5 and 6 come from spherical mapping. note sign change:
83 c ### previous fluxes stored negative flux, fine grids always add
84 c ### their flux, then the delta is either added or subtracted as
85 c ### appropriate for that side. New bc adds or subtracts BOTH fluxes.
86 c
87  if (listbc(3,ispot) .eq. 5) then
88 c ::::: cell i,j on top side of fine grid with spherical mapped bc
89  do 500 ivar = 1, nvar
90  alloc(inlist + ivar) = yfluxm(ivar,i,j+1)*dtc*hx
91 500 continue
92 c write(dbugunit,901) i,j,5,(yfluxm(ivar,i,j+1),ivar=1,nvar)
93  901 format(2i4," side",i3,4e15.7)
94  endif
95 c
96  if (listbc(3,ispot) .eq. 6) then
97 c ::::: cell i,j on bottom side of fine grid with spherical mapped bc
98  do 600 ivar = 1, nvar
99  alloc(inlist + ivar) = yfluxp(ivar,i,j)*dtc*hx
100 600 continue
101 c write(dbugunit,901) i,j,6,(yfluxp(ivar,i,j),ivar=1,nvar)
102  endif
103 
104  ispot = ispot + 1
105  if (ispot .gt. maxsp) go to 99
106  go to 10
107 c
108  99 return
109  end
integer, parameter dbugunit
Definition: amr_module.f90:293
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, parameter nestlevel
AMR level of the grid.
Definition: amr_module.f90:44
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
subroutine fluxsv(mptr, xfluxm, xfluxp, yfluxm, yfluxp, listbc,
When a coarse grid cell is advanced, if it borders a coarse-fine interface, the flux or wave that emi...
Definition: fluxsv.f:11
integer, parameter ndjhi
global j index of upper border of this grid
Definition: amr_module.f90:117
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
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