# twoTemperatureMhdDednerEqn¶

Defines the equations of ideal compressible magnetohydrodynamics with divergence cleaning and an electron entropy equation:

\notag \begin{align} \frac{\partial \rho}{\partial t} + \nabla\cdot\left[ \rho\,\mathbf{u} \right] = 0 \\ \frac{\partial \rho\,\mathbf{u}}{\partial t} + \nabla\cdot\left[ \rho\,\mathbf{u}\,\mathbf{u}^{T} - \mathbf{b}\,\mathbf{b}^{T} + \mathbb{I} \left(P_{\mathrm{tot}}+ \tfrac{1}{2}\left|\mathbf{b}\right|^{2}\right) \right] = 0 \\ \frac{\partial E}{\partial t} + \nabla\cdot\left[ \left(E + P \right) \mathbf{u} + \mathbf{e} \times \mathbf{b} \right] = 0 \\ \frac{\partial \mathbf{b^{\mathrm{plasma}}}}{\partial t} + \nabla\times\mathbf{e} + \nabla \psi= 0 \\ \frac{\partial \psi}{\partial t} + \nabla\cdot\left[ c^{2}_{\mathrm{fast}} \mathbf{b} \right] = 0 \\ \frac{\partial S_{\mathrm{electron}}}{\partial t} + \nabla\cdot\left[ S_{\mathrm{electron}}\,\mathbf{u}_{\mathrm{electron}} \right] = 0 \\ \end{align}

Here, $$\mathbb{I}$$ is the identity matrix, $$P_{\mathrm{tot}} = P_{\mathrm{ion}} + P_{\mathrm{electron}} = \rho_{\mathrm{ion}}\epsilon_{\mathrm{ion}} (\gamma_{\mathrm{ion}}-1) +\rho_{\mathrm{electron}}\epsilon_{\mathrm{electron}} (\gamma_{\mathrm{electron}}-1)$$ is the total plasma pressure, $$\epsilon_{\mathrm{ion,electron}}$$ is the specific internal energy of ions and electrons and $$\gamma_{\mathrm{ion,electron}}$$ is the adiabatic index (ratio of specific heats) for the ions and electrons. The quantity $$c_{\mathrm{fast}}$$ corresponds to the fastest wave speed over the entire simulation domain; divergence errors are advected out of the domain with this speed.

In order to track the electron temperature, USim evolves the electron entropy, defined as:

\notag \begin{align} S_{\mathrm{electron}} = P_{\mathrm{electron}} n_{\mathrm{electron}}^{-\left(\gamma_{\mathrm{electron}}+1\right)} ; \;\; n_{\mathrm{electron}} = \frac{\rho}{m_{\mathrm{electron}}+\frac{m_{\mathrm{ion}}}{Z}} \end{align}

Here, $$n_{\mathrm{electron}}$$ is the electron number density, $$m_{\mathrm{electron}}$$ is the electron mass, $$m_{\mathrm{ion}}$$ is the ion mass and $$Z$$ is the ion charge state. The electron entropy is advected by the electron velocity, $$\mathbf{u}_{\mathrm{electron}}$$, computed as:

\notag \begin{align} \mathbf{u}_{\mathrm{electron}} = -\frac{\mathbf{J}^{\mathrm{plasma}} - q Z m^{-1}_{\mathrm{ion}} \rho \mathbf{u}}{q n_{\mathrm{electron}}}; \;\; \mathbf{J}^{\mathrm{plasma}} = \mu^{-1/2}_0\nabla \times \mathbf{b}^{\mathrm{plasma}} = \mu^{-1}_0\nabla \times \mathbf{B}^{\mathrm{plasma}} \end{align}

Here, $$\mathbf{J}^{\mathrm{plasma}}$$ is the total (ion+electron) plasma current and $$q$$ is the fundamental change ($$-q$$ is the charge on an electron). As defined above, the electron entropy is advected with the electron density. If, for example, heating of electrons by (for example) magnetic dissipation is required, then this can be accomplished by adding source terms of the electron entropy equation, see, e.g. mhdSrc.

The electromagnetic fields are defined as:

