# vanDerWaalsComputeVariables¶

This source allows the user to compute pressure ($$P$$) and the sound speed squared ($$c_s^2$$) from density ($$\rho$$) and the internal energy ($$\rho\epsilon$$) with the Van Der Waals gas law,

\notag \begin{align} P = \frac{R}{C_V}(\epsilon+\eta_a\rho)\frac{\rho}{1-\eta_b\rho}-\eta_a\rho^2 \end{align}

Here $$R$$ is the gas constant, $$C_V$$ is the specific heat at constant volume and $$\eta_a$$ and $$\eta_b$$ are constants accounting for the intermolecular forces and the molecular size, respectively.

In this updater, the sound speed squared is computed from a formula for the generalized sound speed:

\notag \begin{align} c_s^2 = \frac{\partial P}{\partial \epsilon} \frac{P}{\rho^2} + \frac{\partial P}{\partial \rho} \\ \end{align}

## Parameters¶

Rr (float, required)
Specifies the gas constant, $$R$$.
Cv (float, required)
Specifies the gas specific heat at constant volume , $$C_V$$.
etaA (float, required)
Specifies the intermolecular force constant, $$\eta_a$$ in units of $$m^3kg^{-1}$$.
etaB (float, required)
Specifies the molecular size constant, $$\eta_b$$ in units of $$m^5kg^{-1}s^{-2}$$.
speciesMass (float, required)
Specifies the species mass in $$kg$$.
kboltz (float, optional)
Specifies the Boltzmann constant. Defaults to $$1.3806 \times 10^{-23}$$ ($$J/K$$).
delta (float, optional)
A finite difference operation is applied to evaluate partial derivatives. This factor determines the relative width of the stencil. The default is $$10^{-6}$$.
soundSpeedSquaredFloor (float, optional)
Sets a minimum value for the output sound speed squared. The default is 0.
useParticleDensity (int, optional)
Whether to use the particle (true) or mass (false) density. Default is false.
densityConversionCoefficient (float, optional)
Custom density unit conversion factor. Conversion to MKS mass density ($$kg m^{-3}$$) is the default. The default conversion factor is divided by the custom conversion factor. Thus if using alternative units, set the unit conversion factor to to the MKS value that corresponds to unity in the alternative units.
temperatureConversionCoefficient (float, optional)
Custom temperature unit conversion factor. Conversion to MKS temperature ($$K$$) is the default. The default conversion factor is divided by the custom conversion factor. Thus if using alternative units, set the unit conversion factor to to the MKS value that corresponds to unity in the alternative units.
conversionCoefficients (float vector, optional)
Custom unit conversion factors for EOS values. Conversion to MKS units is the default. The default conversion factor is divided by the custom conversion factor. Thus if using alternative units, set the unit conversion factor to to the MKS value that corresponds to unity in the alternative units.
outputPeRhoInv (int, optional)
Boolean that determines if the partial derivative of the pressure with respect to specific energy divided by the density, $$\rho^{-1} \partial P / \partial \epsilon$$, is output. This output is required to compute the EOS system eigenvectors. The default is false.

## Parent Updater Data¶

in (string vector, required)

input variables (nodalArray, 1-component each, 2 required)

The input variables (exactly 2) must be the density and the internal energy, in that order. Inputs are of type nodalArray with one component each.

out (string vector, required)

output variables (nodalArray, 1-component each, 2 required and 3rd optional)

The output variables are the pressure and the sound speed squared, in that order. If outputPeRhoInv is true, a third output variable that is the partial derivative of the pressure with respect to specific energy divided by the density $$\rho^{-1} \partial P / \partial \epsilon$$. This output is required to compute the EOS system eigenvectors. Outputs are of type nodalArray with one component each.

## Example¶

<Updater computePressureAndSoundSpeedSquared>
kind=equation2d
onGrid=domain
in=[rho, intEnergy]
out=[pressure, soundSqr]
<Equation thisGas>
kind=vanDerWaalsComputeVariables
delta=1.e-5
Rr=2.0769
Cv=3.1156
etaA=0.0346
etaB=0.0238
speciesMass=6.64e-27
</Equation>
</Updater>