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/EagerMath/Trace.hpp"
12 : #include "DataStructures/Tensor/Tensor.hpp"
13 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.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 extrinsic curvature from generalized harmonic variables
38 : * and the spacetime normal vector.
39 : *
40 : * \details If \f$ \Pi_{ab} \f$ and \f$ \Phi_{iab} \f$ are the generalized
41 : * harmonic conjugate momentum and spatial derivative variables, and if
42 : * \f$n^a\f$ is the spacetime normal vector, then the extrinsic curvature
43 : * is computed as
44 : * \f{align}
45 : * K_{ij} &= \frac{1}{2} \Pi_{ij} + \Phi_{(ij)a} n^a
46 : * \f}
47 : */
48 : template <typename DataType, size_t SpatialDim, typename Frame>
49 1 : void extrinsic_curvature(
50 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> ex_curv,
51 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
52 : const tnsr::aa<DataType, SpatialDim, Frame>& pi,
53 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
54 :
55 : template <typename DataType, size_t SpatialDim, typename Frame>
56 1 : tnsr::ii<DataType, SpatialDim, Frame> extrinsic_curvature(
57 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
58 : const tnsr::aa<DataType, SpatialDim, Frame>& pi,
59 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
60 : /// @}
61 :
62 : namespace Tags {
63 : /*!
64 : * \brief Compute item to get extrinsic curvature from generalized harmonic
65 : * variables and the spacetime normal vector.
66 : *
67 : * \details See `extrinsic_curvature()`. Can be retrieved using
68 : * `gr::Tags::ExtrinsicCurvature`.
69 : */
70 : template <size_t SpatialDim, typename Frame>
71 1 : struct ExtrinsicCurvatureCompute
72 : : gr::Tags::ExtrinsicCurvature<DataVector, SpatialDim, Frame>,
73 : db::ComputeTag {
74 0 : using argument_tags =
75 : tmpl::list<gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
76 : Pi<DataVector, SpatialDim, Frame>,
77 : Phi<DataVector, SpatialDim, Frame>>;
78 :
79 0 : using return_type = tnsr::ii<DataVector, SpatialDim, Frame>;
80 :
81 0 : static constexpr auto function = static_cast<void (*)(
82 : gsl::not_null<tnsr::ii<DataVector, SpatialDim, Frame>*>,
83 : const tnsr::A<DataVector, SpatialDim, Frame>&,
84 : const tnsr::aa<DataVector, SpatialDim, Frame>&,
85 : const tnsr::iaa<DataVector, SpatialDim, Frame>&)>(
86 : &extrinsic_curvature<DataVector, SpatialDim, Frame>);
87 :
88 0 : using base = gr::Tags::ExtrinsicCurvature<DataVector, SpatialDim, Frame>;
89 : };
90 :
91 : /*!
92 : * \brief Compute item to get the trace of extrinsic curvature from generalized
93 : * harmonic variables and the spacetime normal vector.
94 : *
95 : * \details See `extrinsic_curvature()` for how the extrinsic curvature
96 : * \f$ K_{ij}\f$ is computed. Its trace is taken as
97 : * \f{align}
98 : * tr(K) &= g^{ij} K_{ij}.
99 : * \f}
100 : *
101 : * Can be retrieved using `gr::Tags::TraceExtrinsicCurvature`.
102 : */
103 : template <size_t SpatialDim, typename Frame>
104 1 : struct TraceExtrinsicCurvatureCompute
105 : : gr::Tags::TraceExtrinsicCurvature<DataVector>,
106 : db::ComputeTag {
107 0 : using argument_tags =
108 : tmpl::list<gr::Tags::ExtrinsicCurvature<DataVector, SpatialDim, Frame>,
109 : gr::Tags::InverseSpatialMetric<DataVector, SpatialDim, Frame>>;
110 :
111 0 : using return_type = Scalar<DataVector>;
112 :
113 0 : static constexpr auto function =
114 : static_cast<void (*)(gsl::not_null<Scalar<DataVector>*>,
115 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
116 : const tnsr::II<DataVector, SpatialDim, Frame>&)>(
117 : &trace);
118 :
119 0 : using base = gr::Tags::TraceExtrinsicCurvature<DataVector>;
120 : };
121 : } // namespace Tags
122 : } // namespace gh
|