SoundSpeedSquared.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
8 #include "DataStructures/DataBox/Tag.hpp"
10 #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
11 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
12 #include "PointwiseFunctions/Hydro/Tags.hpp"
13 #include "Utilities/Gsl.hpp"
14 #include "Utilities/TMPL.hpp"
15
16 namespace NewtonianEuler {
17 /// @{
18 /*!
19  * Compute 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  */
26 template <typename DataType, size_t ThermodynamicDim>
29  const Scalar<DataType>& mass_density,
30  const Scalar<DataType>& specific_internal_energy,
32  equation_of_state) noexcept;
33
34 template <typename DataType, size_t ThermodynamicDim>
36  const Scalar<DataType>& mass_density,
37  const Scalar<DataType>& specific_internal_energy,
39  equation_of_state) noexcept;
40 /// @}
41
42 namespace Tags {
43 /// Compute item for the sound speed \f$c_s\f$.
44 ///
45 /// Can be retrieved using NewtonianEuler::Tags::SoundSpeed
46 template <typename DataType>
48  using argument_tags = tmpl::list<SoundSpeedSquared<DataType>>;
49
50  using return_type = Scalar<DataType>;
51
52  static void function(const gsl::not_null<Scalar<DataType>*> result,
53  const Scalar<DataType>& sound_speed_squared) noexcept {
54  get(*result) = sqrt(get(sound_speed_squared));
55  }
56
57  using base = SoundSpeed<DataType>;
58 };
59
60 /// Compute item for the sound speed squared \f$c_s^2\f$.
61 /// \see NewtonianEuler::sound_speed_squared
62 ///
63 /// Can be retrieved using NewtonianEuler::Tags::SoundSpeedSquared
64 template <typename DataType>
66  using argument_tags =
67  tmpl::list<MassDensity<DataType>, SpecificInternalEnergy<DataType>,
69
70  using return_type = Scalar<DataType>;
71
72  template <typename EquationOfStateType>
73  static void function(const gsl::not_null<Scalar<DataType>*> result,
74  const Scalar<DataType>& mass_density,
75  const Scalar<DataType>& specific_internal_energy,
76  const EquationOfStateType& equation_of_state) noexcept {
77  sound_speed_squared(result, mass_density, specific_internal_energy,
78  equation_of_state);
79  }
80
82 };
83 } // namespace Tags
84 } // namespace NewtonianEuler
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
sqrt
auto sqrt(const TensorExpression< T, typename T::type, tmpl::list<>, tmpl::list<>, tmpl::list<>> &t)
Returns the tensor expression representing the square root of a tensor expression that evaluates to a...
Definition: SquareRoot.hpp:83
NewtonianEuler::Tags::SoundSpeedCompute
Compute item for the sound speed .
Definition: SoundSpeedSquared.hpp:47
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
db::get
const auto & get(const DataBox< TagList > &box) noexcept
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:791
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
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:65
cstddef
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.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