\notag \begin{align} \mathbf{b} = \mathbf{b}^{\mathrm{plasma}}+\mathbf{b}^{\mathrm{external}} = \mu^{-1/2}_{0} \left(\mathbf{B}^{\mathrm{plasma}}+\mathbf{B}^{\mathrm{external}} \right) \\ \mathbf{e} = - \mathbf{u} \times \mathbf{b} + \mathbf{e}^{\mathrm{external}} = \mu^{-1/2}_{0} \left( - \mathbf{u} \times \mathbf{B} + \mathbf{E}^{\mathrm{external}} \right) \end{align}

Here, $$\mathbf{b}^{\mathrm{plasma}}$$ is the magnetic field induced in the plasma by the inductive electric field, $$\mathbf{e}$$, while $$\mathbf{e}^{\mathrm{external}}$$ and $$\mathbf{b}^{\mathrm{external}}$$ are electromagnetic fields computed “externally” to the ideal magnetohydrodynamic equations.

## Parameters¶

basementPressure (float, optional)
The minimum pressure allowed. Pressures below this value will be replaced with this value for primitive state, eigensystem and flux computations. Defaults to zero.
basementDensity (float, optional)
The minimum density allowed. Densities below this value will be replaced with this value for primitive state, eigensystem and flux computations. Defaults to zero.
gasGamma (float, optional)
Specifies the adiabatic index (ratio of specific heats) for the total pressure, $$\gamma$$. Defaults to 5/3.
electronGamma (float, optional)
Specifies the adiabatic index (ratio of specific heats) for the electrons, $$\gamma_{\mathrm{electron}}$$. Defaults to 5/3.
electronMass (float, optional)
Specifies the electron mass, $$m_{\mathrm{electron}}$$. Defaults to $$(1836)^{-1}$$.
ionMass (float, optional)
Specifies the ion mass, $$m_{\mathrm{ion}}$$. Defaults to 1.
chargeState (float, optional)
Specifies the charge on an ion, $$Z$$. Defaults to 1.
currentVector (string, required)
Specifies the name of the data structure containing the total (ion + electron) plasma current, $$\mathbf{J}^{\mathrm{plasma}}$$.
externalEfield (string, optional)
Specifies the name of the data structure containing the externally computed electric field, $$\mathbf{e}^{\mathrm{external}}$$.
externalBfield (string, optional)
Specifies the name of the data structure containing the externally computed magnetic field, $$\mathbf{b}^{\mathrm{external}}$$.

## Parent Updater Data¶

in (string vector, required)
Vector of Conserved Quantities (nodalArray, 10-components, required)

The vector of conserved quantities, $$\mathbf{q}$$ has 10 entries:

1. $$\rho$$: mass density
2. $$\rho\,u_{\hat{\mathbf{i}}} = \rho \mathbf{u} \cdot \hat{\mathbf{i}}$$: momentum density in the $$\hat{\mathbf{i}}$$ direction
3. $$\rho\,u_{\hat{\mathbf{j}}} = \rho \mathbf{u} \cdot \hat{\mathbf{j}}$$: momentum density in the $$\hat{\mathbf{j}}$$ direction
4. $$\rho\,u_{\hat{\mathbf{k}}} = \rho \mathbf{u} \cdot \hat{\mathbf{k}}$$: momentum density in the $$\hat{\mathbf{k}}$$ direction
5. $$E = \frac{P}{\gamma -1} + \tfrac{1}{2}\rho|\mathbf{u}|^2 + \tfrac{1}{2}|\mathbf{b}|^2$$: total energy density
6. $$b_{\hat{\mathbf{i}}} = \mathbf{b} \cdot \hat{\mathbf{i}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{i}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{i}}$$ direction
7. $$b_{\hat{\mathbf{j}}} = \mathbf{b} \cdot \hat{\mathbf{j}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{j}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{j}}$$ direction
8. $$b_{\hat{\mathbf{k}}} = \mathbf{b} \cdot \hat{\mathbf{k}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{k}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{k}}$$ direction
9. $$\psi$$: correction potential
10. $$S_{\mathrm{electron}}$$: electron entropy
Current Density (nodalArray, 3-components, required)

