!-----------------------------------------------------------------------
! Physical boundary conditions for 1d Euler equations.
! Reflecting walls at both sides.
! Interface:
! mx,my := shape of grid function
!
! u(,) := grid function
!
! lb(1) := lower bound for grid
! ub(1) := upper bound for grid
! lbbnd(1) := lower bound for boundary region
! ubnd(1) := upper bound for boundary region
! shapebnd(1) := shape of boundary region
! xc(1) := lower left corner of grid
! dx(1) := grid spacing
! dir := at which side of the grid is the boundary?
! bnd(,2,1) := lower left and upper right corner of global grid and
! of mb-1 internal boundary regions
!
! Copyright (C) 2002 Ralf Deiterding
! Brandenburgische Universitaet Cottbus
!
! Copyright (C) 2003-2007 California Institute of Technology
! Ralf Deiterding, ralf@cacr.caltech.edu
!
!-----------------------------------------------------------------------
subroutine physbd(u,mx,lb,ub,lbbnd,ubbnd,shapebnd,
& xc,dx,dir,bnd,mb,time,meqn)
implicit none
integer mx, meqn, mb, dir
integer lb(1), ub(1), lbbnd(1), ubbnd(1), shapebnd(1)
double precision u(meqn, mx), xc(1), dx(1), bnd(mb,2,1), time
! Local variables
integer i, m, imin, imax, isym
integer stride, getindx
integer isx(3)
c
data isx /1,-1,1/
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! See definition of member-function extents() in BBox.h
! for calculation of stride
stride = (ub(1) - lb(1))/(mx-1)
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! Find working domain
imin = getindx(max(lbbnd(1), lb(1)), lb(1), stride)
imax = getindx(min(ubbnd(1), ub(1)), lb(1), stride)
if(imax .gt. mx .or. imin .lt. 1) then
write(0,*)'INDEX ERROR in physbd'
end if
! Left Side --- Symmetry or Fixed Walls
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (dir.eq.0) then
do 200 i = imax, imin, -1
isym = 2*imax+1-i
do 200 m = 1, meqn
u(m,i) = u(m,isym)*isx(m)
200 continue
return
end if
! Right Side --- Symmetry or Fixed Walls
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (dir.eq.1) then
do 210 i = imin, imax
isym = 2*imin-1-i
do 210 m = 1, meqn
u(m,i) = u(m,isym)*isx(m)
210 continue
return
end if
c
return
end