Equations.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines class template GeneralizedHarmonicEquations.
6 
7 #pragma once
8 
9 #include <cstddef>
10 
12 #include "Evolution/Systems/GeneralizedHarmonic/TagsDeclarations.hpp" // IWYU pragma: keep
14 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" // IWYU pragma: keep
15 #include "Utilities/TMPL.hpp"
16 
17 /// \cond
18 class DataVector;
19 
20 namespace Tags {
21 template <typename>
22 class dt;
23 template <typename>
24 struct NormalDotFlux;
25 } // namespace Tags
26 
27 namespace gsl {
28 template <class T>
29 class not_null;
30 } // namespace gsl
31 /// \endcond
32 
33 namespace GeneralizedHarmonic {
34 /*!
35  * \brief Compute the RHS of the Generalized Harmonic formulation of
36  * Einstein's equations.
37  *
38  * \details For the full form of the equations see \cite Lindblom2005qh.
39  */
40 template <size_t Dim>
41 struct ComputeDuDt {
42  public:
43  using argument_tags = tmpl::list<
45  ::Tags::deriv<gr::Tags::SpacetimeMetric<Dim>, tmpl::size_t<Dim>,
47  ::Tags::deriv<Tags::Pi<Dim>, tmpl::size_t<Dim>, Frame::Inertial>,
48  ::Tags::deriv<Tags::Phi<Dim>, tmpl::size_t<Dim>, Frame::Inertial>,
58 
59  static void apply(
60  gsl::not_null<tnsr::aa<DataVector, Dim>*> dt_spacetime_metric,
61  gsl::not_null<tnsr::aa<DataVector, Dim>*> dt_pi,
62  gsl::not_null<tnsr::iaa<DataVector, Dim>*> dt_phi,
63  const tnsr::aa<DataVector, Dim>& spacetime_metric,
64  const tnsr::aa<DataVector, Dim>& pi,
65  const tnsr::iaa<DataVector, Dim>& phi,
66  const tnsr::iaa<DataVector, Dim>& d_spacetime_metric,
67  const tnsr::iaa<DataVector, Dim>& d_pi,
68  const tnsr::ijaa<DataVector, Dim>& d_phi,
69  const Scalar<DataVector>& gamma0, const Scalar<DataVector>& gamma1,
70  const Scalar<DataVector>& gamma2,
71  const tnsr::a<DataVector, Dim>& gauge_function,
72  const tnsr::ab<DataVector, Dim>& spacetime_deriv_gauge_function,
73  const Scalar<DataVector>& lapse, const tnsr::I<DataVector, Dim>& shift,
74  const tnsr::II<DataVector, Dim>& inverse_spatial_metric,
75  const tnsr::AA<DataVector, Dim>& inverse_spacetime_metric,
76  const tnsr::a<DataVector, Dim>& trace_christoffel,
77  const tnsr::abb<DataVector, Dim>& christoffel_first_kind,
78  const tnsr::Abb<DataVector, Dim>& christoffel_second_kind,
79  const tnsr::A<DataVector, Dim>& normal_spacetime_vector,
80  const tnsr::a<DataVector, Dim>& normal_spacetime_one_form);
81 };
82 
83 /*!
84  * \brief Compute the fluxes of the Generalized Harmonic formulation of
85  * Einstein's equations.
86  *
87  * \details The expressions for the fluxes is obtained from
88  * \cite Lindblom2005qh.
89  * The fluxes for each variable are obtained by taking the principal part of
90  * equations 35, 36, and 37, and replacing derivatives \f$ \partial_k \f$
91  * with the unit normal \f$ n_k \f$. This gives:
92  *
93  * \f{align*}
94  * F(\psi_{ab}) =& -(1 + \gamma_1) N^k n_k \psi_{ab} \\
95  * F(\Pi_{ab}) =& - N^k n_k \Pi_{ab} + N g^{ki}n_k \Phi_{iab} - \gamma_1
96  * \gamma_2
97  * N^k n_k \psi_{ab} \\
98  * F(\Phi_{iab}) =& - N^k n_k \Phi_{iab} + N n_i \Pi_{ab} - \gamma_1 \gamma_2
99  * N^i \Phi_{iab}
100  * \f}
101  *
102  * where \f$\psi_{ab}\f$ is the spacetime metric, \f$\Pi_{ab}\f$ its conjugate
103  * momentum, \f$ \Phi_{iab} \f$ is an auxiliary field as defined by the tag Phi,
104  * \f$N\f$ is the lapse, \f$ N^k \f$ is the shift, \f$ g^{ki} \f$ is the inverse
105  * spatial metric, and \f$ \gamma_1, \gamma_2 \f$ are constraint damping
106  * parameters.
107  */
108 template <size_t Dim>
110  public:
111  using argument_tags =
112  tmpl::list<gr::Tags::SpacetimeMetric<Dim>, Tags::Pi<Dim>, Tags::Phi<Dim>,
116 
117  static void apply(
118  gsl::not_null<tnsr::aa<DataVector, Dim>*>
119  spacetime_metric_normal_dot_flux,
120  gsl::not_null<tnsr::aa<DataVector, Dim>*> pi_normal_dot_flux,
121  gsl::not_null<tnsr::iaa<DataVector, Dim>*> phi_normal_dot_flux,
122  const tnsr::aa<DataVector, Dim>& spacetime_metric,
123  const tnsr::aa<DataVector, Dim>& pi,
124  const tnsr::iaa<DataVector, Dim>& phi, const Scalar<DataVector>& gamma1,
125  const Scalar<DataVector>& gamma2, const Scalar<DataVector>& lapse,
126  const tnsr::I<DataVector, Dim>& shift,
127  const tnsr::II<DataVector, Dim>& inverse_spatial_metric,
128  const tnsr::i<DataVector, Dim>& unit_normal) noexcept;
129 };
130 } // namespace GeneralizedHarmonic
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:39
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:27
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
Definition: Tags.hpp:15
tnsr::abb< DataType, SpatialDim, Frame, Index > christoffel_first_kind(const tnsr::abb< DataType, SpatialDim, Frame, Index > &d_metric) noexcept
Computes Christoffel symbol of the first kind from derivative of metric.
Definition: Christoffel.cpp:31
Definition: Tags.hpp:57
Compute the RHS of the Generalized Harmonic formulation of Einstein&#39;s equations.
Definition: Equations.hpp:41
Definition: Tags.hpp:46
Definition: Tags.hpp:31
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
tnsr::AA< DataType, SpatialDim, Frame > inverse_spacetime_metric(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute inverse spacetime metric from inverse spatial metric, lapse and shift.
tnsr::aa< DataType, SpatialDim, Frame > pi(const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
Definition: ComputeGhQuantities.cpp:58
Definition: Tags.hpp:77
tnsr::aa< DataType, SpatialDim, Frame > spacetime_metric(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
tnsr::iaa< DataType, SpatialDim, Frame > phi(const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein&#39;s equations...
Definition: ComputeGhQuantities.cpp:22
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:25
Defines functions computing partial derivatives.
Definition: Tags.hpp:41
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:98
Defines a list of useful type aliases for tensors.
Definition: Tags.hpp:72
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
Stores a collection of function values.
Definition: DataVector.hpp:46
Definition: Tags.hpp:20
Wraps the template metaprogramming library used (brigand)
Compute the fluxes of the Generalized Harmonic formulation of Einstein&#39;s equations.
Definition: Equations.hpp:109
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