SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - Ricci.hpp Hit Total Coverage
Commit: 923cd4a8ea30f5a5589baa60b0a93e358ca9f8e8 Lines: 7 15 46.7 %
Date: 2025-11-07 19:37:56
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : ///\file
       5             : /// Declares function templates to calculate the Ricci tensor
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <cstddef>
      10             : 
      11             : #include "DataStructures/DataBox/Prefixes.hpp"
      12             : #include "DataStructures/DataBox/Tag.hpp"
      13             : #include "DataStructures/Tensor/TypeAliases.hpp"
      14             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      15             : 
      16             : /// \cond
      17             : namespace gsl {
      18             : template <typename>
      19             : struct not_null;
      20             : }  // namespace gsl
      21             : /// \endcond
      22             : 
      23             : namespace gr {
      24             : 
      25             : /// @{
      26             : /*!
      27             :  * \ingroup GeneralRelativityGroup
      28             :  * \brief Computes Ricci tensor from the (spatial or spacetime)
      29             :  * Christoffel symbol of the second kind and its derivative.
      30             :  *
      31             :  * \details Computes Ricci tensor \f$R_{ab}\f$ as:
      32             :  * \f$ R_{ab} = \partial_c \Gamma^{c}_{ab} - \partial_{(b} \Gamma^{c}_{a)c}
      33             :  * + \Gamma^{d}_{ab}\Gamma^{c}_{cd} - \Gamma^{d}_{ac} \Gamma^{c}_{bd} \f$
      34             :  * where \f$\Gamma^{a}_{bc}\f$ is the Christoffel symbol of the second kind.
      35             :  */
      36             : template <size_t SpatialDim, typename Frame, IndexType Index, typename DataType>
      37           1 : void ricci_tensor(
      38             :     gsl::not_null<tnsr::aa<DataType, SpatialDim, Frame, Index>*> result,
      39             :     const tnsr::Abb<DataType, SpatialDim, Frame, Index>& christoffel_2nd_kind,
      40             :     const tnsr::aBcc<DataType, SpatialDim, Frame, Index>&
      41             :         d_christoffel_2nd_kind);
      42             : 
      43             : template <size_t SpatialDim, typename Frame, IndexType Index, typename DataType>
      44           1 : tnsr::aa<DataType, SpatialDim, Frame, Index> ricci_tensor(
      45             :     const tnsr::Abb<DataType, SpatialDim, Frame, Index>& christoffel_2nd_kind,
      46             :     const tnsr::aBcc<DataType, SpatialDim, Frame, Index>&
      47             :         d_christoffel_2nd_kind);
      48             : /// @}
      49             : 
      50             : /// @{
      51             : /*!
      52             :  * \ingroup GeneralRelativityGroup
      53             :  * \brief Computes the Ricci Scalar from the (spatial or spacetime) Ricci Tensor
      54             :  * and inverse metrics.
      55             :  *
      56             :  * \details Computes Ricci scalar using the inverse metric (spatial or
      57             :  * spacetime) and Ricci tensor \f$R = g^{ab}R_{ab}\f$
      58             :  */
      59             : template <size_t SpatialDim, typename Frame, IndexType Index, typename DataType>
      60           1 : void ricci_scalar(
      61             :     gsl::not_null<Scalar<DataType>*> ricci_scalar_result,
      62             :     const tnsr::aa<DataType, SpatialDim, Frame, Index>& ricci_tensor,
      63             :     const tnsr::AA<DataType, SpatialDim, Frame, Index>& inverse_metric);
      64             : 
      65             : template <size_t SpatialDim, typename Frame, IndexType Index, typename DataType>
      66           1 : Scalar<DataType> ricci_scalar(
      67             :     const tnsr::aa<DataType, SpatialDim, Frame, Index>& ricci_tensor,
      68             :     const tnsr::AA<DataType, SpatialDim, Frame, Index>& inverse_metric);
      69             : /// @}
      70             : 
      71             : namespace Tags {
      72             : /// Compute item for spatial Ricci tensor \f$R_{ij}\f$
      73             : /// computed from SpatialChristoffelSecondKind and its spatial derivatives.
      74             : ///
      75             : /// Can be retrieved using `gr::Tags::SpatialRicci`
      76             : template <typename DataType, size_t SpatialDim, typename Frame>
      77           1 : struct SpatialRicciCompute : SpatialRicci<DataType, SpatialDim, Frame>,
      78             :                              db::ComputeTag {
      79           0 :   using argument_tags = tmpl::list<
      80             :       gr::Tags::SpatialChristoffelSecondKind<DataType, SpatialDim, Frame>,
      81             :       ::Tags::deriv<
      82             :           gr::Tags::SpatialChristoffelSecondKind<DataType, SpatialDim, Frame>,
      83             :           tmpl::size_t<SpatialDim>, Frame>>;
      84             : 
      85           0 :   using return_type = tnsr::ii<DataType, SpatialDim, Frame>;
      86             : 
      87           0 :   static constexpr auto function = static_cast<void (*)(
      88             :       gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*>,
      89             :       const tnsr::Ijj<DataType, SpatialDim, Frame>&,
      90             :       const tnsr::iJkk<DataType, SpatialDim, Frame>&)>(
      91             :       &ricci_tensor<SpatialDim, Frame, IndexType::Spatial, DataType>);
      92             : 
      93           0 :   using base = SpatialRicci<DataType, SpatialDim, Frame>;
      94             : };
      95             : 
      96             : /// Computes the spatial Ricci scalar using the spatial Ricci tensor and the
      97             : /// inverse spatial metric.
      98             : ///
      99             : /// Can be retrieved using `gr::Tags::SpatialRicciScalar`
     100             : template <typename DataType, size_t SpatialDim, typename Frame>
     101           1 : struct SpatialRicciScalarCompute : SpatialRicciScalar<DataType>,
     102             :                                    db::ComputeTag {
     103           0 :   using argument_tags =
     104             :       tmpl::list<gr::Tags::SpatialRicci<DataType, SpatialDim, Frame>,
     105             :                  gr::Tags::InverseSpatialMetric<DataType, SpatialDim, Frame>>;
     106             : 
     107           0 :   using return_type = Scalar<DataType>;
     108             : 
     109           0 :   static constexpr auto function =
     110             :       static_cast<void (*)(gsl::not_null<Scalar<DataType>*>,
     111             :                            const tnsr::ii<DataType, SpatialDim, Frame>&,
     112             :                            const tnsr::II<DataType, SpatialDim, Frame>&)>(
     113             :           &ricci_scalar<SpatialDim, Frame, IndexType::Spatial, DataType>);
     114             : 
     115           0 :   using base = SpatialRicciScalar<DataType>;
     116             : };
     117             : }  // namespace Tags
     118             : } // namespace gr

Generated by: LCOV version 1.14