# Using USim to solve 10 moment ions with 5 moment electrons¶

In this tutorial we show how to solve the two-fluid system where the ions use the 10-moment model and the electrons use the 5 moment model. The simulation is based off of the result published in

Hakim, Ammar H. "Extended MHD modelling with the ten-moment equations." Journal of Fusion Energy 27.1-2 (2008): 36-43.


Readers should refer to Using USim to Solve the Two-Fluid Plasma Model since the setup is virtually identical. The difference in this case lays in the use of tenMomentEqn as well as the options type = 10MomentIonsStep1 and type = 10MomentIonsStep2 in twoFluidSrc.

## DataStructs¶

The electrons use the 5 moment model so the electron conserved variables have 5 components eulerEqn

<DataStruct electrons>
kind = nodalArray
onGrid = domain
numComponents = 5
</DataStruct>


The ions use the 10 moment model so the ion conserved variables have 10 components tenMomentEqn

<DataStruct ions>
kind = nodalArray
onGrid = domain
numComponents = 10
</DataStruct>


## Computing the semi-implicit operators¶

The first part of the semi-implicit operator is computed as shown below. The type must be set to 10MomentIonsStep as this operator is applied first

<Updater twoFluidSrc1>
kind = equation1d

onGrid = domain
in =  [electronsNew, ionsNew, emNew]
out = [electronsNew, ionsNew, emNew]

<Equation twofluidLorentz>
kind = twoFluidSrc
type = 10MomentIonsStep1
useImposedField = false
electronCharge = ELECTRON_CHARGE
electronMass = ELECTRON_MASS
ionCharge = ION_CHARGE
ionMass = ION_MASS
epsilon0 = EPSILON0
</Equation>
</Updater>


The second operator can be applied after the conserved variables have been updated from the first operator. In this case the type is 10MomentIonsStep2 as shown below. Notice that the result is only applied to the updated ion values ionsNew

<Updater twoFluidSrc2>
kind = equation1d

onGrid = domain
in =  [ionsNew, emNew]
out = [ionsNew]

<Equation twofluidLorentz>
kind = twoFluidSrc
type = 10MomentIonsStep2
ionCharge = ION_CHARGE
ionMass = ION_MASS
</Equation>
</Updater>


## Integrating the 10 moment ion 5 moment electron system¶

Time integration is performed in the standard way, but now two operators must be applied. Notice the block

<UpdateStep operators>
updaters = [twoFluidSrc1, twoFluidSrc2]
syncVars = [emNew, ionsNew, electronsNew]


where both twoFluidSrc1 and then twoFluidScr2 are applied

<Updater rkUpdaterMain>
kind = multiUpdater1d
onGrid = domain

in = [em, ions, electrons]
out = [emNew, ionsNew, electronsNew]

<TimeIntegrator rkIntegrator>
kind = rungeKutta1d
ongrid = domain
scheme = secondNonTVD
</TimeIntegrator>

fluxStep = [hyper]
boundaryStep = [boundaries]
operatorStep = [operators]

updaters = [bcIons, bcElectrons, bcEm]
syncVars = [em, ions, electrons]

updaters = [hyperIons, hyperElectrons, hyperEm]
syncVars = [emNew, ionsNew, electronsNew]