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 auxiliary variable \f$\Phi_{iab}\f$ used by the
37 : * generalized harmonic formulation of Einstein's equations.
38 : *
39 : * \details If \f$ \alpha, \beta^i\f$ and \f$ \gamma_{ij} \f$ are the lapse,
40 : * shift and spatial metric respectively, then \f$\Phi_{iab} \f$ is computed as
41 : *
42 : * \f{align}
43 : * \Phi_{ktt} &= - 2 \alpha \partial_k \alpha
44 : * + 2 \gamma_{mn} \beta^m \partial_k \beta^n
45 : * + \beta^m \beta^n \partial_k \gamma_{mn} \\
46 : * \Phi_{kti} &= \gamma_{mi} \partial_k \beta^m
47 : * + \beta^m \partial_k \gamma_{mi} \\
48 : * \Phi_{kij} &= \partial_k \gamma_{ij}
49 : * \f}
50 : */
51 : template <typename DataType, size_t SpatialDim, typename Frame>
52 1 : void phi(gsl::not_null<tnsr::iaa<DataType, SpatialDim, Frame>*> phi,
53 : const Scalar<DataType>& lapse,
54 : const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
55 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
56 : const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
57 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
58 : const tnsr::ijj<DataType, SpatialDim, Frame>& deriv_spatial_metric);
59 :
60 : template <typename DataType, size_t SpatialDim, typename Frame>
61 1 : tnsr::iaa<DataType, SpatialDim, Frame> phi(
62 : const Scalar<DataType>& lapse,
63 : const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
64 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
65 : const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
66 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
67 : const tnsr::ijj<DataType, SpatialDim, Frame>& deriv_spatial_metric);
68 : /// @}
69 :
70 : namespace Tags {
71 : /*!
72 : * \brief Compute item for the auxiliary variable \f$\Phi_{iab}\f$ used by the
73 : * generalized harmonic formulation of Einstein's equations.
74 : *
75 : * \details See `phi()`. Can be retrieved using
76 : * `gh::Tags::Phi`.
77 : */
78 : template <size_t SpatialDim, typename Frame>
79 1 : struct PhiCompute : Phi<DataVector, SpatialDim, Frame>, db::ComputeTag {
80 0 : using argument_tags = tmpl::list<
81 : gr::Tags::Lapse<DataVector>,
82 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<SpatialDim>,
83 : Frame>,
84 : gr::Tags::Shift<DataVector, SpatialDim, Frame>,
85 : ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
86 : tmpl::size_t<SpatialDim>, Frame>,
87 : gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>,
88 : ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, SpatialDim, Frame>,
89 : tmpl::size_t<SpatialDim>, Frame>>;
90 :
91 0 : using return_type = tnsr::iaa<DataVector, SpatialDim, Frame>;
92 :
93 0 : static constexpr auto function = static_cast<void (*)(
94 : gsl::not_null<tnsr::iaa<DataVector, SpatialDim, Frame>*>,
95 : const Scalar<DataVector>&, const tnsr::i<DataVector, SpatialDim, Frame>&,
96 : const tnsr::I<DataVector, SpatialDim, Frame>&,
97 : const tnsr::iJ<DataVector, SpatialDim, Frame>&,
98 : const tnsr::ii<DataVector, SpatialDim, Frame>&,
99 : const tnsr::ijj<DataVector, SpatialDim, Frame>&)>(
100 : &phi<DataVector, SpatialDim, Frame>);
101 :
102 0 : using base = Phi<DataVector, SpatialDim, Frame>;
103 : };
104 : } // namespace Tags
105 : } // namespace gh
|