// Set boundary slopes: // The boundary slopes in a_dW are already set to one sided difference // approximations. If this function doesn't change them they will be // used for the slopes at the boundaries. void ExplosionIBC::setBdrySlopes(FArrayBox& a_dW, const FArrayBox& a_W, const int& a_dir, const Real& a_time) { CH_assert(m_isFortranCommonSet == true); CH_assert(m_isDefined == true); // In periodic case, this doesn't do anything if (!m_domain.isPeriodic(a_dir)) { Box loBox,hiBox,centerBox,domain; int hasLo,hasHi; Box slopeBox = a_dW.box(); slopeBox.grow(a_dir,1); // Generate the domain boundary boxes, loBox and hiBox, if there are // domain boundarys there loHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,domain, slopeBox,m_domain,a_dir); // Set the boundary slopes if necessary if ((hasLo != 0) || (hasHi != 0)) { FORT_SLOPEBCSF(CHF_FRA(a_dW), CHF_CONST_FRA(a_W), CHF_CONST_INT(a_dir), CHF_BOX(loBox), CHF_CONST_INT(hasLo), CHF_BOX(hiBox), CHF_CONST_INT(hasHi)); } } }
/** This function is used when in direction a_dir a 5-point stencil of cell-centered data is being used to compute something at the center of the central cell of the stencil. Inputs: * a_dir is the direction of the 5-point stencil; * a_inBox is the cell-centered box on which we are to compute a stencil (2-point or 3-point or 5-point), expanded by 1 in a_dir direction, and not intersected with the domain; * a_domain is the problem domain. Output boxes are all cell-centered subboxes of a_inBox and are also contained in a_domain: * a_loBox is where a 2-point stencil must be used on the low side; * a_nextLoBox is where a 3-point stencil must be used on the low side with one point lower and three points higher; * a_hiBox is where a 2-point stencil must be used on the high side; * a_nextHiBox is where a 3-point stencil must be used on the high side with one point higher and three points lower; * a_centerBox is union of a_innerCenterBox, a_nextLoBox, and a_nextHiBox, where a 3-point stencil may be used; * a_innerCenterBox is where the regular 5-point stencil can be used; where a 5-point stencil may be used; * 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 cell 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 loHiCenter5(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) { loHiCenter(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); } }
// Set boundary slopes: // The boundary slopes in a_dW are already set to one sided difference // approximations. If this function doesn't change them they will be // used for the slopes at the boundaries. void VelIBC::setBdrySlopes(FArrayBox& a_dW, const FArrayBox& a_W, const int& a_dir, const Real& a_time) { // CH_assert(m_isFortranCommonSet == true); CH_assert(m_isDefined == true); // In periodic case, this doesn't do anything if (!m_domain.isPeriodic(a_dir)) { // This needs to be fixed // CH_assert(m_isSlopeValSet); Box loBox,hiBox,centerBox,domain; int hasLo,hasHi; Box slopeBox = a_dW.box()&m_domain; Real loVal = m_slopeVal[a_dir][0]; Real hiVal = m_slopeVal[a_dir][1]; // Generate the domain boundary boxes, loBox and hiBox, if there are // domain boundaries there loHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,domain, slopeBox,m_domain,a_dir); // Set the boundary slopes if necessary if ((hasLo != 0) || (hasHi != 0)) { FORT_SLOPEBCSF(CHF_FRA(a_dW), CHF_CONST_FRA(a_W), CHF_CONST_REAL(m_dx), CHF_CONST_INT(a_dir), CHF_CONST_REAL(loVal), CHF_BOX(loBox), CHF_CONST_INT(hasLo), CHF_CONST_REAL(hiVal), CHF_BOX(hiBox), CHF_CONST_INT(hasHi)); } } }
// Set boundary slopes: // The boundary slopes in a_dW are already set to one sided difference // approximations. If this function doesn't change them they will be // used for the slopes at the boundaries. void RampIBC::setBdrySlopes(FArrayBox& a_dW, const FArrayBox& a_W, const int& a_dir, const Real& a_time) { CH_assert(m_isFortranCommonSet == true); CH_assert(m_isDefined == true); // Neither the x or y direction can be periodic if ((a_dir == 0 || a_dir == 1) && m_domain.isPeriodic(a_dir)) { MayDay::Error("RampIBC::setBdrySlopes: Neither the x and y boundaries can be periodic"); } // In periodic case, this doesn't do anything if (!m_domain.isPeriodic(a_dir)) { Box loBox,hiBox,centerBox,domain; int hasLo,hasHi; Box slopeBox = a_dW.box(); slopeBox.grow(a_dir,1); // Generate the domain boundary boxes, loBox and hiBox, if there are // domain boundarys there loHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,domain, slopeBox,m_domain,a_dir); // Set the boundary slopes if necessary if ((hasLo != 0) || (hasHi != 0)) { FORT_RAMPSLOPEBCSF(CHF_FRA(a_dW), CHF_CONST_FRA(a_W), CHF_CONST_REAL(m_dx), CHF_CONST_INT(a_dir), CHF_BOX(loBox), CHF_CONST_INT(hasLo), CHF_BOX(hiBox), CHF_CONST_INT(hasHi)); } } }