Equations of State

Currently, SWIFT offers three different gas equations of state (EoS) implemented: ideal, isothermal, and barotropic; as well as a variety of EoS for “planetary” materials. The EoS describe the relations between our main thermodynamical variables: the internal energy per unit mass \(u\), the mass density \(\rho\), the entropy \(A\) and the pressure \(P\). It is selected af configure time via the option --with-equation-of-state.

Gas EoS

We write the adiabatic index as \(\gamma\) and \(c_s\) denotes the speed of sound. The adiabatic index can be changed at configure time by choosing one of the allowed values of the option --with-adiabatic-index. The default value is \(\gamma = 5/3\).

The tables below give the expression for the thermodynamic quantities on each row entry as a function of the gas density and the thermodynamical quantity given in the header of each column.

Ideal Gas

Variable

A

u

P

A

\(\left( \gamma - 1 \right) u \rho^{1-\gamma}\)

\(P \rho^{-\gamma}\)

u

\(A \frac{ \rho^{ \gamma - 1 } }{\gamma - 1 }\)

\(\frac{1}{\gamma - 1} \frac{P}{\rho}\)

P

\(A \rho^\gamma\)

\(\left( \gamma - 1\right) u \rho\)

\(c_s\)

\(\sqrt{ \gamma \rho^{\gamma - 1} A}\)

\(\sqrt{ u \gamma \left( \gamma - 1 \right) }\)

\(\sqrt{ \frac{\gamma P}{\rho} }\)

Isothermal Gas

Variable

A

\(\left( \gamma - 1 \right) u \rho^{1-\gamma}\)

u

const

P

\(\left( \gamma - 1\right) u \rho\)

\(c_s\)

\(\sqrt{ u \gamma \left( \gamma - 1 \right) }\)

Barotropic Gas

Variable

A

\(\rho^{1-\gamma} c_0^2 \sqrt{1 + \left( \frac{\rho}{\rho_c} \right) }\)

u

\(\frac{1}(\gamma -1)c_0^2 \sqrt{1 + \left( \frac{\rho}{\rho_c} \right) }\)

P

\(\rho c_0^2 \sqrt{1 + \left( \frac{\rho}{\rho_c} \right) }\)

\(c_s\)

\(\sqrt{ c_0^2 \sqrt{1 + \left( \frac{\rho}{\rho_c} \right) }}\)

Note that when running with an isothermal or barotropic equation of state, the value of the tracked thermodynamic variable (e.g. the entropy in a density-entropy scheme or the internal enegy in a density-energy SPH formulation) written to the snapshots is meaningless. The pressure, however, is always correct in all scheme.

For the isothermal equation of state, the internal energy is specified at runtime via the parameter file. In the case of the barotropic gas, the vacuum sound speed \(c_0\) and core density \(\rho_c\) are similarly specified.

Planetary EoS

See Planetary Equations of State.

How to Implement a New Equation of State

See General information for adding new schemes for a full list of required changes.

You will need to provide an equation_of_state.h file containing: the definition of eos_parameters, IO functions and transformations between the different variables: \(u(\rho, A)\), \(u(\rho, P)\), \(P(\rho,A)\), \(P(\rho, u)\), \(A(\rho, P)\), \(A(\rho, u)\), \(c_s(\rho, A)\), \(c_s(\rho, u)\) and \(c_s(\rho, P)\). See other equation of state files to have implementation details.