Setting the correct boundary conditions is vital for any numerical exercise. Here, incorrect boundaries can lead to spurious waves and other nonphysical features. AstroBEAR has an "extended ghost cell region," meaning that on a given grid there will be more than a single cell in the ghost (boundary) region. This demands careful consideration of all of the ghost cells. We therefore examine each boundary in turn.
Left Boundary
The left boundary has a reflecting boundary condition. This uses a standard AstroBEAR boundary condition.
Right Boundary
The right boundary has a reflecting boundary condition just as the left boundary. This uses a standard AstroBEAR boundary condition.
Top Boundary
Per the problem setup, the top boundary is set to extrapolate velocities while prescribing hydrostatic equilibrium on pressure. Density and pressure are related via an isentropic equation of state.
Bottom Boundary
Per the problem setup, the bottom boundary enforces the following:
Explicit Forms of Top and Bottom Boundaries
First, from the provided setup, (note: "acceleration" is a negative quantity)
Bottom boundary:
v(i,0)= v(i,4)-2*(v(i,3)-v(i,1))
rho(i,0)= rho(i,1)*v(i,1)/v(i,0)
u(i,0)= u(i,1)
p(i,0)= p(i,1)-0.5*(rho(i,0)+rho(i,1))*acceleration*dy &
+rho(i,1)*v(i,1)**2-rho(i,0)*v(i,0)**2
Top Boundary:
u(i,ny+1)= u(i,ny)
v(i,ny+1)= v(i,ny)
rsh=1.66667
del_hat=acceleration*rho(i,ny)/p(i,ny)*(rsh-1.)/rsh
p(i,ny+1)=p(i,ny)*dexp((del_hat*dy-del_hat**2*dy**2*0.5)*rsh/(rsh-1.))
rho(i,ny+1)=rho(i,ny)*dexp((del_hat*dy-del_hat**2*dy**2*0.5)/(rsh-1.))
As implemented,
Bottom Boundary:
DO ibc=0,1-rmbc,-1
! Constant extrapolation
u(ibc) = u(1)
! Curvature extrapolation
v(ibc) = v(ibc+4) - 2.d0*(v(ibc+3)-v(ibc+1))
! Constant mass flow
rho(ibc) = rho(ibc+1)*v(ibc+1)/v(ibc)
! Pressure equilibrium
p(ibc) = p(ibc+1) - dyg2*(rho(ibc) + rho(ibc+1)) + &
rho(ibc+1)*v(ibc+1)**2 - rho(ibc)*v(ibc)**2
END DO
Top Boundary:
DO ibc=my+1,my+rmbc
! Constant extrapolation
u(ibc) = u(my)
v(ibc) = v(my)
! Pressure equilibrium
p(ibc) = p(ibc-1)*EXP(dyg*rho(ibc-1)/p(ibc-1))
! Isentropic equation of state
rho(ibc) = rho(ibc-1)*(p(ibc)/p(ibc-1))**(1.d0/gamma)
END DO