SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - WeylMagnetic.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 6 15 40.0 %
Date: 2025-12-05 05:03:31
Legend: Lines: hit not hit

          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             :  * \ingroup GeneralRelativityGroup
      24             :  * \brief Computes the magnetic part of the Weyl tensor.
      25             :  *
      26             :  * \details Computes the magnetic part of the Weyl tensor \f$B_{ij}\f$
      27             :  * as:
      28             :  *
      29             :  * \f{align}{
      30             :  * B_{ij} =
      31             :  * \left(1/\sqrt{\det\gamma}\right)D_{k}K_{l(i}\gamma_{j)m}\epsilon^{mlk} \f}
      32             :  *
      33             :  * where \f$\epsilon^{ijk}\f$ is the spatial Levi-Civita symbol,
      34             :  * \f$K_{ij}\f$
      35             :  * is the extrinsic curvature, \f$\gamma_{jm} \f$ is the spatial metric,
      36             :  * and \f$D_i\f$ is spatial covariant derivative.
      37             :  */
      38             : template <typename Frame, typename DataType>
      39           1 : tnsr::ii<DataType, 3, Frame> weyl_magnetic(
      40             :     const tnsr::ijj<DataType, 3, Frame>& grad_extrinsic_curvature,
      41             :     const tnsr::ii<DataType, 3, Frame>& spatial_metric,
      42             :     const Scalar<DataType>& sqrt_det_spatial_metric);
      43             : 
      44             : template <typename Frame, typename DataType>
      45           1 : void weyl_magnetic(
      46             :     gsl::not_null<tnsr::ii<DataType, 3, Frame>*> weyl_magnetic_part,
      47             :     const tnsr::ijj<DataType, 3, Frame>& grad_extrinsic_curvature,
      48             :     const tnsr::ii<DataType, 3, Frame>& spatial_metric,
      49             :     const Scalar<DataType>& sqrt_det_spatial_metric);
      50             : /// @}
      51             : 
      52             : /// @{
      53             : /*!
      54             :  * \ingroup GeneralRelativityGroup
      55             :  * \brief Computes the scalar \f$B_{ij} B^{ij}\f$ from the magnetic
      56             :  * part of the Weyl tensor \f$B_{ij}\f$.
      57             :  *
      58             :  * \details Computes the scalar \f$B_{ij} B^{ij}\f$ from the magnetic part
      59             :  * of the Weyl tensor \f$B_{ij}\f$ and the inverse spatial metric
      60             :  * \f$\gamma^{ij}\f$, i.e. \f$B_{ij} = \gamma^{ik}\gamma^{jl}B_{ij}B_{kl}\f$.
      61             :  *
      62             :  * \note The magnetic part of the Weyl tensor in vacuum is available via
      63             :  * `gr::weyl_magnetic()`. The magnetic part of the Weyl tensor needs additional
      64             :  * terms for matter.
      65             :  */
      66             : template <typename Frame, typename DataType>
      67           1 : Scalar<DataType> weyl_magnetic_scalar(
      68             :     const tnsr::ii<DataType, 3, Frame>& weyl_magnetic,
      69             :     const tnsr::II<DataType, 3, Frame>& inverse_spatial_metric);
      70             : 
      71             : template <typename Frame, typename DataType>
      72           1 : void weyl_magnetic_scalar(
      73             :     gsl::not_null<Scalar<DataType>*> weyl_magnetic_scalar_result,
      74             :     const tnsr::ii<DataType, 3, Frame>& weyl_magnetic,
      75             :     const tnsr::II<DataType, 3, Frame>& inverse_spatial_metric);
      76             : /// @}
      77             : 
      78             : namespace Tags {
      79             : /// Compute item for the magnetic part of the weyl tensor in vacuum
      80             : /// Computed from the `ExtrinsicCurvature` and `SpatialMetric`
      81             : ///
      82             : /// Can be retrieved using gr::Tags::WeylMagnetic
      83             : template <typename DataType, size_t Dim, typename Frame>
      84           1 : struct WeylMagneticCompute : WeylMagnetic<DataType, Dim, Frame>,
      85             :                              db::ComputeTag {
      86           0 :   using argument_tags = tmpl::list<
      87             :       gr::Tags::CovariantDerivativeOfExtrinsicCurvature<DataType, Dim, Frame>,
      88             :       gr::Tags::SpatialMetric<DataType, Dim, Frame>,
      89             :       gr::Tags::SqrtDetSpatialMetric<DataType>>;
      90             : 
      91           0 :   using return_type = tnsr::ii<DataType, Dim, Frame>;
      92             : 
      93           0 :   static constexpr auto function = static_cast<void (*)(
      94             :       gsl::not_null<tnsr::ii<DataType, Dim, Frame>*>,
      95             :       const tnsr::ijj<DataType, Dim, Frame>&,
      96             :       const tnsr::ii<DataType, Dim, Frame>&, const Scalar<DataType>&)>(
      97             :       &weyl_magnetic<Frame, DataType>);
      98             : 
      99           0 :   using base = WeylMagnetic<DataType, Dim, Frame>;
     100             : };
     101             : 
     102             : /// Can be retrieved using gr::Tags::`WeylMagneticScalar`
     103             : /// Computes magnetic part of the Weyl tensor
     104             : template <typename DataType, size_t Dim, typename Frame>
     105           1 : struct WeylMagneticScalarCompute : WeylMagneticScalar<DataType>,
     106             :                                    db::ComputeTag {
     107           0 :   using argument_tags =
     108             :       tmpl::list<gr::Tags::WeylMagnetic<DataType, Dim, Frame>,
     109             :                  gr::Tags::InverseSpatialMetric<DataType, Dim, Frame>>;
     110             : 
     111           0 :   using return_type = Scalar<DataType>;
     112             : 
     113           0 :   static constexpr auto function = static_cast<void (*)(
     114             :       gsl::not_null<Scalar<DataType>*>, const tnsr::ii<DataType, Dim, Frame>&,
     115             :       const tnsr::II<DataType, Dim, Frame>&)>(
     116             :       &gr::weyl_magnetic_scalar<Frame, DataType>);
     117             : 
     118           0 :   using base = WeylMagneticScalar<DataType>;
     119             : };
     120             : }  // namespace Tags
     121             : }  // namespace gr

Generated by: LCOV version 1.14