TimeDerivOfShift.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 the shift vector from
38  * the generalized harmonic and geometric variables
39  *
40  * \details The time derivative of \f$ N^i \f$ can be derived from the following
41  * steps:
42  * \f{align*}
43  * \partial_0 N^i
44  * =& g^{ik} \partial_0 (g_{kj} N^j) - N^j g^{ik} \partial_0 g_{kj} \\
45  * =& N g^{ik} t^b \partial_0 \psi_{kb} \\
46  * =& N g^{ik} t^b (\partial_0 - N^j\partial_j) \psi_{kb}
47  * + N g^{ik} t^b N^j\partial_j \psi_{kb} \\
48  * =& -N^2 t^b\Pi_{kb} g^{ik} + N N^j t^b\Phi_{jkb} g^{ik} \\
49  * =& -N g^{ik} t^b (N \Pi_{kb} - N^j \Phi_{jkb}) \\
50  * \f}
51  */
52 template <size_t SpatialDim, typename Frame, typename DataType>
54  gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> dt_shift,
55  const Scalar<DataType>& lapse,
56  const tnsr::I<DataType, SpatialDim, Frame>& shift,
57  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
58  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
59  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
60  const tnsr::aa<DataType, SpatialDim, Frame>& pi) noexcept;
61 
62 template <size_t SpatialDim, typename Frame, typename DataType>
63 tnsr::I<DataType, SpatialDim, Frame> time_deriv_of_shift(
64  const Scalar<DataType>& lapse,
65  const tnsr::I<DataType, SpatialDim, Frame>& shift,
66  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
67  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
68  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
69  const tnsr::aa<DataType, SpatialDim, Frame>& pi) noexcept;
70 // @}
71 
72 namespace Tags {
73 /*!
74  * \brief Compute item to get time derivative of the shift vector from
75  * the generalized harmonic and geometric variables
76  *
77  * \details See `time_deriv_of_shift()`. Can be retrieved using
78  * `gr::Tags::Shift` wrapped in `Tags::dt`.
79  */
80 template <size_t SpatialDim, typename Frame>
82  : ::Tags::dt<gr::Tags::Shift<SpatialDim, Frame, DataVector>>,
84  using argument_tags =
85  tmpl::list<gr::Tags::Lapse<DataVector>,
90 
91  using return_type = tnsr::I<DataVector, SpatialDim, Frame>;
92 
93  static constexpr auto function = static_cast<void (*)(
95  const Scalar<DataVector>&, const tnsr::I<DataVector, SpatialDim, Frame>&,
96  const tnsr::II<DataVector, SpatialDim, Frame>&,
97  const tnsr::A<DataVector, SpatialDim, Frame>&,
98  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
99  const tnsr::aa<DataVector, SpatialDim, Frame>&) noexcept>(
100  &time_deriv_of_shift<SpatialDim, Frame, DataVector>);
101 
103 };
104 } // namespace Tags
105 } // namespace GeneralizedHarmonic
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 .
GeneralizedHarmonic::Tags::TimeDerivShiftCompute
Compute item to get time derivative of the shift vector from the generalized harmonic and geometric v...
Definition: TimeDerivOfShift.hpp:81
gr::Tags::SpacetimeNormalVector
Definition: Tags.hpp:87
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
GeneralizedHarmonic::time_deriv_of_shift
void time_deriv_of_shift(gsl::not_null< tnsr::I< DataType, SpatialDim, Frame > * > dt_shift, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, 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 the shift vector from the generalized harmonic and geometric variables.
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
PartialDerivatives.hpp
Prefixes.hpp
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: Gsl.hpp:183