Shift.hpp
1 // Distributed under the MIT License.
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 shift from spacetime metric and inverse spatial metric.
30  *
31  * \details Computes
32  * \f{align}
33  * N^i &= g^{ij} \psi_{jt}
34  * \f}
35  * where \f$ N^i\f$, \f$ g^{ij}\f$, and \f$\psi_{ab}\f$ are the shift, inverse
36  * spatial metric, and spacetime metric.
37  * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro.
38  */
39 template <size_t SpatialDim, typename Frame, typename DataType>
40 tnsr::I<DataType, SpatialDim, Frame> shift(
41  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric,
42  const tnsr::II<DataType, SpatialDim, Frame>&
43  inverse_spatial_metric) noexcept;
44 
45 template <size_t SpatialDim, typename Frame, typename DataType>
46 void shift(gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> shift,
47  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric,
48  const tnsr::II<DataType, SpatialDim, Frame>&
49  inverse_spatial_metric) noexcept;
50 // @}
51 
52 namespace Tags {
53 /*!
54  * \brief Compute item for shift \f$N^i\f$ from the spacetime metric
55  * \f$\psi_{ab}\f$ and the inverse spatial metric \f$g^{ij}\f$.
56  *
57  * \details Can be retrieved using `gr::Tags::Shift`.
58  */
59 template <size_t SpatialDim, typename Frame, typename DataType>
60 struct ShiftCompute : Shift<SpatialDim, Frame, DataType>, db::ComputeTag {
61  using argument_tags =
62  tmpl::list<SpacetimeMetric<SpatialDim, Frame, DataType>,
64 
65  using return_type = tnsr::I<DataType, SpatialDim, Frame>;
66 
67  static constexpr auto function = static_cast<void (*)(
69  const tnsr::aa<DataType, SpatialDim, Frame>&,
70  const tnsr::II<DataType, SpatialDim, Frame>&) noexcept>(
71  &shift<SpatialDim, Frame, DataType>);
72 
74 };
75 } // namespace Tags
76 } // namespace gr
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
utility
DeterminantAndInverse.hpp
gr::Tags::ShiftCompute
Compute item for shift from the spacetime metric and the inverse spatial metric .
Definition: Shift.hpp:60
cmath
cstddef
cstdint
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.
Gsl.hpp
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
gr
Definition: GaugeWave.hpp:27
Tensor.hpp
PartialDerivatives.hpp
Prefixes.hpp
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