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