InverseSpacetimeMetric.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cmath>
7 #include <cstddef>
8 #include <cstdint>
9 #include <utility>
10
12 #include "DataStructures/DataBox/Tag.hpp"
15 #include "DataStructures/VariablesTag.hpp"
17 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
18 #include "Utilities/ContainerHelpers.hpp"
19 #include "Utilities/Gsl.hpp"
20 #include "Utilities/TMPL.hpp"
21 #include "Utilities/TaggedTuple.hpp"
22
23 /// \ingroup GeneralRelativityGroup
24 /// Holds functions related to general relativity.
25 namespace gr {
26 //@{
27 /*!
28  * \ingroup GeneralRelativityGroup
29  * \brief Compute inverse spacetime metric from inverse spatial metric, lapse
30  * and shift
31  *
32  * \details The inverse spacetime metric \f$\psi^{ab} \f$ is calculated as
33  * \f{align}
34  * \psi^{tt} &= - 1/N^2 \\
35  * \psi^{ti} &= N^i / N^2 \\
36  * \psi^{ij} &= g^{ij} - N^i N^j / N^2
37  * \f}
38  * where \f$N, N^i\f$ and \f$g^{ij}\f$ are the lapse, shift and inverse
39  * spatial metric respectively
40  */
41 template <size_t SpatialDim, typename Frame, typename DataType>
43  gsl::not_null<tnsr::AA<DataType, SpatialDim, Frame>*>
45  const Scalar<DataType>& lapse,
46  const tnsr::I<DataType, SpatialDim, Frame>& shift,
47  const tnsr::II<DataType, SpatialDim, Frame>&
48  inverse_spatial_metric) noexcept;
49
50 template <size_t SpatialDim, typename Frame, typename DataType>
51 tnsr::AA<DataType, SpatialDim, Frame> inverse_spacetime_metric(
52  const Scalar<DataType>& lapse,
53  const tnsr::I<DataType, SpatialDim, Frame>& shift,
54  const tnsr::II<DataType, SpatialDim, Frame>&
55  inverse_spatial_metric) noexcept;
56 //@}
57
58 namespace Tags {
59 /*!
60  * \brief Compute item for inverse spacetime metric \f$\psi^{ab}\f$
61  * in terms of the lapse \f$N\f$, shift \f$N^i\f$, and inverse
62  * spatial metric \f$g^{ij}\f$.
63  *
64  * \details Can be retrieved using gr::Tags::InverseSpacetimeMetric.
65  */
66 template <size_t SpatialDim, typename Frame, typename DataType>
68  : InverseSpacetimeMetric<SpatialDim, Frame, DataType>,
70  using argument_tags =
71  tmpl::list<Lapse<DataType>, Shift<SpatialDim, Frame, DataType>,
73
74  using return_type = tnsr::AA<DataType, SpatialDim, Frame>;
75
76  static constexpr auto function = static_cast<void (*)(
78  const Scalar<DataType>&, const tnsr::I<DataType, SpatialDim, Frame>&,
79  const tnsr::II<DataType, SpatialDim, Frame>&) noexcept>(
80  &inverse_spacetime_metric<SpatialDim, Frame, DataType>);
81
83 };
84 } // namespace Tags
85 } // namespace gr
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
utility
DeterminantAndInverse.hpp
cmath
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
cstdint
gr::Tags::InverseSpacetimeMetric
Definition: Tags.hpp:21
gr::Tags::InverseSpacetimeMetricCompute
Compute item for inverse spacetime metric in terms of the lapse , shift , and inverse spatial metric...
Definition: InverseSpacetimeMetric.hpp:67
gr::Tags::Shift< SpatialDim, Frame, DataType >
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.
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
gr
Definition: GaugeWave.hpp:27
Tensor.hpp
PartialDerivatives.hpp
Prefixes.hpp
gr::inverse_spacetime_metric
void inverse_spacetime_metric(gsl::not_null< tnsr::AA< DataType, SpatialDim, Frame > * > inverse_spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute inverse spacetime metric from inverse spatial metric, lapse and shift.
TMPL.hpp
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