Fluxes.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/Prefixes.hpp" // IWYU pragma: keep
9 #include "DataStructures/Tensor/TypeAliases.hpp" // IWYU pragma: keep
10 #include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp" // IWYU pragma: keep
11 #include "Utilities/TMPL.hpp"
12 
13 // IWYU pragma: no_forward_declare Tensor
14 
15 /// \cond
16 namespace gsl {
17 template <typename T>
18 class not_null;
19 } // namespace gsl
20 
21 class DataVector;
22 /// \endcond
23 
24 namespace NewtonianEuler {
25 
26 /*!
27  * \brief Compute the fluxes of the conservative variables of the
28  * Newtonian Euler system
29  *
30  * The fluxes are \f$(\text{Dim} + 2)\f$ vectors of
31  * dimension \f$\text{Dim}\f$. Denoting the flux of the conservative
32  * variable \f$u\f$ as \f$F(u)\f$, one has
33  *
34  * \f{align*}
35  * F^i(\rho) &= S^i\\
36  * F^i(S^j) &= S^i v^j + \delta^{ij}p\\
37  * F^i(e) &= (e + p)v^i
38  * \f}
39  *
40  * where \f$S^i\f$ is the momentum density, \f$e\f$ is the energy density,
41  * \f$v^i\f$ is the velocity, \f$p\f$ is the pressure, and \f$\delta^{ij}\f$
42  * is the Kronecker delta. This form of the fluxes combines conservative and
43  * primitive variables (while the velocity appears explicitly, the pressure
44  * implicitly depends, for instance, on the mass density and the specific
45  * internal energy), so the conversion from one variable set to the other
46  * must be known prior to calling this function.
47  */
48 template <size_t Dim>
49 struct ComputeFluxes {
50  using return_tags =
51  tmpl::list<::Tags::Flux<Tags::MassDensity<DataVector>, tmpl::size_t<Dim>,
54  tmpl::size_t<Dim>, Frame::Inertial>,
56  tmpl::size_t<Dim>, Frame::Inertial>>;
57 
58  using argument_tags =
59  tmpl::list<Tags::MomentumDensity<DataVector, Dim>,
62 
63  static void apply(
64  gsl::not_null<tnsr::I<DataVector, Dim>*> mass_density_flux,
65  gsl::not_null<tnsr::IJ<DataVector, Dim>*> momentum_density_flux,
66  gsl::not_null<tnsr::I<DataVector, Dim>*> energy_density_flux,
67  const tnsr::I<DataVector, Dim>& momentum_density,
68  const Scalar<DataVector>& energy_density,
69  const tnsr::I<DataVector, Dim>& velocity,
70  const Scalar<DataVector>& pressure) noexcept;
71 };
72 
73 } // namespace NewtonianEuler
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
void velocity(gsl::not_null< tnsr::I< DataType, Dim > *> velocity, const Scalar< DataType > &mass_density, const tnsr::I< DataType, Dim > &momentum_density) noexcept
Compute the velocity from the conservative variables.
The macroscopic or flow velocity of the fluid.
Definition: Tags.hpp:42
Define prefixes for DataBox tags.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
The energy density of the fluid.
Definition: Tags.hpp:35
Compute the fluxes of the conservative variables of the Newtonian Euler system.
Definition: Fluxes.hpp:49
Prefix indicating a flux.
Definition: Prefixes.hpp:38
The fluid pressure.
Definition: Tags.hpp:58
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Definition: IndexType.hpp:44
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12
Items related to evolving the Newtonian Euler system.
Definition: Characteristics.hpp:17