Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

PatchGodunov Class Reference

#include <PatchGodunov.H>

Inheritance diagram for PatchGodunov:

Inheritance graph
[legend]
Collaboration diagram for PatchGodunov:

Collaboration graph
[legend]
List of all members.

Detailed Description

The base class PatchGodunov provides an implementation of a second-order, unsplit Godunov method acting on a single grid/patch. PatchGodunov provides an interface to the level integrator, LevelGodunov, which manages the entire level and flux corrections (via flux registers) to the coarser and finer levels. In addition, the physics dependent code is not provided in PatchGodunov but is supplied by the user by subclassing PatchGodunov and implementing the pure virtual functions. Some parameters can also be adjusted to modify the algorithm. All functions are virtual so any of them can be reimplemented by the user.

There are three types of grid variables that appear in the unsplit Godunov method: conserved variables, primitive variables, and fluxes, denoted below by U, W, F, respectively. It is often convenient to have the number of primitive variables and fluxes exceed the number of conserved variables. In the case of primitive variables, redundant quantities are carried that parameterize the equation of state in order to avoid multiple calls to that the equation of state function. In the case of fluxes, it is often convenient to split the flux for some variables into multiple components, e.g., dividing the momentum flux into advective and pressure terms. The API given here provides the flexibility to support these various possibilities.


Public Member Functions

 PatchGodunov ()
 Constructor.

virtual ~PatchGodunov ()
 Destructor.

virtual void define (const ProblemDomain &a_domain, const Real &a_dx)
 Define the object.

virtual void setPhysIBC (PhysIBC *a_bc)
 Set the initial and boundary condition object.

virtual PhysIBCgetPhysIBC () const
 Get the initial and boundary condition object.

virtual void setSlopeParameters (bool a_fourthOrderSlopes, bool a_flattening, bool a_limitSlopes=true)
 Set parameters for slope computations.

virtual bool useFourthOrderSlopes ()
 Fourth-order slope query.

virtual bool useFlattening ()
 Slope flattening query.

virtual bool limitSlopes ()
 Slope limiter query.

virtual void setArtificialViscosity (bool a_useArtificialViscosity, Real a_artificialViscosity)
 Set parameters for artificial viscosity.

virtual bool useArtificialViscosity ()
 Artificial viscosity query.

virtual Real artificialViscosityCoefficient ()
 Artificial viscosity coefficient.

virtual PatchGodunovnew_patchGodunov () const=0
 Factory method - this object is its own factory.

virtual void setCurrentTime (const Real &a_currentTime)
 Set the current time before calling updateState().

virtual void setCurrentBox (const Box &a_currentBox)
 Set the current box before calling updateState().

virtual void updateState (FArrayBox &a_U, FArrayBox a_F[CH_SPACEDIM], Real &a_maxWaveSpeed, const FArrayBox &a_S, const Real &a_dt, const Box &a_box)
 Update the conserved variables and return the final fluxes used for this.

virtual void computeFluxes (FArrayBox &a_U, FArrayBox a_F[CH_SPACEDIM], const FArrayBox &a_S, const Real &a_dt, const Box &a_box)
 Compute the fluxes which will be used for the update.

virtual Real getMaxWaveSpeed (const FArrayBox &a_U, const Box &a_box)=0
 Compute the maximum wave speed.

virtual int numConserved ()=0
 Number of conserved variables.

virtual Vector< string > stateNames ()
 Names of the conserved variables.

virtual int numFluxes ()=0
 Number of flux variables.


Protected Member Functions

virtual bool isDefined () const
 Is the object completely defined.

virtual int numPrimitives ()=0
 Number of primitive variables.

virtual int numSlopes ()=0
 Number of primitive variables for which slopes are computed.

virtual void consToPrim (FArrayBox &a_W, const FArrayBox &a_U, const Box &a_box)=0
 Compute the primitive variables from the conserved variables within a_box.

virtual void computeFlattening (FArrayBox &a_flattening, const FArrayBox &a_W, const Box &a_box)
 Compute the slope flattening coefficients.

virtual void slope (FArrayBox &a_dW, const FArrayBox &a_W, const FArrayBox &a_flattening, const int &a_dir, const Box &a_box)
 Compute the 2nd or 4th order slopes of the primitive variables.

virtual void normalPred (FArrayBox &a_WMinus, FArrayBox &a_WPlus, const FArrayBox &a_W, const FArrayBox &a_dW, const Real &a_scale, const int &a_dir, const Box &a_box)=0
 Extrapolate the primitive variables to the cell faces.

virtual void incrementWithSource (FArrayBox &a_W, const FArrayBox &a_S, const Real &a_scale, const Box &a_box)
 Increment the primitive variables by a source term.