The total (ion and electron) current in the plasma, typically calculated from from pre-Maxwell form of Ampere’s law, $$\mathbf{J}^{\mathrm{plasma}} = \mu^{1/2}_0\nabla \times \mathbf{b}^{\mathrm{plasma}}$$, which can be computed through, e.g. vector (1d, 2d, 3d). The data structure containing $$\mathbf{J}^{\mathrm{plasma}}$$ is specified by the “currentVector” option described below.

1. $${J}^{\mathrm{plasma}}_{\hat{\mathbf{i}}} = \mathbf{J}^{\mathrm{plasma}} \cdot \hat{\mathbf{i}}$$: total (ion and electron) current in the plasma in the $$\hat{\mathbf{i}}$$ direction.
2. $${J}^{\mathrm{plasma}}_{\hat{\mathbf{j}}} =\mathbf{J}^{\mathrm{plasma}} \cdot \hat{\mathbf{j}}$$: total (ion and electron) current in the plasma in the $$\hat{\mathbf{j}}$$ direction
3. $${J}^{\mathrm{plasma}}_{\hat{\mathbf{k}}} = \mathbf{J}^{\mathrm{plasma}} \cdot \hat{\mathbf{k}}$$: total (ion and electron) current in the plasma in the $$\hat{\mathbf{k}}$$ direction
Fastest Wave Speed (dynVector, 1-component, required)
The fastest wave speed across the entire simulation domain, $$c_{\mathrm{fast}}$$. Can be computed using hyperbolic (1d, 2d, 3d) (see below).
Externally Computed Electric Field (nodalArray, 3-components, optional)

Additional terms in the generalized Ohm’s law, $$\mathbf{E}^{\mathrm{external}}$$, computed “externally” to the ideal magnetohydrodynamic system. The data structure containing $$\mathbf{e}^{\mathrm{external}}$$ is specified by the “externalEField” option described below.

1. $${e}^{\mathrm{external}}_{\hat{\mathbf{i}}} = \mathbf{e}^{\mathrm{external}} \cdot \hat{\mathbf{i}} = \mu^{-1/2}_{0} \mathbf{E}^{\mathrm{external}} \cdot \hat{\mathbf{i}}$$: “externally” computed electric field normalized by permeability of free-space in the $$\hat{\mathbf{i}}$$ direction.
2. $${e}^{\mathrm{external}}_{\hat{\mathbf{j}}} =\mathbf{e}^{\mathrm{external}} \cdot \hat{\mathbf{j}} = \mu^{-1/2}_{0} \mathbf{E}^{\mathrm{external}} \cdot \hat{\mathbf{j}}$$:”externally” computed electric field normalized by permeability of free-space in the $$\hat{\mathbf{j}}$$ direction
3. $${e}^{\mathrm{external}}_{\hat{\mathbf{k}}} = \mathbf{e}^{\mathrm{external}} \cdot \hat{\mathbf{k}} = \mu^{-1/2}_{0} \mathbf{E}^{\mathrm{external}} \cdot \hat{\mathbf{k}}$$: “externally” computed electric field normalized by permeability of free-space in the $$\hat{\mathbf{k}}$$ direction
Externally Computed Magnetic Field (nodalArray, 3-components, optional)

Additional contribution to the magnetic field, $$\mathbf{b}^{\mathrm{external}}$$, which is not evolved by the induction equation, but does contribute to the Lorentz force and the work done on the plasma. The data structure containing $$\mathbf{b}^{\mathrm{external}}$$ is specified by the “externalBField” option described below.

1. $${b}^{\mathrm{external}}_{\hat{\mathbf{i}}} = \mathbf{b}^{\mathrm{external}} \cdot \hat{\mathbf{i}} = \mu^{-1/2}_{0} \mathbf{B}^{\mathrm{external}} \cdot \hat{\mathbf{i}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{i}}$$ direction
2. $${b}^{\mathrm{external}}_{\hat{\mathbf{j}}} =\mathbf{b}^{\mathrm{external}} \cdot \hat{\mathbf{j}} = \mu^{-1/2}_{0} \mathbf{B}^{\mathrm{external}} \cdot \hat{\mathbf{j}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{j}}$$ direction
3. $${b}^{\mathrm{external}}_{\hat{\mathbf{k}}} = \mathbf{b}^{\mathrm{external}} \cdot \hat{\mathbf{k}} = \mu^{-1/2}_{0} \mathbf{B}^{\mathrm{external}} \cdot \hat{\mathbf{k}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{k}}$$ direction
out (string vector, required)

