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

Generated by: LCOV version 1.14