virtual void riemann (FArrayBox &a_F, const FArrayBox &a_WLeft, const FArrayBox &a_WRight, const int &a_dir, const Box &a_box)=0
 Compute a Riemann problem and generate fluxes at the faces.

virtual void updatePrim (FArrayBox &a_WMinus, FArrayBox &a_WPlus, const FArrayBox &a_F, const Real &a_scale, const int &a_dir, const Box &a_box)=0
 Update the primitive variables using fluxes (of the conserved variables).

virtual void artificialViscosity (FArrayBox &a_F, const FArrayBox &a_U, const FArrayBox &a_divVel, const int &a_dir, const Box &a_box)
 Apply artificial viscosity to the fluxes.

virtual void updateCons (FArrayBox &a_U, const FArrayBox &a_F, const Real &a_scale, const int &a_dir, const Box &a_box)=0
 Update the conserved variable using fluxes and a scaling factor.

virtual void finalUpdate (FArrayBox &a_U, const FArrayBox &a_F, const Real &a_scale, const int &a_dir, const Box &a_box)=0
 Perform final update of conserved variable using fluxes.

virtual void postUpdateCons (FArrayBox &a_U, const FArrayBox &a_Uold, const Real &a_dt, const Real &a_dx, const Box &a_box)
virtual Interval velocityInterval ()=0
 Interval within the primitive variables corresponding to the velocities.

virtual int pressureIndex ()=0
 Component index within the primitive variables of the pressure.

virtual int bulkModulusIndex ()=0
 Component index within the primitive variables of the bulk modulus.

virtual void applyLimiter (FArrayBox &a_dW, const FArrayBox &a_dWLeft, const FArrayBox &a_dWRight, const int &a_dir, const Box &a_box)
 Apply a slope limiter to computed slopes.

virtual void divVel (FArrayBox &a_divVel, const FArrayBox &a_W, const int a_dir, const Box &a_box)
 Compute the face centered divergence of the velocity.


Protected Attributes

bool m_isDefined
ProblemDomain m_domain
Real m_dx
bool m_useFourthOrderSlopes
bool m_useFlattening
bool m_limitSlopes
bool m_isSlopeSet
bool m_useArtificialViscosity
Real m_artificialViscosity
bool m_isArtViscSet
PhysIBCm_bc
bool m_isBCSet
Real m_currentTime
bool m_isCurrentTimeSet
Box m_currentBox
bool m_isCurrentBoxSet

Private Member Functions

void operator= (const PatchGodunov &a_input)
 PatchGodunov (const PatchGodunov &a_input)


Constructor & Destructor Documentation

PatchGodunov::PatchGodunov  ) 
 

Constructor.

virtual PatchGodunov::~PatchGodunov  )  [virtual]
 

Destructor.

PatchGodunov::PatchGodunov const PatchGodunov a_input  )  [inline, private]
 


Member Function Documentation

virtual void PatchGodunov::define const ProblemDomain a_domain,
const Real a_dx
[virtual]
 

Define the object.

virtual void PatchGodunov::setPhysIBC PhysIBC a_bc  )  [virtual]
 

Set the initial and boundary condition object.

virtual PhysIBC* PatchGodunov::getPhysIBC  )  const [virtual]
 

Get the initial and boundary condition object.

virtual void PatchGodunov::setSlopeParameters bool  a_fourthOrderSlopes,
bool  a_flattening,
bool  a_limitSlopes = true
[virtual]
 

Set parameters for slope computations.

virtual bool PatchGodunov::useFourthOrderSlopes  )  [virtual]
 

Fourth-order slope query.

Return true if you are using fourth-order slopes and return false if you are using second-order slopes.

virtual bool PatchGodunov::useFlattening  )  [virtual]
 

Slope flattening query.

Return true if the application is using slope flattening.

virtual bool PatchGodunov::limitSlopes  )  [virtual]
 

Slope limiter query.

Return true if the application is using slope limiting

virtual void PatchGodunov::setArtificialViscosity bool  a_useArtificialViscosity,
Real  a_artificialViscosity
[virtual]
 

Set parameters for artificial viscosity.

virtual bool PatchGodunov::useArtificialViscosity  )  [virtual]
 

Artificial viscosity query.

Return true if the application is using artificial viscosity.

virtual Real PatchGodunov::artificialViscosityCoefficient  )  [virtual]
 

Artificial viscosity coefficient.

virtual PatchGodunov* PatchGodunov::new_patchGodunov  )  const [pure virtual]
 

Factory method - this object is its own factory.

Return a pointer to new PatchGodunov object with its initial and boundary condtions, slope parameters, and artificial viscosity information defined.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::setCurrentTime const Real a_currentTime  )  [virtual]
 

Set the current time before calling updateState().

virtual void PatchGodunov::setCurrentBox const Box a_currentBox  )  [virtual]
 

