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"
9 #include "DataStructures/DataVector.hpp"
12 #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
13 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp" // IWYU pragma: keep
14 #include "PointwiseFunctions/Hydro/Tags.hpp" // IWYU pragma: keep
15 #include "Utilities/Gsl.hpp"
16 #include "Utilities/TMPL.hpp"
17 
18 // IWYU pragma: no_forward_declare EquationsOfState::EquationOfState
19 // IWYU pragma: no_forward_declare hydro::Tags::EquationOfState
20 
21 namespace NewtonianEuler {
22 //@{
23 /// Computes the Newtonian sound speed squared
24 /// \f$c_s^2 = \chi + p\kappa / \rho^2\f$, where
25 /// \f$p\f$ is the fluid pressure, \f$\rho\f$ is the mass density,
26 /// \f$\chi = (\partial p/\partial\rho)_\epsilon\f$ and
27 /// \f$\kappa = (\partial p/ \partial \epsilon)_\rho\f$, where
28 /// \f$\epsilon\f$ is the specific internal energy.
29 template <typename DataType, size_t ThermodynamicDim>
32  const Scalar<DataType>& mass_density,
33  const Scalar<DataType>& specific_internal_energy,
35  equation_of_state) noexcept;
36 
37 template <typename DataType, size_t ThermodynamicDim>
39  const Scalar<DataType>& mass_density,
40  const Scalar<DataType>& specific_internal_energy,
42  equation_of_state) noexcept;
43 //@}
44 
45 namespace Tags {
46 /// Compute item for the sound speed squared \f$c_s^2\f$.
47 /// \see NewtonianEuler::sound_speed_squared
48 ///
49 /// Can be retrieved using `NewtonianEuler::Tags::SoundSpeedSquared`
50 template <typename DataType>
52  using argument_tags =
53  tmpl::list<MassDensity<DataType>, SpecificInternalEnergy<DataType>,
55 
56  using return_type = Scalar<DataType>;
57 
58  template <typename EquationOfStateType>
59  static void function(const gsl::not_null<Scalar<DataType>*> result,
60  const Scalar<DataType>& mass_density,
61  const Scalar<DataType>& specific_internal_energy,
62  const EquationOfStateType& equation_of_state) noexcept {
63  sound_speed_squared(result, mass_density, specific_internal_energy,
64  equation_of_state);
65  }
66 
68 };
69 
70 /// Compute item for the sound speed \f$c_s\f$.
71 ///
72 /// Can be retrieved using `NewtonianEuler::Tags::SoundSpeed`
73 template <typename DataType>
75  using argument_tags = tmpl::list<SoundSpeedSquared<DataType>>;
76 
77  using return_type = Scalar<DataType>;
78 
79  static void function(const gsl::not_null<Scalar<DataType>*> result,
80  const Scalar<DataType>& sound_speed_squared) noexcept {
81  get(*result) = sqrt(get(sound_speed_squared));
82  }
83 
84  using base = SoundSpeed<DataType>;
85 };
86 } // namespace Tags
87 } // namespace NewtonianEuler
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
get
constexpr Tag::type & get(Variables< TagList > &v) noexcept
Return Tag::type pointing into the contiguous array.
Definition: Variables.hpp:639
NewtonianEuler::Tags::SoundSpeedCompute
Compute item for the sound speed .
Definition: SoundSpeedSquared.hpp:74
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
NewtonianEuler::Tags::SpecificInternalEnergy
The specific internal energy of the fluid.
Definition: Tags.hpp:60
NewtonianEuler
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8
NewtonianEuler::sound_speed_squared
void sound_speed_squared(gsl::not_null< Scalar< DataType > * > result, 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,...
NewtonianEuler::Tags::SoundSpeedSquared
The square of the sound speed.
Definition: Tags.hpp:78
NewtonianEuler::Tags::SoundSpeedSquaredCompute
Compute item for the sound speed squared .
Definition: SoundSpeedSquared.hpp:51
cstddef
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
TypeAliases.hpp
hydro::Tags::EquationOfStateBase
Base tag for the equation of state.
Definition: Tags.hpp:53
Tensor.hpp
NewtonianEuler::Tags::SoundSpeed
The sound speed.
Definition: Tags.hpp:72
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183