Lapse.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 lapse from shift and spacetime metric
30  *
31  * \details Computes
32  * \f{align}
33  * N &= \sqrt{N^i \psi_{it}-\psi_{tt}}
34  * \f}
35  * where \f$ N \f$, \f$ N^i\f$, and \f$\psi_{ab}\f$ are the lapse, shift,
36  * 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>
41  const tnsr::I<DataType, SpatialDim, Frame>& shift,
42  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
43 
44 template <size_t SpatialDim, typename Frame, typename DataType>
45 void lapse(
47  const tnsr::I<DataType, SpatialDim, Frame>& shift,
48  const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric) noexcept;
49 // @}
50 
51 namespace Tags {
52 /*!
53  * \brief Compute item for lapse \f$N\f$ from the spacetime metric
54  * \f$\psi_{ab}\f$ and the shift \f$N^i\f$.
55  *
56  * \details Can be retrieved using `gr::Tags::Lapse`.
57  */
58 template <size_t SpatialDim, typename Frame, typename DataType>
59 struct LapseCompute : Lapse<DataType>, db::ComputeTag {
60  using argument_tags =
61  tmpl::list<Shift<SpatialDim, Frame, DataType>,
63 
64  using return_type = Scalar<DataType>;
65 
66  static constexpr auto function = static_cast<void (*)(
68  const tnsr::I<DataType, SpatialDim, Frame>&,
69  const tnsr::aa<DataType, SpatialDim, Frame>&) noexcept>(
70  &lapse<SpatialDim, Frame, DataType>);
71 
72  using base = Lapse<DataType>;
73 };
74 } // namespace Tags
75 } // 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::SpacetimeMetric< SpatialDim, Frame, DataType >
gr::Tags::LapseCompute
Compute item for lapse from the spacetime metric and the shift .
Definition: Lapse.hpp:59
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::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
gr::Tags::Lapse
Definition: Tags.hpp:52
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183