SpatialDerivOfLapse.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
9 #include "DataStructures/DataBox/Tag.hpp"
10 #include "DataStructures/DataVector.hpp"
12 #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 GeneralizedHarmonic {
34 /// @{
35 /*!
36  * \ingroup GeneralRelativityGroup
37  * \brief Computes spatial derivatives of lapse (N) from the generalized
38  * harmonic variables and spacetime unit normal 1-form.
39  *
40  * \details If the generalized harmonic conjugate momentum and spatial
41  * derivative variables are \f$\Pi_{ab} = -t^c \partial_c \psi_{ab} \f$ and
42  * \f$\Phi_{iab} = \partial_i \psi_{ab} \f$, the spatial derivatives of N
43  * can be obtained from:
44  * \f{align*}
45  * t^a t^b \Phi_{iab} = -\frac{1}{2N} [\partial_i (-N^2 + N_jN^j)-
46  * 2 N^j \partial_i N_j
47  * + N^j N^k \partial_i g_{jk}]
48  * = -\frac{2}{N} \partial_i N,
49  * \f}
50  * since
51  * \f[
52  * \partial_i (N_jN^j) = 2N^j \partial_i N_j - N^j N^k \partial_i g_{jk}.
53  * \f]
54  *
55  * \f[
56  * \Longrightarrow \partial_i N = -(N/2) t^a \Phi_{iab} t^b
57  * \f]
58  */
59 template <size_t SpatialDim, typename Frame, typename DataType>
61  gsl::not_null<tnsr::i<DataType, SpatialDim, Frame>*> deriv_lapse,
62  const Scalar<DataType>& lapse,
63  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
64  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
65
66 template <size_t SpatialDim, typename Frame, typename DataType>
67 tnsr::i<DataType, SpatialDim, Frame> spatial_deriv_of_lapse(
68  const Scalar<DataType>& lapse,
69  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
70  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
71 /// @}
72
73 namespace Tags {
74 /*!
75  * \brief Compute item to get spatial derivatives of lapse from the
76  * generalized harmonic variables and spacetime unit normal one-form.
77  *
78  * \details See spatial_deriv_of_lapse(). Can be retrieved using
79  * gr::Tags::Lapse wrapped in ::Tags::deriv.
80  */
81 template <size_t SpatialDim, typename Frame>
82 struct DerivLapseCompute : ::Tags::deriv<gr::Tags::Lapse<DataVector>,
83  tmpl::size_t<SpatialDim>, Frame>,
85  using argument_tags =
86  tmpl::list<gr::Tags::Lapse<DataVector>,
89
90  using return_type = tnsr::i<DataVector, SpatialDim, Frame>;
91
92  static constexpr auto function = static_cast<void (*)(
94  const Scalar<DataVector>&, const tnsr::A<DataVector, SpatialDim, Frame>&,
95  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
96  &spatial_deriv_of_lapse<SpatialDim, Frame>);
97
99  tmpl::size_t<SpatialDim>, Frame>;
100 };
101 } // namespace Tags
102 } // namespace GeneralizedHarmonic
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
gr::Tags::SpacetimeNormalVector
Definition: Tags.hpp:87
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Bjorhus.hpp:38
GeneralizedHarmonic::spatial_deriv_of_lapse
void spatial_deriv_of_lapse(gsl::not_null< tnsr::i< DataType, SpatialDim, Frame > * > deriv_lapse, const Scalar< DataType > &lapse, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes spatial derivatives of lapse (N) from the generalized harmonic variables and spacetime unit ...
gr::lapse
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
GeneralizedHarmonic::phi
void phi(gsl::not_null< tnsr::iaa< DataType, SpatialDim, Frame > * > phi, const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein's equations...
GeneralizedHarmonic::Tags::Phi< SpatialDim, Frame >
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
Frame
Definition: IndexType.hpp:36
Tensor.hpp
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:52
GeneralizedHarmonic::Tags::DerivLapseCompute
Compute item to get spatial derivatives of lapse from the generalized harmonic variables and spacetim...
Definition: SpatialDerivOfLapse.hpp:82
PartialDerivatives.hpp
Prefixes.hpp
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr