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/TMPL.hpp"
12 :
13 : /// \cond
14 : namespace gsl {
15 : template <typename>
16 : struct not_null;
17 : } // namespace gsl
18 : /// \endcond
19 :
20 : namespace gr {
21 :
22 : /// @{
23 : /*!
24 : * \ingroup GeneralRelativityGroup
25 : * \brief Computes a quantity measuring how far from type D spacetime is.
26 : *
27 : * \details Computes a quantity measuring how far from type D spacetime is,
28 : * using measure D1 [Eq. (8) of \cite Bhagwat2017tkm]:
29 : *
30 : * \f{align}{
31 : * \frac{a}{12} \gamma_{ij} - \frac{b}{a} E_{ij} - 4
32 : * E_{i}^{k} E_{jk} = 0 \f}
33 : *
34 : * where \f$\gamma_{ij}\f$ is the spatial metric and \f$E_{ij}\f$ is the
35 : * electric part ofthe Weyl tensor.
36 : */
37 : template <typename DataType, size_t SpatialDim, typename Frame>
38 1 : tnsr::ii<DataType, SpatialDim, Frame> weyl_type_D1(
39 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_electric,
40 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
41 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
42 :
43 : template <typename DataType, size_t SpatialDim, typename Frame>
44 1 : void weyl_type_D1(
45 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> weyl_type_D1,
46 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_electric,
47 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_metric,
48 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
49 : /// @}
50 :
51 : /// @{
52 : /*!
53 : * \ingroup GeneralRelativityGroup
54 : * \brief Computes the scalar \f$D_{ij} D^{ij}\f$ , a measure of a spacetime's
55 : * devitation from type D.
56 : *
57 : * \details Computes the scalar \f$D_{ij} D^{ij}\f$ from \f$D_{ij}\f$ (Eq. (8)
58 : * of \cite Bhagwat2017tkm] and the inverse spatial metric \f$\gamma^{ij}\f$,
59 : * i.e. \f$D = \gamma^{ik}\gamma^{jl}D_{ij}D_{kl}\f$.
60 : *
61 : * \note The Weyl Type D1 \f$D_{ij}\f$ is available via gr::weyl_type_D1.
62 : */
63 : template <typename DataType, size_t SpatialDim, typename Frame>
64 1 : void weyl_type_D1_scalar(
65 : gsl::not_null<Scalar<DataType>*> weyl_type_D1_scalar_result,
66 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_type_D1,
67 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
68 :
69 : template <typename DataType, size_t SpatialDim, typename Frame>
70 1 : Scalar<DataType> weyl_type_D1_scalar(
71 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_type_D1,
72 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
73 :
74 : /// @}
75 :
76 : namespace Tags {
77 : /// Compute item for WeylTypeD1
78 : /// Computed from WeylElectric, SpatialMetric, and InverseSpatialMetric
79 : ///
80 : /// Can be retrieved using gr::Tags::WeylTypeD1
81 : template <typename DataType, size_t SpatialDim, typename Frame>
82 1 : struct WeylTypeD1Compute : WeylTypeD1<DataType, SpatialDim, Frame>,
83 : db::ComputeTag {
84 0 : using argument_tags =
85 : tmpl::list<gr::Tags::WeylElectric<DataType, SpatialDim, Frame>,
86 : gr::Tags::SpatialMetric<DataType, SpatialDim, Frame>,
87 : gr::Tags::InverseSpatialMetric<DataType, SpatialDim, Frame>>;
88 :
89 0 : using return_type = tnsr::ii<DataType, SpatialDim, Frame>;
90 :
91 0 : static constexpr auto function = static_cast<void (*)(
92 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*>,
93 : const tnsr::ii<DataType, SpatialDim, Frame>&,
94 : const tnsr::ii<DataType, SpatialDim, Frame>&,
95 : const tnsr::II<DataType, SpatialDim, Frame>&)>(
96 : &weyl_type_D1<DataType, SpatialDim, Frame>);
97 :
98 0 : using base = WeylTypeD1<DataType, SpatialDim, Frame>;
99 : };
100 :
101 : /// Can be retrieved using gr::Tags::WeylTypeD1Scalar
102 : template <typename DataType, size_t SpatialDim, typename Frame>
103 1 : struct WeylTypeD1ScalarCompute : WeylTypeD1Scalar<DataType>, db::ComputeTag {
104 0 : using argument_tags =
105 : tmpl::list<gr::Tags::WeylTypeD1<DataType, SpatialDim, Frame>,
106 : gr::Tags::InverseSpatialMetric<DataType, SpatialDim, Frame>>;
107 :
108 0 : using return_type = Scalar<DataType>;
109 :
110 0 : static constexpr auto function =
111 : static_cast<void (*)(gsl::not_null<Scalar<DataType>*>,
112 : const tnsr::ii<DataType, SpatialDim, Frame>&,
113 : const tnsr::II<DataType, SpatialDim, Frame>&)>(
114 : &gr::weyl_type_D1_scalar<DataType, SpatialDim, Frame>);
115 :
116 0 : using base = WeylTypeD1Scalar<DataType>;
117 : };
118 : } // namespace Tags
119 : } // namespace gr
|