WARPXM v1.10.0
Loading...
Searching...
No Matches
wxm::apps::rmhd::DensityDiffusionFlux Class Reference

Density diffusion flux for the MHD model. More...

#include <density_diffusion_flux.h>

Inheritance diagram for wxm::apps::rmhd::DensityDiffusionFlux:
WmApplication wxm::app_base

Detailed Description

Density diffusion flux for the MHD model.

In Euler or MHD fluid systems, the diffusion of density is driven indirectly through pressure gradients and inter- or intra- species collisional processes (viscosity, resisitivity, etc.).

In some cases, enhanced density diffusion may be desirable for stability purposes or to approximate processes not captured by the model.

Density diffusion flux

The density diffusion flux in conservative form

\[ \frac{\partial \rho_p}{\partial t} = - \nabla \cdot (-D \nabla \rho_p ) \]

where \(D\) is the diffusion coefficient (see options for the calculation of \(D\) below), and the flux vector in cartesian cooridnates

\[ \overline{\overline{\mathcal{F}}} = \begin{bmatrix} - D \frac{\partial \rho_p}{\partial x} & - D \frac{\partial \rho_p}{\partial y} & - D \frac{\partial \rho_p}{\partial z} \\ 0 & 0 & 0 \\ \vdots & \vdots & \vdots \end{bmatrix} \]

Diffusion coefficient options

The diffusion coefficient can have the following forms:

  1. _ddiff_type == "basic". Constant density diffusion coefficient

    \[ D_{basic} = \text{_ddiff}. \]

  2. _ddiff_type == "nimrod". A NIMROD-style density diffusion, where diffusion is a funciton of the density gradient

    \[ D_{nim} = \min(\text{_ddiff} \cdot dx^2 \; |v \cdot \nabla n / n|, \; \text{_ddiff_limit}) \]

The suggested maximum time step is given by

\[ \Delta t_{\max} = CFL_{diff} \frac{\Delta x_{eff}^2}{D} \]

where

\[ \Delta x_{eff} = CFL \Delta x. \]

Cylindrical coordinates

In the case of density diffusion in cylindrical coordinates, cylindrical source terms are necessary. This app must be used in conjuction with density_diffusion_cyl_source.

See also
Warpy constructor: warpy.apps.mhd.rmhd.rmhd.density_diffusion_flux_mhd

Public Types

enum  GradientMethod { LDG }
 Available gradient methods. More...
 
enum  DDiffType { BASIC , NIMROD }
 Available density diffusion types. More...
 
- Public Types inherited from WmApplication
typedef Application_Variable WmApplication_Variable
 
typedef std::map< std::string, std::string > replaceMap_t
 

Public Member Functions

 DensityDiffusionFlux ()
 
 ~DensityDiffusionFlux () override
 
void setup (const WxCryptSet &wxc) override
 Setup.
 
const std::vector< int > & getInputVariableIndexes (int flag) const override
 Grab input variable indices.
 
const std::vector< int > & getAuxiliaryVariableIndexes (int flag) const override
 Grab auxiliary variable indices.
 
const std::vector< int > & getOutputVariableIndexes (int flag) const override
 Grab output variable indices.
 
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 override
 Redefinition of the numerical flux function.
 
real internal_flux (const real *q, const real *aux, const solverVariables_t *pSV, std::vector< std::vector< real > > &internalFlux) const override
 Redefinition of the interal flux function.
 
