DerivSpatialMetric.hpp
1 // Distributed under the MIT License.
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 the spatial metric from
38  * the generalized harmonic spatial derivative variable.
39  *
40  * \details If \f$ \Phi_{kab} \f$ is the generalized
41  * harmonic spatial derivative variable, then the derivatives of the
42  * spatial metric are
43  * \f[
44  * \partial_k g_{ij} = \Phi_{kij}
45  * \f]
46  *
47  * This quantity is needed for computing spatial Christoffel symbols.
48  */
49 template <size_t SpatialDim, typename Frame, typename DataType>
51  gsl::not_null<tnsr::ijj<DataType, SpatialDim, Frame>*> d_spatial_metric,
52  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
53 
54 template <size_t SpatialDim, typename Frame, typename DataType>
55 tnsr::ijj<DataType, SpatialDim, Frame> deriv_spatial_metric(
56  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
57 // @}
58 
59 namespace Tags {
60 /*!
61  * \brief Compute item to get spatial derivatives of the spatial metric from
62  * the generalized harmonic spatial derivative variable.
63  *
64  * \details See `deriv_spatial_metric()`. Can be retrieved using
65  * `gr::Tags::SpatialMetric` wrapped in `::Tags::deriv`.
66  */
67 template <size_t SpatialDim, typename Frame>
69  : ::Tags::deriv<gr::Tags::SpatialMetric<SpatialDim, Frame, DataVector>,
70  tmpl::size_t<SpatialDim>, Frame>,
72  using argument_tags = tmpl::list<Phi<SpatialDim, Frame>>;
73 
74  using return_type = tnsr::ijj<DataVector, SpatialDim, Frame>;
75 
76  static constexpr auto function = static_cast<void (*)(
78  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
79  &deriv_spatial_metric<SpatialDim, Frame>);
80 
81  using base =
83  tmpl::size_t<SpatialDim>, Frame>;
84 };
85 } // namespace Tags
86 } // namespace GeneralizedHarmonic
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
cstddef
GeneralizedHarmonic::Tags::DerivSpatialMetricCompute
Compute item to get spatial derivatives of the spatial metric from the generalized harmonic spatial d...
Definition: DerivSpatialMetric.hpp:68
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::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...
Gsl.hpp
Frame
Definition: IndexType.hpp:36
Tensor.hpp
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:54
PartialDerivatives.hpp
Prefixes.hpp
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183