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 shift vector from
36 : * the generalized harmonic and geometric variables
37 : *
38 : * \details The time derivative of \f$ \beta^i \f$ can be derived from the
39 : * following steps:
40 : * \f{align*}
41 : * \partial_0 \beta^i
42 : * =& \gamma^{ik} \partial_0 (\gamma_{kj} \beta^j)
43 : * - \beta^j \gamma^{ik} \partial_0 \gamma_{kj} \\
44 : * =& \alpha \gamma^{ik} n^b \partial_0 g_{kb} \\
45 : * =& \alpha \gamma^{ik} n^b (\partial_0 - \beta^j\partial_j) g_{kb}
46 : * + \alpha \gamma^{ik} n^b \beta^j\partial_j g_{kb} \\
47 : * =& -\alpha^2 n^b\Pi_{kb} \gamma^{ik}
48 : * + \alpha \beta^j n^b\Phi_{jkb} \gamma^{ik} \\
49 : * =& -\alpha \gamma^{ik} n^b (\alpha \Pi_{kb} - \beta^j \Phi_{jkb}) \\
50 : * \f}
51 : */
52 : template <typename DataType, size_t SpatialDim, typename Frame>
53 1 : void time_deriv_of_shift(
54 : gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> dt_shift,
55 : const Scalar<DataType>& lapse,
56 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
57 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
58 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
59 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
60 : const tnsr::aa<DataType, SpatialDim, Frame>& pi);
61 :
62 : template <typename DataType, size_t SpatialDim, typename Frame>
63 1 : tnsr::I<DataType, SpatialDim, Frame> time_deriv_of_shift(
64 : const Scalar<DataType>& lapse,
65 : const tnsr::I<DataType, SpatialDim, Frame>& shift,
66 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
67 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
68 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
69 : const tnsr::aa<DataType, SpatialDim, Frame>& pi);
70 : /// @}
71 :
72 : namespace Tags {
73 : /*!
74 : * \brief Compute item to get time derivative of the shift vector from
75 : * the generalized harmonic and geometric variables
76 : *
77 : * \details See `time_deriv_of_shift()`. Can be retrieved using
78 : * `gr::Tags::Shift` wrapped in `Tags::dt`.
79 : */
80 : template <size_t SpatialDim, typename Frame>
81 1 : struct TimeDerivShiftCompute
82 : : ::Tags::dt<gr::Tags::Shift<DataVector, SpatialDim, Frame>>,
83 : db::ComputeTag {
84 0 : using argument_tags =
85 : tmpl::list<gr::Tags::Lapse<DataVector>,
86 : gr::Tags::Shift<DataVector, SpatialDim, Frame>,
87 : gr::Tags::InverseSpatialMetric<DataVector, SpatialDim, Frame>,
88 : gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
89 : Phi<DataVector, SpatialDim, Frame>,
90 : Pi<DataVector, SpatialDim, Frame>>;
91 :
92 0 : using return_type = tnsr::I<DataVector, SpatialDim, Frame>;
93 :
94 0 : static constexpr auto function = static_cast<void (*)(
95 : gsl::not_null<tnsr::I<DataVector, SpatialDim, Frame>*>,
96 : const Scalar<DataVector>&, const tnsr::I<DataVector, SpatialDim, Frame>&,
97 : const tnsr::II<DataVector, SpatialDim, Frame>&,
98 : const tnsr::A<DataVector, SpatialDim, Frame>&,
99 : const tnsr::iaa<DataVector, SpatialDim, Frame>&,
100 : const tnsr::aa<DataVector, SpatialDim, Frame>&)>(
101 : &time_deriv_of_shift<DataVector, SpatialDim, Frame>);
102 :
103 0 : using base = ::Tags::dt<gr::Tags::Shift<DataVector, SpatialDim, Frame>>;
104 : };
105 : } // namespace Tags
106 : } // namespace gh
|