PrimitiveFromConservative.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
9
10 /// \cond
11 namespace gsl {
12 template <typename T>
13 class not_null;
14 } // namespace gsl
15 /// \endcond
16
17 namespace NewtonianEuler {
18 // @{
19 /*!
20  * \brief Compute the velocity from the conservative variables.
21  */
22 template <size_t Dim, typename DataType>
23 void velocity(gsl::not_null<tnsr::I<DataType, Dim>*> velocity,
24  const Scalar<DataType>& mass_density,
25  const tnsr::I<DataType, Dim>& momentum_density) noexcept;
26
27 template <size_t Dim, typename DataType>
28 tnsr::I<DataType, Dim> velocity(
29  const Scalar<DataType>& mass_density,
30  const tnsr::I<DataType, Dim>& momentum_density) noexcept;
31 // @}
32
33 /*!
34  * \brief Compute the primitive variables from the conservative variables.
35  *
36  * \f{align*}
37  * v^i &= \frac{S^i}{\rho} \\
38  * \epsilon &= \frac{e}{\rho} - \frac{1}{2}\frac{S^2}{\rho^2}
39  * \f}
40  *
41  * where \f$v^i\f$ is the velocity, \f$\epsilon\f$ is the specific
42  * internal energy, \f$e\f$ is the energy density, \f$\rho\f$
43  * is the mass density, \f$S^i\f$ is the momentum density, and
44  * \f$S^2\f$ is the momentum density squared.
45  */
46 template <size_t Dim, typename DataType>
48  gsl::not_null<tnsr::I<DataType, Dim>*> velocity,
49  gsl::not_null<Scalar<DataType>*> specific_internal_energy,
50  const Scalar<DataType>& mass_density,
51  const tnsr::I<DataType, Dim>& momentum_density,
52  const Scalar<DataType>& energy_density) noexcept;
53
54 } // namespace NewtonianEuler
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
void velocity(gsl::not_null< tnsr::I< DataType, Dim > *> velocity, const Scalar< DataType > &mass_density, const tnsr::I< DataType, Dim > &momentum_density) noexcept
Compute the velocity from the conservative variables.
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.
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
Items related to evolving the Newtonian Euler system.
Definition: Characteristics.hpp:17