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 "DataStructures/DataVector.hpp"
11 : #include "DataStructures/Tensor/Tensor.hpp"
12 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
13 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.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 gh {
34 : /// @{
35 : /*!
36 : * \ingroup GeneralRelativityGroup
37 : * \brief Computes time derivative of the spatial metric.
38 : *
39 : * \details Let the generalized harmonic conjugate momentum and spatial
40 : * derivative variables be \f$\Pi_{ab} = -n^c \partial_c g_{ab} \f$ and
41 : * \f$\Phi_{iab} = \partial_i g_{ab} \f$. As \f$ n_i \equiv 0 \f$. The time
42 : * derivative of the spatial metric is given by the time derivative of the
43 : * spatial sector of the spacetime metric, i.e.
44 : * \f$ \partial_0 \gamma_{ij} = \partial_0 g_{ij} \f$.
45 : *
46 : * To compute the latter, we use the evolution equation for \f$ g_{ij} \f$,
47 : * c.f. eq.(35) of \cite Lindblom2005qh (with \f$\gamma_1 = -1\f$):
48 : *
49 : * \f[
50 : * \partial_0 g_{ab} = - \alpha \Pi_{ab} + \beta^k \Phi_{kab}
51 : * \f]
52 : */
53 : template <typename DataType, size_t SpatialDim, typename Frame>
54 1 : void time_deriv_of_spatial_metric(
55 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> dt_spatial_metric,
56 : const Scalar<DataType>& lapse,
57 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
58 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
59 : const tnsr::aa<DataType, SpatialDim, Frame>& pi);
60 :
61 : template <typename DataType, size_t SpatialDim, typename Frame>
62 1 : tnsr::ii<DataType, SpatialDim, Frame> time_deriv_of_spatial_metric(
63 : const Scalar<DataType>& lapse,
64 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
65 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
66 : const tnsr::aa<DataType, SpatialDim, Frame>& pi);
67 : /// @}
68 :
69 : namespace Tags {
70 : /*!
71 : * \brief Compute item to get time derivative of the spatial metric from
72 : * generalized harmonic and geometric variables
73 : *
74 : * \details See `time_deriv_of_spatial_metric()`. Can be retrieved using
75 : * `gr::Tags::SpatialMetric` wrapped in `Tags::dt`.
76 : */
77 : template <size_t SpatialDim, typename Frame>
78 1 : struct TimeDerivSpatialMetricCompute
79 : : ::Tags::dt<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>>,
80 : db::ComputeTag {
81 0 : using argument_tags =
82 : tmpl::list<gr::Tags::Lapse<DataVector>,
83 : gr::Tags::Shift<DataVector, SpatialDim, Frame>,
84 : Phi<DataVector, SpatialDim, Frame>,
85 : Pi<DataVector, SpatialDim, Frame>>;
86 :
87 0 : using return_type = tnsr::ii<DataVector, SpatialDim, Frame>;
88 :
89 0 : static constexpr auto function = static_cast<void (*)(
90 : gsl::not_null<tnsr::ii<DataVector, SpatialDim, Frame>*>,
91 : const Scalar<DataVector>&, const tnsr::I<DataVector, SpatialDim, Frame>&,
92 : const tnsr::iaa<DataVector, SpatialDim, Frame>&,
93 : const tnsr::aa<DataVector, SpatialDim, Frame>&)>(
94 : &time_deriv_of_spatial_metric<DataVector, SpatialDim, Frame>);
95 :
96 0 : using base =
97 : ::Tags::dt<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>>;
98 : };
99 : } // namespace Tags
100 : } // namespace gh
|