SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - ProjectionOperators.hpp Hit Total Coverage
Commit: 1e29a35ad8559408f21493dc5db8a49a237bb2f0 Lines: 10 11 90.9 %
Date: 2026-03-31 22:27:51
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/Tensor/TypeAliases.hpp"
       9             : 
      10             : /// \cond
      11             : namespace gsl {
      12             : template <typename>
      13             : struct not_null;
      14             : }  // namespace gsl
      15             : /// \endcond
      16             : 
      17             : namespace gr {
      18             : 
      19             : /// @{
      20             : /*!
      21             :  * \ingroup GeneralRelativityGroup
      22             :  * \brief Compute projection operator onto an interface
      23             :  *
      24             :  * \details Returns the operator \f$P^{ij} = \gamma^{ij} - n^i n^j\f$,
      25             :  * where \f$\gamma^{ij}\f$ is the inverse spatial metric, and
      26             :  * \f$n^i\f$ is the normal vector to the interface in question.
      27             :  *
      28             :  */
      29             : template <typename DataType, size_t VolumeDim, typename Frame>
      30           1 : tnsr::II<DataType, VolumeDim, Frame> transverse_projection_operator(
      31             :     const tnsr::II<DataType, VolumeDim, Frame>& inverse_spatial_metric,
      32             :     const tnsr::I<DataType, VolumeDim, Frame>& normal_vector);
      33             : 
      34             : template <typename DataType, size_t VolumeDim, typename Frame>
      35           1 : void transverse_projection_operator(
      36             :     gsl::not_null<tnsr::II<DataType, VolumeDim, Frame>*> projection_tensor,
      37             :     const tnsr::II<DataType, VolumeDim, Frame>& inverse_spatial_metric,
      38             :     const tnsr::I<DataType, VolumeDim, Frame>& normal_vector);
      39             : /// @}
      40             : 
      41             : /*!
      42             :  * \ingroup GeneralRelativityGroup
      43             :  * \brief Compute projection operator onto an interface
      44             :  *
      45             :  * \details Returns the operator \f$P_{ij} = \gamma_{ij} - n_i n_j\f$,
      46             :  * where \f$ \gamma_{ij}\f$ is the spatial metric, and \f$ n_i\f$ is
      47             :  * the normal one-form to the interface in question.
      48             :  */
      49             : template <typename DataType, size_t VolumeDim, typename Frame>
      50           1 : tnsr::ii<DataType, VolumeDim, Frame> transverse_projection_operator(
      51             :     const tnsr::ii<DataType, VolumeDim, Frame>& spatial_metric,
      52             :     const tnsr::i<DataType, VolumeDim, Frame>& normal_one_form);
      53             : 
      54             : /*!
      55             :  * \ingroup GeneralRelativityGroup
      56             :  * \brief Compute projection operator onto an interface
      57             :  *
      58             :  * \details Returns the operator \f$P_{ij} = \gamma_{ij} - n_i n_j\f$,
      59             :  * where \f$ \gamma_{ij}\f$ is the spatial metric, and \f$ n_i\f$ is
      60             :  * the normal one-form to the interface in question.
      61             :  */
      62             : template <typename DataType, size_t VolumeDim, typename Frame>
      63             : void transverse_projection_operator(
      64             :     gsl::not_null<tnsr::ii<DataType, VolumeDim, Frame>*> projection_tensor,
      65             :     const tnsr::ii<DataType, VolumeDim, Frame>& spatial_metric,
      66             :     const tnsr::i<DataType, VolumeDim, Frame>& normal_one_form);
      67             : 
      68             : /*!
      69             :  * \ingroup GeneralRelativityGroup
      70             :  * \brief Compute projection operator onto an interface
      71             :  *
      72             :  * \details Returns the operator \f$P^{i}_{j} = \delta^{i}_{j} - n^i n_j\f$,
      73             :  * where \f$n^i\f$ and \f$n_i\f$ are the normal vector and normal one-form
      74             :  * to the interface in question.
      75             :  */
      76             : template <typename DataType, size_t VolumeDim, typename Frame>
      77           1 : tnsr::Ij<DataType, VolumeDim, Frame> transverse_projection_operator(
      78             :     const tnsr::I<DataType, VolumeDim, Frame>& normal_vector,
      79             :     const tnsr::i<DataType, VolumeDim, Frame>& normal_one_form);
      80             : 
      81             : /*!
      82             :  * \ingroup GeneralRelativityGroup
      83             :  * \brief Compute projection operator onto an interface
      84             :  *
      85             :  * \details Returns the operator \f$P^{i}_{j} = \delta^{i}_{j} - n^i n_j\f$,
      86             :  * where \f$n^i\f$ and \f$n_i\f$ are the normal vector and normal one-form
      87             :  * to the interface in question.
      88             :  */
      89             : template <typename DataType, size_t VolumeDim, typename Frame>
      90             : void transverse_projection_operator(
      91             :     gsl::not_null<tnsr::Ij<DataType, VolumeDim, Frame>*> projection_tensor,
      92             :     const tnsr::I<DataType, VolumeDim, Frame>& normal_vector,
      93             :     const tnsr::i<DataType, VolumeDim, Frame>& normal_one_form);
      94             : 
      95             : /// @{
      96             : /*!
      97             :  * \ingroup GeneralRelativityGroup
      98             :  * \brief Compute spacetime projection operator onto an interface
      99             :  *
     100             :  * \details Consider a \f$d-1\f$-dimensional surface \f$S\f$ in a
     101             :  * \f$d\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let \f$s_a\f$
     102             :  * be the unit spacelike one-form orthogonal to \f$S\f$ in \f$\Sigma\f$,
     103             :  * and \f$n_a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
     104             :  * This function returns the projection operator onto \f$S\f$ for
     105             :  * \f$d+1\f$ dimensional quantities:
     106             :  *
     107             :  * \f{align*}
     108             :  * P_{ab} = g_{ab} + n_a n_b - s_a s_b = \gamma_{ab} - s_a s_b.
     109             :  * \f}
     110             :  *
     111             :  * Here \f$n_a = g_{ab} n^b\f$ and \f$s_a = g_{ab} s^b\f$ are the spacetime
     112             :  * one-forms corresponding to the spacetime vectors \f$n^a\f$ and \f$s^a\f$.
     113             :  *
     114             :  * If \f$t^a=(1,0,0,0)\f$ is a vector in the time direction, then the unit
     115             :  * normal to the spatial slice \f$n^a\f$ is determined by the relation
     116             :  * \f$t^a = \alpha n^a + \beta^a\f$ (e.g. Eq. (2.98) of \cite BaumgarteShapiro),
     117             :  * where \f$\alpha\f$ is the lapse, \f$\beta^a = (0, \beta^i)\f$, and
     118             :  * \f$\beta^i\f$ is the shift. Solving for \f$n^a\f$ then gives
     119             :  * \f$n^a = \alpha^{-1}(t^a - \beta^a)\f$. Then since \f$n_a = g_{ab} n^b\f$,
     120             :  * the normal one-form is given by
     121             :  * \f$n_a = g_{ab} n^b = \alpha^{-1}(g_{at} - g_{ab} \beta^b)\f$. This implies
     122             :  * \f$n_i = \alpha^{-1}(g_{it} - g_{ij} \beta^j)\f$, or
     123             :  * \f$ n_i = -\alpha^{-1}(\beta_i - \beta_i) = 0\f$. Only \f$n_t\f$ is nonzero:
     124             :  * it is \f$n_t = \alpha^{-1}(g_{tt} - g_{tj} \beta^j)\f$, or
     125             :  * \f$n_t = \alpha^{-1}(-\alpha^2 + \beta_j \beta^j - \beta_j \beta^j)\f$, or
     126             :  * \f$n_t = -\alpha\f$. Note that \f$n^a\f$ is a unit timelike vector, since
     127             :  * \f$n^a n_a = n^t n_t = \alpha^{-1}(-\alpha) = -1\f$.
     128             :  *
     129             :  * The unit normal to the boundary \f$s^a\f$ is orthogonal to \f$n^a\f$ and has
     130             :  * components \f$s^a = (0, s^i)\f$, where \f$s^i\f$ is the spatial unit normal
     131             :  * vector to the boundary. Since it is a spacelike unit normal vector whose
     132             :  * time component vanishes, \f$s^a s_a = s^i s_i = 1\f$.
     133             :  * Note that \f$s_a = g_{ab} s^b = g_{aj} s^j\f$, so
     134             :  * \f$s_i = g_{ij} s^j = \gamma_{ij} s^j\f$, where \f$\gamma_{ij}\f$ is the
     135             :  * spatial metric, while \f$s_t = g_{tj} s^j = \beta_j s^j = \beta^j s_j\f$.
     136             :  * Thus \f$n^a\f$ and \f$s_a\f$ are orthogonal, since
     137             :  * \f$n^a s_a = \alpha^{-1}(t^a s_a - \beta^a s_a)\f$, or
     138             :  * \f$n^a s_a = \alpha^{-1}(\beta^j s_j - \beta^j s_j) = 0\f$.
     139             :  *
     140             :  * This function computes $s_a$ from the inputs $s_i$ (provided as
     141             :  * `interface_unit_normal_one_form`) and \f$\beta^i\f$ (provided as `shift`).
     142             :  */
     143             : template <typename DataType, size_t VolumeDim, typename Frame>
     144           1 : tnsr::aa<DataType, VolumeDim, Frame> transverse_projection_operator(
     145             :     const tnsr::aa<DataType, VolumeDim, Frame>& spacetime_metric,
     146             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
     147             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
     148             :     const tnsr::I<DataType, VolumeDim, Frame>& shift);
     149             : 
     150             : template <typename DataType, size_t VolumeDim, typename Frame>
     151           1 : void transverse_projection_operator(
     152             :     gsl::not_null<tnsr::aa<DataType, VolumeDim, Frame>*> projection_tensor,
     153             :     const tnsr::aa<DataType, VolumeDim, Frame>& spacetime_metric,
     154             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
     155             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
     156             :     const tnsr::I<DataType, VolumeDim, Frame>& shift);
     157             : /// @}
     158             : 
     159             : /*!
     160             :  * \ingroup GeneralRelativityGroup
     161             :  * \brief Compute spacetime projection operator onto an interface
     162             :  *
     163             :  * \details Consider a \f$d-1\f$-dimensional surface \f$S\f$ in a
     164             :  * \f$d\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let \f$s^a\f$
     165             :  * be the unit spacelike vector orthogonal to \f$S\f$ in \f$\Sigma\f$,
     166             :  * and \f$n^a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
     167             :  * This function returns the projection operator onto \f$S\f$ for
     168             :  * \f$d+1\f$ dimensional quantities:
     169             :  *
     170             :  * \f{align*}
     171             :  * P^{ab} = g^{ab} + n^a n^b - s^a s^b = \gamma_{ab} - s_a s_b.
     172             :  * \f}
     173             :  */
     174             : template <typename DataType, size_t VolumeDim, typename Frame>
     175           1 : tnsr::AA<DataType, VolumeDim, Frame> transverse_projection_operator(
     176             :     const tnsr::AA<DataType, VolumeDim, Frame>& inverse_spacetime_metric,
     177             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
     178             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector);
     179             : 
     180             : /*!
     181             :  * \ingroup GeneralRelativityGroup
     182             :  * \brief Compute spacetime projection operator onto an interface
     183             :  *
     184             :  * \details Consider a \f$d-1\f$-dimensional surface \f$S\f$ in a
     185             :  * \f$d\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let \f$s^a\f$
     186             :  * be the unit spacelike vector orthogonal to \f$S\f$ in \f$\Sigma\f$,
     187             :  * and \f$n^a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
     188             :  * This function returns the projection operator onto \f$S\f$ for
     189             :  * \f$d+1\f$ dimensional quantities:
     190             :  *
     191             :  * \f{align*}
     192             :  * P^{ab} = g^{ab} + n^a n^b - s^a s^b = \gamma_{ab} - s_a s_b.
     193             :  * \f}
     194             :  */
     195             : template <typename DataType, size_t VolumeDim, typename Frame>
     196           1 : void transverse_projection_operator(
     197             :     gsl::not_null<tnsr::AA<DataType, VolumeDim, Frame>*> projection_tensor,
     198             :     const tnsr::AA<DataType, VolumeDim, Frame>& inverse_spacetime_metric,
     199             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
     200             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector);
     201             : 
     202             : /// @{
     203             : /*!
     204             :  * \ingroup GeneralRelativityGroup
     205             :  * \brief Compute spacetime projection operator onto an interface
     206             :  *
     207             :  * \details Consider a \f$d-1\f$-dimensional surface \f$S\f$ in a
     208             :  * \f$d\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let \f$s^a\f$
     209             :  * \f$(s_a)\f$ be the unit spacelike vector (one-form) orthogonal
     210             :  * to \f$S\f$ in \f$\Sigma\f$, and \f$n^a\f$ \f$(n_a)\f$ be the timelike
     211             :  * unit vector (one-form) orthogonal to \f$\Sigma\f$. This function
     212             :  * returns the projection operator onto \f$S\f$ for \f$d+1\f$ dimensional
     213             :  * quantities:
     214             :  *
     215             :  * \f{align*}
     216             :  * P^a_b = \delta^a_b + n^a n_b - s^a s_b.
     217             :  * \f}
     218             :  *
     219             :  * Here \f$n_a = g_{ab} n^b\f$ and \f$s_a = g_{ab} s^b\f$ are the spacetime
     220             :  * one-forms corresponding to the spacetime vectors \f$n^a\f$ and \f$s^a\f$.
     221             :  *
     222             :  * If \f$t^a=(1,0,0,0)\f$ is a vector in the time direction, then the unit
     223             :  * normal to the spatial slice \f$n^a\f$ is determined by the relation
     224             :  * \f$t^a = \alpha n^a + \beta^a\f$ (e.g. Eq. (2.98) of \cite BaumgarteShapiro),
     225             :  * where \f$\alpha\f$ is the lapse, \f$\beta^a = (0, \beta^i)\f$, and
     226             :  * \f$\beta^i\f$ is the shift. Solving for \f$n^a\f$ then gives
     227             :  * \f$n^a = \alpha^{-1}(t^a - \beta^a)\f$. Then since \f$n_a = g_{ab} n^b\f$,
     228             :  * the normal one-form is given by
     229             :  * \f$n_a = g_{ab} n^b = \alpha^{-1}(g_{at} - g_{ab} \beta^b)\f$. This implies
     230             :  * \f$n_i = \alpha^{-1}(g_{it} - g_{ij} \beta^j)\f$, or
     231             :  * \f$ n_i = -\alpha^{-1}(\beta_i - \beta_i) = 0\f$. Only \f$n_t\f$ is nonzero:
     232             :  * it is \f$n_t = \alpha^{-1}(g_{tt} - g_{tj} \beta^j)\f$, or
     233             :  * \f$n_t = \alpha^{-1}(-\alpha^2 + \beta_j \beta^j - \beta_j \beta^j)\f$, or
     234             :  * \f$n_t = -\alpha\f$. Note that \f$n^a\f$ is a unit timelike vector, since
     235             :  * \f$n^a n_a = n^t n_t = \alpha^{-1}(-\alpha) = -1\f$.
     236             :  *
     237             :  * The unit normal to the boundary \f$s^a\f$ is orthogonal to \f$n^a\f$ and has
     238             :  * components \f$s^a = (0, s^i)\f$, where \f$s^i\f$ is the spatial unit normal
     239             :  * vector to the boundary. Since it is a spacelike unit normal vector whose
     240             :  * time component vanishes, \f$s^a s_a = s^i s_i = 1\f$.
     241             :  * Note that \f$s_a = g_{ab} s^b = g_{aj} s^j\f$, so
     242             :  * \f$s_i = g_{ij} s^j = \gamma_{ij} s^j\f$, where \f$\gamma_{ij}\f$ is the
     243             :  * spatial metric, while \f$s_t = g_{tj} s^j = \beta_j s^j = \beta^j s_j\f$.
     244             :  * Thus \f$n^a\f$ and \f$s_a\f$ are orthogonal, since
     245             :  * \f$n^a s_a = \alpha^{-1}(t^a s_a - \beta^a s_a)\f$, or
     246             :  * \f$n^a s_a = \alpha^{-1}(\beta^j s_j - \beta^j s_j) = 0\f$.
     247             :  *
     248             :  * This function computes \f$s_a\f$ from the inputs \f$s_i\f$ (provided as
     249             :  * `interface_unit_normal_one_form`) and \f$\beta^i\f$ (provided as `shift`),
     250             :  * and it computes \f$s^a\f$ from \f$s^i\f$ (since \f$s^t=0\f$).
     251             :  */
     252             : template <typename DataType, size_t VolumeDim, typename Frame>
     253           1 : tnsr::Ab<DataType, VolumeDim, Frame> transverse_projection_operator(
     254             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
     255             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
     256             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector,
     257             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
     258             :     const tnsr::I<DataType, VolumeDim, Frame>& shift);
     259             : 
     260             : template <typename DataType, size_t VolumeDim, typename Frame>
     261           1 : void transverse_projection_operator(
     262             :     gsl::not_null<tnsr::Ab<DataType, VolumeDim, Frame>*> projection_tensor,
     263             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
     264             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
     265             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector,
     266             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
     267             :     const tnsr::I<DataType, VolumeDim, Frame>& shift);
     268             : /// @}
     269             : }  // namespace gr

Generated by: LCOV version 1.14