SoundSpeedSquared.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 #include "DataStructures/DataBox/Tag.hpp"
10 #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
11 #include "Utilities/Gsl.hpp"
12 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 namespace EquationsOfState {
16 template <bool IsRelativistic, size_t ThermodynamicDim>
17 class EquationOfState;
18 } // namespace EquationsOfState
19 /// \endcond
20 
21 namespace hydro {
22 //@{
23 /*!
24  * \ingroup EquationsOfStateGroup
25  * \brief Computes the relativistic sound speed squared
26  *
27  * The relativistic sound speed squared is given by
28  * \f$c_s^2 = \left(\chi + p\kappa / \rho^2\right)/h\f$, where
29  * \f$p\f$ is the fluid pressure, \f$\rho\f$ is the rest mass density,
30  * \f$h = 1 + \epsilon + p / \rho\f$ is the specific enthalpy
31  * \f$\chi = (\partial p/\partial\rho)_\epsilon\f$ and
32  * \f$\kappa = (\partial p/ \partial \epsilon)_\rho\f$, where
33  * \f$\epsilon\f$ is the specific internal energy.
34  */
35 template <typename DataType, size_t ThermodynamicDim>
38  const Scalar<DataType>& rest_mass_density,
39  const Scalar<DataType>& specific_internal_energy,
40  const Scalar<DataType>& specific_enthalpy,
42  equation_of_state) noexcept;
43 
44 template <typename DataType, size_t ThermodynamicDim>
46  const Scalar<DataType>& rest_mass_density,
47  const Scalar<DataType>& specific_internal_energy,
48  const Scalar<DataType>& specific_enthalpy,
50  equation_of_state) noexcept;
51 //@}
52 
53 namespace Tags {
54 /// Compute item for the sound speed squared \f$c_s^2\f$.
55 /// \see hydro::sound_speed_squared
56 ///
57 /// Can be retrieved using `hydro::Tags::SoundSpeedSquared`
58 template <typename DataType>
60  using argument_tags = typename tmpl::list<
63 
64  using return_type = Scalar<DataType>;
65 
66  template <typename EquationOfStateType>
67  static void function(const gsl::not_null<Scalar<DataType>*> result,
68  const Scalar<DataType>& rest_mass_density,
69  const Scalar<DataType>& specific_internal_energy,
70  const Scalar<DataType>& specific_enthalpy,
71  const EquationOfStateType& equation_of_state) noexcept {
72  sound_speed_squared(result, rest_mass_density, specific_internal_energy,
73  specific_enthalpy, equation_of_state);
74  }
75 
77 };
78 } // namespace Tags
79 } // namespace hydro
The specific internal energy .
Definition: Tags.hpp:173
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
Compute item for the sound speed squared .
Definition: SoundSpeedSquared.hpp:59
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
Base tag for the equation of state.
Definition: Tags.hpp:53
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
Scalar< DataType > sound_speed_squared(const Scalar< DataType > &rest_mass_density, const Scalar< DataType > &specific_internal_energy, const Scalar< DataType > &specific_enthalpy, const EquationsOfState::EquationOfState< true, ThermodynamicDim > &equation_of_state) noexcept
Computes the relativistic sound speed squared.
Definition: DataBoxTag.hpp:27
Defines a list of useful type aliases for tensors.
Wraps the template metaprogramming library used (brigand)
Items related to hydrodynamic systems.
Definition: LorentzFactor.hpp:20
Defines functions and classes from the GSL.
The rest-mass density .
Definition: Tags.hpp:125
The sound speed squared .
Definition: Tags.hpp:131
The relativistic specific enthalpy .
Definition: Tags.hpp:167
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182