ComputeSpacetimeQuantities.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 Functions for calculating spacetime tensors from 3+1 quantities
6 
7 #pragma once
8 
9 #include <cstddef>
10 
12 
13 /// \ingroup GeneralRelativityGroup
14 /// Holds functions related to general relativity.
15 namespace gr {
16 
17 /*!
18  * \ingroup GeneralRelativityGroup
19  * \brief Computes the spacetime metric from the spatial metric, lapse, and
20  * shift.
21  * \details The spacetime metric \f$ \psi_{ab} \f$ is calculated as
22  * \f{align}{
23  * \psi_{tt} &= - N^2 + N^m N^n g_{mn} \\
24  * \psi_{ti} &= g_{mi} N^m \\
25  * \psi_{ij} &= g_{ij}
26  * \f}
27  * where \f$ N, N^i\f$ and \f$ g_{ij}\f$ are the lapse, shift and spatial metric
28  * respectively
29  */
30 template <size_t SpatialDim, typename Frame, typename DataType>
31 tnsr::aa<DataType, SpatialDim, Frame> spacetime_metric(
32  const Scalar<DataType>& lapse,
33  const tnsr::I<DataType, SpatialDim, Frame>& shift,
34  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric) noexcept;
35 
36 /*!
37  * \ingroup GeneralRelativityGroup
38  * \brief Compute spatial metric from spacetime metric.
39  * \details Simply pull out the spatial components.
40  */
41 template <size_t SpatialDim, typename Frame, typename DataType>
42 tnsr::ii<DataType, SpatialDim, Frame> spatial_metric(
43  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
44 
45 /*!
46  * \ingroup GeneralRelativityGroup
47  * \brief Compute inverse spacetime metric from inverse spatial metric, lapse
48  * and shift
49  *
50  * \details The inverse spacetime metric \f$ \psi^{ab} \f$ is calculated as
51  * \f{align}
52  * \psi^{tt} &= - 1/N^2 \\
53  * \psi^{ti} &= N^i / N^2 \\
54  * \psi^{ij} &= g^{ij} - N^i N^j / N^2
55  * \f}
56  * where \f$ N, N^i\f$ and \f$ g^{ij}\f$ are the lapse, shift and inverse
57  * spatial metric respectively
58  */
59 template <size_t SpatialDim, typename Frame, typename DataType>
60 tnsr::AA<DataType, SpatialDim, Frame> inverse_spacetime_metric(
61  const Scalar<DataType>& lapse,
62  const tnsr::I<DataType, SpatialDim, Frame>& shift,
63  const tnsr::II<DataType, SpatialDim, Frame>&
64  inverse_spatial_metric) noexcept;
65 
66 /*!
67  * \ingroup GeneralRelativityGroup
68  * \brief Compute shift from spacetime metric and inverse spatial metric.
69  *
70  * \details Computes
71  * \f{align}
72  * N^i &= g^{ij} \psi_{jt}
73  * \f}
74  * where \f$ N^i\f$, \f$ g^{ij}\f$, and \f$\psi_{ab}\f$ are the shift, inverse
75  * spatial metric, and spacetime metric.
76  * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro.
77  */
78 template <size_t SpatialDim, typename Frame, typename DataType>
79 tnsr::I<DataType, SpatialDim, Frame> shift(
80  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric,
81  const tnsr::II<DataType, SpatialDim, Frame>&
82  inverse_spatial_metric) noexcept;
83 
84 /*!
85  * \ingroup GeneralRelativityGroup
86  * \brief Compute lapse from shift and spacetime metric
87  *
88  * \details Computes
89  * \f{align}
90  * N &= \sqrt{N^i \psi_{it}-\psi_{tt}}
91  * \f}
92  * where \f$ N \f$, \f$ N^i\f$, and \f$\psi_{ab}\f$ are the lapse, shift,
93  * and spacetime metric.
94  * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro.
95  */
96 template <size_t SpatialDim, typename Frame, typename DataType>
98  const tnsr::I<DataType, SpatialDim, Frame>& shift,
99  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
100 
101 /*!
102  * \ingroup GeneralRelativityGroup
103  * \brief Computes spacetime derivative of spacetime metric from spatial metric,
104  * lapse, shift, and their space and time derivatives.
105  *
106  * \details Computes the derivatives as:
107  * \f{align}
108  * \partial_\mu \psi_{tt} &= - 2 N \partial_\mu N
109  * + 2 g_{mn} N^m \partial_\mu N^n
110  * + N^m N^n \partial_\mu g_{mn} \\
111  * \partial_\mu \psi_{ti} &= g_{mi} \partial_\mu N^m
112  * + N^m \partial_\mu g_{mi} \\
113  * \partial_\mu \psi_{ij} &= \partial_\mu g_{ij}
114  * \f}
115  * where \f$ N, N^i, g \f$ are the lapse, shift, and spatial metric
116  * respectively.
117  */
118 template <size_t SpatialDim, typename Frame, typename DataType>
119 tnsr::abb<DataType, SpatialDim, Frame> derivatives_of_spacetime_metric(
120  const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
121  const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
122  const tnsr::I<DataType, SpatialDim, Frame>& shift,
123  const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
124  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
125  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
126  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
127  const tnsr::ijj<DataType, SpatialDim, Frame>&
128  deriv_spatial_metric) noexcept;
129 
130 /*!
131  * \brief Computes spacetime normal one-form from lapse.
132  *
133  * \details If \f$N\f$ is the lapse, then
134  * \f{align} n_t &= - N \\
135  * n_i &= 0 \f}
136  * is computed.
137  */
138 template <size_t SpatialDim, typename Frame, typename DataType>
139 tnsr::a<DataType, SpatialDim, Frame> spacetime_normal_one_form(
140  const Scalar<DataType>& lapse) noexcept;
141 
142 /*!
143  * \ingroup GeneralRelativityGroup
144  * \brief Computes spacetime normal vector from lapse and shift.
145  * \details If \f$N, N^i\f$ are the lapse and shift respectively, then
146  * \f{align} n^t &= 1/N \\
147  * n^i &= -\frac{N^i}{N} \f}
148  * is computed.
149  */
150 template <size_t SpatialDim, typename Frame, typename DataType>
151 tnsr::A<DataType, SpatialDim, Frame> spacetime_normal_vector(
152  const Scalar<DataType>& lapse,
153  const tnsr::I<DataType, SpatialDim, Frame>& shift) noexcept;
154 
155 /*!
156  * \ingroup GeneralRelativityGroup
157  * \brief Computes extrinsic curvature from metric and derivatives.
158  * \details Uses the ADM evolution equation for the spatial metric,
159  * \f[ K_{ij} = \frac{1}{2N} \left ( -\partial_0 g_{ij}
160  * + N^k \partial_k g_{ij} + g_{ki} \partial_j N^k
161  * + g_{kj} \partial_i N^k \right ) \f]
162  * where \f$K_{ij}\f$ is the extrinsic curvature, \f$N\f$ is the lapse,
163  * \f$N^i\f$ is the shift, and \f$g_{ij}\f$ is the spatial metric. In terms
164  * of the Lie derivative of the spatial metric with respect to a unit timelike
165  * vector \f$t^a\f$ normal to the spatial slice, this corresponds to the sign
166  * convention
167  * \f[ K_{ab} = - \frac{1}{2} \mathcal{L}_{\mathbf{t}} g_{ab} \f]
168  */
169 template <size_t SpatialDim, typename Frame, typename DataType>
170 tnsr::ii<DataType, SpatialDim, Frame> extrinsic_curvature(
171  const Scalar<DataType>& lapse,
172  const tnsr::I<DataType, SpatialDim, Frame>& shift,
173  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
174  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
175  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
176  const tnsr::ijj<DataType, SpatialDim, Frame>&
177  deriv_spatial_metric) noexcept;
178 
179 } // namespace gr
tnsr::A< DataType, SpatialDim, Frame > spacetime_normal_vector(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
Computes spacetime normal vector from lapse and shift.
Definition: ComputeSpacetimeQuantities.cpp:185
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:43
tnsr::ijj< DataType, SpatialDim, Frame > deriv_spatial_metric(const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative v...
Definition: ComputeGhQuantities.cpp:183
tnsr::a< DataType, SpatialDim, Frame > spacetime_normal_one_form(const Scalar< DataType > &lapse) noexcept
Computes spacetime normal one-form from lapse.
Definition: ComputeSpacetimeQuantities.cpp:176
Holds functions related to general relativity.
Definition: KerrHorizon.cpp:14
tnsr::ii< DataType, SpatialDim, Frame > extrinsic_curvature(const Scalar< DataType > &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::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes extrinsic curvature from metric and derivatives.
Definition: ComputeSpacetimeQuantities.cpp:199
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.
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
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21