SpacetimeNormalVector.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 Computes spacetime normal vector from lapse and shift.
30  * \details If \f$N, N^i\f$ are the lapse and shift respectively, then
31  * \f{align} n^t &= 1/N \\
32  * n^i &= -\frac{N^i}{N} \f}
33  * is computed.
34  */
35 template <size_t SpatialDim, typename Frame, typename DataType>
36 tnsr::A<DataType, SpatialDim, Frame> spacetime_normal_vector(
37  const Scalar<DataType>& lapse,
38  const tnsr::I<DataType, SpatialDim, Frame>& shift) noexcept;
39 
40 template <size_t SpatialDim, typename Frame, typename DataType>
42  gsl::not_null<tnsr::A<DataType, SpatialDim, Frame>*>
44  const Scalar<DataType>& lapse,
45  const tnsr::I<DataType, SpatialDim, Frame>& shift) noexcept;
46 // @}
47 
48 namespace Tags {
49 /*!
50  * \brief Compute item for spacetime normal vector \f$n^a\f$ from
51  * the lapse \f$N\f$ and the shift \f$N^i\f$.
52  *
53  * \details Can be retrieved using `gr::Tags::SpacetimeNormalVector`.
54  */
55 template <size_t SpatialDim, typename Frame, typename DataType>
57  : SpacetimeNormalVector<SpatialDim, Frame, DataType>,
59  using argument_tags =
60  tmpl::list<Lapse<DataType>, Shift<SpatialDim, Frame, DataType>>;
61 
62  using return_type = tnsr::A<DataType, SpatialDim, Frame>;
63 
64  static constexpr auto function = static_cast<void (*)(
66  const Scalar<DataType>&,
67  const tnsr::I<DataType, SpatialDim, Frame>&) noexcept>(
68  &spacetime_normal_vector<SpatialDim, Frame, DataType>);
69 
71 };
72 } // namespace Tags
73 } // 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::SpacetimeNormalVector
Definition: Tags.hpp:87
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::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.
gr::Tags::SpacetimeNormalVectorCompute
Compute item for spacetime normal vector from the lapse and the shift .
Definition: SpacetimeNormalVector.hpp:56
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
gr
Definition: GaugeWave.hpp:27
Tensor.hpp
PartialDerivatives.hpp
Prefixes.hpp
TMPL.hpp
gr::spacetime_normal_vector
tnsr::A< DataType, SpatialDim, Frame > spacetime_normal_vector(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
Computes spacetime normal vector from lapse and shift.
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183