c
c
c ==========================================================
subroutine step2ds(maxm,maxmx,maxmy,mvar,meqn,maux,mwaves,mbc,
& mx,my,qold,aux,dx,dy,dt,method,mthlim,cfl,
& fm,fp,gm,gp,faddm,faddp,gaddm,gaddp,
& q1d,dtdx1d,dtdy1d,aux1,aux2,aux3,
& work,mwork,rpn2,rpt2,ids)
c ==========================================================
c
c # Update fluxes in normal direction for a single direction within
c # a dimensional splitting method.
c
c # fadd is used to return flux increments in normal direction from flux2.
c # See the flux2 documentation for more information.
c
implicit double precision (a-h,o-z)
include "call.i"
c
dimension qold(mvar, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension fm(mvar, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension fp(mvar, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension gm(mvar, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension gp(mvar, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension q1d(1-mbc:maxm+mbc, meqn)
dimension faddm(1-mbc:maxm+mbc, meqn)
dimension faddp(1-mbc:maxm+mbc, meqn)
dimension gaddm(1-mbc:maxm+mbc, meqn, 2)
dimension gaddp(1-mbc:maxm+mbc, meqn, 2)
dimension aux(maux, 1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
dimension aux1(1-mbc:maxm+mbc, maux)
dimension aux2(1-mbc:maxm+mbc, maux)
dimension aux3(1-mbc:maxm+mbc, maux)
dimension dtdx1d(1-mbc:maxm+mbc)
dimension dtdy1d(1-mbc:maxm+mbc)
dimension method(7),mthlim(mwaves)
dimension work(mwork)
external rpn2,rpt2
c
c # partition work array into pieces needed for local storage in
c # flux2 routine. Find starting index of each piece:
c
i0wave = 1
i0s = i0wave + (maxm+2*mbc)*meqn*mwaves
i0amdq = i0s + (maxm+2*mbc)*mwaves
i0apdq = i0amdq + (maxm+2*mbc)*meqn
i0cqxx = i0apdq + (maxm+2*mbc)*meqn
i0bmadq = i0cqxx + (maxm+2*mbc)*meqn
i0bpadq = i0bmadq + (maxm+2*mbc)*meqn
if (method(1).ge.1) then
i0qls = i0bpadq + (maxm+2*mbc)*meqn
i0qrs = i0qls + (maxmx+2*mbc)*(maxmy+2*mbc)*mvar
i0qbs = i0qrs + (maxmx+2*mbc)*(maxmy+2*mbc)*mvar
i0qts = i0qbs + (maxmx+2*mbc)*(maxmy+2*mbc)*mvar
i0ql = i0qts + (maxmx+2*mbc)*(maxmy+2*mbc)*mvar
i0qr = i0ql + (maxm+2*mbc)*meqn
i0slope = i0ql
else
i0slope = i0bpadq + (maxm+2*mbc)*meqn
endif
iused = i0slope + (maxm+2*mbc)*meqn*4 - 1
mslope = iused-i0slope+1
c
if (iused.gt.mwork) then
write(6,*) '*** not enough work space in step2dsex'
write(6,*) '*** iused = ', iused, ' mwork =',mwork
stop
endif
c
c
mcapa = method(6)
c
cfl = 0.d0
dtdx = dt/dx
dtdy = dt/dy
c
if (mcapa.eq.0) then
c # no capa array:
do 5 i=1-mbc,maxm+mbc
dtdx1d(i) = dtdx
dtdy1d(i) = dtdy
5 continue
endif
c
if( ids.eq.1 )then
c
c # perform x-sweeps
c ==================
c
c # note that for dimensional splitting we sweep over the rows of
c # ghosts cells as well as the interior. This updates the ghost
c # cell values to the intermediate state as needed in the following
c # sweep in the y-direction.
c
do 50 j = 1-mbc,my+mbc
c
c # copy data along a slice into 1d arrays:
do 20 i = 1-mbc, mx+mbc
do 20 m=1,meqn
q1d(i,m) = qold(m,i,j)
20 continue
c
if (mcapa.gt.0) then
do 22 i = 1-mbc, mx+mbc
dtdx1d(i) = dtdx / aux(mcapa,i,j)
22 continue
endif
c
if (maux .gt. 0) then
do 23 ma=1,maux
do 23 i = 1-mbc, mx+mbc
aux2(i,ma) = aux(ma,i,j)
23 continue
c
if(j .ne. 1-mbc)then
do 24 ma=1,maux
do 24 i = 1-mbc, mx+mbc
aux1(i,ma) = aux(ma,i,j-1)
24 continue
endif
c
if(j .ne. my+mbc)then
do 25 ma=1,maux
do 25 i = 1-mbc, mx+mbc
aux3(i,ma) = aux(ma,i,j+1)
25 continue
endif
c
endif
c
c # Store the value of j along this slice in the common block
c # comxyt in case it is needed in the Riemann solver (for
c # variable coefficient problems)
jcom = j
c
c # compute modifications fadd and gadd to fluxes along this slice:
call flux2(1,maxm,meqn,maux,mwaves,mbc,mx,
& q1d,dtdx1d,aux1,aux2,aux3,method,mthlim,
& faddm,faddp,gaddm,gaddp,cfl1d,
& work(i0wave),work(i0s),work(i0amdq),work(i0apdq),
& work(i0cqxx),work(i0bmadq),work(i0bpadq),
& work(i0slope),mslope,rpn2,rpt2)
cfl = dmax1(cfl,cfl1d)
c
c # update fluxes for use in AMR:
c
do 26 i=1,mx+1
do 26 m=1,meqn
fm(m,i,j) = fm(m,i,j) + faddm(i,m)
fp(m,i,j) = fp(m,i,j) + faddp(i,m)
26 continue
c
if (method(1).ge.1.and.method(2).ge.3)
& call saverec2(1,maxm,maxmx,maxmy,mvar,meqn,mbc,mx,my,
& qold,work(i0qls),work(i0qrs),work(i0qbs),
& work(i0qts),work(i0ql),work(i0qr))
c
50 continue
c
if (method(1).ge.1) then
if (method(2).le.2) then
call fmod2(maxm,maxmx,maxmy,mvar,meqn,maux,mbc,mx,my,
& qold,qold,qold,qold,qold,aux,dx,dy,dt,method,
& cfl,fm,fp,gm,gp,q1d,aux2,faddm,faddp,1)
else
call fmod2(maxm,maxmx,maxmy,mvar,meqn,maux,mbc,mx,my,
& qold,work(i0qls),work(i0qrs),work(i0qbs),
& work(i0qts),aux,dx,dy,dt,method,cfl,
& fm,fp,gm,gp,q1d,aux2,faddm,faddp,1)
endif
endif
c
endif
c
if( ids.eq.2 )then
c
c # perform y sweeps
c ==================
c
c
do 100 i = 1-mbc, mx+mbc
c
c # copy data along a slice into 1d arrays:
do 70 j = 1-mbc, my+mbc
do 70 m=1,meqn
q1d(j,m) = qold(m,i,j)
70 continue
c
if (mcapa.gt.0) then
do 72 j = 1-mbc, my+mbc
dtdy1d(j) = dtdy / aux(mcapa,i,j)
72 continue
endif
c
if (maux .gt. 0) then
c
do 73 ma=1,maux
do 73 j = 1-mbc, my+mbc
aux2(j,ma) = aux(ma,i,j)
73 continue
c
if(i .ne. 1-mbc)then
do 74 ma=1,maux
do 74 j = 1-mbc, my+mbc
aux1(j,ma) = aux(ma,i-1,j)
74 continue
endif
c
if(i .ne. mx+mbc)then
do 75 ma=1,maux
do 75 j = 1-mbc, my+mbc
aux3(j,ma) = aux(ma,i+1,j)
75 continue
endif
c
endif
c
c # Store the value of i along this slice in the common block
c # comxyt in case it is needed in the Riemann solver (for
c # variable coefficient problems)
icom = i
c
c # compute modifications fadd and gadd to fluxes along this slice:
call flux2(2,maxm,meqn,maux,mwaves,mbc,my,
& q1d,dtdy1d,aux1,aux2,aux3,method,mthlim,
& faddm,faddp,gaddm,gaddp,cfl1d,
& work(i0wave),work(i0s),work(i0amdq),work(i0apdq),
& work(i0cqxx),work(i0bmadq),work(i0bpadq),
& work(i0slope),mslope,rpn2,rpt2)
cfl = dmax1(cfl,cfl1d)
c
c # update fluxes for use in AMR:
c
do 76 j=1,my+1
do 76 m=1,meqn
gm(m,i,j) = gm(m,i,j) + faddm(j,m)
gp(m,i,j) = gp(m,i,j) + faddp(j,m)
76 continue
c
if (method(1).ge.1.and.method(2).ge.3)
& call saverec2(2,maxm,maxmx,maxmy,mvar,meqn,mbc,mx,my,
& qold,work(i0qls),work(i0qrs),work(i0qbs),
& work(i0qts),work(i0ql),work(i0qr))
c
100 continue
c
if (method(1).ge.1) then
if (method(2).le.2) then
call fmod2(maxm,maxmx,maxmy,mvar,meqn,maux,mbc,mx,my,
& qold,qold,qold,qold,qold,aux,dx,dy,dt,method,
& cfl,fm,fp,gm,gp,q1d,aux2,faddm,faddp,2)
else
call fmod2(maxm,maxmx,maxmy,mvar,meqn,maux,mbc,mx,my,
& qold,work(i0qls),work(i0qrs),work(i0qbs),
& work(i0qts),aux,dx,dy,dt,method,cfl,
& fm,fp,gm,gp,q1d,aux2,faddm,faddp,2)
endif
endif
c
endif
c
c
return
end