WARPXM v1.10.0
Loading...
Searching...
No Matches
wxm::apps::functions::mhd::SetFloors Class Reference

Class to set density and pressure floors for MHD fluid. More...

#include <set_floors.h>

Inheritance diagram for wxm::apps::functions::mhd::SetFloors:
WmApplication wxm::app_base

Detailed Description

Class to set density and pressure floors for MHD fluid.

!!WARNING: Does not conserve density or energy.!!

Density and pressure floors are a brute-force method of enforcing positivity in regions where numerical oscillations, or where the kinetic or magnetic energy is large compared to the thermal energy, resulting in density or pressures going negative.

In the methods implemented here, when the density or pressure at a node is found to be below a threshold value ( \(\rho_{min}\) or \(P_{min}\)) the value is replaced. The replacement value is calculated one of two ways:

  1. _eliminate_ke == false (Default). When density or pressure fall below threshold values density and energy are recalculated using \(\rho_{min}\) and \(P_{min}\)

    \begin{align*} \rho_{out} &= \max (\rho_{min}, \rho_{in}) \\ \boldsymbol{p}_{out} &= \boldsymbol{p}_{in}, \\ e_{out} &= \frac{1}{\gamma-1} \max (P_{min}, P_{in}) + \frac{1}{2} \max \left( \rho_{min}, \rho_{in} \right)^{-1} \left(p_x^2 + p_y^2 + p_z^2 \right)_{in}. \end{align*}

  2. _eliminate_ke == true. When density falls below \(\rho_{min}\), the momentum is set to zero and kinetic energy is subtracted from total energy

    \begin{align*} \rho_{out} &= \rho_{min}, \\ \boldsymbol{p}_{out} &= 0, \\ e_{out} &= \frac{1}{\gamma - 1} P_{min}. \end{align*}

    In cases where \(\rho > \rho_{min}\)

    \begin{align*} \rho_{out} &= \rho_{in}, \\ \boldsymbol{p}_{out} &= \boldsymbol{p}_{in}, \\ e_{out} &= \frac{1}{\gamma-1} \max (P_{min}, P_{in}) + \frac{1}{2 \rho_{in}} \left(p_x^2 + p_y^2 + p_z^2 \right)_{in}. \end{align*}

Public Member Functions

 SetFloors ()
 Constructor.
 
 ~SetFloors () override
 Destructor.
 
void setup (const WxCryptSet &wxc) override
 Setup.
 
const std::vector< int > & getInputVariableIndexes (int flag) const override
 Grab input variable indices.
 
const std::vector< int > & getOutputVariableIndexes (int flag) const override
 Grab output variable indices.
 
void evaluate_function (const real *q, const real *aux, const solverVariables_t *pSV, real *result) const override
 Redefinition of the function evaluator.
 
- Public Member Functions inherited from WmApplication
 WmApplication ()
 
virtual ~WmApplication ()=default
 
virtual void setup (const WxCryptSet &wxc)
 
virtual const std::vector< int > & getAuxiliaryVariableIndexes (int flag=WMAPPLICATIONFLAG_NONE) const
 
virtual const std::vector< int > & getCrossVariableIndexes (int flag=WMAPPLICATIONFLAG_NONE) const
 
const std::vector< std::string > & getBoundaryNames () const
 
bool isOnBoundary (const std::string &boundaryName) const
 
bool has (int flag) const
 
virtual real numerical_flux (const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
 
virtual real internal_flux (const real *q, const real *aux, const solverVariables_t *pSV, std::vector< std::vector< real > > &internalFlux) const
 
virtual real source (const real *q, const real *aux, const elementGeometry_t *pEG, real *source) const
 
virtual void bc_q (const real *q_in, const real *aux_in, const real *aux_out, const solverVariables_t *pFV, real *q_out) const
 Boundary Condition Application which sets the boundary condition on ghost nodes.
 
virtual real bcNumericalFlux (const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
 
virtual void conserved_to_primitive (const real *q, const real *aux, real *w) const
 
virtual void primitive_to_conserved (const real *w, const real *aux, real *q) const
 
virtual void evaluate_function (const real *q, const real *aux, const solverVariables_t *pSV, real *result) const
 
virtual void bc_q_kinetic (const real *q_in, const real *aux_in, const solverVariables_t *pFV, real *q_out) const
 
std::shared_ptr< std::string > app_name ()
 
virtual const std::vector< int > & getInputVariableIndexes (int flag=0) const
 
virtual const std::vector< int > & getOutputVariableIndexes (int flag=0) const
 

Protected Attributes

std::vector< int > _fluid
 Vector of MHD fluid variable indices.
 
real _gas_gamma
 Ratio of specific heats.
 
real _rho_min
 Mass density floor.
 
real _p_min
 Pressure floor.
 
bool _eliminate_ke
 Floor method toggle.
 
- Protected Attributes inherited from WmApplication
std::string _app_name
 
WxLogStream _debStrm
 
std::vector< int > _allowedFlags
 
std::vector< std::string > _onBoundaries
 

Additional Inherited Members

- Public Types inherited from WmApplication
typedef Application_Variable WmApplication_Variable
 
typedef std::map< std::string, std::string > replaceMap_t
 
- Static Public Attributes inherited from wxm::app_base
static std::vector< int > empty
 
- Protected Member Functions inherited from wxm::app_base
virtual ~app_base ()=default
 

Constructor & Destructor Documentation

◆ SetFloors()

wxm::apps::functions::mhd::SetFloors::SetFloors ( )

Constructor.

◆ ~SetFloors()

wxm::apps::functions::mhd::SetFloors::~SetFloors ( )
override

Destructor.

Member Function Documentation

◆ evaluate_function()

void wxm::apps::functions::mhd::SetFloors::evaluate_function ( const real q,
const real aux,
const solverVariables_t pSV,
real result 
) const
overridevirtual

Redefinition of the function evaluator.

Parameters
constq - input variable
constaux - auxiliary variable
constpSV - solver variable structure
result- output variable

Reimplemented from WmApplication.

◆ getInputVariableIndexes()

const std::vector< int > & wxm::apps::functions::mhd::SetFloors::getInputVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab input variable indices.

Parameters
intflag - usually flag is given like flux type but usually not checked
Returns
vector of input variable indices

Reimplemented from wxm::app_base.

◆ getOutputVariableIndexes()

const std::vector< int > & wxm::apps::functions::mhd::SetFloors::getOutputVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab output variable indices.

Parameters
intflag - usually flag is given like flux type but usually not checked
Returns
vector of output variable indices

Reimplemented from wxm::app_base.

◆ setup()

void wxm::apps::functions::mhd::SetFloors::setup ( const WxCryptSet wxc)
overridevirtual

Setup.

Parameters
WxCryptSetobject

Reimplemented from WmApplication.

Member Data Documentation

◆ _eliminate_ke

bool wxm::apps::functions::mhd::SetFloors::_eliminate_ke
protected

Floor method toggle.

See detailed notes. Default False.

◆ _fluid

std::vector<int> wxm::apps::functions::mhd::SetFloors::_fluid
protected

Vector of MHD fluid variable indices.

Len 8.

◆ _gas_gamma

real wxm::apps::functions::mhd::SetFloors::_gas_gamma
protected

Ratio of specific heats.

◆ _p_min

real wxm::apps::functions::mhd::SetFloors::_p_min
protected

Pressure floor.

◆ _rho_min

real wxm::apps::functions::mhd::SetFloors::_rho_min
protected

Mass density floor.


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