releasedExamples/MultiDimPhase/advectSrc/PatchAdvection.cpp
// Compute a Riemann problem and generate fluxes at the faces
Compute a Riemann problem and generate fluxes at the faces
Compute a Riemann problem and generate fluxes at the faces
void PatchAdvection::riemann(FArrayBox&       a_F,
                             const FArrayBox& a_WLeft,
                             const FArrayBox& a_WRight,
                             const int&       a_dir,
                             const Box&       a_box)
{
  CH_assert(isDefined());
  CH_assert(a_F.box().contains(a_box));
  CH_assert(m_advVelPtr != NULL);
  FluxBox& advVel = *m_advVelPtr;
  int numPrim = numPrimitives();
  int numFlux = numFluxes();
  CH_assert(a_F.nComp() == numFlux);
  CH_assert(a_WLeft.nComp() == numPrim);
  CH_assert(a_WRight.nComp() == numPrim);
  FArrayBox& shiftWLeft  = (FArrayBox&)a_WLeft;
  FArrayBox& shiftWRight = (FArrayBox&)a_WRight;
  FArrayBox Wgdnv(a_box,numPrim);
  shiftWLeft .shiftHalf(a_dir, 1);
  shiftWRight.shiftHalf(a_dir,-1);
  CH_assert(shiftWLeft.box().contains(a_box));
  CH_assert(shiftWRight.box().contains(a_box));
  FArrayBox& advVelDir = advVel[a_dir];
  CH_assert(advVelDir.box().contains(a_box));
  FORT_RIEMANNF(CHF_FRA(Wgdnv),
                CHF_CONST_FRA(shiftWLeft),
                CHF_CONST_FRA(shiftWRight),
                CHF_CONST_FRA1(advVelDir,0),
                CHF_CONST_INT(a_dir),
                CHF_BOX(a_box));
  shiftWLeft .shiftHalf(a_dir,-1);
  shiftWRight.shiftHalf(a_dir, 1);
  a_F.copy(Wgdnv);
}
void PatchAdvection :: riemann ( FArrayBox & a_F , const FArrayBox & a_WLeft , const FArrayBox & a_WRight , const int & a_dir , const Box & a_box ) { CH_assert ( isDefined ( ) ) ; CH_assert ( a_F . box ( ) . contains ( a_box ) ) ; CH_assert ( m_advVelPtr != NULL ) ; FluxBox & advVel = * m_advVelPtr ; int numPrim = numPrimitives ( ) ; int numFlux = numFluxes ( ) ; CH_assert ( a_F . nComp ( ) == numFlux ) ; CH_assert ( a_WLeft . nComp ( ) == numPrim ) ; CH_assert ( a_WRight . nComp ( ) == numPrim ) ; FArrayBox & shiftWLeft = ( FArrayBox & ) a_WLeft ; FArrayBox & shiftWRight = ( FArrayBox & ) a_WRight ; FArrayBox Wgdnv ( a_box , numPrim ) ; shiftWLeft . shiftHalf ( a_dir , 1 ) ; shiftWRight . shiftHalf ( a_dir , -1 ) ; CH_assert ( shiftWLeft . box ( ) . contains ( a_box ) ) ; CH_assert ( shiftWRight . box ( ) . contains ( a_box ) ) ; FArrayBox & advVelDir = advVel [ a_dir ] ; CH_assert ( advVelDir . box ( ) . contains ( a_box ) ) ; FORT_RIEMANNF ( CHF_FRA ( Wgdnv ) , CHF_CONST_FRA ( shiftWLeft ) , CHF_CONST_FRA ( shiftWRight ) , CHF_CONST_FRA1 ( advVelDir , 0 ) , CHF_CONST_INT ( a_dir ) , CHF_BOX ( a_box ) ) ; shiftWLeft . shiftHalf ( a_dir , -1 ) ; shiftWRight . shiftHalf ( a_dir , 1 ) ; a_F . copy ( Wgdnv ) ; }
Compute a Riemann problem and generate fluxes at the faces
Compute a Riemann problem and generate fluxes at the faces
//CH_assert(advVel.box().contains(a_box)); // Get the numbers of relevant variables // Cast away "const" inputs so their boxes can be shifted left or right // 1/2 cell and then back again (no net change is made!) // Solution to the Riemann problem // Shift the left and right primitive variable boxes 1/2 cell so they are // face centered // Riemann solver computes Wgdnv all edges that are not on the physical // boundary. // Shift the left and right primitive variable boxes back to their original // position