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 spatial derivatives of lapse (\f$\alpha\f$) from the
36 : * generalized harmonic variables and spacetime unit normal 1-form.
37 : *
38 : * \details If the generalized harmonic conjugate momentum and spatial
39 : * derivative variables are \f$\Pi_{ab} = -n^c \partial_c g_{ab} \f$ and
40 : * \f$\Phi_{iab} = \partial_i g_{ab} \f$, the spatial derivatives of
41 : * \f$\alpha\f$ can be obtained from:
42 : *
43 : * \f{align*}
44 : * n^a n^b \Phi_{iab} =
45 : * -\frac{1}{2\alpha} [\partial_i (-\alpha^2 + \beta_j\beta^j)-
46 : * 2 \beta^j \partial_i \beta_j
47 : * + \beta^j \beta^k \partial_i \gamma_{jk}]
48 : * = -\frac{2}{\alpha} \partial_i \alpha,
49 : * \f}
50 : *
51 : * since
52 : *
53 : * \f[
54 : * \partial_i (\beta_j\beta^j) =
55 : * 2\beta^j \partial_i \beta_j - \beta^j \beta^k \partial_i \gamma_{jk}.
56 : * \f]
57 : *
58 : * \f[
59 : * \Longrightarrow \partial_i \alpha = -(\alpha/2) n^a \Phi_{iab} n^b
60 : * \f]
61 : */
62 : template <typename DataType, size_t SpatialDim, typename Frame>
63 1 : void spatial_deriv_of_lapse(
64 : gsl::not_null<tnsr::i<DataType, SpatialDim, Frame>*> deriv_lapse,
65 : const Scalar<DataType>& lapse,
66 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
67 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
68 :
69 : template <typename DataType, size_t SpatialDim, typename Frame>
70 1 : tnsr::i<DataType, SpatialDim, Frame> spatial_deriv_of_lapse(
71 : const Scalar<DataType>& lapse,
72 : const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
73 : const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
74 : /// @}
75 :
76 : namespace Tags {
77 : /*!
78 : * \brief Compute item to get spatial derivatives of lapse from the
79 : * generalized harmonic variables and spacetime unit normal one-form.
80 : *
81 : * \details See `spatial_deriv_of_lapse()`. Can be retrieved using
82 : * `gr::Tags::Lapse` wrapped in `::Tags::deriv`.
83 : */
84 : template <size_t SpatialDim, typename Frame>
85 1 : struct DerivLapseCompute : ::Tags::deriv<gr::Tags::Lapse<DataVector>,
86 : tmpl::size_t<SpatialDim>, Frame>,
87 : db::ComputeTag {
88 0 : using argument_tags =
89 : tmpl::list<gr::Tags::Lapse<DataVector>,
90 : gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
91 : Phi<DataVector, SpatialDim, Frame>>;
92 :
93 0 : using return_type = tnsr::i<DataVector, SpatialDim, Frame>;
94 :
95 0 : static constexpr auto function = static_cast<void (*)(
96 : gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame>*>,
97 : const Scalar<DataVector>&, const tnsr::A<DataVector, SpatialDim, Frame>&,
98 : const tnsr::iaa<DataVector, SpatialDim, Frame>&)>(
99 : &spatial_deriv_of_lapse<DataVector, SpatialDim, Frame>);
100 :
101 0 : using base = ::Tags::deriv<gr::Tags::Lapse<DataVector>,
102 : tmpl::size_t<SpatialDim>, Frame>;
103 : };
104 : } // namespace Tags
105 : } // namespace gh
|