Fluxes.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include "DataStructures/DataBox/Prefixes.hpp" // IWYU pragma: keep
7 #include "DataStructures/Tensor/TypeAliases.hpp" // IWYU pragma: keep
8 #include "Evolution/Systems/GrMhd/ValenciaDivClean/TagsDeclarations.hpp" // IWYU pragma: keep
9 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" // IWYU pragma: keep
10 #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp" // IWYU pragma: keep
11 #include "Utilities/TMPL.hpp"
12 
13 // IWYU pragma: no_include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
14 // IWYU pragma: no_include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
15 // IWYU pragma: no_include "PointwiseFunctions/Hydro/Tags.hpp"
16 // IWYU pragma: no_forward_declare Tags::Flux
17 
18 /// \cond
19 namespace gsl {
20 template <typename T>
21 class not_null;
22 } // namespace gsl
23 
24 class DataVector;
25 /// \endcond
26 
27 // IWYU pragma: no_forward_declare Tensor
28 
29 namespace grmhd {
30 namespace ValenciaDivClean {
31 
32 /*!
33  * \brief The fluxes of the conservative variables
34  *
35  * \f{align*}
36  * F^i({\tilde D}) = &~ {\tilde D} v^i_{tr} \\
37  * F^i({\tilde S}_j) = &~ {\tilde S}_j v^i_{tr} + \sqrt{\gamma} \alpha \left( p
38  * + p_m \right) \delta^i_j - \frac{B_j {\tilde B}^i}{W^2} - v_j {\tilde B}^i
39  * B^m v_m\\
40  * F^i({\tilde \tau}) = &~ {\tilde \tau} v^i_{tr} + \sqrt{\gamma} \alpha \left(
41  * p + p_m \right) v^i - \alpha {\tilde B}^i B^m v_m \\
42  * F^i({\tilde B}^j) = &~ {\tilde B}^j v^i_{tr} - \alpha v^j {\tilde B}^i +
43  * \alpha \gamma^{ij} {\tilde \Phi} \\
44  * F^i({\tilde \Phi}) = &~ \alpha {\tilde B^i} - \beta^i {\tilde \Phi}
45  * \f}
46  *
47  * where the conserved variables \f${\tilde D}\f$, \f${\tilde S}_i\f$,
48  * \f${\tilde \tau}\f$, \f${\tilde B}^i\f$, and \f${\tilde \Phi}\f$ are a
49  * generalized mass-energy density, momentum density, specific internal energy
50  * density, magnetic field, and divergence cleaning field. Furthermore,
51  * \f$v^i_{tr} = \alpha v^i - \beta^i\f$ is the transport velocity, \f$\alpha\f$
52  * is the lapse, \f$\beta^i\f$ is the shift, \f$\gamma\f$ is the determinant of
53  * the spatial metric \f$\gamma_{ij}\f$, \f$v^i\f$ is the spatial velocity,
54  * \f$B^i\f$ is the spatial magnetic field measured by an Eulerian observer,
55  * \f$p\f$ is the fluid pressure, and \f$p_m = \frac{1}{2} \left[ \left( B^n v_n
56  * \right)^2 + B^n B_n / W^2 \right]\f$ is the magnetic pressure.
57  */
58 struct ComputeFluxes {
59  using return_tags =
61  tmpl::size_t<3>, Frame::Inertial>,
63  tmpl::size_t<3>, Frame::Inertial>,
65  tmpl::size_t<3>, Frame::Inertial>,
67  tmpl::size_t<3>, Frame::Inertial>,
69  tmpl::size_t<3>, Frame::Inertial>>;
70 
71  using argument_tags =
72  tmpl::list<grmhd::ValenciaDivClean::Tags::TildeD,
73  grmhd::ValenciaDivClean::Tags::TildeTau,
76  grmhd::ValenciaDivClean::Tags::TildePhi, gr::Tags::Lapse<>,
83 
84  static void apply(
85  gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_d_flux,
86  gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_tau_flux,
87  gsl::not_null<tnsr::Ij<DataVector, 3, Frame::Inertial>*> tilde_s_flux,
88  gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*> tilde_b_flux,
89  gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_phi_flux,
90  const Scalar<DataVector>& tilde_d, const Scalar<DataVector>& tilde_tau,
91  const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
92  const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
93  const Scalar<DataVector>& tilde_phi, const Scalar<DataVector>& lapse,
94  const tnsr::I<DataVector, 3, Frame::Inertial>& shift,
95  const Scalar<DataVector>& sqrt_det_spatial_metric,
96  const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
97  const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
98  const Scalar<DataVector>& pressure,
99  const tnsr::I<DataVector, 3, Frame::Inertial>& spatial_velocity,
100  const Scalar<DataVector>& lorentz_factor,
101  const tnsr::I<DataVector, 3, Frame::Inertial>& magnetic_field) noexcept;
102 };
103 } // namespace ValenciaDivClean
104 } // namespace grmhd
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
The spatial velocity .
Definition: Tags.hpp:144
The fluid pressure .
Definition: Tags.hpp:123
Definition: Tags.hpp:36
Define prefixes for DataBox tags.
The densitized divergence-cleaning field .
Definition: Tags.hpp:70
Definition: Tags.hpp:46
Definition: Tags.hpp:31
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:43
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 magnetic field measured by an Eulerian observer, where is the normal to the spatial hypersurfac...
Definition: Tags.hpp:80
The densitized energy density .
Definition: Tags.hpp:50
The densitized momentum density .
Definition: Tags.hpp:57
The fluxes of the conservative variables.
Definition: Fluxes.hpp:58
The densitized magnetic field .
Definition: Tags.hpp:64
Definition: Tags.hpp:26
Prefix indicating a flux.
Definition: Prefixes.hpp:38
The Lorentz factor .
Definition: Tags.hpp:64
Definition: Tags.hpp:41
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:98
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:82
The densitized rest-mass density .
Definition: Tags.hpp:44
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Definition: IndexType.hpp:44
Items related to general relativistic magnetohydrodynamics (GRMHD)
Definition: Characteristics.hpp:34
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12