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

Generated by: LCOV version 1.14