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/Tensor/TypeAliases.hpp"
9 : #include "Evolution/Systems/RelativisticEuler/Valencia/TagsDeclarations.hpp"
10 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
11 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
12 : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : // IWYU pragma: no_forward_declare Tensor
16 :
17 : /// \cond
18 : class DataVector;
19 :
20 : namespace gsl {
21 : template <typename T>
22 : class not_null;
23 : } // namespace gsl
24 :
25 : namespace Tags {
26 : template <typename>
27 : struct Source;
28 : } // namespace Tags
29 : /// \endcond
30 :
31 : namespace RelativisticEuler {
32 : namespace Valencia {
33 :
34 : /*!
35 : * \brief Compute the source terms for the flux-conservative Valencia
36 : * formulation of the relativistic Euler system.
37 : *
38 : *
39 : * A flux-conservative system has the generic form:
40 : * \f[
41 : * \partial_t U_i + \partial_m F^m(U_i) = S(U_i)
42 : * \f]
43 : *
44 : * where \f$F^a()\f$ denotes the flux of a conserved variable \f$U_i\f$ and
45 : * \f$S()\f$ denotes the source term for the conserved variable.
46 : *
47 : * For the Valencia formulation:
48 : * \f{align*}
49 : * S({\tilde D}) = & 0\\
50 : * S({\tilde S}_i) = & \frac{1}{2} \alpha {\tilde S}^{mn} \partial_i \gamma_{mn}
51 : * + {\tilde S}_m \partial_i \beta^m - ({\tilde D} + {\tilde \tau}) \partial_i
52 : * \alpha \\ S({\tilde \tau}) = & \alpha {\tilde S}^{mn} K_{mn}
53 : * - {\tilde S}^m \partial_m \alpha
54 : * \f}
55 : *
56 : * where
57 : * \f{align*}
58 : * {\tilde S}^i = & {\tilde S}_m \gamma^{im} \\
59 : * {\tilde S}^{ij} = & {\tilde S}^i v^j + \sqrt{\gamma} p \gamma^{ij}
60 : * \f}
61 : * where \f${\tilde D}\f$, \f${\tilde S}_i\f$, and \f${\tilde \tau}\f$ are a
62 : * generalized mass-energy density, momentum density, and specific internal
63 : * energy density as measured by an Eulerian observer, \f$\gamma\f$ is the
64 : * determinant of the spatial metric \f$\gamma_{ij}\f$, \f$\rho\f$ is the rest
65 : * mass density, \f$W\f$ is the Lorentz factor, \f$h\f$ is the specific
66 : * enthalpy, \f$v^i\f$ is the spatial velocity, \f$p\f$ is the pressure,
67 : * \f$\alpha\f$ is the lapse, \f$\beta^i\f$ is the shift, and \f$K_{ij}\f$ is
68 : * the extrinsic curvature.
69 : */
70 : template <size_t Dim>
71 1 : struct ComputeSources {
72 0 : using return_tags = tmpl::list<
73 : ::Tags::Source<RelativisticEuler::Valencia::Tags::TildeTau>,
74 : ::Tags::Source<RelativisticEuler::Valencia::Tags::TildeS<Dim>>>;
75 :
76 0 : using argument_tags =
77 : tmpl::list<RelativisticEuler::Valencia::Tags::TildeD,
78 : RelativisticEuler::Valencia::Tags::TildeTau,
79 : RelativisticEuler::Valencia::Tags::TildeS<Dim>,
80 : hydro::Tags::SpatialVelocity<DataVector, Dim>,
81 : hydro::Tags::Pressure<DataVector>, gr::Tags::Lapse<DataVector>,
82 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<Dim>,
83 : Frame::Inertial>,
84 : ::Tags::deriv<gr::Tags::Shift<DataVector, Dim>,
85 : tmpl::size_t<Dim>, Frame::Inertial>,
86 : ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, Dim>,
87 : tmpl::size_t<Dim>, Frame::Inertial>,
88 : gr::Tags::InverseSpatialMetric<DataVector, Dim>,
89 : gr::Tags::SqrtDetSpatialMetric<DataVector>,
90 : gr::Tags::ExtrinsicCurvature<DataVector, Dim>>;
91 :
92 0 : static void apply(
93 : gsl::not_null<Scalar<DataVector>*> source_tilde_tau,
94 : gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> source_tilde_s,
95 : const Scalar<DataVector>& tilde_d, const Scalar<DataVector>& tilde_tau,
96 : const tnsr::i<DataVector, Dim, Frame::Inertial>& tilde_s,
97 : const tnsr::I<DataVector, Dim, Frame::Inertial>& spatial_velocity,
98 : const Scalar<DataVector>& pressure, const Scalar<DataVector>& lapse,
99 : const tnsr::i<DataVector, Dim, Frame::Inertial>& d_lapse,
100 : const tnsr::iJ<DataVector, Dim, Frame::Inertial>& d_shift,
101 : const tnsr::ijj<DataVector, Dim, Frame::Inertial>& d_spatial_metric,
102 : const tnsr::II<DataVector, Dim, Frame::Inertial>& inv_spatial_metric,
103 : const Scalar<DataVector>& sqrt_det_spatial_metric,
104 : const tnsr::ii<DataVector, Dim, Frame::Inertial>& extrinsic_curvature);
105 : };
106 : } // namespace Valencia
107 : } // namespace RelativisticEuler
|