PrimitiveFromConservative.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
9 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
10
11 /// \cond
12 namespace gsl {
13 template <typename T>
14 class not_null;
15 } // namespace gsl
16 /// \endcond
17
18 // IWYU pragma: no_forward_declare EquationsOfState::EquationOfState
19
20 namespace RelativisticEuler {
21 namespace Valencia {
22
23 /*!
24  * \brief Compute the primitive variables from the conservative variables
25  *
26  * For the Valencia formulation of the Relativistic Euler system, the conversion
27  * of the evolved conserved variables to the primitive variables cannot
28  * be expressed in closed analytic form and requires a root find. We use
29  * the method from [Appendix C of Galeazzi \em et \em al, PRD 88, 064009 (2013)]
30  * (https://journals.aps.org/prd/abstract/10.1103/PhysRevD.88.064009). The
31  * method finds the root of \f[ f(z) = z - \frac{r}{h(z)} \f] where
32  * \f{align*}
33  * r = & \frac{\sqrt{\gamma^{mn} {\tilde S}_m {\tilde S}_n}}{\tilde D} \\
34  * h(z) = & [1+ \epsilon(z)][1 + a(z)] \\
35  * \epsilon(z) = & W(z) q - z r + \frac{z^2}{1 + W(z)} \\
36  * W(z) = & \sqrt{1 + z^2} \\
37  * q = & \frac{\tilde \tau}{\tilde D} \\
38  * a(z) = & \frac{p}{\rho(z) [1 + \epsilon(z)]} \\
39  * \rho(z) = & \frac{\tilde D}{\sqrt{\gamma} W(z)}
40  * \f}
41  * and where the conserved variables \f${\tilde D}\f$, \f${\tilde S}_i\f$, and
42  * \f${\tilde \tau}\f$ are a generalized mass-energy density, momentum density,
43  * and specific internal energy density as measured by an Eulerian observer,
44  * \f$\gamma\f$ and \f$\gamma^{mn}\f$ are the determinant and inverse of the
45  * spatial metric \f$\gamma_{mn}\f$, \f$\rho\f$ is the rest mass density, \f$W = 46 * 1/\sqrt{1 - \gamma_{mn} v^m v^n}\f$ is the Lorentz factor, \f$h = 1 + 47 * \epsilon + \frac{p}{\rho}\f$ is the specific enthalpy, \f$v^i\f$ is the
48  * spatial velocity, \f$\epsilon\f$ is the specific internal energy, and \f$p\f$
49  * is the pressure. The pressure is determined from the equation of state.
50  * Finally, once \f$z\f$ is found, the spatial velocity is given by \f[ v^i =
51  * \frac{{\tilde S}^i}{{\tilde D} W(z) h(z)} \f]
52  *
53  * \todo The method also will make corrections if physical bounds are violated,
54  * see the paper for details.
55  */
56 template <size_t ThermodynamicDim, typename DataType, size_t Dim>
58  gsl::not_null<Scalar<DataType>*> rest_mass_density,
59  gsl::not_null<Scalar<DataType>*> specific_internal_energy,
60  gsl::not_null<Scalar<DataType>*> lorentz_factor,
63  gsl::not_null<tnsr::I<DataType, Dim, Frame::Inertial>*> spatial_velocity,
64  const Scalar<DataType>& tilde_d, const Scalar<DataType>& tilde_tau,
65  const tnsr::i<DataType, Dim, Frame::Inertial>& tilde_s,
66  const tnsr::II<DataType, Dim, Frame::Inertial>& inv_spatial_metric,
67  const Scalar<DataType>& sqrt_det_spatial_metric,
69  equation_of_state) noexcept;
70 } // namespace Valencia
71 } // namespace RelativisticEuler
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
Base class for equations of state depending on whether or not the system is relativistic, and the number of independent thermodynamic variables (ThermodynamicDim) needed to determine the pressure.
Definition: EquationOfState.hpp:63
void primitive_from_conservative(gsl::not_null< tnsr::I< DataType, Dim > *> velocity, gsl::not_null< Scalar< DataType > *> specific_internal_energy, const Scalar< DataType > &mass_density, const tnsr::I< DataType, Dim > &momentum_density, const Scalar< DataType > &energy_density) noexcept
Compute the primitive variables from the conservative variables.
Items related to evolving the relativistic Euler system.
Definition: Characteristics.hpp:21
Scalar< DataType > specific_enthalpy(const Scalar< DataType > &rest_mass_density, const Scalar< DataType > &specific_internal_energy, const Scalar< DataType > &pressure) noexcept
Computes the relativistic specific enthalpy as: where is the specific internal energy...
Defines a list of useful type aliases for tensors.
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12