MassFlux.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
10 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" // IWYU pragma: keep
11 #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp" // IWYU pragma: keep
12 #include "Utilities/TMPL.hpp"
13 
14 // IWYU pragma: no_forward_declare gr::Tags::Lapse
15 // IWYU pragma: no_forward_declare gr::Tags::Shift
16 // IWYU pragma: no_forward_declare gr::Tags::SqrtDetSpatialMetric
17 // IWYU pragma: no_forward_declare hydro::Tags::LorentzFactor
18 // IWYU pragma: no_forward_declare hydro::Tags::RestMassDensity
19 // IWYU pragma: no_forward_declare hydro::Tags::SpatialVelocity
20 
21 namespace hydro {
22 /// Computes the vector \f$J^i\f$ in \f$\dot{M} = -\int J^i s_i d^2S\f$,
23 /// representing the mass flux through a surface with normal \f$s_i\f$.
24 ///
25 /// Note that the integral is understood
26 /// as a flat-space integral: all metric factors are included in \f$J^i\f$.
27 /// In particular, if the integral is done over a Strahlkorper, the
28 /// `StrahlkorperGr::euclidean_area_element` of the Strahlkorper should be used,
29 /// and \f$s_i\f$ is
30 /// the normal one-form to the Strahlkorper normalized with the flat metric,
31 /// \f$s_is_j\delta^{ij}=1\f$.
32 ///
33 /// The formula is
34 /// \f$ J^i = \rho W \sqrt{\gamma}(\alpha v^i-\beta^i)\f$,
35 /// where \f$\rho\f$ is the mass density, \f$W\f$ is the Lorentz factor,
36 /// \f$v^i\f$ is the spatial velocity of the fluid,
37 /// \f$\gamma\f$ is the determinant of the 3-metric \f$\gamma_{ij}\f$,
38 /// \f$\alpha\f$ is the lapse, and \f$\beta^i\f$ is the shift.
39 template <typename DataType, size_t Dim, typename Frame>
40 tnsr::I<DataType, Dim, Frame> mass_flux(
41  const Scalar<DataType>& rest_mass_density,
42  const tnsr::I<DataType, Dim, Frame>& spatial_velocity,
44  const tnsr::I<DataType, Dim, Frame>& shift,
45  const Scalar<DataType>& sqrt_det_spatial_metric) noexcept;
46 
47 namespace Tags {
48 /// Compute item for mass flux vector \f$J^i\f$.
49 ///
50 /// Can be retrieved using `hydro::Tags::MassFlux`
51 template <typename DataType, size_t Dim, typename Frame>
52 struct MassFluxCompute : MassFlux<DataType, Dim, Frame>,
54  static constexpr auto function = &mass_flux<DataType, Dim, Frame>;
55  using argument_tags =
56  tmpl::list<hydro::Tags::RestMassDensity<DataType>,
62 };
63 } // namespace Tags
64 } // namespace hydro
Scalar< DataType > lorentz_factor(const tnsr::I< DataType, Dim, Fr > &spatial_velocity, const tnsr::i< DataType, Dim, Fr > &spatial_velocity_form) noexcept
Computes the Lorentz factor .
The spatial velocity of the fluid, where . Here is the spatial part of the 4-velocity of the fluid...
Definition: Tags.hpp:157
Definition: Tags.hpp:49
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:155
Definition: Tags.hpp:59
The vector in , representing the mass flux through a surface with normal .
Definition: Tags.hpp:213
The Lorentz factor , where is the spatial velocity of the fluid.
Definition: Tags.hpp:69
Definition: Tags.hpp:54
Definition: DataBoxTag.hpp:29
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:117
Defines a list of useful type aliases for tensors.
tnsr::I< DataType, SpatialDim, Frame > shift(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute shift from spacetime metric and inverse spatial metric.
Definition: ComputeSpacetimeQuantities.cpp:101
Wraps the template metaprogramming library used (brigand)
Items related to hydrodynamic systems.
Definition: LorentzFactor.hpp:13
tnsr::I< DataType, Dim, Frame > mass_flux(const Scalar< DataType > &rest_mass_density, const tnsr::I< DataType, Dim, Frame > &spatial_velocity, const Scalar< DataType > &lorentz_factor, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const Scalar< DataType > &sqrt_det_spatial_metric) noexcept
Computes the vector in , representing the mass flux through a surface with normal ...
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Compute item for mass flux vector .
Definition: MassFlux.hpp:52