Chombo + EB  3.0
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
GodunovPhysics Class Referenceabstract

#include <GodunovPhysics.H>

Inheritance diagram for GodunovPhysics:
Inheritance graph
[legend]

Public Member Functions

 GodunovPhysics ()
 Constructor. More...
 
PhysIBCgetPhysIBC () const
 Get the initial and boundary condition object. More...
 
void setPhysIBC (PhysIBC *a_bc)
 Set the initial and boundary condition object. More...
 
virtual ~GodunovPhysics ()
 Destructor. More...
 
virtual void define (const ProblemDomain &a_domain, const Real &a_dx)
 Define the object. More...
 
virtual void setCurrentBox (const Box &a_currentBox)
 Set the current box (default implementation - do nothing) More...
 
virtual Real getMaxWaveSpeed (const FArrayBox &a_U, const Box &a_box)=0
 Compute the maximum wave speed. More...
 
virtual void soundSpeed (FArrayBox &a_speed, const FArrayBox &a_U, const Box &a_box)
 Compute the maximum wave speed. More...
 
virtual GodunovPhysicsnew_godunovPhysics () const =0
 Object factory for this class. More...
 
virtual void computeUpdate (FArrayBox &a_dU, FluxBox &a_F, const FArrayBox &a_U, const FluxBox &a_WHalf, const bool &a_useArtificialViscosity, const Real &a_artificialViscosity, const Real &a_currentTime, const Real &a_dx, const Real &a_dt, const Box &a_box)
 Compute the increment in the conserved variables from face variables. More...
 
virtual void getFlux (FArrayBox &a_flux, const FArrayBox &a_WHalf, const int &a_dir, const Box &a_box)
 Compute the fluxes from primitive variable values on a face. More...
 
virtual void charAnalysis (FArrayBox &a_dW, const FArrayBox &a_W, const int &a_dir, const Box &a_box)=0
 Transform a_dW from primitive to characteristic variables. More...
 
virtual void charSynthesis (FArrayBox &a_dW, const FArrayBox &a_W, const int &a_dir, const Box &a_box)=0
 Transform a_dW from characteristic to primitive variables. More...
 
virtual void charValues (FArrayBox &a_lambda, const FArrayBox &a_W, const int &a_dir, const Box &a_box)=0
 Compute the characteristic values (eigenvalues) More...
 
virtual void incrementSource (FArrayBox &a_S, const FArrayBox &a_W, const Box &a_box)=0
 Add to (increment) the source terms given the current state. More...
 
virtual void riemann (FArrayBox &a_WStar, const FArrayBox &a_WLeft, const FArrayBox &a_WRight, const FArrayBox &a_W, const Real &a_time, const int &a_dir, const Box &a_box)=0
 Compute the solution to the Riemann problem. More...
 
virtual void postNormalPred (FArrayBox &a_dWMinus, FArrayBox &a_dWPlus, const FArrayBox &a_W, const Real &a_dt, const Real &a_dx, const int &a_dir, const Box &a_box)=0
 Post-normal predictor calculation. More...
 
virtual void quasilinearUpdate (FArrayBox &a_AdWdx, const FArrayBox &a_wHalf, const FArrayBox &a_W, const Real &a_scale, const int &a_dir, const Box &a_box)=0
 Compute the quasilinear update A*dW/dx. More...
 
virtual void consToPrim (FArrayBox &a_W, const FArrayBox &a_U, const Box &a_box)=0
 Compute primitive variables from conserved variables. More...
 
virtual void artVisc (FArrayBox &a_F, const FArrayBox &a_U, const Real &a_artificialViscosity, const Real &a_currentTime, const int &a_dir, const Box &a_box)
 Compute the artificial viscosity contribution to the flux. More...
 
virtual void expressions (HDF5HeaderData &a_holder) const
 
Access functions
virtual int numConserved ()=0
 Number of conserved variables. More...
 
virtual Vector< string > stateNames ()=0
 Names of the conserved variables. More...
 
virtual bool fourthOrderArtificialViscosityIsDefined () const
 Returns true if 4th-order artificial viscosity is defined. More...
 
