ExtrinsicCurvature.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"
13 #include "PointwiseFunctions/GeneralRelativity/IndexManipulation.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 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$t^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} t^a
46  * \f}
47  */
48 template <size_t SpatialDim, typename Frame, typename DataType>
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) noexcept;
54
55 template <size_t SpatialDim, typename Frame, typename DataType>
56 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) noexcept;
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>
72  : gr::Tags::ExtrinsicCurvature<SpatialDim, Frame, DataVector>,
74  using argument_tags =
75  tmpl::list<gr::Tags::SpacetimeNormalVector<SpatialDim, Frame, DataVector>,
77
78  using return_type = tnsr::ii<DataVector, SpatialDim, Frame>;
79
80  static constexpr auto function = static_cast<void (*)(
82  const tnsr::A<DataVector, SpatialDim, Frame>&,
83  const tnsr::aa<DataVector, SpatialDim, Frame>&,
84  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
85  &extrinsic_curvature<SpatialDim, Frame, DataVector>);
86
88 };
89
90 /*!
91  * \brief Compute item to get the trace of extrinsic curvature from generalized
92  * harmonic variables and the spacetime normal vector.
93  *
94  * \details See extrinsic_curvature() for how the extrinsic curvature
95  * \f$K_{ij}\f$ is computed. Its trace is taken as
96  * \f{align}
97  * tr(K) &= g^{ij} K_{ij}.
98  * \f}
99  *
100  * Can be retrieved using gr::Tags::TraceExtrinsicCurvature.
101  */
102 template <size_t SpatialDim, typename Frame>
104  : gr::Tags::TraceExtrinsicCurvature<DataVector>,
106  using argument_tags =
107  tmpl::list<gr::Tags::ExtrinsicCurvature<SpatialDim, Frame, DataVector>,
109
110  using return_type = Scalar<DataVector>;
111
112  static constexpr auto function = static_cast<void (*)(
114  const tnsr::ii<DataVector, SpatialDim, Frame>&,
115  const tnsr::II<DataVector, SpatialDim, Frame>&) noexcept>(&trace);
116
118 };
119 } // namespace Tags
120 } // namespace GeneralizedHarmonic
gr::Tags::TraceExtrinsicCurvature
Definition: Tags.hpp:114
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
GeneralizedHarmonic::pi
void pi(gsl::not_null< tnsr::aa< DataType, SpatialDim, Frame > * > pi, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
GeneralizedHarmonic::Tags::ExtrinsicCurvatureCompute
Compute item to get extrinsic curvature from generalized harmonic variables and the spacetime normal ...
Definition: ExtrinsicCurvature.hpp:71
trace
void trace(gsl::not_null< Scalar< DataType > * > trace, const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
Computes trace of a rank-2 symmetric tensor.
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
GeneralizedHarmonic::extrinsic_curvature
void extrinsic_curvature(gsl::not_null< tnsr::ii< DataType, SpatialDim, Frame > * > ex_curv, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes extrinsic curvature from generalized harmonic variables and the spacetime normal vector.
cstddef
GeneralizedHarmonic::Tags::Pi< SpatialDim, Frame >
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
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
Tensor.hpp
gr::Tags::ExtrinsicCurvature
Definition: Tags.hpp:110
GeneralizedHarmonic::Tags::TraceExtrinsicCurvatureCompute
Compute item to get the trace of extrinsic curvature from generalized harmonic variables and the spac...
Definition: ExtrinsicCurvature.hpp:103
Prefixes.hpp
TMPL.hpp
gr::spacetime_normal_vector
tnsr::A< DataType, SpatialDim, Frame > spacetime_normal_vector(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
Computes spacetime normal vector from lapse and shift.
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183