Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/DataBox/Tag.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
11 : #include "Utilities/Gsl.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : /// \ingroup GeneralRelativityGroup
15 : /// Holds functions related to general relativity.
16 : namespace gr {
17 : /// @{
18 : /*!
19 : * \ingroup GeneralRelativityGroup
20 : * \brief Compute shift from spacetime metric and inverse spatial metric.
21 : *
22 : * \details Computes
23 : * \f{align}
24 : * \beta^i &= \gamma^{ij} g_{jt}
25 : * \f}
26 : * where \f$ \beta^i\f$, \f$ \gamma^{ij}\f$, and \f$g_{ab}\f$ are the shift,
27 : * inverse spatial metric, and spacetime metric.
28 : * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro.
29 : */
30 : template <typename DataType, size_t SpatialDim, typename Frame>
31 1 : tnsr::I<DataType, SpatialDim, Frame> shift(
32 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric,
33 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
34 :
35 : template <typename DataType, size_t SpatialDim, typename Frame>
36 1 : void shift(gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> shift,
37 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric,
38 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
39 : /// @}
40 :
41 : namespace Tags {
42 : /*!
43 : * \brief Compute item for shift \f$\beta^i\f$ from the spacetime metric
44 : * \f$g_{ab}\f$ and the inverse spatial metric \f$\gamma^{ij}\f$.
45 : *
46 : * \details Can be retrieved using `gr::Tags::Shift`.
47 : */
48 : template <typename DataType, size_t SpatialDim, typename Frame>
49 1 : struct ShiftCompute : Shift<DataType, SpatialDim, Frame>, db::ComputeTag {
50 0 : using argument_tags =
51 : tmpl::list<SpacetimeMetric<DataType, SpatialDim, Frame>,
52 : InverseSpatialMetric<DataType, SpatialDim, Frame>>;
53 :
54 0 : using return_type = tnsr::I<DataType, SpatialDim, Frame>;
55 :
56 0 : static constexpr auto function = static_cast<void (*)(
57 : const gsl::not_null<tnsr::I<DataType, SpatialDim, Frame>*> shift,
58 : const tnsr::aa<DataType, SpatialDim, Frame>&,
59 : const tnsr::II<DataType, SpatialDim, Frame>&)>(
60 : &shift<DataType, SpatialDim, Frame>);
61 :
62 0 : using base = Shift<DataType, SpatialDim, Frame>;
63 : };
64 : } // namespace Tags
65 : } // namespace gr
|