real numerical_flux_ldg (const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
 The numerical flux function using the LDG gradient method.
 
- 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

GradientMethod _gradient_method
 Gradient method chosen for app.
 
DDiffType _ddiff_type
 Density diffusion type.
 
std::vector< int > _input_variables
 Vector of MHD fluid variable indices.
 
std::vector< int > _aux_variables
 Vector of MHD fluid gradient variable indices.
 
real _ddiff
 Density diffusion coefficient.
 
real _ddiff_limit
 Density diffusion coefficient limit for Nimrod method.
 
real _cfl_diff
 Diffusion CFL.
 
std::vector< std::vector< real > > _flux_tensor
 Flux tensor is used to calculate left and right fluxes for numerical flux mutable because this will continuously be changed upon call, but functions are labled const.
 
- Protected Attributes inherited from WmApplication
std::string _app_name
 
WxLogStream _debStrm
 
std::vector< int > _allowedFlags
 
std::vector< std::string > _onBoundaries
 

Additional Inherited Members

- 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
 

Member Enumeration Documentation

◆ DDiffType

Available density diffusion types.

Enumerator
BASIC 
NIMROD 

◆ GradientMethod

Available gradient methods.

Enumerator
LDG 

Constructor & Destructor Documentation

◆ DensityDiffusionFlux()

wxm::apps::rmhd::DensityDiffusionFlux::DensityDiffusionFlux ( )

◆ ~DensityDiffusionFlux()

wxm::apps::rmhd::DensityDiffusionFlux::~DensityDiffusionFlux ( )
override

Member Function Documentation

◆ getAuxiliaryVariableIndexes()

const std::vector< int > & wxm::apps::rmhd::DensityDiffusionFlux::getAuxiliaryVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab auxiliary variable indices.

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

Reimplemented from WmApplication.

◆ getInputVariableIndexes()

const std::vector< int > & wxm::apps::rmhd::DensityDiffusionFlux::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::rmhd::DensityDiffusionFlux::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.

◆ internal_flux()

real wxm::apps::rmhd::DensityDiffusionFlux::internal_flux ( const real q,
const real aux,
const solverVariables_t pSV,
std::vector< std::vector< real > > &  internalFlux 
) const
overridevirtual

Redefinition of the interal flux function.

Parameters
constq - input variable
constaux - auxiliary variable
constpSV - solver variable structure
constinternalFlux - 2D vector of internal fluxes
result- suggested dt

Reimplemented from WmApplication.

◆ numerical_flux()

real wxm::apps::rmhd::DensityDiffusionFlux::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
overridevirtual

Redefinition of the numerical flux function.

Parameters
constq_l - input variable, left
constq_r - input variable, right
constaux_l - auxiliary variable, left
constaux_r - auxiliary variable, right
constpFV - solver variable structure
constnumericalFlux - numerical fluxes
result- suggested dt

Reimplemented from WmApplication.

◆ numerical_flux_ldg()

real wxm::apps::rmhd::DensityDiffusionFlux::numerical_flux_ldg ( const real q_l,
const real q_r,
const real aux_l,
const real aux_r,
const solverVariables_t pFV,
real numericalFlux 
) const

The numerical flux function using the LDG gradient method.

Parameters
constq_l - input variable, left
constq_r - input variable, right
constaux_l - auxiliary variable, left
constaux_r - auxiliary variable, right
constpFV - solver variable structure
constnumericalFlux - 2D vector of numerical fluxes
result- suggested dt

◆ setup()

void wxm::apps::rmhd::DensityDiffusionFlux::setup ( const WxCryptSet wxc)
overridevirtual

Setup.

Parameters
WxCryptSetobject

Reimplemented from WmApplication.

Member Data Documentation

◆ _aux_variables

std::vector<int> wxm::apps::rmhd::DensityDiffusionFlux::_aux_variables
protected

Vector of MHD fluid gradient variable indices.

Len 24.

◆ _cfl_diff

real wxm::apps::rmhd::DensityDiffusionFlux::_cfl_diff
protected

Diffusion CFL.

◆ _ddiff

real wxm::apps::rmhd::DensityDiffusionFlux::_ddiff
protected

Density diffusion coefficient.

◆ _ddiff_limit

real wxm::apps::rmhd::DensityDiffusionFlux::_ddiff_limit
protected

Density diffusion coefficient limit for Nimrod method.

◆ _ddiff_type

DDiffType wxm::apps::rmhd::DensityDiffusionFlux::_ddiff_type
protected

Density diffusion type.

See class description.

◆ _flux_tensor

std::vector<std::vector<real> > wxm::apps::rmhd::DensityDiffusionFlux::_flux_tensor
mutableprotected

Flux tensor is used to calculate left and right fluxes for numerical flux mutable because this will continuously be changed upon call, but functions are labled const.

◆ _gradient_method

GradientMethod wxm::apps::rmhd::DensityDiffusionFlux::_gradient_method
protected

Gradient method chosen for app.

◆ _input_variables

std::vector<int> wxm::apps::rmhd::DensityDiffusionFlux::_input_variables
protected

Vector of MHD fluid variable indices.

Len 8.


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