Phi.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 auxiliary variable \f$\Phi_{iab}\f$ used by the
37  * generalized harmonic formulation of Einstein's equations.
38  *
39  * \details If \f$N, N^i\f$ and \f$g_{ij} \f$ are the lapse, shift and spatial
40  * metric respectively, then \f$\Phi_{iab} \f$ is computed as
41  *
42  * \f{align}
43  * \Phi_{ktt} &= - 2 N \partial_k N
44  * + 2 g_{mn} N^m \partial_k N^n
45  * + N^m N^n \partial_k g_{mn} \\
46  * \Phi_{kti} &= g_{mi} \partial_k N^m
47  * + N^m \partial_k g_{mi} \\
48  * \Phi_{kij} &= \partial_k g_{ij}
49  * \f}
50  */
51 template <size_t SpatialDim, typename Frame, typename DataType>
52 void phi(gsl::not_null<tnsr::iaa<DataType, SpatialDim, Frame>*> phi,
53  const Scalar<DataType>& lapse,
54  const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
55  const tnsr::I<DataType, SpatialDim, Frame>& shift,
56  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
57  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
58  const tnsr::ijj<DataType, SpatialDim, Frame>&
59  deriv_spatial_metric) noexcept;
60
61 template <size_t SpatialDim, typename Frame, typename DataType>
62 tnsr::iaa<DataType, SpatialDim, Frame> phi(
63  const Scalar<DataType>& lapse,
64  const tnsr::i<DataType, SpatialDim, Frame>& deriv_lapse,
65  const tnsr::I<DataType, SpatialDim, Frame>& shift,
66  const tnsr::iJ<DataType, SpatialDim, Frame>& deriv_shift,
67  const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
68  const tnsr::ijj<DataType, SpatialDim, Frame>&
69  deriv_spatial_metric) noexcept;
70 // @}
71
72 namespace Tags {
73 /*!
74  * \brief Compute item for the auxiliary variable \f$\Phi_{iab}\f$ used by the
75  * generalized harmonic formulation of Einstein's equations.
76  *
77  * \details See phi(). Can be retrieved using
78  * GeneralizedHarmonic::Tags::Phi.
79  */
80 template <size_t SpatialDim, typename Frame>
81 struct PhiCompute : Phi<SpatialDim, Frame>, db::ComputeTag {
82  using argument_tags = tmpl::list<
84  ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<SpatialDim>,
85  Frame>,
88  tmpl::size_t<SpatialDim>, Frame>,
91  tmpl::size_t<SpatialDim>, Frame>>;
92
93  using return_type = tnsr::iaa<DataVector, SpatialDim, Frame>;
94
95  static constexpr auto function = static_cast<void (*)(
97  const Scalar<DataVector>&, const tnsr::i<DataVector, SpatialDim, Frame>&,
98  const tnsr::I<DataVector, SpatialDim, Frame>&,
99  const tnsr::iJ<DataVector, SpatialDim, Frame>&,
100  const tnsr::ii<DataVector, SpatialDim, Frame>&,
101  const tnsr::ijj<DataVector, SpatialDim, Frame>&) noexcept>(
102  &phi<SpatialDim, Frame, DataVector>);
103
105 };
106 } // namespace Tags
107 } // namespace GeneralizedHarmonic
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
GeneralizedHarmonic::Tags::PhiCompute
Compute item for the auxiliary variable used by the generalized harmonic formulation of Einstein's e...
Definition: Phi.hpp:81
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: BoundaryCondition.hpp:20
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...
gr::Tags::Shift
Definition: Tags.hpp:48
GeneralizedHarmonic::deriv_spatial_metric
void deriv_spatial_metric(gsl::not_null< tnsr::ijj< DataType, SpatialDim, Frame > * > d_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative v...
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
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:40
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
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