For the mhdDednerEqn, one of four output variables are computed, depending on whether the equation is combined with an updater capable of computing fluxes (classicMusclUpdater (1d, 2d, 3d)), primitive variables (computePrimitiveState(1d, 2d, 3d)), the time step associated with the CFL condition (timeStepRestrictionUpdater (1d, 2d, 3d)) or the fastest wave speed in the grid (hyperbolic (1d, 2d, 3d)).

Vector of Fluxes (nodalArray, 9-components)

When combined with an updater that computes $$\nabla \cdot \mathcal{F}\left(\mathbf{w} \right)$$ (e.g. classicMusclUpdater (1d, 2d, 3d)), the equation system returns:

1. $$\nabla \cdot \mathcal{F}\left( \rho \right)$$: mass flux
2. $$\nabla \cdot \mathcal{F}\left( \rho\,u_{\hat{\mathbf{i}}} \right)$$: $$\hat{\mathbf{i}}$$ momentum flux
3. $$\nabla \cdot \mathcal{F}\left( \rho\,u_{\hat{\mathbf{j}}} \right)$$: $$\hat{\mathbf{j}}$$ momentum flux
4. $$\nabla \cdot \mathcal{F}\left( \rho\,u_{\hat{\mathbf{k}}} \right)$$: $$\hat{\mathbf{k}}$$ momentum flux
5. $$\nabla \cdot \mathcal{F}\left( E \right)$$: total energy flux
6. $$\nabla \cdot \mathcal{F}\left( b_{\hat{\mathbf{i}}} \right)$$: $$\hat{\mathbf{i}}$$ magnetic field flux
7. $$\nabla \cdot \mathcal{F}\left( b_{\hat{\mathbf{j}}} \right)$$: $$\hat{\mathbf{j}}$$ magnetic field flux
8. $$\nabla \cdot \mathcal{F}\left( b_{\hat{\mathbf{k}}} \right)$$: $$\hat{\mathbf{k}}$$ magnetic field flux
9. $$\nabla \cdot \mathcal{F}\left(\psi \right)$$: correction potential flux
10. $$\nabla \cdot \mathcal{F}\left( S_{\mathrm{electron}} \right)$$: electron entropy flux
Vector of Primitive States (nodalArray, 9-components)

When combined with an updater that computes $$\mathbf{w} = \mathbf{w}(\mathbf{q})$$ (e.g. computePrimitiveState(1d, 2d, 3d)), the equation systen returns:

1. $$\rho$$: mass density
2. $$u_{\hat{\mathbf{i}}} = \mathbf{u} \cdot \hat{\mathbf{i}}$$: velocity in the $$\hat{\mathbf{i}}$$ direction
3. $$u_{\hat{\mathbf{j}}} = \mathbf{u} \cdot \hat{\mathbf{j}}$$: velocity in the $$\hat{\mathbf{j}}$$ direction
4. $$u_{\hat{\mathbf{k}}} = \mathbf{u} \cdot \hat{\mathbf{k}}$$: velocity in the $$\hat{\mathbf{k}}$$ direction
5. $$P = \rho\epsilon(\gamma-1)$$: ideal gas pressure
6. $$b_{\hat{\mathbf{i}}} = \mathbf{b} \cdot \hat{\mathbf{i}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{i}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{i}}$$ direction
7. $$b_{\hat{\mathbf{j}}} = \mathbf{b} \cdot \hat{\mathbf{j}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{j}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{j}}$$ direction
8. $$b_{\hat{\mathbf{k}}} = \mathbf{b} \cdot \hat{\mathbf{k}} = \mu^{-1/2}_{0} \mathbf{B} \cdot \hat{\mathbf{k}}$$: magnetic field normalized by permeability of free-space in the $$\hat{\mathbf{k}}$$ direction
9. $$\psi$$: correction potential
10. $$P_{\mathrm{electron}}$$: electron pressure
Time Step (dynVector, 1-component)
When combined with timeStepRestrictionUpdater (1d, 2d, 3d), the equation system returns the time step consisten with the CFL condition across the entire simulation domain.
Fastest Wave Speed (dynVector, 1-component)
When combined with hyperbolic (1d, 2d, 3d), the equation system returns the fastest wave speed across the entire simulation domain, $$c_{\mathrm{fast}}$$.

