SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - InverseSpacetimeMetric.hpp Hit Total Coverage
Commit: d0fc80462417e83e5cddfa1b9901bb4a9b6af4d6 Lines: 3 8 37.5 %
Date: 2024-03-29 00:33: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 <cmath>
       7             : #include <cstddef>
       8             : #include <cstdint>
       9             : #include <utility>
      10             : 
      11             : #include "DataStructures/DataBox/Prefixes.hpp"
      12             : #include "DataStructures/DataBox/Tag.hpp"
      13             : #include "DataStructures/Tensor/EagerMath/DeterminantAndInverse.hpp"
      14             : #include "DataStructures/Tensor/Tensor.hpp"
      15             : #include "DataStructures/VariablesTag.hpp"
      16             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      17             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      18             : #include "Utilities/ContainerHelpers.hpp"
      19             : #include "Utilities/Gsl.hpp"
      20             : #include "Utilities/TMPL.hpp"
      21             : #include "Utilities/TaggedTuple.hpp"
      22             : 
      23             : /// \ingroup GeneralRelativityGroup
      24             : /// Holds functions related to general relativity.
      25             : namespace gr {
      26             : /// @{
      27             : /*!
      28             :  * \ingroup GeneralRelativityGroup
      29             :  * \brief Compute inverse spacetime metric from inverse spatial metric, lapse
      30             :  * and shift
      31             :  *
      32             :  * \details The inverse spacetime metric \f$ g^{ab} \f$ is calculated as
      33             :  * \f{align}
      34             :  *    g^{tt} &= -  1/\alpha^2 \\
      35             :  *    g^{ti} &= \beta^i / \alpha^2 \\
      36             :  *    g^{ij} &= \gamma^{ij} - \beta^i \beta^j / \alpha^2
      37             :  * \f}
      38             :  * where \f$ \alpha, \beta^i\f$ and \f$ \gamma^{ij}\f$ are the lapse, shift and
      39             :  * inverse spatial metric respectively
      40             :  */
      41             : template <typename DataType, size_t SpatialDim, typename Frame>
      42           1 : void inverse_spacetime_metric(
      43             :     gsl::not_null<tnsr::AA<DataType, SpatialDim, Frame>*>
      44             :         inverse_spacetime_metric,
      45             :     const Scalar<DataType>& lapse,
      46             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      47             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
      48             : 
      49             : template <typename DataType, size_t SpatialDim, typename Frame>
      50           1 : tnsr::AA<DataType, SpatialDim, Frame> inverse_spacetime_metric(
      51             :     const Scalar<DataType>& lapse,
      52             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      53             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric);
      54             : /// @}
      55             : 
      56             : namespace Tags {
      57             : /*!
      58             :  * \brief Compute item for inverse spacetime metric \f$g^{ab}\f$ in terms of the
      59             :  * lapse \f$\alpha\f$, shift \f$\beta^i\f$, and inverse spatial metric
      60             :  * \f$\gamma^{ij}\f$.
      61             :  *
      62             :  * \details Can be retrieved using `gr::Tags::InverseSpacetimeMetric`.
      63             :  */
      64             : template <typename DataType, size_t SpatialDim, typename Frame>
      65           1 : struct InverseSpacetimeMetricCompute
      66             :     : InverseSpacetimeMetric<DataType, SpatialDim, Frame>,
      67             :       db::ComputeTag {
      68           0 :   using argument_tags =
      69             :       tmpl::list<Lapse<DataType>, Shift<DataType, SpatialDim, Frame>,
      70             :                  InverseSpatialMetric<DataType, SpatialDim, Frame>>;
      71             : 
      72           0 :   using return_type = tnsr::AA<DataType, SpatialDim, Frame>;
      73             : 
      74           0 :   static constexpr auto function = static_cast<void (*)(
      75             :       gsl::not_null<tnsr::AA<DataType, SpatialDim, Frame>*>,
      76             :       const Scalar<DataType>&, const tnsr::I<DataType, SpatialDim, Frame>&,
      77             :       const tnsr::II<DataType, SpatialDim, Frame>&)>(
      78             :       &inverse_spacetime_metric<DataType, SpatialDim, Frame>);
      79             : 
      80           0 :   using base = InverseSpacetimeMetric<DataType, SpatialDim, Frame>;
      81             : };
      82             : }  // namespace Tags
      83             : }  // namespace gr

Generated by: LCOV version 1.14