SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - WeylMagnetic.hpp Hit Total Coverage
Commit: 664546099c4dbf27a1b708fac45e39c82dd743d2 Lines: 6 15 40.0 %
Date: 2024-04-19 16:28:01
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             :       ::Tags::deriv<gr::Tags::ExtrinsicCurvature<DataType, Dim, Frame>,
      88             :                     tmpl::size_t<Dim>, Frame>,
      89             :       gr::Tags::SpatialMetric<DataType, Dim, Frame>,
      90             :       gr::Tags::SqrtDetSpatialMetric<DataType>>;
      91             : 
      92           0 :   using return_type = tnsr::ii<DataType, Dim, Frame>;
      93             : 
      94           0 :   static constexpr auto function = static_cast<void (*)(
      95             :       gsl::not_null<tnsr::ii<DataType, Dim, Frame>*>,
      96             :       const tnsr::ijj<DataType, Dim, Frame>&,
      97             :       const tnsr::ii<DataType, Dim, Frame>&, const Scalar<DataType>&)>(
      98             :       &weyl_magnetic<Frame, DataType>);
      99             : 
     100           0 :   using base = WeylMagnetic<DataType, Dim, Frame>;
     101             : };
     102             : 
     103             : /// Can be retrieved using gr::Tags::`WeylMagneticScalar`
     104             : /// Computes magnetic part of the Weyl tensor
     105             : template <typename DataType, size_t Dim, typename Frame>
     106           1 : struct WeylMagneticScalarCompute : WeylMagneticScalar<DataType>,
     107             :                                    db::ComputeTag {
     108           0 :   using argument_tags =
     109             :       tmpl::list<gr::Tags::WeylMagneticCompute<DataType, Dim, Frame>,
     110             :                  gr::Tags::InverseSpatialMetric<DataType, Dim, Frame>>;
     111             : 
     112           0 :   using return_type = Scalar<DataType>;
     113             : 
     114           0 :   static constexpr auto function = static_cast<void (*)(
     115             :       gsl::not_null<Scalar<DataType>*>, const tnsr::ii<DataType, Dim, Frame>&,
     116             :       const tnsr::II<DataType, Dim, Frame>&)>(
     117             :       &gr::weyl_magnetic_scalar<Frame, DataType>);
     118             : 
     119           0 :   using base = WeylMagneticScalar<DataType>;
     120             : };
     121             : }  // namespace Tags
     122             : }  // namespace gr

Generated by: LCOV version 1.14