SoundSpeedSquared.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
10 #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
11 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp" // IWYU pragma: keep
12 #include "PointwiseFunctions/Hydro/Tags.hpp" // IWYU pragma: keep
13 #include "Utilities/TMPL.hpp"
14 
15 // IWYU pragma: no_forward_declare EquationsOfState::EquationOfState
16 // IWYU pragma: no_forward_declare hydro::Tags::EquationOfState
17 
18 namespace NewtonianEuler {
19 /// Computes the Newtonian sound speed squared
20 /// \f$c_s^2 = \chi + p\kappa / \rho^2\f$, where
21 /// \f$p\f$ is the fluid pressure, \f$\rho\f$ is the mass density,
22 /// \f$\chi = (\partial p/\partial\rho)_\epsilon\f$ and
23 /// \f$\kappa = (\partial p/ \partial \epsilon)_\rho\f$, where
24 /// \f$\epsilon\f$ is the specific internal energy.
25 template <typename DataType, size_t ThermodynamicDim>
27  const Scalar<DataType>& mass_density,
28  const Scalar<DataType>& specific_internal_energy,
30  equation_of_state) noexcept;
31 
32 namespace Tags {
33 /// Compute item for the sound speed squared \f$c_s^2\f$.
34 /// \see NewtonianEuler::sound_speed_squared
35 ///
36 /// Can be retrieved using `NewtonianEuler::Tags::SoundSpeedSquared`
37 template <typename DataType>
39  template <typename EquationOfStateType>
40  static Scalar<DataType> function(
41  const Scalar<DataType>& mass_density,
42  const Scalar<DataType>& specific_internal_energy,
43  const EquationOfStateType& equation_of_state) noexcept {
44  return sound_speed_squared(mass_density, specific_internal_energy,
45  equation_of_state);
46  }
47  using argument_tags =
48  tmpl::list<MassDensity<DataType>, SpecificInternalEnergy<DataType>,
50 };
51 
52 /// Compute item for the sound speed \f$c_s\f$.
53 ///
54 /// Can be retrieved using `NewtonianEuler::Tags::SoundSpeed`
55 template <typename DataType>
57  static Scalar<DataType> function(
58  const Scalar<DataType>& sound_speed_squared) noexcept {
59  return Scalar<DataType>{sqrt(get(sound_speed_squared))};
60  }
61  using argument_tags = tmpl::list<SoundSpeedSquared<DataType>>;
62 };
63 } // namespace Tags
64 } // namespace NewtonianEuler
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
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:154
Base tag for the equation of state.
Definition: Tags.hpp:57
The square of the sound speed.
Definition: Tags.hpp:89
Compute item for the sound speed squared .
Definition: SoundSpeedSquared.hpp:38
The sound speed.
Definition: Tags.hpp:82
The specific internal energy of the fluid.
Definition: Tags.hpp:68
Scalar< DataType > sound_speed_squared(const Scalar< DataType > &mass_density, const Scalar< DataType > &specific_internal_energy, const EquationsOfState::EquationOfState< false, ThermodynamicDim > &equation_of_state) noexcept
Computes the Newtonian sound speed squared , where is the fluid pressure, is the mass density...
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
Wraps the template metaprogramming library used (brigand)
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Compute item for the sound speed .
Definition: SoundSpeedSquared.hpp:56
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8