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/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 kinetic energy density, \f$\rho v^2/2\f$,
20 : * where \f$\rho\f$ is the mass density, and \f$v\f$ is the
21 : * magnitude of the velocity.
22 : */
23 : template <typename DataType, size_t Dim, typename Fr>
24 1 : void kinetic_energy_density(gsl::not_null<Scalar<DataType>*> result,
25 : const Scalar<DataType>& mass_density,
26 : const tnsr::I<DataType, Dim, Fr>& velocity);
27 :
28 : template <typename DataType, size_t Dim, typename Fr>
29 1 : Scalar<DataType> kinetic_energy_density(
30 : const Scalar<DataType>& mass_density,
31 : const tnsr::I<DataType, Dim, Fr>& velocity);
32 : /// @}
33 :
34 : namespace Tags {
35 : /// Compute item for the kinetic energy density, \f$\rho v^2/2\f$.
36 : /// \see NewtonianEuler::kinetic_energy_density
37 : ///
38 : /// Can be retrieved using `NewtonianEuler::Tags::KineticEnergyDensity`
39 : template <typename DataType, size_t Dim, typename Fr = Frame::Inertial>
40 1 : struct KineticEnergyDensityCompute : KineticEnergyDensity<DataType>,
41 : db::ComputeTag {
42 0 : using base = KineticEnergyDensity<DataType>;
43 :
44 0 : using argument_tags =
45 : tmpl::list<hydro::Tags::RestMassDensity<DataType>,
46 : hydro::Tags::SpatialVelocity<DataType, Dim, Fr>>;
47 :
48 0 : using return_type = Scalar<DataType>;
49 :
50 0 : static constexpr auto function = static_cast<void (*)(
51 : const gsl::not_null<Scalar<DataType>*>, const Scalar<DataType>&,
52 : const tnsr::I<DataType, Dim, Fr>&)>(
53 : &kinetic_energy_density<DataType, Dim, Fr>);
54 : };
55 : } // namespace Tags
56 : } // namespace NewtonianEuler
|