DerivativesOfSpacetimeMetric.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cmath>
7 #include <cstddef>
8 #include <cstdint>
9 #include <utility>
10 
12 #include "DataStructures/DataBox/Tag.hpp"
15 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
16 #include "Utilities/ContainerHelpers.hpp"
17 #include "Utilities/Gsl.hpp"
18 #include "Utilities/TMPL.hpp"
19 #include "Utilities/TaggedTuple.hpp"
20 
21 /// \ingroup GeneralRelativityGroup
22 /// Holds functions related to general relativity.
23 namespace gr {
24 //@{
25 /*!
26  * \ingroup GeneralRelativityGroup
27  * \brief Computes spacetime derivative of spacetime metric from spatial metric,
28  * lapse, shift, and their space and time derivatives.
29  *
30  * \details Computes the derivatives as:
31  * \f{align}
32  * \partial_\mu \psi_{tt} &= - 2 N \partial_\mu N
33  * + 2 g_{mn} N^m \partial_\mu N^n
34  * + N^m N^n \partial_\mu g_{mn} \\
35  * \partial_\mu \psi_{ti} &= g_{mi} \partial_\mu N^m
36  * + N^m \partial_\mu g_{mi} \\
37  * \partial_\mu \psi_{ij} &= \partial_\mu g_{ij}
38  * \f}
39  * where \f$ N, N^i, g \f$ are the lapse, shift, and spatial metric
40  * respectively.
41  */
42 template <size_t SpatialDim, typename Frame, typename DataType>
44  gsl::not_null<tnsr::abb<DataType, SpatialDim, Frame>*>
45  spacetime_deriv_spacetime_metric,
46  const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
47  const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
48  const tnsr::I<DataType, SpatialDim, Frame>& shift,
49  const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
50  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
51  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
52  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
53  const tnsr::ijj<DataType, SpatialDim, Frame>&
54  deriv_spatial_metric) noexcept;
55 
56 template <size_t SpatialDim, typename Frame, typename DataType>
57 tnsr::abb<DataType, SpatialDim, Frame> derivatives_of_spacetime_metric(
58  const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
59  const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
60  const tnsr::I<DataType, SpatialDim, Frame>& shift,
61  const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
62  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
63  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
64  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
65  const tnsr::ijj<DataType, SpatialDim, Frame>&
66  deriv_spatial_metric) noexcept;
67 //@}
68 
69 namespace Tags {
70 /*!
71  * \brief Compute item to get spacetime derivative of spacetime metric from
72  * spatial metric, lapse, shift, and their space and time derivatives.
73  *
74  * \details See `derivatives_of_spacetime_metric()`. Can be retrieved using
75  * `gr::Tags::DerivativesOfSpacetimeMetric`.
76  */
77 template <size_t SpatialDim, typename Frame>
79  : gr::Tags::DerivativesOfSpacetimeMetric<SpatialDim, Frame, DataVector>,
81  using argument_tags = tmpl::list<
83  ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<SpatialDim>,
84  Frame>,
88  tmpl::size_t<SpatialDim>, Frame>,
92  tmpl::size_t<SpatialDim>, Frame>>;
93 
94  using return_type = tnsr::abb<DataVector, SpatialDim, Frame>;
95 
96  static constexpr auto function = static_cast<void (*)(
98  spacetime_deriv_spacetime_metric,
100  const tnsr::i<DataVector, SpatialDim, Frame>&,
101  const tnsr::I<DataVector, SpatialDim, Frame>&,
102  const tnsr::I<DataVector, SpatialDim, Frame>&,
103  const tnsr::iJ<DataVector, SpatialDim, Frame>&,
104  const tnsr::ii<DataVector, SpatialDim, Frame>&,
105  const tnsr::ii<DataVector, SpatialDim, Frame>&,
106  const tnsr::ijj<DataVector, SpatialDim, Frame>&) noexcept>(
107  &gr::derivatives_of_spacetime_metric<SpatialDim, Frame, DataVector>);
108 
109  using base =
111 };
112 } // namespace Tags
113 } // namespace gr
gr::Tags::DerivativesOfSpacetimeMetricCompute
Compute item to get spacetime derivative of spacetime metric from spatial metric, lapse,...
Definition: DerivativesOfSpacetimeMetric.hpp:78
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
utility
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
cmath
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
cstdint
gr::Tags::DerivativesOfSpacetimeMetric
Spacetime derivatives of the spacetime metric.
Definition: Tags.hpp:63
gr::Tags::Shift
Definition: Tags.hpp:48
GeneralizedHarmonic::deriv_spatial_metric
void deriv_spatial_metric(gsl::not_null< tnsr::ijj< DataType, SpatialDim, Frame > * > d_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative v...
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.
Tags::dt
Prefix indicating a time derivative.
Definition: Prefixes.hpp:29
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
gr::derivatives_of_spacetime_metric
void derivatives_of_spacetime_metric(gsl::not_null< tnsr::abb< DataType, SpatialDim, Frame > * > spacetime_deriv_spacetime_metric, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes spacetime derivative of spacetime metric from spatial metric, lapse, shift,...
Frame
Definition: IndexType.hpp:36
gr
Definition: GaugeWave.hpp:27
Tensor.hpp
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:54
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.
PartialDerivatives.hpp
Prefixes.hpp
gr::Tags::Lapse
Definition: Tags.hpp:52
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183