MachNumber.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 "Evolution/Systems/NewtonianEuler/Tags.hpp"
11 #include "PointwiseFunctions/Hydro/Tags.hpp"
12 #include "Utilities/Gsl.hpp"
13 #include "Utilities/TMPL.hpp"
14 
15 namespace NewtonianEuler {
16 /// @{
17 /*!
18  * Compute the local Mach number, \f$\text{Ma} = v/c_s\f$,
19  * where \f$v\f$ is the magnitude of the velocity, and
20  * \f$c_s\f$ is the sound speed.
21  */
22 template <typename DataType, size_t Dim, typename Fr>
24  const tnsr::I<DataType, Dim, Fr>& velocity,
25  const Scalar<DataType>& sound_speed) noexcept;
26 
27 template <typename DataType, size_t Dim, typename Fr>
28 Scalar<DataType> mach_number(const tnsr::I<DataType, Dim, Fr>& velocity,
29  const Scalar<DataType>& sound_speed) noexcept;
30 /// @}
31 
32 namespace Tags {
33 /// Compute item for the local Mach number, \f$\text{Ma}\f$.
34 /// \see NewtonianEuler::mach_number
35 ///
36 /// Can be retrieved using `NewtonianEuler::Tags::MachNumber`
37 template <typename DataType, size_t Dim, typename Fr = Frame::Inertial>
39  using base = MachNumber<DataType>;
40 
41  using argument_tags =
42  tmpl::list<Velocity<DataType, Dim, Fr>, SoundSpeed<DataType>>;
43 
44  using return_type = Scalar<DataType>;
45 
46  static constexpr auto function = static_cast<void (*)(
47  const gsl::not_null<Scalar<DataType>*>, const tnsr::I<DataType, Dim, Fr>&,
48  const Scalar<DataType>&)>(&mach_number<DataType, Dim, Fr>);
49 };
50 } // namespace Tags
51 } // namespace NewtonianEuler
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
NewtonianEuler::mach_number
void mach_number(gsl::not_null< Scalar< DataType > * > result, const tnsr::I< DataType, Dim, Fr > &velocity, const Scalar< DataType > &sound_speed) noexcept
NewtonianEuler
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8
NewtonianEuler::Tags::MachNumber
The local Mach number of the flow.
Definition: Tags.hpp:116
cstddef
NewtonianEuler::Tags::MachNumberCompute
Compute item for the local Mach number, .
Definition: MachNumber.hpp:38
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
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: ReadSpecPiecewisePolynomial.hpp:13