## Examples¶

The following block demonstrates the twoTemperatureMhdDednerEqn used in combination with classicMusclUpdater (1d, 2d, 3d) to compute $$\nabla \cdot \mathcal{F}\left(\mathbf{w} \right)$$, including resistive effects

<Updater hyper>
kind = classicMuscl1d
onGrid = domain

# input data-structures
in = [q,electricField,current,chargeState,resistivity]
# output data-structures
out = [qnew]
# the time integration scheme, rk1 for first order runge-kutta
timeIntegrationScheme = none
# the numerical flux to use
numericalFlux = roeFlux
# CFL number to use
cfl = 0.4
# Form of variables to limit
variableForm = primitive
# Limiter to use
limiter = [muscl,muscl,muscl,muscl,muscl]

waveSpeeds = [waveSpeed]

# list of equations to solve
equations = [mhd]

# list of sources to add
source = [mhdSource]

<Equation mhd>
kind = twoTemperatureMhdDednerEqn
gasGamma = GAS_GAMMA
electronGamma = $ELECTRON_GAMMA$
basementDensity = $BASEMENT_DENSITY$
basementPressure = $BASEMENT_PRESSURE$
externalEfield = "electricField"
currentVector = "current"
</Equation>

<Source mhdSource>
kind = mhdSrc
model = twoTemperatureMhdDednerEqn
externalEfield = true
inputVariables = [q, electricField,current,chargeState,resistivity]
ionMass = ION_MASS
fundamentalCharge = FUNDAMENTAL_CHARGE
</Source>

</Updater>

The following block demonstrates the twoTemperatureMhdDednerEqn used in combination with computePrimitiveState(1d, 2d, 3d) to compute $$\mathbf{w} \left( \mathbf{q} \right)$$

<Updater computePrimitiveState>
kind = computePrimitiveState1d

onGrid = domain
# input data-structures
in = [q,electricField,current,chargeState,resistivity]

# ouput data-structures
out = [w]

<Equation mhd>
kind = twoTemperatureMhdDednerEqn
gasGamma = GAS_GAMMA
electronGamma = $ELECTRON_GAMMA$
basementDensity = $BASEMENT_DENSITY$
basementPressure = $BASEMENT_PRESSURE$
externalEfield = "electricField"
currentVector = "current"
</Equation>

</Updater>

The following block demonstrates the twoTemperatureMhdDednerEqn used in combination with timeStepRestrictionUpdater (1d, 2d, 3d), hyperbolic (1d, 2d, 3d) and quadratic (1d, 2d, 3d) to compute $$dt_{\mathrm{min}}$$, $$dt_{\mathrm{diff}}$$ and $$c_{\mathrm{fast}}$$ for resistive two-temperature MHD:

<Updater getHypDT>
kind = timeStepRestrictionUpdater1d
in = [q,electricField,current,chargeState,resistivity]
onGrid = domain
waveSpeeds = [waveSpeed]
timeSteps = [diffDT]
courantCondition = CFL

<TimeStepRestriction idealMhd>
kind = hyperbolic1d
cfl = CFL
model = twoTemperatureMhdDednerEqn
gasGamma = GAS_GAMMA
electronGamma = $ELECTRON_GAMMA$
correctNans = true
correct = true
correctNans = true
basementDensity = $BASEMENT_DENSITY$
basementPressure = $BASEMENT_PRESSURE$
externalEfield = "electricField"
currentVector = "current"
storeTimeStep = False
</TimeStepRestriction>