eos

Definitions of equation of states for compressible flow.

This module defines the equations of state for the compressible flow solvers, which establish the relationship between the thermodynamic variables such as density \(\rho\), pressure \(p\) and temperature \(T\).

Ideal gas

We derive the dimensionless ideal gas equation from the dimensional one, namely:

\[\begin{split}\overline{p} &= \overline{\rho} \overline{R} \overline{T}, \\ \rho_{ref} u^2_{ref} p &= \rho_{ref} \rho \overline{R} T_{ref} T, \\ u^2_{ref} p &= \rho \frac{\overline{c}_\infty^2}{\gamma \overline{T}_\infty} T_{ref} T, \\ \gamma p &= ( \gamma - 1) \rho T.\end{split}\]
class EquationOfState(mesh: Mesh, root: Configuration = None, **default)

Base class for equations of state in compressible flow solvers.

class IdealGas(mesh, root=None, **default)
density(U: flowfields) CoefficientFunction

Returns the density from given fields

\[\begin{split}(1) \quad \rho &= \frac{\gamma}{\gamma - 1} \frac{p}{T}, \\ (2) \quad \rho &= \gamma \frac{\rho E_i}{T}, \\ (3) \quad \rho &= \gamma \frac{p}{c^2}.\end{split}\]
pressure(U: flowfields) CoefficientFunction

Returns the density from given fields

\[\begin{split}(1) \quad p &= \frac{\gamma - 1}{\gamma} \rho T, \\ (2) \quad p &= (\gamma - 1) \rho E_i, \\ (3) \quad p &= \rho \frac{c^2}{\gamma}.\end{split}\]
temperature(U: flowfields) CoefficientFunction

Returns the temperature from given fields

\[\begin{split}(1) \quad T &= \frac{\gamma}{\gamma - 1} \frac{p}{\rho}, \\ (2) \quad T &= \gamma E_i, \\ (3) \quad T &= \frac{c^2}{\gamma - 1}.\end{split}\]
inner_energy(U: flowfields) CoefficientFunction

Returns the inner energy from given fields

\[\begin{split}(1) \quad \rho E_i &= \frac{p}{\gamma - 1}, \\ (2) \quad \rho E_i &= \rho \frac{T}{\gamma}.\end{split}\]
specific_inner_energy(U: flowfields) CoefficientFunction

Returns the specific inner energy from given fields

\[\begin{split}(1) \quad E_i &= \frac{T}{\gamma}, \\ (2) \quad E_i &= \frac{p}{\rho (\gamma - 1)}.\end{split}\]
speed_of_sound(U: flowfields) CoefficientFunction

Returns the speed of sound from given fields

\[\begin{split}(1) \quad c &= \sqrt{\gamma \frac{p}{\rho}}, \\ (2) \quad c &= \sqrt{(\gamma - 1) T}.\end{split}\]
specific_entropy(U: flowfields) CoefficientFunction

Returns the specific entropy from given fields

\[s = \frac{p}{\rho^{\gamma}}.\]
density_gradient(U: flowfields, dU: flowfields) CoefficientFunction

Returns the density gradient from given fields

\[\begin{split}(1) \quad \nabla \rho &= \frac{\gamma}{\gamma - 1} \left[ \frac{\nabla p}{T} - p \frac{\nabla T}{T^2} \right], \\ (2) \quad \nabla \rho &= \gamma \left[ \frac{ \nabla (\rho E_i)}{T} - \rho E_i \frac{\nabla T}{T^2} \right].\end{split}\]
pressure_gradient(U: flowfields, dU: flowfields) CoefficientFunction

Returns the pressure gradient from given fields

\[\begin{split}(1) \quad \nabla p &= \frac{\gamma - 1}{\gamma} \left[ (\nabla \rho) T + (\nabla T) \rho \right], \\ (2) \quad \nabla p &= (\gamma - 1) \nabla \rho E_i.\end{split}\]
temperature_gradient(U: flowfields, dU: flowfields) CoefficientFunction

