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 : * \brief Computes the Pontryagin scalar in vacuum.
25 : *
26 : * \details The Pontryagin scalar in vacuum is given by
27 : * \begin{align}
28 : * \mathcal{P} &\equiv {^{\star} C}_{abcd} C^{abcd} \\
29 : * &= - 16 E_{ab} B^{ab} ~,
30 : * \end{align}
31 : * where $ C_{abcd} $ it the Weyl tensor (with dual $ {^\star} C}_{abcd} $) in 4
32 : * spacetime dimensions. Here it is computed in terms of the electric ($
33 : * E_{ab} $) and magnetic ($ B_{ab} $) parts of the Weyl scalar, with the
34 : * conventions used here for ($ \{E_{ab}, B_{ab}\} $).
35 : *
36 : * \see `gr::Tags::WeylMagnetic` and `gr::Tags::WeylElectric`
37 : *
38 : */
39 : template <typename Frame>
40 1 : void pontryagin_scalar_in_vacuum(
41 : gsl::not_null<Scalar<DataVector>*> pontryagin_scalar,
42 : const tnsr::ii<DataVector, 3, Frame>& weyl_electric,
43 : const tnsr::ii<DataVector, 3, Frame>& weyl_magnetic,
44 : const tnsr::II<DataVector, 3, Frame>& inverse_spatial_metric);
45 :
46 : template <typename Frame>
47 1 : Scalar<DataVector> pontryagin_scalar_in_vacuum(
48 : const tnsr::ii<DataVector, 3, Frame>& weyl_electric,
49 : const tnsr::ii<DataVector, 3, Frame>& weyl_magnetic,
50 : const tnsr::II<DataVector, 3, Frame>& inverse_spatial_metric);
51 : /// @}
52 :
53 : /// @{
54 : /*!
55 : * \brief Computes Gauss-Bonnet scalar in vacuum.
56 : *
57 : * \details The Gauss-Bonnet scalar in vacuum is given by
58 : * \begin{align}
59 : * \mathcal{G} &\equiv R_{abcd} R^{abcd} - 4 R_{ab} R^{ab} + R^2
60 : * &= C_{abcd} C^{abcd}
61 : * &= 8 (E_{ab} E^{ab} - B_{ab} B^{ab}) ~,
62 : * \end{align}
63 : * where $ R_{abcd} $, $ R_{ab} $, $ R $ $ C_{abcd} $ are the Riemann tensor,
64 : * Ricci tensor, Ricci scalar and Weyl tensor in 4 spacetime dimensions. The
65 : * Gauss-Bonnet scalar in vacuum can be computed in terms of the electric ($
66 : * E_{ab} $) and magnetic ($ B_{ab} $) parts of the Weyl tensor.
67 : *
68 : * \see `gr::Tags::WeylMagnetic` and `gr::Tags::WeylElectric`
69 : *
70 : */
71 1 : void gauss_bonnet_scalar_in_vacuum(
72 : gsl::not_null<Scalar<DataVector>*> gb_scalar,
73 : const Scalar<DataVector>& weyl_electric_scalar,
74 : const Scalar<DataVector>& weyl_magnetic_scalar);
75 :
76 1 : Scalar<DataVector> gauss_bonnet_scalar_in_vacuum(
77 : const Scalar<DataVector>& weyl_electric_scalar,
78 : const Scalar<DataVector>& weyl_magnetic_scalar);
79 : /// @}
80 :
81 : } // namespace gr
82 :
83 : namespace gr::Tags {
84 : /// @{
85 : /*!
86 : * \brief Tags for the PontryaginScalar in vacuum.
87 : *
88 : * The tags are tested in Test_CurvatureScalarComputeTags.cpp
89 : */
90 : template <typename DataType>
91 1 : struct PontryaginScalar : db::SimpleTag {
92 0 : using type = Scalar<DataType>;
93 : };
94 :
95 : template <typename DataType, size_t Dim, typename Frame>
96 0 : struct PontryaginScalarCompute : PontryaginScalar<DataType>, db::ComputeTag {
97 0 : using argument_tags =
98 : tmpl::list<gr::Tags::WeylElectric<DataType, Dim, Frame>,
99 : gr::Tags::WeylMagnetic<DataType, Dim, Frame>,
100 : gr::Tags::InverseSpatialMetric<DataType, Dim, Frame>>;
101 0 : using return_type = Scalar<DataType>;
102 0 : static constexpr auto function = static_cast<void (*)(
103 : gsl::not_null<Scalar<DataType>*>, const tnsr::ii<DataType, Dim, Frame>&,
104 : const tnsr::ii<DataType, Dim, Frame>&,
105 : const tnsr::II<DataType, Dim, Frame>&)>(
106 : &gr::pontryagin_scalar_in_vacuum<Frame>);
107 0 : using base = PontryaginScalar<DataType>;
108 : };
109 : /// @{
110 :
111 : /// @{
112 : /*!
113 : * \brief Tags for the Gauss Bonnet Scalar in vacuum.
114 : *
115 : * The tags are tested in Test_CurvatureScalarComputeTags.cpp
116 : */
117 : template <typename DataType>
118 1 : struct GaussBonnetScalar : db::SimpleTag {
119 0 : using type = Scalar<DataType>;
120 : };
121 :
122 : template <typename DataType>
123 0 : struct GaussBonnetScalarCompute : GaussBonnetScalar<DataType>, db::ComputeTag {
124 0 : using argument_tags = tmpl::list<gr::Tags::WeylElectricScalar<DataType>,
125 : gr::Tags::WeylMagneticScalar<DataType>>;
126 0 : using return_type = Scalar<DataType>;
127 0 : static constexpr auto function =
128 : static_cast<void (*)(gsl::not_null<Scalar<DataType>*>,
129 : const Scalar<DataType>&, const Scalar<DataType>&)>(
130 : &gr::gauss_bonnet_scalar_in_vacuum);
131 0 : using base = GaussBonnetScalar<DataType>;
132 : };
133 : /// @}
134 : } // namespace gr::Tags
|