2D AMRCLAW
fixcapaq.f
Go to the documentation of this file.
1 
2 c ------------------------------------------------------------------
3 
4  subroutine fixcapaq(val,aux,mitot,mjtot,valc,auxc,mic,mjc,
5  & nvar,naux,levc,setflags)
6 
7  use amr_module
8  implicit double precision (a-h,o-z)
9 
10 c
11 c ::::::::::::::::::::::: FIXCAPAQ ::::::::::::::::::::::::::::::
12 c new fine grid solution q was linearly interpolated. but want
13 c to conserve kappa*q, not q. calculate the discrepancy
14 c in kappa*q using this q, and modify q to account for it.
15 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
16 
17  dimension val(nvar,mitot,mjtot), valc(nvar,mic,mjc)
18  dimension aux(naux,mitot,mjtot), auxc(naux,mic,mjc)
19  dimension setflags(mitot,mjtot)
20 
21  dcapamax = 0.d0
22  lratiox = intratx(levc)
23  lratioy = intraty(levc)
24 
25  do 10 ic = 2, mic-1
26  do 10 jc = 2, mjc-1
27 
28 
29  do 15 ivar = 1, nvar
30 
31  capaqfine = 0.d0
32 
33  do 20 ico = 1, lratiox
34  ifine = (ic-2)*lratiox + nghost + ico
35  do 20 jco = 1, lratioy
36  jfine = (jc-2)*lratioy + nghost + jco
37  capaqfine = capaqfine + aux(mcapa,ifine,jfine)*
38  & val(ivar,ifine,jfine)
39 20 continue
40 
41  dcapaq = auxc(mcapa,ic,jc)*valc(ivar,ic,jc)-
42  & capaqfine/(lratiox*lratioy)
43  dcapamax = dmax1(dcapamax,dabs(dcapaq))
44 
45  do 30 ico = 1, lratiox
46  ifine = (ic-2)*lratiox + nghost + ico
47  do 30 jco = 1, lratioy
48  jfine = (jc-2)*lratioy + nghost + jco
49 
50  if (setflags(ifine,jfine) .eq. needs_to_be_set) then
51  ! was set by coarsegrid, need to check for adjustment
52  val(ivar,ifine,jfine) = val(ivar,ifine,jfine) +
53  & dcapaq/aux(mcapa,ifine,jfine)
54  endif
55 30 continue
56 
57 15 continue
58 
59 10 continue
60 
61 c write(6,*)" max discrepancy ", dcapamax
62 
63  return
64  end
subroutine setflags(iflags, isize, jsize, rctold, idim3, mitot, mjtot, mptr)
Definition: setflags.f:6
real(kind=8), parameter needs_to_be_set
Definition: amr_module.f90:168
subroutine fixcapaq(val, aux, mitot, mjtot, valc, auxc, mic, mjc, nvar, naux, levc, setflags)
Definition: fixcapaq.f:6
integer mcapa
Definition: amr_module.f90:253
integer, dimension(maxlv) intraty
Definition: amr_module.f90:198
integer, dimension(maxlv) intratx
Definition: amr_module.f90:198
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