virtual void setFourthOrderArtificialViscosityParameter (const Real &M0sq)
 Defines fourth-order artifical viscosity strong shock threshold. More...
 
virtual Real getFourthOrderArtificialViscosityParameter () const
 Returns fourth-order artifical viscosity strong shock threshold. More...
 
virtual int numFluxes ()=0
 Number of flux variables. More...
 
virtual bool isDefined () const
 Is the object completely defined. More...
 
virtual int numPrimitives ()=0
 Number of primitive variables. More...
 
virtual Interval velocityInterval ()=0
 Interval within the primitive variables corresponding to the velocities. More...
 
virtual int pressureIndex ()=0
 Component index within the primitive variables of the pressure. More...
 
virtual Real smallPressure ()=0
 Used to limit the absolute value of a "pressure" difference. More...
 
virtual int bulkModulusIndex ()=0
 Component index within the primitive variables of the bulk modulus. More...
 
virtual int densityIndex ()
 Component index within the primitive variables of the density. More...
 

Protected Attributes

bool m_isDefined
 
ProblemDomain m_domain
 
Real m_dx
 
GodunovUtilities m_util
 
bool m_useFourthOrderArtificialViscosity
 
Real m_M0sq
 
PhysIBCm_bc
 
bool m_isBCSet
 

Private Member Functions

void operator= (const GodunovPhysics &)
 
 GodunovPhysics (const GodunovPhysics &)
 

Detailed Description

The base class GodunovPhysics provides the physics-dependent components for a higher-order Godunov method for a single patch: characteristic analysis, Riemann solver, quasilinear update, conservative update, and transformations between conserved, primitive, and flux variables. This class is essentially pure virtual; i.e., all of its member functions are virtual; and the ones that have default implementations are ones that are optionally defined; i.e., the default definition is to send an error message. Physics-dependent versions of this class that are required in real applications are derived from this class by inheritance.

Constructor & Destructor Documentation

◆ GodunovPhysics() [1/2]

GodunovPhysics::GodunovPhysics ( )

Constructor.

◆ ~GodunovPhysics()

virtual GodunovPhysics::~GodunovPhysics ( )
virtual

Destructor.

◆ GodunovPhysics() [2/2]

GodunovPhysics::GodunovPhysics ( const GodunovPhysics )
private

Member Function Documentation

◆ getPhysIBC()

PhysIBC* GodunovPhysics::getPhysIBC ( ) const

Get the initial and boundary condition object.

◆ setPhysIBC()

void GodunovPhysics::setPhysIBC ( PhysIBC a_bc)

Set the initial and boundary condition object.

◆ define()

virtual void GodunovPhysics::define ( const ProblemDomain a_domain,
const Real a_dx 
)
virtual

Define the object.

◆ setCurrentBox()

virtual void GodunovPhysics::setCurrentBox ( const Box a_currentBox)
virtual

Set the current box (default implementation - do nothing)

◆ getMaxWaveSpeed()

virtual Real GodunovPhysics::getMaxWaveSpeed ( const FArrayBox a_U,
const Box a_box 
)
pure virtual

Compute the maximum wave speed.

Implemented in AdvectPhysics.

◆ soundSpeed()

virtual void GodunovPhysics::soundSpeed ( FArrayBox a_speed,
const FArrayBox a_U,
const Box a_box 
)
virtual

Compute the maximum wave speed.

◆ new_godunovPhysics()

virtual GodunovPhysics* GodunovPhysics::new_godunovPhysics ( ) const
pure virtual

Object factory for this class.

Implemented in AdvectPhysics.

◆ computeUpdate()

virtual void GodunovPhysics::computeUpdate ( FArrayBox a_dU,
FluxBox a_F,
const FArrayBox a_U,
const FluxBox a_WHalf,
const bool &  a_useArtificialViscosity,
const Real a_artificialViscosity,
const Real a_currentTime,
const Real a_dx,
const Real a_dt,
const Box a_box 
)
virtual

Compute the increment in the conserved variables from face variables.

Compute dU = dt*dUdt, the change in the conserved variables over the time step. The fluxes are returned are suitable for use in refluxing. This has a default implementation but can be redefined as needed.

◆ getFlux()

