WARPXM v1.10.0
Loading...
Searching...
No Matches
mhd.h File Reference

Functions related to temperature and pressure used across many MHD apps. More...

Go to the source code of this file.

Detailed Description

Functions related to temperature and pressure used across many MHD apps.

Functions

real get_p (real gas_gamma, real rho, real E, real V2, real B2)
 Calculate pressure from MHD total energy.
 
real get_E (real gas_gamma, real rho, real p, real V2, real B2)
 Calculate MHD total energy density.
 
void calculate_grad_pressure (const real *q, const real *aux, real *grad_pressure, const real gas_gamma, const real rho_min=std::numeric_limits< real >::epsilon())
 
real get_temperature (real p, real rho, real Ai, real Zi)
 
void calculate_grad_T (const real *q, const real *aux, real *grad_T, const real gas_gamma, const real Ai=1.0, const real Zi=1.0, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
 
void ensure_floor_density (const real *q, real num_q, real density_floor, real *mod_q)
 
void ensure_floor_pressure (const real *q, real num_q, real gas_gamma, real pressure_floor, real *mod_q)
 
real getRhoFloored (const real *q, const real rho_min=std::numeric_limits< real >::epsilon())
 Get the floored mass density.
 
real getPressureFloored (const real *q, const real gas_gamma, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
 Get the pressure from MHD variables using floors for pressure and density.
 
real getTemperatureFloored (const real *q, const real gas_gamma, const real Ai=1.0, const real Zi=1.0, const real rho_min=std::numeric_limits< real >::epsilon(), const real press_min=std::numeric_limits< real >::epsilon())
 Get the temperature from MHD variables using floors for pressure and density.
 

Function Documentation

◆ calculate_grad_pressure()

void calculate_grad_pressure ( const real q,
const real aux,
real grad_pressure,
const real  gas_gamma,
const real  rho_min = std::numeric_limits< real >::epsilon() 
)

◆ calculate_grad_T()

void calculate_grad_T ( const real q,
const real aux,
real grad_T,
const real  gas_gamma,
const real  Ai = 1.0,
const real  Zi = 1.0,
const real  rho_min = std::numeric_limits< real >::epsilon(),
const real  press_min = std::numeric_limits< real >::epsilon() 
)

◆ ensure_floor_density()

void ensure_floor_density ( const real q,
real  num_q,
real  density_floor,
real mod_q 
)

◆ ensure_floor_pressure()

void ensure_floor_pressure ( const real q,
real  num_q,
real  gas_gamma,
real  pressure_floor,
real mod_q 
)

◆ get_E()

real get_E ( real  gas_gamma,
real  rho,
real  p,
real  V2,
real  B2 
)

Calculate MHD total energy density.

\[ e = \frac{p}{\gamma - 1} + \frac{1}{2} \rho v^2 + \frac{1}{2} B^2 \]

Parameters
gas_gammaRatio of specfic heats.
rhoNormalized mass density.
pNormalized pressure.
V2Normalized velocity squared.
B2Normalized magnetic field squared.
Returns
Noramalized MHD energy density

◆ get_p()

real get_p ( real  gas_gamma,
real  rho,
real  E,
real  V2,
real  B2 
)

Calculate pressure from MHD total energy.

\[ p = (\gamma - 1) \left( e - \frac{1}{2} \rho v^2 - \frac{1}{2} B^2 \right) \]

Parameters
gas_gammaRatio of specfic heats.
rhoNormalized mass density.
EMHD total energy density \(e = \frac{p}{\gamma - 1} + \frac{1}{2} \rho v^2 + \frac{1}{2} B^2 \).
V2Normalized velocity squared.
B2Normalized magnetic field squared.
Returns
Noramalized MHD energy density

◆ get_temperature()

real get_temperature ( real  p,
real  rho,
real  Ai,
real  Zi 
)

◆ getPressureFloored()

real getPressureFloored ( const real q,
const real  gas_gamma,
const real  rho_min = std::numeric_limits< real >::epsilon(),
const real  press_min = std::numeric_limits< real >::epsilon() 
)

Get the pressure from MHD variables using floors for pressure and density.

The floored pressure is given as

\[ p_{fl} = \max(p, p_{min}), \]

where

\[ p = (\gamma - 1) \left( e - \frac{1}{2} \max(\rho, \rho_{min}) v^2 - \frac{1}{2} B^2 \right) \]

Assumes \( \rho_{min}, \; p_{min} > 0 \).

Parameters
qThe raw MHD variables.
gas_gammaRatio of specific heats.
rho_minNormalized minimum mass density.
press_minNormalized minimum mass density.
Returns
Pressure calculated assuming pressure and density floors.

◆ getRhoFloored()

real getRhoFloored ( const real q,
const real  rho_min = std::numeric_limits< real >::epsilon() 
)

Get the floored mass density.

The floored mass density is given as

\[ \rho_{fl} = \max(\rho, \rho_{min}), \]

Assumes \( \rho_{min} > 0 \).

Parameters
qThe raw MHD variables.
rho_minNormalized minimum mass density.
Returns
Floored mass density.

◆ getTemperatureFloored()

real getTemperatureFloored ( const real q,
const real  gas_gamma,
const real  Ai = 1.0,
const real  Zi = 1.0,
const real  rho_min = std::numeric_limits< real >::epsilon(),
const real  press_min = std::numeric_limits< real >::epsilon() 
)

Get the temperature from MHD variables using floors for pressure and density.

Temperature is calculated assuming:

  1. ideal gas: \( p = n_i T_i + n_e T_e \)
  2. quasineutrality: \( Z_i n_i + Z_e n_e = 0 \)
  3. electron charge: \( Z_e = -1 \)
  4. temperature equilabration: \( T = T_i = T_e \)
  5. MHD mass density: \( \rho_{mhd} \approx \rho_i = A_i * n_i \)

Therefore

\[ T = \frac{p_{fl}}{\rho_{fl}} \frac{ A_i } {(1 + Z_i)} \]

where

\[ p_{fl} = \max(p, p_{min}), \quad \text{and} \quad \rho_{fl} = \max(\rho, \rho_{min}). \]

Assumes \( \rho_{min}, \; p_{min} > 0 \).

Parameters
qThe raw MHD variables.
gas_gammaRatio of specific heats.
AiProton normalized ion mass.
ZiIon charge.
rho_minNormalized minimum mass density.
press_minNormalized minimum mass density.
Returns
Temperature calculated assuming pressure and density floors.