TimeDerivative.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Tags.hpp"
10 #include "Evolution/Systems/GeneralizedHarmonic/DuDtTempTags.hpp"
11 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp" // IWYU pragma: keep
12 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
13 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" // IWYU pragma: keep
14 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 class DataVector;
18 
19 namespace PUP {
20 class er;
21 } // namespace PUP
22 
23 namespace gsl {
24 template <class T>
25 class not_null;
26 } // namespace gsl
27 
28 template <typename, typename, typename>
29 class Tensor;
30 /// \endcond
31 
32 // IWYU pragma: no_forward_declare Tags::deriv
33 
34 namespace GeneralizedHarmonic {
35 /*!
36  * \brief Compute the RHS of the Generalized Harmonic formulation of
37  * Einstein's equations.
38  *
39  * The evolved variables are the spacetime metric \f$g_{ab}\f$, its spatial
40  * derivative \f$\Phi_{iab}=\partial_i g_{ab}\f$, and conjugate momentum
41  * \f$\Pi_{ab}=n^c\partial_c g_{ab}\f$, where \f$n^a\f$ is the spacetime
42  * unit normal vector. The evolution equations are (Eqs. 35-57 of
43  * \cite Lindblom2005qh)
44  *
45  * \f{align}{
46  * \partial_t g_{ab}-
47  * &\left(1+\gamma_1\right)\beta^k\partial_k g_{ab} =
48  * -\alpha \Pi_{ab}-\gamma_1\beta^i\Phi_{iab}, \\
49  *
50  * \partial_t\Pi_{ab}-
51  * &\beta^k\partial_k\Pi_{ab} + \alpha \gamma^{ki}\partial_k\Phi_{iab}
52  * - \gamma_1\gamma_2\beta^k\partial_kg_{ab} \notag \\
53  * =&2\alpha g^{cd}\left(\gamma^{ij}\Phi_{ica}\Phi_{jdb}
54  * - \Pi_{ca}\Pi_{db} - g^{ef}\Gamma_{ace}\Gamma_{bdf}\right) \notag \\
55  * &-2\alpha \nabla_{(a}H_{b)}
56  * - \frac{1}{2}\alpha n^c n^d\Pi_{cd}\Pi_{ab}
57  * - \alpha n^c \Pi_{ci}\gamma^{ij}\Phi_{jab} \notag \\
58  * &+\alpha \gamma_0\left(2\delta^c{}_{(a} n_{b)}
59  * - (1 + \gamma_3)g_{ab}n^c\right)\mathcal{C}_c \notag \\
60  * &+ 2 \gamma_4 \alpha \Pi_{ab} n^c \mathcal{C}_c \notag \\
61  * &- \gamma_5\alpha n^c\mathcal{C}_c \left(\frac{\mathcal{C}_a\mathcal{C}_b
62  * - \frac{1}{2} g_{ab} \mathcal{C}_d \mathcal{C}^d}
63  * {\epsilon_{5} + 2 n^d \mathcal{C}_d n^e \mathcal{C}_e
64  * + \mathcal{C}_d \mathcal{C}^d} \right) \notag \\
65  * &-\gamma_1\gamma_2 \beta^i\Phi_{iab} \notag \\
66  * &-16\pi \alpha \left(T_{ab} - \frac{1}{2}g_{ab}T^c{}_c\right),\\
67  *
68  * \partial_t\Phi_{iab}-
69  * &\beta^k\partial_k\Phi_{iab} + \alpha \partial_i\Pi_{ab}
70  * - \alpha \gamma_2\partial_ig_{ab} \notag \\
71  * =&\frac{1}{2}\alpha n^c n^d\Phi_{icd}\Pi_{ab}
72  * + \alpha \gamma^{jk}n^c\Phi_{ijc}\Phi_{kab} \notag \\
73  * &-\alpha \gamma_2\Phi_{iab},
74  * \f}
75  *
76  * where \f$H_a\f$ is the gauge source function and
77  * \f$\mathcal{C}_a=H_a+\Gamma_a\f$ is the gauge constraint. The constraint
78  * damping parameters \f$\gamma_0\f$ \f$\gamma_1\f$, \f$\gamma_2\f$,
79  * \f$\gamma_3\f$, \f$\gamma_4\f$, and \f$\gamma_5\f$ have units of inverse time
80  * and control the time scales on which the constraints are damped to zero.
81  *
82  * \note We have not coded up the constraint damping terms for \f$\gamma_3\f$,
83  * \f$\gamma_4\f$, and \f$\gamma_5\f$. \f$\gamma_3\f$ was found to be essential
84  * for evolutions of black strings by Pretorius and Lehner \cite Lehner2010pn.
85  */
86 template <size_t Dim>
88  public:
89  using temporary_tags = tmpl::list<
108  DataVector>,
110  DataVector>,
114  using argument_tags = tmpl::list<
120 
121  static void apply(
122  gsl::not_null<tnsr::aa<DataVector, Dim>*> dt_spacetime_metric,
123  gsl::not_null<tnsr::aa<DataVector, Dim>*> dt_pi,
124  gsl::not_null<tnsr::iaa<DataVector, Dim>*> dt_phi,
125  gsl::not_null<Scalar<DataVector>*> temp_gamma1,
126  gsl::not_null<Scalar<DataVector>*> temp_gamma2,
127  gsl::not_null<Scalar<DataVector>*> gamma1gamma2,
128  gsl::not_null<Scalar<DataVector>*> pi_two_normals,
129  gsl::not_null<Scalar<DataVector>*> normal_dot_gauge_constraint,
130  gsl::not_null<Scalar<DataVector>*> gamma1_plus_1,
131  gsl::not_null<tnsr::a<DataVector, Dim>*> pi_one_normal,
132  gsl::not_null<tnsr::a<DataVector, Dim>*> gauge_constraint,
133  gsl::not_null<tnsr::i<DataVector, Dim>*> phi_two_normals,
134  gsl::not_null<tnsr::aa<DataVector, Dim>*>
135  shift_dot_three_index_constraint,
136  gsl::not_null<tnsr::ia<DataVector, Dim>*> phi_one_normal,
137  gsl::not_null<tnsr::aB<DataVector, Dim>*> pi_2_up,
138  gsl::not_null<tnsr::iaa<DataVector, Dim>*> three_index_constraint,
139  gsl::not_null<tnsr::Iaa<DataVector, Dim>*> phi_1_up,
140  gsl::not_null<tnsr::iaB<DataVector, Dim>*> phi_3_up,
141  gsl::not_null<tnsr::abC<DataVector, Dim>*> christoffel_first_kind_3_up,
143  gsl::not_null<tnsr::I<DataVector, Dim>*> shift,
144  gsl::not_null<tnsr::ii<DataVector, Dim>*> spatial_metric,
145  gsl::not_null<tnsr::II<DataVector, Dim>*> inverse_spatial_metric,
146  gsl::not_null<Scalar<DataVector>*> det_spatial_metric,
147  gsl::not_null<tnsr::AA<DataVector, Dim>*> inverse_spacetime_metric,
148  gsl::not_null<tnsr::abb<DataVector, Dim>*> christoffel_first_kind,
149  gsl::not_null<tnsr::Abb<DataVector, Dim>*> christoffel_second_kind,
150  gsl::not_null<tnsr::a<DataVector, Dim>*> trace_christoffel,
151  gsl::not_null<tnsr::A<DataVector, Dim>*> normal_spacetime_vector,
152  gsl::not_null<tnsr::a<DataVector, Dim>*> normal_spacetime_one_form,
153  gsl::not_null<tnsr::abb<DataVector, Dim>*> da_spacetime_metric,
154  const tnsr::iaa<DataVector, Dim>& d_spacetime_metric,
155  const tnsr::iaa<DataVector, Dim>& d_pi,
156  const tnsr::ijaa<DataVector, Dim>& d_phi,
157  const tnsr::aa<DataVector, Dim>& spacetime_metric,
158  const tnsr::aa<DataVector, Dim>& pi,
159  const tnsr::iaa<DataVector, Dim>& phi, const Scalar<DataVector>& gamma0,
160  const Scalar<DataVector>& gamma1, const Scalar<DataVector>& gamma2,
161  const tnsr::a<DataVector, Dim>& gauge_function,
162  const tnsr::ab<DataVector, Dim>& spacetime_deriv_gauge_function) noexcept;
163 };
164 } // namespace GeneralizedHarmonic
GeneralizedHarmonic::Tags::SpacetimeDerivGaugeH
Spacetime derivatives of the gauge source function for the generalized harmonic system.
Definition: Tags.hpp:67
GeneralizedHarmonic::Tags::GaugeConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:153
GeneralizedHarmonic::pi
void pi(gsl::not_null< 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 .
gr::christoffel_first_kind
void christoffel_first_kind(gsl::not_null< tnsr::abb< DataType, SpatialDim, Frame, Index > * > christoffel, const tnsr::abb< DataType, SpatialDim, Frame, Index > &d_metric) noexcept
Computes Christoffel symbol of the first kind from derivative of metric.
Frame::Inertial
Definition: IndexType.hpp:44
gr::Tags::SpacetimeChristoffelSecondKind
Definition: Tags.hpp:71
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
GeneralizedHarmonic::Tags::Gamma1Plus1
Definition: DuDtTempTags.hpp:31
gr::Tags::SpacetimeNormalVector
Definition: Tags.hpp:87
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
GeneralizedHarmonic::Tags::PhiOneNormal
Definition: DuDtTempTags.hpp:55
gr::Tags::DetSpatialMetric
Determinant of the spatial metric.
Definition: Tags.hpp:40
GeneralizedHarmonic::Tags::PhiTwoNormals
Definition: DuDtTempTags.hpp:43
gr::lapse
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.
gr::Tags::TraceSpacetimeChristoffelFirstKind
Definition: Tags.hpp:91
GeneralizedHarmonic::Tags::PiTwoNormals
Definition: DuDtTempTags.hpp:21
GeneralizedHarmonic::Tags::NormalDotOneIndexConstraint
Definition: DuDtTempTags.hpp:26
gr::Tags::SpacetimeChristoffelFirstKind
Definition: Tags.hpp:67
GeneralizedHarmonic::ConstraintDamping::Tags::ConstraintGamma0
Constraint dammping parameter for the generalized harmonic system (cf. ).
Definition: Tags.hpp:54
cstddef
GeneralizedHarmonic::Tags::ShiftDotThreeIndexConstraint
Definition: DuDtTempTags.hpp:49
GeneralizedHarmonic::TimeDerivative
Compute the RHS of the Generalized Harmonic formulation of Einstein's equations.
Definition: TimeDerivative.hpp:87
GeneralizedHarmonic::Tags::Pi
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:29
gr::Tags::InverseSpacetimeMetric
Definition: Tags.hpp:21
gr::Tags::SpacetimeMetric
Definition: Tags.hpp:17
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
GeneralizedHarmonic::phi
void phi(gsl::not_null< 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's equations...
GeneralizedHarmonic::Tags::PhiThirdIndexUp
Definition: DuDtTempTags.hpp:73
gr::Tags::DerivativesOfSpacetimeMetric
Spacetime derivatives of the spacetime metric.
Definition: Tags.hpp:63
GeneralizedHarmonic::Tags::GaugeH
Gauge source function for the generalized harmonic system.
Definition: Tags.hpp:53
GeneralizedHarmonic::Tags::PiSecondIndexUp
Definition: DuDtTempTags.hpp:61
GeneralizedHarmonic::three_index_constraint
tnsr::iaa< DataType, SpatialDim, Frame > three_index_constraint(const tnsr::iaa< DataType, SpatialDim, Frame > &d_spacetime_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the generalized-harmonic 3-index constraint.
Definition: Constraints.cpp:927
gr::Tags::Shift
Definition: Tags.hpp:48
gr::Tags::SpacetimeNormalOneForm
Definition: Tags.hpp:83
GeneralizedHarmonic::ConstraintDamping::Tags::ConstraintGamma2
Constraint dammping parameter for the generalized harmonic system (cf. ).
Definition: Tags.hpp:70
GeneralizedHarmonic::gauge_constraint
tnsr::a< DataType, SpatialDim, Frame > gauge_constraint(const tnsr::a< DataType, SpatialDim, Frame > &gauge_function, const tnsr::a< DataType, SpatialDim, Frame > &spacetime_normal_one_form, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the generalized-harmonic gauge constraint.
Definition: Constraints.cpp:957
gr::shift
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.
GeneralizedHarmonic::Tags::Phi
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:40
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
GeneralizedHarmonic::Tags::ThreeIndexConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:168
TypeAliases.hpp
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
GeneralizedHarmonic::Tags::SpacetimeChristoffelFirstKindThirdIndexUp
Definition: DuDtTempTags.hpp:79
GeneralizedHarmonic::Tags::PhiFirstIndexUp
Definition: DuDtTempTags.hpp:67
GeneralizedHarmonic::Tags::Gamma1Gamma2
constraint damping product
Definition: DuDtTempTags.hpp:16
GeneralizedHarmonic::ConstraintDamping::Tags::ConstraintGamma1
Constraint dammping parameter for the generalized harmonic system (cf. ).
Definition: Tags.hpp:62
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:11
gr::Tags::Lapse
Definition: Tags.hpp:52
gr::inverse_spacetime_metric
void inverse_spacetime_metric(gsl::not_null< 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.
TMPL.hpp
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
GeneralizedHarmonic::Tags::PiOneNormal
Definition: DuDtTempTags.hpp:37