virtual void GodunovPhysics::getFlux ( FArrayBox a_flux,
const FArrayBox a_WHalf,
const int &  a_dir,
const Box a_box 
)
virtual

Compute the fluxes from primitive variable values on a face.

This has a default implementation which throws an error. The method is here so that the default implementation of "computeUpdate" can use it and the user can supply it. It has an implementation so if the user redefines "computeUpdate" they aren't force to implement "getFlux" - which is only used by the default implementation of "computeUpdate".

Reimplemented in AdvectPhysics.

◆ charAnalysis()

virtual void GodunovPhysics::charAnalysis ( FArrayBox a_dW,
const FArrayBox a_W,
const int &  a_dir,
const Box a_box 
)
pure virtual

Transform a_dW from primitive to characteristic variables.

On input, a_dW contains the increments of the primitive variables. On output, it contains the increments in the characteristic variables.

IMPORTANT NOTE: It is assumed that the characteristic analysis puts the smallest eigenvalue first, the largest eigenvalue last, and orders the characteristic variables accordingly.

Implemented in AdvectPhysics.

◆ charSynthesis()

virtual void GodunovPhysics::charSynthesis ( FArrayBox a_dW,
const FArrayBox a_W,
const int &  a_dir,
const Box a_box 
)
pure virtual

Transform a_dW from characteristic to primitive variables.

On input, a_dW contains the increments of the characteristic variables. On output, it contains the increments in the primitive variables.

IMPORTANT NOTE: It is assumed that the characteristic analysis puts the smallest eigenvalue first, the largest eigenvalue last, and orders the characteristic variables accordingly.

Implemented in AdvectPhysics.

◆ charValues()

virtual void GodunovPhysics::charValues ( FArrayBox a_lambda,
const FArrayBox a_W,
const int &  a_dir,
const Box a_box 
)
pure virtual

Compute the characteristic values (eigenvalues)

Compute the characteristic values (eigenvalues).

IMPORTANT NOTE: It is assumed that the characteristic analysis puts the smallest eigenvalue first, the largest eigenvalue last, and orders the characteristic variables accordingly.

Implemented in AdvectPhysics.

◆ incrementSource()

virtual void GodunovPhysics::incrementSource ( FArrayBox a_S,
const FArrayBox a_W,
const Box a_box 
)
pure virtual

Add to (increment) the source terms given the current state.

On input, a_S contains the current source terms. On output, a_S has had any additional source terms (based on the current state, a_W) added to it. This should all be done on the region defined by a_box.

Implemented in AdvectPhysics.

◆ riemann()

virtual void GodunovPhysics::riemann ( FArrayBox a_WStar,
const FArrayBox a_WLeft,
const FArrayBox a_WRight,
const FArrayBox a_W,
const Real a_time,
const int &  a_dir,
const Box a_box 
)
pure virtual

Compute the solution to the Riemann problem.

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

Parameters
a_WStarface-centered solution to Riemann problem
a_WLeftleft state, on cells to left of each face
a_WRightright state, on cells to right of each face
a_Wstate on cells, used to set boundary conditions
a_timecurrent time
a_dirdirection of faces
a_boxface-centered box on which to set a_WStar

Implemented in AdvectPhysics.

◆ postNormalPred()

virtual void GodunovPhysics::postNormalPred ( FArrayBox a_dWMinus,
FArrayBox a_dWPlus,
const FArrayBox a_W,
const Real a_dt,
const Real a_dx,
const int &  a_dir,
const Box a_box 
)
pure virtual

Post-normal predictor calculation.

Add increment to normal predictor, e.g. to account for source terms due to spatially-varying coefficients, to bound primitive variable ranges.

Implemented in AdvectPhysics.

◆ quasilinearUpdate()

virtual void GodunovPhysics::quasilinearUpdate ( FArrayBox a_AdWdx,
const FArrayBox a_wHalf,
const FArrayBox a_W,
const Real a_scale,
const int &  a_dir,
const Box a_box 
)
pure virtual

Compute the quasilinear update A*dW/dx.

Implemented in AdvectPhysics.

◆ consToPrim()

virtual void GodunovPhysics::consToPrim ( FArrayBox a_W,
const FArrayBox a_U,
const Box a_box 
)
pure virtual