Set the current box before calling updateState().

virtual void PatchGodunov::updateState FArrayBox a_U,
FArrayBox  a_F[CH_SPACEDIM],
Real a_maxWaveSpeed,
const FArrayBox a_S,
const Real a_dt,
const Box a_box
[virtual]
 

Update the conserved variables and return the final fluxes used for this.

Update the conserved variables and return the final fluxes that were used for this. Defines the container for the fluxes (a_F) and calls computeFluxes to compute fluxes for the update. If there are no source terms then a_S should be null constructed. Also return the maximum wave speed.

virtual void PatchGodunov::computeFluxes FArrayBox a_U,
FArrayBox  a_F[CH_SPACEDIM],
const FArrayBox a_S,
const Real a_dt,
const Box a_box
[virtual]
 

Compute the fluxes which will be used for the update.

Compute the fluxes using a second-order, unsplit Godunov method based on the input conserved variables, a_U, and source terms, a_S. If there are no source terms then a_S should be null constructed. Assumes a_F has been defined already.

virtual Real PatchGodunov::getMaxWaveSpeed const FArrayBox a_U,
const Box a_box
[pure virtual]
 

Compute the maximum wave speed.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual int PatchGodunov::numConserved  )  [pure virtual]
 

Number of conserved variables.

Return the number of conserved variables.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual Vector<string> PatchGodunov::stateNames  )  [virtual]
 

Names of the conserved variables.

Return the names of the conserved variables. A default implementation is provided that puts in generic names (i.e., "variable#" which "#" ranges for 0 to numConserved()-1.

Reimplemented in PatchIdealMHD, and PatchPolytropicGas.

virtual int PatchGodunov::numFluxes  )  [pure virtual]
 

Number of flux variables.

Return the number of flux variables. This can be greater than the number of conserved variables if addition fluxes/face-centered quantities are computed.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual bool PatchGodunov::isDefined  )  const [protected, virtual]
 

Is the object completely defined.

Return true if the object is completely defined.

virtual int PatchGodunov::numPrimitives  )  [protected, pure virtual]
 

Number of primitive variables.

Return the number of primitive variables. This may be greater than the number of conserved variables if derived/redundant quantities are also stored for convenience.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual int PatchGodunov::numSlopes  )  [protected, pure virtual]
 

Number of primitive variables for which slopes are computed.

Return the number of primitive variables for which slopes are computed. Only slopes corresponding to primitive variables in the interval 0 to numSlopes() - 1 are computed and only primitive variables in that interval are updated using the slopes.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::consToPrim FArrayBox a_W,
const FArrayBox a_U,
const Box a_box
[protected, pure virtual]
 

Compute the primitive variables from the conserved variables within a_box.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::computeFlattening FArrayBox a_flattening,
const FArrayBox a_W,
const Box a_box
[protected, virtual]
 

Compute the slope flattening coefficients.

Compute the slope flattening coefficients, a_flattening, using the primitive variables, a_W, within a_box.

virtual void PatchGodunov::slope FArrayBox a_dW,
const FArrayBox a_W,
const FArrayBox a_flattening,
const int &  a_dir,
const Box a_box
[protected, virtual]
 

Compute the 2nd or 4th order slopes of the primitive variables.

Compute the limited slope, a_dW, of the primitive variables, a_W, over the range of indices, 0 to numSlopes()-1. This only used a_flattening if 4th order slopes are being computed and slope flattening is turned on. This also calls applyLimiter() to do slope limiting.

virtual void PatchGodunov::normalPred FArrayBox a_WMinus,
FArrayBox a_WPlus,
const FArrayBox a_W,
const FArrayBox a_dW,
const Real a_scale,
const int &  a_dir,
const Box a_box
[protected, pure virtual]
 

Extrapolate the primitive variables to the cell faces.

Extrapolate the primitive variables, a_W, in the minus and plus direction, a_dir, using the slopes a_dW within a_box. See document for details.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::incrementWithSource FArrayBox a_W,
const FArrayBox a_S,
const Real a_scale,
const Box a_box
[protected, virtual]
 

Increment the primitive variables by a source term.

The default implementation does nothing to the primitive variables.

virtual void PatchGodunov::riemann FArrayBox a_F,
const FArrayBox a_WLeft,
const FArrayBox a_WRight,
const int &  a_dir,
const Box a_box
[protected, pure virtual]
 

Compute a Riemann problem and generate fluxes at the faces.

Given input left and right states in a direction, a_dir, compute a Riemann problem and generate fluxes at the faces within a_box.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::updatePrim FArrayBox a_WMinus,
FArrayBox a_WPlus,
const FArrayBox a_F,
const Real a_scale,
const int &  a_dir,
const Box a_box
[protected, pure virtual]
 

Update the primitive variables using fluxes (of the conserved variables).

