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 the electric part of the Weyl tensor in vacuum.
26 : *
27 : * \details Computes the electric part of the Weyl tensor in vacuum \f$E_{ij}\f$
28 : * as: \f$ E_{ij} = R_{ij} + KK_{ij} - K^m_{i}K_{mj}\f$ where \f$R_{ij}\f$ is
29 : * the spatial Ricci tensor, \f$K_{ij}\f$ is the extrinsic curvature, and
30 : * \f$K\f$ is the trace of \f$K_{ij}\f$. An additional definition is \f$E_{ij} =
31 : * n^a n^b C_{a i b j}\f$, where \f$n\f$ is the unit-normal to the hypersurface
32 : * and \f$C\f$ is the Weyl tensor consistent with the conventions
33 : * in \cite Boyle2019kee.
34 : * \note This needs additional terms for computations in a non-vacuum.
35 : */
36 : template <typename DataType, size_t SpatialDim, typename Frame>
37 1 : tnsr::ii<DataType, SpatialDim, Frame> weyl_electric(
38 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_ricci,
39 : const tnsr::ii<DataType, SpatialDim, Frame>& extrinsic_curvature,
40 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
41 :
42 : template <typename DataType, size_t SpatialDim, typename Frame>
43 1 : void weyl_electric(
44 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> weyl_electric_part,
45 : const tnsr::ii<DataType, SpatialDim, Frame>& spatial_ricci,
46 : const tnsr::ii<DataType, SpatialDim, Frame>& extrinsic_curvature,
47 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
48 : /// @}
49 :
50 : /// @{
51 : /*!
52 : * \ingroup GeneralRelativityGroup
53 : * \brief Computes the scalar \f$E_{ij} E^{ij}\f$ from the electric
54 : * part of the Weyl tensor \f$E_{ij}\f$.
55 : *
56 : * \details Computes the scalar \f$E_{ij} E^{ij}\f$ from the electric part
57 : * of the Weyl tensor \f$E_{ij}\f$ and the inverse spatial metric
58 : * \f$\gamma^{ij}\f$, i.e. \f$E_{ij} = \gamma^{ik}\gamma^{jl}E_{ij}E_{kl}\f$.
59 : *
60 : * \note The electric part of the Weyl tensor in vacuum is available via
61 : * gr::weyl_electric(). The electric part of the Weyl tensor needs additional
62 : * terms for matter.
63 : */
64 : template <typename DataType, size_t SpatialDim, typename Frame>
65 1 : Scalar<DataType> weyl_electric_scalar(
66 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_electric,
67 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
68 :
69 : template <typename DataType, size_t SpatialDim, typename Frame>
70 1 : void weyl_electric_scalar(
71 : gsl::not_null<Scalar<DataType>*> weyl_electric_scalar_result,
72 : const tnsr::ii<DataType, SpatialDim, Frame>& weyl_electric,
73 : const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
74 : /// @}
75 :
76 : namespace Tags {
77 : /// Compute item for the electric part of the weyl tensor in vacuum
78 : /// Computed from the SpatialRicci, ExtrinsicCurvature, and InverseSpatialMetric
79 : ///
80 : /// Can be retrieved using gr::Tags::WeylElectric
81 : template <typename DataType, size_t SpatialDim, typename Frame>
82 1 : struct WeylElectricCompute : WeylElectric<DataType, SpatialDim, Frame>,
83 : db::ComputeTag {
84 0 : using argument_tags =
85 : tmpl::list<gr::Tags::SpatialRicci<DataType, SpatialDim, Frame>,
86 : gr::Tags::ExtrinsicCurvature<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_electric<DataType, SpatialDim, Frame>);
97 :
98 0 : using base = WeylElectric<DataType, SpatialDim, Frame>;
99 : };
100 :
101 : /// Can be retrieved using gr::Tags::WeylElectricScalar
102 : template <typename DataType, size_t SpatialDim, typename Frame>
103 1 : struct WeylElectricScalarCompute : WeylElectricScalar<DataType>,
104 : db::ComputeTag {
105 0 : using argument_tags =
106 : tmpl::list<gr::Tags::WeylElectric<DataType, SpatialDim, Frame>,
107 : gr::Tags::InverseSpatialMetric<DataType, SpatialDim, Frame>>;
108 :
109 0 : using return_type = Scalar<DataType>;
110 :
111 0 : static constexpr auto function =
112 : static_cast<void (*)(gsl::not_null<Scalar<DataType>*>,
113 : const tnsr::ii<DataType, SpatialDim, Frame>&,
114 : const tnsr::II<DataType, SpatialDim, Frame>&)>(
115 : &gr::weyl_electric_scalar<DataType, SpatialDim, Frame>);
116 :
117 0 : using base = WeylElectricScalar<DataType>;
118 : };
119 : } // namespace Tags
120 : } // namespace gr
|