ConservativeFromPrimitive.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
9
10 namespace gsl {
11 template <typename T>
12 class not_null;
13 } // namespace gsl
14
15 namespace RelativisticEuler {
16 namespace Valencia {
17
18 /*!
19  * \brief Compute the conservative variables from primitive variables
20  *
21  * \f{align*}
22  * {\tilde D} = & \sqrt{\gamma} \rho W \\
23  * {\tilde S}_i = & \sqrt{\gamma} \rho h W^2 v_i \\
24  * {\tilde \tau} = & \sqrt{\gamma} \left( \rho h W^2 - p - \rho W \right)
25  * \f}
26  * where \f${\tilde D}\f$, \f${\tilde S}_i\f$, and \f${\tilde \tau}\f$ are a
27  * generalized mass-energy density, momentum density, and specific internal
28  * energy density as measured by an Eulerian observer, \f$\gamma\f$ is the
29  * determinant of the spatial metric, \f$\rho\f$ is the rest mass density,
30  * \f$W = 1/\sqrt{1-v_i v^i}\f$ is the Lorentz factor, \f$h = 1 + \epsilon + 31 * \frac{p}{\rho}\f$ is the specific enthalpy, \f$v_i\f$ is the spatial
32  * velocity, \f$\epsilon\f$ is the specific internal energy, and \f$p\f$ is the
33  * pressure.
34  *
35  * Using the definitions of the Lorentz factor and the specific enthalpy, the
36  * last equation can be rewritten in a form that has a well-behaved Newtonian
37  * limit: \f[
38  * {\tilde \tau} = \sqrt{\gamma} W^2 \left[ \rho \left( \epsilon + v^2
39  * \frac{W}{W + 1} \right) + p v^2 \right] .\f]
40  */
41 template <typename DataType, size_t Dim>
42 void conservative_from_primitive(
44  gsl::not_null<Scalar<DataType>*> tilde_tau,
45  gsl::not_null<tnsr::i<DataType, Dim, Frame::Inertial>*> tilde_s,
46  const Scalar<DataType>& rest_mass_density,
47  const Scalar<DataType>& specific_internal_energy,
48  const tnsr::i<DataType, Dim, Frame::Inertial>& spatial_velocity_oneform,
49  const Scalar<DataType>& spatial_velocity_squared,
50  const Scalar<DataType>& lorentz_factor,
51  const Scalar<DataType>& specific_enthalpy, const Scalar<DataType>& pressure,
52  const Scalar<DataType>& sqrt_det_spatial_metric) noexcept;
53 } // namespace Valencia
54 } // namespace RelativisticEuler
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
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