c-----------------------------------------------------------------------
c Two-dimensional prolongation operator for AMROC.
c A fine grid value is replaced by the value of a bilinear function
c through the neighbouring coarse grid values at the center
c of the particular fine grid cell.
c
c Interface:
c mfx,mfy := shape of fine grid
c mcx,mcy := shape of coarse grid
c
c uf(,) := fine grid
c uc(,) := coarse grid
c
c lbc(2) := lower bound for coarse grid
c ubc(2) := upper bound for coarse grid
c lbf(2) := lower bound for fine grid
c ubf(2) := upper bound for fine grid
c lbr(2) := lower bound for region prolongation desired
c ufr(2) := upper bound for region prolongation desired
c shaper(2) := shape of region prolongation desired
c
c Copyright (C) 2002 Ralf Deiterding
c Brandenburgische Universitaet Cottbus
c
c Copyright (C) 2003-2007 California Institute of Technology
c Ralf Deiterding, ralf@amroc.net
c-----------------------------------------------------------------------
subroutine prolong2(uc,mcx,mcy,lbc,ubc,
& uf,mfx,mfy,lbf,ubf,
& lbr,ubr,shaper,meqn,mbc)
implicit none
integer meqn, mbc, mcx, mcy, mfx, mfy, shaper(2)
double precision uf(meqn,mfx,mfy), uc(meqn,mcx,mcy)
integer lbf(2), ubf(2),
& lbc(2), ubc(2),
& lbr(2), ubr(2),
& getindx
c Local variables
integer i, j, m, ic, jc, mic, mjc,
& stridec, stridef,
& ifine, ics, jfine, jcs
double precision eta1, eta2
c- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
c See definition of member-function extents() in BBox.h
c for calculation of stride
c- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
stridec = (ubc(1) - lbc(1))/(mcx-1)
stridef = (ubf(1) - lbf(1))/(mfx-1)
c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
c Prolongation region is defined on the domain of the fine grid.
c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
do 10 j=lbr(2), ubr(2), stridef
jfine = getindx(j, lbf(2), stridef)
jcs = getindx(j, lbc(2), stridec)
jc = j - lbc(2)
mjc = jc - (jc/stridec)*stridec
if(mjc .lt. stridec*0.5) then
jcs = jcs - 1
end if
jc = jc + stridec*0.5
mjc = jc - (jc/stridec)*stridec
eta2 = (mjc+0.5d0*stridef) / stridec
do 10 i=lbr(1), ubr(1), stridef
ifine = getindx(i, lbf(1), stridef)
ics = getindx(i, lbc(1), stridec)
ic = i - lbc(1)
mic = ic - (ic/stridec)*stridec
if(mic .lt. stridec*0.5) then
ics = ics - 1
end if
ic = ic + stridec*0.5
mic = ic - (ic/stridec)*stridec
eta1 = (mic+0.5d0*stridef) / stridec
! if(ics+1 .gt. mcx .or.
! & jcs+1 .gt. mcy .or.
! & ics .lt. 1 .or. jcs .lt. 1) then
! uf(1,ifine,jfine) = -100000.0
! write(0,*)'ERROR in prolongation: ',ics,jcs
! endif
do 10 m=1, meqn
uf(m,ifine,jfine) = (1.d0-eta2)*
& ((1.d0-eta1)*uc(m,ics, jcs ) +
& eta1 *uc(m,ics+1,jcs ))+ eta2*
& ((1.d0-eta1)*uc(m,ics, jcs+1) +
& eta1 *uc(m,ics+1,jcs+1))
10 continue
return
end