releasedExamples/AMRGodunov/srcPolytropic/PolytropicPhysics.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 PolytropicPhysics::riemann(FArrayBox&       a_WGdnv,
                                const FArrayBox& a_WLeft,
                                const FArrayBox& a_WRight,
                                const FArrayBox& a_W,
                                const Real&      a_time,
                                const int&       a_dir,
                                const Box&       a_box)
{
  CH_assert(isDefined());
  CH_assert(a_WGdnv.box().contains(a_box));
  int numPrim = numPrimitives();
  CH_assert(a_WGdnv .nComp() == numPrim);
  CH_assert(a_WLeft .nComp() == numPrim);
  CH_assert(a_WRight.nComp() == numPrim);
  FArrayBox& shiftWLeft  = (FArrayBox&)a_WLeft;
  FArrayBox& shiftWRight = (FArrayBox&)a_WRight;
  shiftWLeft .shiftHalf(a_dir, 1);
  shiftWRight.shiftHalf(a_dir,-1);
  CH_assert(shiftWLeft .box().contains(a_box));
  CH_assert(shiftWRight.box().contains(a_box));
  FORT_RIEMANNF(CHF_FRA(a_WGdnv),
                CHF_CONST_FRA(shiftWLeft),
                CHF_CONST_FRA(shiftWRight),
                CHF_CONST_INT(a_dir),
                CHF_BOX(a_box));
  m_bc->primBC(a_WGdnv,shiftWLeft ,a_W,a_dir,Side::Hi,a_time);
  m_bc->primBC(a_WGdnv,shiftWRight,a_W,a_dir,Side::Lo,a_time);
  shiftWLeft .shiftHalf(a_dir,-1);
  shiftWRight.shiftHalf(a_dir, 1);
}
void PolytropicPhysics :: riemann ( FArrayBox & a_WGdnv , const FArrayBox & a_WLeft , const FArrayBox & a_WRight , const FArrayBox & a_W , const Real & a_time , const int & a_dir , const Box & a_box ) { CH_assert ( isDefined ( ) ) ; CH_assert ( a_WGdnv . box ( ) . contains ( a_box ) ) ; int numPrim = numPrimitives ( ) ; CH_assert ( a_WGdnv . nComp ( ) == numPrim ) ; CH_assert ( a_WLeft . nComp ( ) == numPrim ) ; CH_assert ( a_WRight . nComp ( ) == numPrim ) ; FArrayBox & shiftWLeft = ( FArrayBox & ) a_WLeft ; FArrayBox & shiftWRight = ( FArrayBox & ) a_WRight ; shiftWLeft . shiftHalf ( a_dir , 1 ) ; shiftWRight . shiftHalf ( a_dir , -1 ) ; CH_assert ( shiftWLeft . box ( ) . contains ( a_box ) ) ; CH_assert ( shiftWRight . box ( ) . contains ( a_box ) ) ; FORT_RIEMANNF ( CHF_FRA ( a_WGdnv ) , CHF_CONST_FRA ( shiftWLeft ) , CHF_CONST_FRA ( shiftWRight ) , CHF_CONST_INT ( a_dir ) , CHF_BOX ( a_box ) ) ; m_bc -> primBC ( a_WGdnv , shiftWLeft , a_W , a_dir , Side :: Hi , a_time ) ; m_bc -> primBC ( a_WGdnv , shiftWRight , a_W , a_dir , Side :: Lo , a_time ) ; shiftWLeft . shiftHalf ( a_dir , -1 ) ; shiftWRight . shiftHalf ( a_dir , 1 ) ; }
Compute a Riemann problem and generate fluxes at the faces.
Compute a Riemann problem and generate fluxes at the faces .
// 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. // Call boundary Riemann solver (note: periodic BC's are handled there). // Shift the left and right primitive variable boxes back to their original // position.