Compute primitive variables from conserved variables.

Implemented in AdvectPhysics.

◆ artVisc()

virtual void GodunovPhysics::artVisc ( FArrayBox a_F,
const FArrayBox a_U,
const Real a_artificialViscosity,
const Real a_currentTime,
const int &  a_dir,
const Box a_box 
)
virtual

Compute the artificial viscosity contribution to the flux.

Compute the artificial viscosity contribution to the flux. This has a default implementation but this can be overridded as needed.

◆ expressions()

virtual void GodunovPhysics::expressions ( HDF5HeaderData a_holder) const
inlinevirtual

◆ numConserved()

virtual int GodunovPhysics::numConserved ( )
pure virtual

Number of conserved variables.

Return the number of conserved variables.

Implemented in AdvectPhysics.

Referenced by expressions().

◆ stateNames()

virtual Vector<string> GodunovPhysics::stateNames ( )
pure virtual

Names of the conserved variables.

Return the names of the conserved variables.

Implemented in AdvectPhysics.

Referenced by expressions().

◆ fourthOrderArtificialViscosityIsDefined()

virtual bool GodunovPhysics::fourthOrderArtificialViscosityIsDefined ( ) const
virtual

Returns true if 4th-order artificial viscosity is defined.

Referenced by expressions().

◆ setFourthOrderArtificialViscosityParameter()

virtual void GodunovPhysics::setFourthOrderArtificialViscosityParameter ( const Real M0sq)
virtual

Defines fourth-order artifical viscosity strong shock threshold.

Referenced by expressions().

◆ getFourthOrderArtificialViscosityParameter()

virtual Real GodunovPhysics::getFourthOrderArtificialViscosityParameter ( ) const
virtual

Returns fourth-order artifical viscosity strong shock threshold.

Referenced by expressions().

◆ numFluxes()

virtual int GodunovPhysics::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 AdvectPhysics.

Referenced by expressions().

◆ isDefined()

virtual bool GodunovPhysics::isDefined ( ) const
virtual

Is the object completely defined.

Return true if the object is completely defined.

Reimplemented in AdvectPhysics.

Referenced by expressions().

◆ numPrimitives()

virtual int GodunovPhysics::numPrimitives ( )
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 AdvectPhysics.

Referenced by expressions().

◆ velocityInterval()

virtual Interval GodunovPhysics::velocityInterval ( )
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 AdvectPhysics.

Referenced by expressions().

◆ pressureIndex()

virtual int GodunovPhysics::pressureIndex ( )
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 AdvectPhysics.

Referenced by expressions().

◆ smallPressure()

virtual Real GodunovPhysics::smallPressure ( )
pure virtual

Used to limit the absolute value of a "pressure" difference.

Return a value that is used by slope flattening to limit (away from zero) the absolute value of a slope in the pressureIndex() component (slope computation).

Implemented in AdvectPhysics.

Referenced by expressions().

◆ bulkModulusIndex()

virtual int GodunovPhysics::bulkModulusIndex ( )
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 AdvectPhysics.

Referenced by expressions().

◆ densityIndex()

virtual int GodunovPhysics::densityIndex ( )
virtual

Component index within the primitive variables of the density.

Return the component index within the primitive variables for the density. Used for fourth-order accurate artificial viscosity.

Reimplemented in AdvectPhysics.

Referenced by expressions().

◆ operator=()

void GodunovPhysics::operator= ( const GodunovPhysics )
private

Member Data Documentation

◆ m_isDefined

bool GodunovPhysics::m_isDefined
protected

◆ m_domain

ProblemDomain GodunovPhysics::m_domain
protected

◆ m_dx

Real GodunovPhysics::m_dx
protected

◆ m_util

GodunovUtilities GodunovPhysics::m_util
protected

◆ m_useFourthOrderArtificialViscosity

bool GodunovPhysics::m_useFourthOrderArtificialViscosity
protected

◆ m_M0sq

Real GodunovPhysics::m_M0sq
protected

◆ m_bc

PhysIBC* GodunovPhysics::m_bc
protected

◆ m_isBCSet

bool GodunovPhysics::m_isBCSet
protected

The documentation for this class was generated from the following file: