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 "PointwiseFunctions/GeneralRelativity/Tags.hpp"
14 : #include "Utilities/ContainerHelpers.hpp"
15 : #include "Utilities/Gsl.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : // IWYU pragma: no_forward_declare Tags::deriv
19 :
20 : /// \cond
21 : namespace domain {
22 : namespace Tags {
23 : template <size_t Dim, typename Frame>
24 : struct Coordinates;
25 : } // namespace Tags
26 : } // namespace domain
27 : class DataVector;
28 : template <typename X, typename Symm, typename IndexList>
29 : class Tensor;
30 : /// \endcond
31 :
32 : namespace gh {
33 : /// @{
34 : /*!
35 : * \ingroup GeneralRelativityGroup
36 : * \brief Computes the conjugate momentum \f$\Pi_{ab}\f$ of the spacetime metric
37 : * \f$ g_{ab} \f$.
38 : *
39 : * \details If \f$ \alpha, \beta^i\f$ are the lapse and shift respectively, and
40 : * \f$ \Phi_{iab} = \partial_i g_{ab} \f$ then
41 : * \f$\Pi_{\mu\nu} = -\frac{1}{\alpha} ( \partial_t g_{\mu\nu} -
42 : * \beta^m \Phi_{m\mu\nu}) \f$ where \f$ \partial_t g_{ab} \f$ is computed
43 : * as
44 : *
45 : * \f{align}
46 : * \partial_t g_{tt} &= - 2 \alpha \partial_t \alpha
47 : * + 2 \gamma_{mn} \beta^m \partial_t \beta^n
48 : * + \beta^m \beta^n \partial_t \gamma_{mn} \\
49 : * \partial_t g_{ti} &= \gamma_{mi} \partial_t \beta^m
50 : * + \beta^m \partial_t \gamma_{mi} \\
51 : * \partial_t g_{ij} &= \partial_t \gamma_{ij}
52 : * \f}
53 : */
54 : template <typename DataType, size_t SpatialDim, typename Frame>
55 1 : void pi(gsl::not_null<tnsr::aa<DataType, SpatialDim, Frame>*> pi,
56 : const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
57 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
58 : const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
59 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
60 : const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
61 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
62 :
63 : template <typename DataType, size_t SpatialDim, typename Frame>
64 1 : tnsr::aa<DataType, SpatialDim, Frame> pi(
65 : const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
66 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
67 : const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
68 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
69 : const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
70 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
71 : /// @}
72 :
73 : namespace Tags {
74 : /*!
75 : * \brief Compute item the conjugate momentum \f$\Pi_{ab}\f$ of the spacetime
76 : * metric \f$ g_{ab} \f$.
77 : *
78 : * \details See `pi()`. Can be retrieved using `gh::Tags::Pi`.
79 : */
80 : template <size_t SpatialDim, typename Frame>
81 1 : struct PiCompute : Pi<DataVector, SpatialDim, Frame>, db::ComputeTag {
82 0 : using argument_tags = tmpl::list<
83 : gr::Tags::Lapse<DataVector>, ::Tags::dt<gr::Tags::Lapse<DataVector>>,
84 : gr::Tags::Shift<DataVector, SpatialDim, Frame>,
85 : ::Tags::dt<gr::Tags::Shift<DataVector, SpatialDim, Frame>>,
86 : gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>,
87 : ::Tags::dt<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>>,
88 : Phi<DataVector, SpatialDim, Frame>>;
89 :
90 0 : using return_type = tnsr::aa<DataVector, SpatialDim, Frame>;
91 :
92 0 : static constexpr auto function = static_cast<void (*)(
93 : gsl::not_null<tnsr::aa<DataVector, SpatialDim, Frame>*>,
94 : const Scalar<DataVector>&, const Scalar<DataVector>&,
95 : const tnsr::I<DataVector, SpatialDim, Frame>&,
96 : const tnsr::I<DataVector, SpatialDim, Frame>&,
97 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
98 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
99 : const tnsr::iaa<DataVector, SpatialDim, Frame>&)>(
100 : &pi<DataVector, SpatialDim, Frame>);
101 :
102 0 : using base = Pi<DataVector, SpatialDim, Frame>;
103 : };
104 : } // namespace Tags
105 : } // namespace gh
|