Given the fluxes, a_F, in a direction, a_dir, and a scaling factor, a_scale, update the primitive variables, a_WMinus and a_WPlus, within a_box. Note: The fluxes are fluxes of conserved variables.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::artificialViscosity FArrayBox a_F,
const FArrayBox a_U,
const FArrayBox a_divVel,
const int &  a_dir,
const Box a_box
[protected, virtual]
 

Apply artificial viscosity to the fluxes.

Return fluxes, a_F, updated using artificial viscosity based on the conserved variables, a_U, and the face centered divergence of the velocity, a_divVel, in a given direction, a_dir, within a_box.

virtual void PatchGodunov::updateCons FArrayBox a_U,
const FArrayBox a_F,
const Real a_scale,
const int &  a_dir,
const Box a_box
[protected, pure virtual]
 

Update the conserved variable using fluxes and a scaling factor.

Given the fluxes, a_F, in a direction, a_dir, and a scaling factor, a_scale, update the conserved variables, a_U, within a_box:

a_U = a_U - a_scale * (a_F(a_dir,HiSide) - a_F(a_dir,LoSide))

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::finalUpdate FArrayBox a_U,
const FArrayBox a_F,
const Real a_scale,
const int &  a_dir,
const Box a_box
[protected, pure virtual]
 

Perform final update of conserved variable using fluxes.

Given the fluxes, a_F, in a direction, a_dir, and a scaling factor, a_scale, update the conserved variables, a_U, within a_box:

a_U = a_U - a_scale * (a_F(a_dir,HiSide) - a_F(a_dir,LoSide))

Implemented in PatchPolytropicGas.

virtual void PatchGodunov::postUpdateCons FArrayBox a_U,
const FArrayBox a_Uold,
const Real a_dt,
const Real a_dx,
const Box a_box
[protected, virtual]
 

virtual Interval PatchGodunov::velocityInterval  )  [protected, pure virtual]
 

Interval within the primitive variables corresponding to the velocities.

Return the interval of component indices within the primitive variable of the velocities. Used for slope flattening (slope computation) and computing the divergence of the velocity (artificial viscosity).

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual int PatchGodunov::pressureIndex  )  [protected, pure virtual]
 

Component index within the primitive variables of the pressure.

Return the component index withn the primitive variables for the pressure. Used for slope flattening (slope computation).

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual int PatchGodunov::bulkModulusIndex  )  [protected, pure virtual]
 

Component index within the primitive variables of the bulk modulus.

Return the component index withn the primitive variables for the bulk modulus. Used for slope flattening (slope computation) used as a normalization to measure shock strength.

Implemented in PatchIdealMHD, and PatchPolytropicGas.

virtual void PatchGodunov::applyLimiter FArrayBox a_dW,
const FArrayBox a_dWLeft,
const FArrayBox a_dWRight,
const int &  a_dir,
const Box a_box
[protected, virtual]
 

Apply a slope limiter to computed slopes.

Given the center difference, a_dW, and the left and right differences, a_dWLeft and a_dWRight, in direction, a_dir, apply a slope limiter within a_box to generate final slopes, a_dW. This is called by slope().

A default implementation is provided which implements a van Leer limiter, see the documentation for details.

virtual void PatchGodunov::divVel FArrayBox a_divVel,
const FArrayBox a_W,
const int  a_dir,
const Box a_box
[protected, virtual]
 

Compute the face centered divergence of the velocity.

Compute the face centered divergence of the velocity, a_divVel, from the primitive variables, a_W, in a direction, a_dir, within a_box.

void PatchGodunov::operator= const PatchGodunov a_input  )  [inline, private]
 


Member Data Documentation

bool PatchGodunov::m_isDefined [protected]
 

ProblemDomain PatchGodunov::m_domain [protected]
 

Real PatchGodunov::m_dx [protected]
 

bool PatchGodunov::m_useFourthOrderSlopes [protected]
 

bool PatchGodunov::m_useFlattening [protected]
 

bool PatchGodunov::m_limitSlopes [protected]
 

bool PatchGodunov::m_isSlopeSet [protected]
 

bool PatchGodunov::m_useArtificialViscosity [protected]
 

Real PatchGodunov::m_artificialViscosity [protected]
 

bool PatchGodunov::m_isArtViscSet [protected]
 

PhysIBC* PatchGodunov::m_bc [protected]
 

bool PatchGodunov::m_isBCSet [protected]
 

Real PatchGodunov::m_currentTime [protected]
 

bool PatchGodunov::m_isCurrentTimeSet [protected]
 

Box PatchGodunov::m_currentBox [protected]
 

bool PatchGodunov::m_isCurrentBoxSet [protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Jul 2 17:55:59 2004 for Chombo by doxygen 1.3.2