/** This function is used when in direction a_dir a 4-point stencil of cell-centered data is being used to compute something at the face between cells of the stencil. Inputs: * a_dir is the direction of the 4-point stencil; * a_inBox is the cell-centered box on which we have data; * a_domain is the problem domain. Output boxes are all face-centered subboxes of the faces of a_inBox in direction a_dir, and are also contained in the faces of a_domain: * a_loBox is where a stencil must be used on the low side with all four points higher; * a_nextLoBox is where a stencil must be used on the low side with one point lower and three points higher; * a_centerBox is where the regular 4-point stencil can be used; * a_hiBox is where a stencil must be used on the high side with all four points lower; * a_nextHiBox is where a stencil must be used on the high side with one point higher and three points lower; * a_entireBox is the union of a_(lo|nextLo|center|hi|nextHi)Box. Each of the boxes a_loBox, a_nextLoBox, a_hiBox, a_nextHiBox will be at most 1 face wide. a_loBox and a_nextLoBox will both be defined or both be undefined. a_hiBox and a_nextHiBox will both be defined or both be undefined. Output flags: * a_hasLo: 1 or 0, according to whether a_loBox and a_nextLoBox are defined or not; * a_hasHi: 1 or 0, according to whether a_hiBox and a_nextHiBox are defined or not. */ void loHiCenterFace4(Box& a_loBox, Box& a_nextLoBox, int& a_hasLo, Box& a_hiBox, Box& a_nextHiBox, int& a_hasHi, Box& a_centerBox, Box& a_innerCenterBox, Box& a_entireBox, const Box& a_inBox, const ProblemDomain& a_domain, const int& a_dir) { loHiCenterFace(a_loBox, a_hasLo, a_hiBox, a_hasHi, a_centerBox, a_entireBox, a_inBox, a_domain, a_dir); a_innerCenterBox = a_centerBox; if (a_hasLo) { a_nextLoBox = a_loBox; a_nextLoBox.shift(a_dir, 1); // Remove first row of faces from a_centerBox. int centerMin = a_centerBox.smallEnd(a_dir); a_innerCenterBox.setSmall(a_dir, centerMin + 1); } if (a_hasHi) { a_nextHiBox = a_hiBox; a_nextHiBox.shift(a_dir, -1); // Remove last row of faces from a_centerBox. int centerMax = a_centerBox.bigEnd(a_dir); a_innerCenterBox.setBig(a_dir, centerMax - 1); } }
// Adjust boundary fluxes to account for artificial viscosity void RampIBC::artViscBC(FArrayBox& a_F, const FArrayBox& a_U, const FArrayBox& a_divVel, const int& a_dir, const Real& a_time) { CH_assert(m_isFortranCommonSet == true); CH_assert(m_isDefined == true); FArrayBox &divVel = (FArrayBox &)a_divVel; Box fluxBox = divVel.box(); fluxBox.enclosedCells(a_dir); fluxBox.grow(a_dir,1); Box loBox,hiBox,centerBox,entireBox; int hasLo,hasHi; loHiCenterFace(loBox,hasLo,hiBox,hasHi,centerBox,entireBox, fluxBox,m_domain,a_dir); if (hasLo == 1) { loBox.shiftHalf(a_dir,1); divVel.shiftHalf(a_dir,1); a_F.shiftHalf(a_dir,1); int loHiSide = -1; FORT_RAMPARTVISCF(CHF_FRA(a_F), CHF_CONST_FRA(a_U), CHF_CONST_FRA1(divVel,0), CHF_CONST_INT(loHiSide), CHF_CONST_REAL(m_dx), CHF_CONST_INT(a_dir), CHF_BOX(loBox)); loBox.shiftHalf(a_dir,-1); divVel.shiftHalf(a_dir,-1); a_F.shiftHalf(a_dir,-1); } if (hasHi == 1) { hiBox.shiftHalf(a_dir,-1); divVel.shiftHalf(a_dir,-1); a_F.shiftHalf(a_dir,-1); int loHiSide = 1; FORT_RAMPARTVISCF(CHF_FRA(a_F), CHF_CONST_FRA(a_U), CHF_CONST_FRA1(divVel,0), CHF_CONST_INT(loHiSide), CHF_CONST_REAL(m_dx), CHF_CONST_INT(a_dir), CHF_BOX(hiBox)); hiBox.shiftHalf(a_dir,1); divVel.shiftHalf(a_dir,1); a_F.shiftHalf(a_dir,1); } }