SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic - TimeDerivOfLapse.hpp Hit Total Coverage
Commit: e97d9291135504237f5d2c1beffee9372b7df5e4 Lines: 3 8 37.5 %
Date: 2025-04-04 19:04:27
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/Prefixes.hpp"
       9             : #include "DataStructures/DataBox/Tag.hpp"
      10             : #include "DataStructures/DataVector.hpp"
      11             : #include "DataStructures/Tensor/TypeAliases.hpp"
      12             : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
      13             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      14             : #include "Utilities/Gsl.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : 
      17             : /// \cond
      18             : namespace domain {
      19             : namespace Tags {
      20             : template <size_t Dim, typename Frame>
      21             : struct Coordinates;
      22             : }  // namespace Tags
      23             : }  // namespace domain
      24             : class DataVector;
      25             : /// \endcond
      26             : 
      27             : namespace gh {
      28             : /// @{
      29             : /*!
      30             :  * \ingroup GeneralRelativityGroup
      31             :  * \brief Computes time derivative of lapse (\f$\alpha\f$) from the generalized
      32             :  *        harmonic variables, lapse, shift and the spacetime unit normal 1-form.
      33             :  *
      34             :  * \details Let the generalized harmonic conjugate momentum and spatial
      35             :  * derivative variables be \f$\Pi_{ab} = -n^c \partial_c g_{ab} \f$ and
      36             :  * \f$\Phi_{iab} = \partial_i g_{ab} \f$, and the operator
      37             :  * \f$D := \partial_0 - \beta^k \partial_k \f$. The time derivative of
      38             :  * \f$\alpha\f$ is then:
      39             :  *
      40             :  * \f{align*}
      41             :  *  \frac{1}{2} \alpha^2 n^a n^b \Pi_{ab}
      42             :  *       - \frac{1}{2} \alpha \beta^i n^a n^b \Phi_{iab}
      43             :  *  =& \frac{1}{2} \alpha^2 n^a n^b n^c \partial_c g_{ab}
      44             :  *       - \frac{1}{2} \alpha \beta^i (-(2/\alpha) \partial_i \alpha) \\
      45             :  *  =& \frac{1}{2} \alpha^2 [ \\
      46             :  *       &-(1/\alpha^3) D[\gamma_{jk} \beta^j \beta^k - \alpha^2] \\
      47             :  *       &- (\beta^j \beta^k / \alpha^3)D[\gamma_{jk}] \\
      48             :  *       &+ 2 (\beta^j / \alpha^3) D[\gamma_{jk} \beta^k] \\
      49             :  *       &+ (2 / \alpha^2)(\beta^i \partial_i \alpha)]] \\
      50             :  *  =& \frac{1}{2\alpha} [-D[\gamma_{jk}\beta^j\beta^k - \alpha^2]
      51             :  *       - \beta^j\beta^k D[\gamma_{jk}] + 2\alpha \beta^k\partial_k \alpha
      52             :  *       + 2\beta^j D[\gamma_{jk}\beta^k]] \\
      53             :  *  =& D[\alpha] + \beta^k\partial_k \alpha \\
      54             :  *  =& \partial_0 \alpha
      55             :  * \f}
      56             :  *
      57             :  * where the simplification done for \f$\partial_i \alpha\f$ is used to
      58             :  * substitute for the second term (\f$\frac{1}{2} \alpha \beta^i n^a n^b
      59             :  * \Phi_{iab}\f$).
      60             :  *
      61             :  * Thus,
      62             :  *
      63             :  * \f[
      64             :  *  \partial_0 \alpha =
      65             :  *      (\alpha/2)(\alpha n^a n^b \Pi_{ab} - \beta^i n^a n^b \Phi_{iab})
      66             :  * \f]
      67             :  *
      68             :  */
      69             : template <typename DataType, size_t SpatialDim, typename Frame>
      70           1 : void time_deriv_of_lapse(
      71             :     gsl::not_null<Scalar<DataType>*> dt_lapse, const Scalar<DataType>& lapse,
      72             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      73             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      74             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
      75             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi);
      76             : 
      77             : template <typename DataType, size_t SpatialDim, typename Frame>
      78           1 : Scalar<DataType> time_deriv_of_lapse(
      79             :     const Scalar<DataType>& lapse,
      80             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      81             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      82             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
      83             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi);
      84             : /// @}
      85             : 
      86             : namespace Tags {
      87             : /*!
      88             :  * \brief Compute item to get time derivative of lapse (\f$\alpha\f$) from the
      89             :  *        generalized harmonic variables, lapse, shift and the spacetime unit
      90             :  *        normal 1-form.
      91             :  *
      92             :  * \details See `time_deriv_of_lapse()`. Can be retrieved using
      93             :  * `gr::Tags::Lapse` wrapped in `Tags::dt`.
      94             :  */
      95             : template <size_t SpatialDim, typename Frame>
      96           1 : struct TimeDerivLapseCompute : ::Tags::dt<gr::Tags::Lapse<DataVector>>,
      97             :                                db::ComputeTag {
      98           0 :   using argument_tags =
      99             :       tmpl::list<gr::Tags::Lapse<DataVector>,
     100             :                  gr::Tags::Shift<DataVector, SpatialDim, Frame>,
     101             :                  gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
     102             :                  Phi<DataVector, SpatialDim, Frame>,
     103             :                  Pi<DataVector, SpatialDim, Frame>>;
     104             : 
     105           0 :   using return_type = Scalar<DataVector>;
     106             : 
     107           0 :   static constexpr auto function = static_cast<void (*)(
     108             :       gsl::not_null<Scalar<DataVector>*>, const Scalar<DataVector>&,
     109             :       const tnsr::I<DataVector, SpatialDim, Frame>&,
     110             :       const tnsr::A<DataVector, SpatialDim, Frame>&,
     111             :       const tnsr::iaa<DataVector, SpatialDim, Frame>&,
     112             :       const tnsr::aa<DataVector, SpatialDim, Frame>&)>(
     113             :       &time_deriv_of_lapse<DataVector, SpatialDim, Frame>);
     114             : 
     115           0 :   using base = ::Tags::dt<gr::Tags::Lapse<DataVector>>;
     116             : };
     117             : }  // namespace Tags
     118             : }  // namespace gh

Generated by: LCOV version 1.14