Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/DataBox/Prefixes.hpp"
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
11 : #include "Utilities/Gsl.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : /// \ingroup GeneralRelativityGroup
15 : /// Holds functions related to general relativity.
16 : namespace gr {
17 : /// @{
18 : /*!
19 : * \ingroup GeneralRelativityGroup
20 : * \brief Computes spacetime derivative of spacetime metric from spatial metric,
21 : * lapse, shift, and their space and time derivatives.
22 : *
23 : * \details Computes the derivatives as:
24 : * \f{align}
25 : * \partial_\mu g_{tt} &= - 2 \alpha \partial_\mu \alpha
26 : * + 2 \gamma_{mn} \beta^m \partial_\mu \beta^n
27 : * + \beta^m \beta^n \partial_\mu \gamma_{mn} \\
28 : * \partial_\mu g_{ti} &= \gamma_{mi} \partial_\mu \beta^m
29 : * + \beta^m \partial_\mu \gamma_{mi} \\
30 : * \partial_\mu g_{ij} &= \partial_\mu \gamma_{ij}
31 : * \f}
32 : * where \f$ \alpha, \beta^i, \gamma_{ij} \f$ are the lapse, shift, and spatial
33 : * metric respectively.
34 : */
35 : template <typename DataType, size_t SpatialDim, typename Frame>
36 1 : void derivatives_of_spacetime_metric(
37 : gsl::not_null<tnsr::abb<DataType, SpatialDim, Frame>*>
38 : spacetime_deriv_spacetime_metric,
39 : const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
40 : const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
41 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
42 : const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
43 : const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
44 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
45 : const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
46 : const tnsr::ijj<DataType, SpatialDim, Frame>& deriv_spatial_metric);
47 :
48 : template <typename DataType, size_t SpatialDim, typename Frame>
49 1 : tnsr::abb<DataType, SpatialDim, Frame> derivatives_of_spacetime_metric(
50 : const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
51 : const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
52 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
53 : const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
54 : const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
55 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
56 : const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
57 : const tnsr::ijj<DataType, SpatialDim, Frame>& deriv_spatial_metric);
58 : /// @}
59 :
60 : namespace Tags {
61 : /*!
62 : * \brief Compute item to get spacetime derivative of spacetime metric from
63 : * spatial metric, lapse, shift, and their space and time derivatives.
64 : *
65 : * \details See `derivatives_of_spacetime_metric()`. Can be retrieved using
66 : * `gr::Tags::DerivativesOfSpacetimeMetric`.
67 : */
68 : template <size_t SpatialDim, typename Frame>
69 1 : struct DerivativesOfSpacetimeMetricCompute
70 : : gr::Tags::DerivativesOfSpacetimeMetric<DataVector, SpatialDim, Frame>,
71 : db::ComputeTag {
72 0 : using argument_tags = tmpl::list<
73 : gr::Tags::Lapse<DataVector>, ::Tags::dt<gr::Tags::Lapse<DataVector>>,
74 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<SpatialDim>,
75 : Frame>,
76 : gr::Tags::Shift<DataVector, SpatialDim, Frame>,
77 : ::Tags::dt<gr::Tags::Shift<DataVector, SpatialDim, Frame>>,
78 : ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
79 : tmpl::size_t<SpatialDim>, Frame>,
80 : gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>,
81 : ::Tags::dt<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>>,
82 : ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>,
83 : tmpl::size_t<SpatialDim>, Frame>>;
84 :
85 0 : using return_type = tnsr::abb<DataVector, SpatialDim, Frame>;
86 :
87 0 : static constexpr auto function = static_cast<void (*)(
88 : gsl::not_null<tnsr::abb<DataVector, SpatialDim, Frame>*>
89 : spacetime_deriv_spacetime_metric,
90 : const Scalar<DataVector>&, const Scalar<DataVector>&,
91 : const tnsr::i<DataVector, SpatialDim, Frame>&,
92 : const tnsr::I<DataVector, SpatialDim, Frame>&,
93 : const tnsr::I<DataVector, SpatialDim, Frame>&,
94 : const tnsr::iJ<DataVector, SpatialDim, Frame>&,
95 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
96 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
97 : const tnsr::ijj<DataVector, SpatialDim, Frame>&)>(
98 : &gr::derivatives_of_spacetime_metric<DataVector, SpatialDim, Frame>);
99 :
100 0 : using base =
101 : gr::Tags::DerivativesOfSpacetimeMetric<DataVector, SpatialDim, Frame>;
102 : };
103 : } // namespace Tags
104 : } // namespace gr
|