Returns the temperature gradient from given fields

\[\begin{split}(1) \quad \nabla T &= \frac{\gamma}{\gamma - 1} \left[ \frac{\nabla p}{\rho} - p \frac{\nabla \rho}{\rho^2} \right], \\ (2) \quad \nabla T &= \gamma \nabla E_i.\end{split}\]
characteristic_amplitudes(U: flowfields, dU: flowfields, unit_vector: CoefficientFunction, type_: str = None) CoefficientFunction

Returns the charachteristic amplitudes

\[\vec{\mathcal{L}} := \vec{\Lambda} \mat{P}_n^{-1} \frac{\partial \vec{U}}{\partial n} = \vec{\Lambda} \vec{L}_n^{-1} \frac{\partial \vec{V}}{\partial n} = \vec{\Lambda} \frac{\partial \vec{W}}{\partial n},\]
conservative_from_primitive(U: flowfields) CoefficientFunction

The \(\mat{M}\) matrix transforms primitive variables to conservative variables

\[\begin{split}\mat{M} := \begin{pmatrix} 1 & 0 & 0 & 0 \\ u_x & \rho & 0 & 0 \\ u_y & 0 & \rho & 0 \\ \frac{|u|^2}{2} & \rho u_x & \rho u_y & \frac{1}{\gamma - 1} \end{pmatrix}\end{split}\]
Note:

See equation \((E16.2.10)\) in [3].

primitive_from_conservative(U: flowfields) CoefficientFunction

The \(\mat{M}^{-1}\) matrix transforms conservative variables to primitive variables

\[\begin{split}\mat{M}^{-1} := \begin{pmatrix} 1 & 0 & 0 & 0 \\ -\frac{u_x}{\rho} & \frac{1}{\rho} & 0 & 0 \\ -\frac{u_y}{\rho} & 0 & \frac{1}{\rho} & 0 \\ (\gamma - 1)\frac{|u|^2}{2} & -(\gamma - 1) u_x & -(\gamma - 1) u_y & \gamma - 1 \end{pmatrix}\end{split}\]
Note:

See equation \((E16.2.11)\) in [3].

primitive_from_characteristic(U: flowfields, unit_vector: CoefficientFunction) CoefficientFunction

The \(\mat{L}_n\) matrix transforms characteristic variables to primitive variables

\[\begin{split}\mat{L}_n := \begin{pmatrix} \frac{0.5}{c^2} & \frac{1}{c^2} & 0 & \frac{0.5}{c^2} \\ -\frac{n_x}{2c\rho} & 0 & n_y & \frac{n_x}{2c\rho} \\ -\frac{n_y}{2c\rho} & 0 & -n_x & \frac{n_y}{2c\rho} \\ 0.5 & 0 & 0 & 0.5 \end{pmatrix}\end{split}\]
characteristic_from_primitive(U: flowfields, unit_vector: CoefficientFunction) CoefficientFunction

The \(\mat{L}^{-1}_n\) matrix transforms primitive variables to charactersitic variables

\[\begin{split}\mat{L}^{-1}_n := \begin{pmatrix} 0 & -\rho c n_x & -\rho c n_y & 1 \\ c^2 & 0 & 0 & -1 \\ 0 & n_y & -n_x & 0 \\ 0 & \rho c n_x & \rho c n_y & 1 \end{pmatrix}\end{split}\]
conservative_from_characteristic(U: flowfields, unit_vector: CoefficientFunction) CoefficientFunction

The \(\mat{P}_n\) matrix transforms characteristic variables to conservative variables

