SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity - InterfaceNullNormal.hpp Hit Total Coverage
Commit: 1e29a35ad8559408f21493dc5db8a49a237bb2f0 Lines: 4 5 80.0 %
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             :  * \ingroup GeneralRelativityGroup
      21             :  * \brief Compute null normal one-form to the boundary of a closed
      22             :  * region in a spatial slice of spacetime.
      23             :  *
      24             :  * \details Consider an \f$n-1\f$-dimensional boundary \f$S\f$ of a closed
      25             :  * region in an \f$n\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let
      26             :  * \f$s^a\f$ be the unit spacelike vector orthogonal to \f$S\f$ in \f$\Sigma\f$,
      27             :  * and \f$n^a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
      28             :  * This function returns the null one-form that is outgoing/incoming on \f$S\f$:
      29             :  *
      30             :  * \f{align*}
      31             :  * k_a = \frac{1}{\sqrt{2}}\left(n_a \pm s_a\right).
      32             :  * \f}
      33             :  *
      34             :  * Here \f$n_a = g_{ab} n^b\f$ and \f$s_a = g_{ab} s^b\f$ are the spacetime
      35             :  * one-forms corresponding to the spacetime vectors \f$n^a\f$ and \f$s^a\f$.
      36             :  *
      37             :  * If \f$t^a=(1,0,0,0)\f$ is a vector in the time direction, then the unit
      38             :  * normal to the spatial slice \f$n^a\f$ is determined by the relation
      39             :  * \f$t^a = \alpha n^a + \beta^a\f$ (e.g. Eq. (2.98) of \cite BaumgarteShapiro),
      40             :  * where \f$\alpha\f$ is the lapse, \f$\beta^a = (0, \beta^i)\f$, and
      41             :  * \f$\beta^i\f$ is the shift. Solving for \f$n^a\f$ then gives
      42             :  * \f$n^a = \alpha^{-1}(t^a - \beta^a)\f$. Then since \f$n_a = g_{ab} n^b\f$,
      43             :  * the normal one-form is given by
      44             :  * \f$n_a = g_{ab} n^b = \alpha^{-1}(g_{at} - g_{ab} \beta^b)\f$. This implies
      45             :  * \f$n_i = \alpha^{-1}(g_{it} - g_{ij} \beta^j)\f$, or
      46             :  * \f$ n_i = -\alpha^{-1}(\beta_i - \beta_i) = 0\f$. Only \f$n_t\f$ is nonzero:
      47             :  * it is \f$n_t = \alpha^{-1}(g_{tt} - g_{tj} \beta^j)\f$, or
      48             :  * \f$n_t = \alpha^{-1}(-\alpha^2 + \beta_j \beta^j - \beta_j \beta^j)\f$, or
      49             :  * \f$n_t = -\alpha\f$. Note that \f$n^a\f$ is a unit timelike vector, since
      50             :  * \f$n^a n_a = n^t n_t = \alpha^{-1}(-\alpha) = -1\f$.
      51             :  *
      52             :  * The unit normal to the boundary \f$s^a\f$ is orthogonal to \f$n^a\f$ and has
      53             :  * components \f$s^a = (0, s^i)\f$, where \f$s^i\f$ is the spatial unit normal
      54             :  * vector to the boundary. Since it is a spacelike unit normal vector whose
      55             :  * time component vanishes, \f$s^a s_a = s^i s_i = 1\f$.
      56             :  * Note that \f$s_a = g_{ab} s^b = g_{aj} s^j\f$, so
      57             :  * \f$s_i = g_{ij} s^j = \gamma_{ij} s^j\f$, where \f$\gamma_{ij}\f$ is the
      58             :  * spatial metric, while \f$s_t = g_{tj} s^j = \beta_j s^j = \beta^j s_j\f$.
      59             :  * Thus \f$n^a\f$ and \f$s_a\f$ are orthogonal, since
      60             :  * \f$n^a s_a = \alpha^{-1}(t^a s_a - \beta^a s_a)\f$, or
      61             :  * \f$n^a s_a = \alpha^{-1}(\beta^j s_j - \beta^j s_j) = 0\f$.
      62             :  *
      63             :  * This function computes \f$s_a\f$ from the inputs \f$s_i\f$ (provided as
      64             :  * `interface_unit_normal_one_form`) and \f$\beta^i\f$ (provided as `shift`).
      65             :  */
      66             : template <typename DataType, size_t VolumeDim, typename Frame>
      67           1 : tnsr::a<DataType, VolumeDim, Frame> interface_null_normal(
      68             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
      69             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
      70             :     const tnsr::I<DataType, VolumeDim, Frame>& shift, double sign);
      71             : 
      72             : template <typename DataType, size_t VolumeDim, typename Frame>
      73           1 : void interface_null_normal(
      74             :     gsl::not_null<tnsr::a<DataType, VolumeDim, Frame>*> null_one_form,
      75             :     const tnsr::a<DataType, VolumeDim, Frame>& spacetime_normal_one_form,
      76             :     const tnsr::i<DataType, VolumeDim, Frame>& interface_unit_normal_one_form,
      77             :     const tnsr::I<DataType, VolumeDim, Frame>& shift, double sign);
      78             : /// @}
      79             : 
      80             : /*!
      81             :  * \ingroup GeneralRelativityGroup
      82             :  * \brief Compute null normal vector to the boundary of a closed
      83             :  * region in a spatial slice of spacetime.
      84             :  *
      85             :  * \details Consider an \f$n-1\f$-dimensional boundary \f$S\f$ of a closed
      86             :  * region in an \f$n\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let
      87             :  * \f$s^a\f$ be the unit spacelike vector orthogonal to \f$S\f$ in \f$\Sigma\f$,
      88             :  * and \f$n^a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
      89             :  * This function returns the null vector that is outgoing/ingoing on \f$S\f$:
      90             :  *
      91             :  * \f{align*}
      92             :  * k^a = \frac{1}{\sqrt{2}}\left(n^a \pm s^a\right).
      93             :  * \f}
      94             :  */
      95             : template <typename DataType, size_t VolumeDim, typename Frame>
      96           1 : tnsr::A<DataType, VolumeDim, Frame> interface_null_normal(
      97             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
      98             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector,
      99             :     double sign);
     100             : 
     101             : /*!
     102             :  * \ingroup GeneralRelativityGroup
     103             :  * \brief Compute null normal vector to the boundary of a closed
     104             :  * region in a spatial slice of spacetime.
     105             :  *
     106             :  * \details Consider an \f$n-1\f$-dimensional boundary \f$S\f$ of a closed
     107             :  * region in an \f$n\f$-dimensional spatial hypersurface \f$\Sigma\f$. Let
     108             :  * \f$s^a\f$ be the unit spacelike vector orthogonal to \f$S\f$ in \f$\Sigma\f$,
     109             :  * and \f$n^a\f$ be the timelike unit vector orthogonal to \f$\Sigma\f$.
     110             :  * This function returns the null vector that is outgoing/ingoing on \f$S\f$:
     111             :  *
     112             :  * \f{align*}
     113             :  * k^a = \frac{1}{\sqrt{2}}\left(n^a \pm s^a\right).
     114             :  * \f}
     115             :  */
     116             : template <typename DataType, size_t VolumeDim, typename Frame>
     117           1 : void interface_null_normal(
     118             :     gsl::not_null<tnsr::A<DataType, VolumeDim, Frame>*> null_vector,
     119             :     const tnsr::A<DataType, VolumeDim, Frame>& spacetime_normal_vector,
     120             :     const tnsr::I<DataType, VolumeDim, Frame>& interface_unit_normal_vector,
     121             :     double sign);
     122             : }  // namespace gr

Generated by: LCOV version 1.14