Pi.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/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 GeneralizedHarmonic {
33 // @{
34 /*!
35  * \ingroup GeneralRelativityGroup
36  * \brief Computes the conjugate momentum \f$\Pi_{ab}\f$ of the spacetime metric
37  * \f$\psi_{ab} \f$.
38  *
39  * \details If \f$N, N^i\f$ are the lapse and shift
40  * respectively, and \f$\Phi_{iab} = \partial_i \psi_{ab} \f$ then
41  * \f$\Pi_{\mu\nu} = -\frac{1}{N} ( \partial_t \psi_{\mu\nu} - 42 * N^m \Phi_{m\mu\nu}) \f$ where \f$\partial_t \psi_{ab} \f$ is computed
43  * as
44  *
45  * \f{align}
46  * \partial_t \psi_{tt} &= - 2 N \partial_t N
47  * + 2 g_{mn} N^m \partial_t N^n
48  * + N^m N^n \partial_t g_{mn} \\
49  * \partial_t \psi_{ti} &= g_{mi} \partial_t N^m
50  * + N^m \partial_t g_{mi} \\
51  * \partial_t \psi_{ij} &= \partial_t g_{ij}
52  * \f}
53  */
54 template <size_t SpatialDim, typename Frame, typename DataType>
55 void pi(gsl::not_null<tnsr::aa<DataType, SpatialDim, Frame>*> pi,
56  const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
57  const tnsr::I<DataType, SpatialDim, Frame>& shift,
58  const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
59  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
60  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
61  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
62
63 template <size_t SpatialDim, typename Frame, typename DataType>
64 tnsr::aa<DataType, SpatialDim, Frame> pi(
65  const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
66  const tnsr::I<DataType, SpatialDim, Frame>& shift,
67  const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
68  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
69  const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
70  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
71 // @}
72
73 namespace Tags {
74 /*!
75  * \brief Compute item the conjugate momentum \f$\Pi_{ab}\f$ of the spacetime
76  * metric \f$\psi_{ab} \f$.
77  *
78  * \details See pi(). Can be retrieved using GeneralizedHarmonic::Tags::Pi.
79  */
80 template <size_t SpatialDim, typename Frame>
81 struct PiCompute : Pi<SpatialDim, Frame>, db::ComputeTag {
82  using argument_tags = tmpl::list<
89
90  using return_type = tnsr::aa<DataVector, SpatialDim, Frame>;
91
92  static constexpr auto function = static_cast<void (*)(
95  const tnsr::I<DataVector, SpatialDim, Frame>&,
96  const tnsr::I<DataVector, SpatialDim, Frame>&,
97  const tnsr::ii<DataVector, SpatialDim, Frame>&,
98  const tnsr::ii<DataVector, SpatialDim, Frame>&,
99  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
100  &pi<SpatialDim, Frame, DataVector>);
101
102  using base = Pi<SpatialDim, Frame>;
103 };
104 } // namespace Tags
105 } // namespace GeneralizedHarmonic
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 .
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
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
GeneralizedHarmonic::Tags::Pi
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:29
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...
gr::Tags::Shift
Definition: Tags.hpp:48
gr::shift
tnsr::I< DataType, SpatialDim, Frame > shift(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute shift from spacetime metric and inverse spatial metric.
GeneralizedHarmonic::Tags::Phi< SpatialDim, Frame >
Tags::dt
Prefix indicating a time derivative.
Definition: Prefixes.hpp:29
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
GeneralizedHarmonic::Tags::PiCompute
Compute item the conjugate momentum of the spacetime metric .
Definition: Pi.hpp:81
Tensor.hpp
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
Prefixes.hpp
gr::Tags::Lapse
Definition: Tags.hpp:52
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183