TimeDerivOfLapse.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "DataStructures/DataBox/Tag.hpp"
10 #include "DataStructures/DataVector.hpp"
12 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
14 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
15 #include "Utilities/ContainerHelpers.hpp"
16 #include "Utilities/Gsl.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 // IWYU pragma: no_forward_declare Tags::deriv
20 
21 /// \cond
22 namespace domain {
23 namespace Tags {
24 template <size_t Dim, typename Frame>
25 struct Coordinates;
26 } // namespace Tags
27 } // namespace domain
28 class DataVector;
29 template <typename X, typename Symm, typename IndexList>
30 class Tensor;
31 /// \endcond
32 
33 namespace GeneralizedHarmonic {
34 // @{
35 /*!
36  * \ingroup GeneralRelativityGroup
37  * \brief Computes time derivative of lapse (N) from the generalized
38  * harmonic variables, lapse, shift and the spacetime unit normal 1-form.
39  *
40  * \details Let the generalized harmonic conjugate momentum and spatial
41  * derivative variables be \f$\Pi_{ab} = -t^c \partial_c \psi_{ab} \f$ and
42  * \f$\Phi_{iab} = \partial_i \psi_{ab} \f$, and the operator
43  * \f$D := \partial_0 - N^k \partial_k \f$. The time derivative of N is then:
44  * \f{align*}
45  * \frac{1}{2} N^2 t^a t^b \Pi_{ab} - \frac{1}{2} N N^i t^a t^b \Phi_{iab}
46  * =& \frac{1}{2} N^2 t^a t^b t^c \partial_c \psi_{ab}
47  * - \frac{1}{2} N N^i (-(2/N) \partial_i N) \\
48  * =& \frac{1}{2} N^2 [-(1/N^3) D[g_{jk} N^j N^k - N^2] \\
49  * &- (N^j N^k / N^3)D[g_{jk}] \\
50  * &+ 2 (N^j / N^3) D[g_{jk} N^k] + (2 / N^2)(N^i \partial_i N)] \\
51  * =& \frac{1}{2N} [-D[g_{jk}N^jN^k - N^2] - N^jN^k D[g_{jk}]
52  * + 2N N^k\partial_k N + 2N^j D[g_{jk}N^k]] \\
53  * =& D[N] + N^k\partial_k N \\
54  * =& \partial_0 N
55  * \f}
56  * where the simplification done for \f$\partial_i N\f$ is used to substitute
57  * for the second term (\f$\frac{1}{2} N N^i t^a t^b \Phi_{iab}\f$).
58  *
59  * Thus,
60  * \f[
61  * \partial_0 N = (N/2)(N t^a t^b \Pi_{ab} - N^i t^a t^b \Phi_{iab})
62  * \f]
63  */
64 template <size_t SpatialDim, typename Frame, typename DataType>
67  const tnsr::I<DataType, SpatialDim, Frame>& shift,
68  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
69  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
70  const tnsr::aa<DataType, SpatialDim, Frame>& pi) noexcept;
71 
72 template <size_t SpatialDim, typename Frame, typename DataType>
74  const Scalar<DataType>& lapse,
75  const tnsr::I<DataType, SpatialDim, Frame>& shift,
76  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
77  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
78  const tnsr::aa<DataType, SpatialDim, Frame>& pi) noexcept;
79 // @}
80 
81 namespace Tags {
82 /*!
83  * \brief Compute item to get time derivative of lapse (N) from the generalized
84  * harmonic variables, lapse, shift and the spacetime unit normal 1-form.
85  *
86  * \details See `time_deriv_of_lapse()`. Can be retrieved using
87  * `gr::Tags::Lapse` wrapped in `Tags::dt`.
88  */
89 template <size_t SpatialDim, typename Frame>
90 struct TimeDerivLapseCompute : ::Tags::dt<gr::Tags::Lapse<DataVector>>,
92  using argument_tags =
93  tmpl::list<gr::Tags::Lapse<DataVector>,
97 
98  using return_type = Scalar<DataVector>;
99 
100  static constexpr auto function = static_cast<void (*)(
102  const tnsr::I<DataVector, SpatialDim, Frame>&,
103  const tnsr::A<DataVector, SpatialDim, Frame>&,
104  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
105  const tnsr::aa<DataVector, SpatialDim, Frame>&) noexcept>(
106  &time_deriv_of_lapse<SpatialDim, Frame>);
107 
109 };
110 } // namespace Tags
111 } // namespace GeneralizedHarmonic
GeneralizedHarmonic::Tags::TimeDerivLapseCompute
Compute item to get time derivative of lapse (N) from the generalized harmonic variables,...
Definition: TimeDerivOfLapse.hpp:90
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
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::Tags::SpacetimeNormalVector
Definition: Tags.hpp:87
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
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.
cstddef
GeneralizedHarmonic::Tags::Pi< SpatialDim, Frame >
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...
gr::Tags::Shift
Definition: Tags.hpp:48
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< SpatialDim, Frame >
Tags::dt
Prefix indicating a time derivative.
Definition: Prefixes.hpp:29
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
Tensor.hpp
GeneralizedHarmonic::time_deriv_of_lapse
void time_deriv_of_lapse(gsl::not_null< Scalar< DataType > * > dt_lapse, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
Computes time derivative of lapse (N) from the generalized harmonic variables, lapse,...
PartialDerivatives.hpp
Prefixes.hpp
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183