\[\begin{split}\mat{P}_n := \mat{M} \mat{L}_n = \begin{pmatrix} \frac{1}{2 c^{2}} & \frac{1}{c^{2}} & 0 & \frac{1}{2 c^{2}} \\ - \frac{n_{x}}{2 c} + \frac{u}{2 c^{2}} & \frac{u}{c^{2}} & \rho n_{y} & \frac{n_{x}}{2 c} + \frac{u}{2 c^{2}} \\ - \frac{n_{y}}{2 c} + \frac{v}{2 c^{2}} & \frac{v}{c^{2}} & - \rho n_{x} & \frac{n_{y}}{2 c} + \frac{v}{2 c^{2}} \\ \frac{1}{2(\gamma - 1)} - \frac{u_{n}}{2 c} + \frac{|\vec{u}|^2}{4 c^{2}} & \frac{|\vec{u}|^2}{2c^{2}} & \rho u n_{y} - \rho v n_{x} & \frac{1}{2(\gamma - 1)} + \frac{u_{n}}{2 c} + \frac{|\vec{u}|^2}{4 c^{2}} \end{pmatrix}\end{split}\]
characteristic_from_conservative(U: flowfields, unit_vector: CoefficientFunction) CoefficientFunction

The \(\mat{P}^{-1}_n\) matrix transforms conservative variables to characteristic variables

\[\begin{split}\mat{P}^{-1}_n := \mat{M}^{-1} \mat{L}^{-1}_n = \begin{pmatrix} c u_{n} + \frac{\gamma - 1}{2}|\vec{u}|^2 & - c n_{x} + u (1 - \gamma) & - c n_{y} + v (1 - \gamma) & \gamma - 1 \\ c^{2} - \frac{\gamma - 1}{2}|\vec{u}|^2 & - u (1 - \gamma) & - v (1 - \gamma) & 1 - \gamma \\ - \frac{u n_{y}}{\rho} + \frac{v n_{x}}{\rho} & \frac{n_{y}}{\rho} & - \frac{n_{x}}{\rho} & 0 \\ - c u_{n} + \frac{\gamma - 1}{2}|\vec{u}|^2 & c n_{x} + u (1 - \gamma) & c n_{y} + v (1 - \gamma) & \gamma - 1 \end{pmatrix}\end{split}\]
conservative_convective_jacobian_x(U: flowfields) CoefficientFunction

Convective flux Jacobian \(\mat{A}\) in x-direction

\[\begin{split}\mat{A} := \begin{pmatrix} 0 & 1 & 0 & 0 \\ \frac{\gamma - 3}{2} u_x^2 + \frac{\gamma - 1}{2} u_y^2 & (3 - \gamma) u_x & -(\gamma - 1) u_y & \gamma - 1\\ -u_x u_y & u_y & u_x & 0 \\ -\gamma u_x E + (\gamma - 1) u_x |\vec{u}|^2 & \gamma E - \frac{\gamma - 1}{2} (u_y^2 + 3 u_x^2)& -(\gamma - 1) u_x u_y & \gamma u_x \end{pmatrix}\end{split}\]
Note:

See equation \((E16.2.5)\) in [3].

conservative_convective_jacobian_y(U: flowfields) CoefficientFunction

Convective flux Jacobian \(\mat{B}\) in y-direction

\[\begin{split}\mat{B} := \begin{pmatrix} 0 & 0 & 1 & 0 \\ -u_x u_y & u_y & u_x& 0 \\ \frac{\gamma - 3}{2} u_y^2 + \frac{\gamma - 1}{2} u_x^2& -(\gamma - 1) u_x& (3 - \gamma) u_y & \gamma - 1 \\ -\gamma u_y E + (\gamma - 1) u_y |\vec{u}|^2 & -(\gamma - 1) u_x u_y & \gamma E - \frac{\gamma - 1}{2} (u_x^2 + 3 u_y^2) & \gamma u_y \end{pmatrix}\end{split}\]
Note:

See equation \((E16.2.6)\) in [3].

isentropic_density(U: flowfields, Uref: flowfields) CoefficientFunction

Returns the isentropic density from given fields

\[\begin{split}(1) \quad \rho &= \rho_{ref} (\frac{T}{T_{ref}})^{\frac{1}{\gamma - 1}}, \\ (2) \quad \rho &= \rho_{ref} (\frac{p}{p_{ref}})^{\frac{1}{\gamma}}.\end{split}\]