Line data Source code
1 0 : // 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/Tensor/Tensor.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> 23 1 : void mach_number(gsl::not_null<Scalar<DataType>*> result, 24 : const tnsr::I<DataType, Dim, Fr>& velocity, 25 : const Scalar<DataType>& sound_speed); 26 : 27 : template <typename DataType, size_t Dim, typename Fr> 28 1 : Scalar<DataType> mach_number(const tnsr::I<DataType, Dim, Fr>& velocity, 29 : const Scalar<DataType>& sound_speed); 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> 38 1 : struct MachNumberCompute : MachNumber<DataType>, db::ComputeTag { 39 0 : using base = MachNumber<DataType>; 40 : 41 0 : using argument_tags = 42 : tmpl::list<hydro::Tags::SpatialVelocity<DataType, Dim, Fr>, 43 : SoundSpeed<DataType>>; 44 : 45 0 : using return_type = Scalar<DataType>; 46 : 47 0 : static constexpr auto function = static_cast<void (*)( 48 : const gsl::not_null<Scalar<DataType>*>, const tnsr::I<DataType, Dim, Fr>&, 49 : const Scalar<DataType>&)>(&mach_number<DataType, Dim, Fr>); 50 : }; 51 : } // namespace Tags 52 : } // namespace NewtonianEuler