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