releasedExamples/MultiDimPhase/advectSrc/OldPatchGodunov.cpp
// Compute the directional slopes (2nd or 4th order) of the primitive
// variables applying slope limiting and, possibly, slope flattening.
// Slopes are only computed for primitive variables with indices 0 through
// numSlopes()-1.
Compute the directional slopes (2nd or 4th order) of the primitive
variables applying slope limiting and, possibly, slope flattening.
Slopes are only computed for primitive variables with indices 0 through
numSlopes()-1.
Compute the directional slopes ( 2nd or 4th order ) of the primitive variables applying slope limiting and possibly slope flattening . Slopes are only computed for primitive variables with indices 0 through numSlopes () - 1 .
void OldPatchGodunov::slope(FArrayBox&       a_dW,
                            const FArrayBox& a_W,
                            const FArrayBox& a_flattening,
                            const int&       a_dir,
                            const Box&       a_box)
{
  int numSlope = numSlopes();
  CH_assert(a_dW.nComp() == numSlope);
  CH_assert(a_W.nComp() >= numSlope);
  Box box1 = a_box;
  box1.grow(a_dir,1);
  Box box2 = a_box;
  box2.grow(a_dir,2);
  Box loBox,hiBox,centerBox,entireBox;
  int hasLo,hasHi;
  if (useFourthOrderSlopes())
  {
    oldLoHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,entireBox,
                  box2,m_domain,a_dir);
  }
  else
  {
    oldLoHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,entireBox,
                  box1,m_domain,a_dir);
  }
  FArrayBox delta2W(entireBox,numSlope);
  FArrayBox deltaWL(entireBox,numSlope);
  FArrayBox deltaWR(entireBox,numSlope);
  FORT_OLDSECONDSLOPEDIFFSF(CHF_FRA(delta2W),
                            CHF_FRA(deltaWL),
                            CHF_FRA(deltaWR),
                            CHF_CONST_FRA(a_W),
                            CHF_CONST_INT(numSlope),
                            CHF_CONST_INT(a_dir),
                            CHF_BOX(loBox),
                            CHF_CONST_INT(hasLo),
                            CHF_BOX(hiBox),
                            CHF_CONST_INT(hasHi),
                            CHF_BOX(centerBox));
  if (limitSlopes())
    {
      applyLimiter(delta2W,deltaWL,deltaWR,a_dir,centerBox);
    }
  m_bc->setBdrySlopes(delta2W,a_W,a_dir,m_currentTime);
  if (useFourthOrderSlopes())
  {
    oldLoHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,entireBox,
                  box1,m_domain,a_dir);
    FArrayBox delta4W(entireBox,numSlope);
    CH_assert(delta4W.box().contains(entireBox));
    FORT_OLDFOURTHSLOPEDIFFSF(CHF_FRA(delta4W),
                              CHF_CONST_FRA(a_W),
                              CHF_CONST_FRA(delta2W),
                              CHF_CONST_INT(numSlope),
                              CHF_CONST_INT(a_dir),
                              CHF_BOX(loBox),
                              CHF_CONST_INT(hasLo),
                              CHF_BOX(hiBox),
                              CHF_CONST_INT(hasHi),
                              CHF_BOX(centerBox));
    if (limitSlopes())
      {
        applyLimiter(delta4W,deltaWL,deltaWR,a_dir,centerBox);
      }
    if (useFlattening())
    {
      FORT_OLDAPPLYFLATF(CHF_FRA(delta4W),
                         CHF_CONST_FRA1(a_flattening,0),
                         CHF_CONST_INT(numSlope),
                         CHF_BOX(entireBox));
    }
    a_dW.copy(delta4W);
  }
  else
  {
    a_dW.copy(delta2W);
  }
}
void OldPatchGodunov :: slope ( FArrayBox & a_dW , const FArrayBox & a_W , const FArrayBox & a_flattening , const int & a_dir , const Box & a_box ) { int numSlope = numSlopes ( ) ; CH_assert ( a_dW . nComp ( ) == numSlope ) ; CH_assert ( a_W . nComp ( ) >= numSlope ) ; Box box1 = a_box ; box1 . grow ( a_dir , 1 ) ; Box box2 = a_box ; box2 . grow ( a_dir , 2 ) ; Box loBox , hiBox , centerBox , entireBox ; int hasLo , hasHi ; if ( useFourthOrderSlopes ( ) ) { oldLoHiCenter ( loBox , hasLo , hiBox , hasHi , centerBox , entireBox , box2 , m_domain , a_dir ) ; } else { oldLoHiCenter ( loBox , hasLo , hiBox , hasHi , centerBox , entireBox , box1 , m_domain , a_dir ) ; } FArrayBox delta2W ( entireBox , numSlope ) ; FArrayBox deltaWL ( entireBox , numSlope ) ; FArrayBox deltaWR ( entireBox , numSlope ) ; FORT_OLDSECONDSLOPEDIFFSF ( CHF_FRA ( delta2W ) , CHF_FRA ( deltaWL ) , CHF_FRA ( deltaWR ) , CHF_CONST_FRA ( a_W ) , CHF_CONST_INT ( numSlope ) , CHF_CONST_INT ( a_dir ) , CHF_BOX ( loBox ) , CHF_CONST_INT ( hasLo ) , CHF_BOX ( hiBox ) , CHF_CONST_INT ( hasHi ) , CHF_BOX ( centerBox ) ) ; if ( limitSlopes ( ) ) { applyLimiter ( delta2W , deltaWL , deltaWR , a_dir , centerBox ) ; } m_bc -> setBdrySlopes ( delta2W , a_W , a_dir , m_currentTime ) ; if ( useFourthOrderSlopes ( ) ) { oldLoHiCenter ( loBox , hasLo , hiBox , hasHi , centerBox , entireBox , box1 , m_domain , a_dir ) ; FArrayBox delta4W ( entireBox , numSlope ) ; CH_assert ( delta4W . box ( ) . contains ( entireBox ) ) ; FORT_OLDFOURTHSLOPEDIFFSF ( CHF_FRA ( delta4W ) , CHF_CONST_FRA ( a_W ) , CHF_CONST_FRA ( delta2W ) , CHF_CONST_INT ( numSlope ) , CHF_CONST_INT ( a_dir ) , CHF_BOX ( loBox ) , CHF_CONST_INT ( hasLo ) , CHF_BOX ( hiBox ) , CHF_CONST_INT ( hasHi ) , CHF_BOX ( centerBox ) ) ; if ( limitSlopes ( ) ) { applyLimiter ( delta4W , deltaWL , deltaWR , a_dir , centerBox ) ; } if ( useFlattening ( ) ) { FORT_OLDAPPLYFLATF ( CHF_FRA ( delta4W ) , CHF_CONST_FRA1 ( a_flattening , 0 ) , CHF_CONST_INT ( numSlope ) , CHF_BOX ( entireBox ) ) ; } a_dW . copy ( delta4W ) ; } else { a_dW . copy ( delta2W ) ; } }
Compute the directional slopes (2nd or 4th order) of the primitive
variables applying slope limiting and, possibly, slope flattening.
Compute the directional slopes ( 2nd or 4th order ) of the primitive variables applying slope limiting and possibly slope flattening .
// Number of slopes to compute // A box one larger (in direction "a_dir") than the final result box // A box two larger (in direction "a_dir") than the final result box // Compute where centered differences can be used and where one sided // differences need to be used.  The data used for the differences is // defined on "box2" for 4th order slope and "box1" for 2nd order slopes // Compute 2nd order slopes - including one sided differences // Apply the slope limiter, if desired // Use the user supplied PhysBC object to obtain slopes at the boundary // 4th order slopes requested // Compute where centered differences can be used and where one sided // differences need to be used.  The data used for the differences is // defined on "box1" // Compute 4th order slopes // Apply the slope limiter // Apply slope flattening if requested // Copy the 4th order slopes for return // Copy the 2nd order slopes for return