15 integer,
intent(in) :: mitot, mjtot, level, mic, mjc, nvar, mptr, ilo, ihi
16 integer,
intent(in) :: jlo, jhi, naux
17 real(kind=8),
intent(in) :: dx, dy, time, xleft, xright, ybot, ytop
20 real(kind=8),
intent(in out) :: val(nvar,mitot,mjtot), aux(naux,mitot,mjtot)
23 integer :: refinement_ratio_x, refinement_ratio_y, iclo, jclo, ichi, jchi, ng
24 integer :: ivar, i, j, ico, jco, ifine, jfine, nx, ny
25 real(kind=8) :: valc(nvar,mic,mjc), auxc(naux,mic,mjc)
26 real(kind=8) :: dx_coarse, dy_coarse, xl, xr, yb, yt, area
27 real(kind=8) :: s1m, s1p, slopex, slopey, xoff, yoff
28 real(kind=8) :: fliparray((mitot+mjtot)*nghost*(nvar+naux))
29 real(kind=8) ::
setflags(mitot,mjtot),maxauxdif,aux2(naux,mitot,mjtot)
32 logical :: sticksoutxfine, sticksoutyfine,sticksoutxcrse,sticksoutycrse
35 integer :: clock_start, clock_finish, clock_rate
36 real(kind=8) :: cpu_start, cpu_finish
40 real(kind=8) :: get_max_speed
43 refinement_ratio_x = intratx(level-1)
44 refinement_ratio_y = intraty(level-1)
45 dx_coarse = dx * refinement_ratio_x
46 dy_coarse = dy * refinement_ratio_y
47 xl = xleft - dx_coarse
48 xr = xright + dx_coarse
58 iclo = ilo / refinement_ratio_x - 1
59 jclo = jlo / refinement_ratio_y - 1
60 ichi = (ihi + 1) / refinement_ratio_x - 1 + 1
61 jchi = (jhi + 1) / refinement_ratio_y - 1 + 1
64 sticksoutxfine = ( (ilo .lt. 0) .or. (ihi .ge.
iregsz(level)))
65 sticksoutyfine = ( (jlo .lt. 0) .or. (jhi .ge.
jregsz(level)))
66 sticksoutxcrse = ((iclo .lt. 0) .or. (ichi .ge.
iregsz(level-1)))
67 sticksoutycrse = ((jclo .lt. 0) .or. (jchi .ge.
jregsz(level-1)))
70 if ((xperdom .and. sticksoutxcrse).or. (yperdom.and.sticksoutycrse) .or. spheredom)
then 71 call preintcopy(valc,mic,mjc,nvar,iclo,ichi,jclo,jchi,level-1,fliparray)
73 call intcopy(valc,mic,mjc,nvar,iclo,ichi,jclo,jchi,level-1,1,1)
77 auxc(1,:,:) = needs_to_be_set
78 if ((xperdom .and.sticksoutxcrse) .or. (yperdom.and.sticksoutycrse) .or. spheredom)
then 79 call preicall(valc,auxc,mic,mjc,nvar,naux,iclo,ichi,jclo,jchi, &
82 call icall(valc,auxc,mic,mjc,nvar,naux,iclo,ichi,jclo,jchi,level-1,1,1)
95 call setaux(ng,mic,mjc,xl,yb,dx_coarse,dy_coarse,naux,auxc)
98 call bc2amr(valc,auxc,mic,mjc,nvar,naux,dx_coarse,dy_coarse,level-1,time,xl,xr,yb, &
99 yt,xlower,ylower,xupper,yupper,xperdom,yperdom,spheredom)
109 nx = mitot - 2*nghost
110 ny = mjtot - 2*nghost
112 if (naux .gt. 0)
then 118 aux(1,:,:) = needs_to_be_set
120 if ((xperdom.and.sticksoutxfine) .or. (yperdom.and.sticksoutyfine) .or. spheredom)
then 121 call preicall(val,aux,mitot,mjtot,nvar,naux,ilo-nghost,ihi+nghost, &
122 jlo-nghost,jhi+nghost,level,fliparray)
124 call icall(val,aux,mitot,mjtot,nvar,naux,ilo-nghost,ihi+nghost, &
125 jlo-nghost,jhi+nghost,level,1,1)
130 call setaux(nghost,nx,ny,xleft,ybot,dx,dy,naux,aux)
136 val(1,:,:) = needs_to_be_set
137 if ((xperdom.and.sticksoutxfine) .or. (yperdom.and.sticksoutyfine) .or. spheredom)
then 138 call preintcopy(val,mitot,mjtot,nvar,ilo-nghost,ihi+nghost, &
139 jlo-nghost,jhi+nghost,level,fliparray)
141 call intcopy(val,mitot,mjtot,nvar,ilo-nghost,ihi+nghost, &
142 jlo-nghost,jhi+nghost,level,1,1)
154 s1p = valc(ivar,i+1,j) - valc(ivar,i,j)
155 s1m = valc(ivar,i,j) - valc(ivar,i-1,j)
156 slopex = min(abs(s1p), abs(s1m)) &
157 * sign(1.d0,valc(ivar,i+1,j) - valc(ivar,i-1,j))
159 if ( s1m*s1p <= 0.d0) slopex = 0.d0
161 s1p = valc(ivar,i,j+1) - valc(ivar,i,j)
162 s1m = valc(ivar,i,j) - valc(ivar,i,j-1)
163 slopey = min(abs(s1p), abs(s1m)) &
164 * sign(1.0d0, valc(ivar,i,j+1) - valc(ivar,i,j-1))
165 if ( s1m*s1p <= 0.d0) slopey = 0.d0
168 do jco = 1,refinement_ratio_y
169 yoff = (
real(jco,kind=8) - 0.5d0) / refinement_ratio_y - 0.5d0
170 jfine = (j-2) * refinement_ratio_y + nghost + jco
172 do ico = 1,refinement_ratio_x
173 xoff = (
real(ico,kind=8) - 0.5d0) / refinement_ratio_x - 0.5d0
174 ifine = (i-2) * refinement_ratio_x + nghost + ico
176 if (
setflags(ifine,jfine) .eq. needs_to_be_set)
then 177 val(ivar,ifine,jfine) = valc(ivar,i,j) + xoff*slopex + yoff*slopey
189 if (mcapa .ne. 0)
then 190 call fixcapaq(val,aux,mitot,mjtot,valc,auxc,mic,mjc,nvar,naux,level-1,
setflags)
subroutine bc2amr(val, aux, nrow, ncol, meqn, naux,
Take a grid patch with mesh widths hx,hy, of dimensions nrow by ncol, and set the values of any piece...
integer, dimension(maxlv) iregsz
integer, dimension(maxlv) newstl
integer, dimension(maxlv) jregsz
subroutine setflags(iflags, isize, jsize, rctold, idim3, mitot, mjtot, mptr)
subroutine icall(val, aux, nrow, ncol, nvar, naux, ilo, ihi, jlo, jhi, level, iputst, jputst)
For a rectangle defined on level level and bound by ilo, ihi, jlo, jhi, find intersecting grids at th...
subroutine intcopy(val, mitot, mjtot, nvar, ilo, ihi, jlo, jhi, level, iputst, jputst)
For a rectangle that is on level level, described by ilo, ihi, jlo, jhi and made up by mitot mjtot c...
real(kind=8), parameter needs_to_be_set
subroutine fixcapaq(val, aux, mitot, mjtot, valc, auxc, mic, mjc, nvar, naux, levc, setflags)
subroutine preintcopy(val, mitot, mjtot, nvar, ilo, ihi, jlo, jhi, level, fliparray)
integer, dimension(maxlv) intraty
subroutine preicall(val, aux, nrow, ncol, nvar, naux, ilo, ihi, jlo, jhi, level, fliparray)
integer, parameter outunit
integer, dimension(maxlv) intratx
The module contains the definition of a "node descriptor" as well as other global variables used duri...
subroutine setaux(mbc, mx, my, xlower, ylower, dx, dy, maux, aux)
real(kind=8), dimension(:), allocatable alloc