SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic - SecondTimeDerivOfSpacetimeMetric.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 "Domain/Tags.hpp"
      13             : #include "Evolution/Systems/GeneralizedHarmonic/Tags.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             : class DataVector;
      21             : template <typename X, typename Symm, typename IndexList>
      22             : class Tensor;
      23             : /// \endcond
      24             : 
      25             : namespace gh {
      26             : /// @{
      27             : /*!
      28             :  * \ingroup GeneralRelativityGroup
      29             :  * \brief Computes the second time derivative of the spacetime metric from the
      30             :  * generalized harmonic variables, lapse, shift, and the spacetime unit normal
      31             :  * 1-form.
      32             :  *
      33             :  * \details Let the generalized harmonic conjugate momentum and spatial
      34             :  * derivative variables be \f$\Pi_{ab} = -n^c \partial_c g_{ab} \f$ and
      35             :  * \f$\Phi_{iab} = \partial_i g_{ab} \f$.
      36             :  *
      37             :  * Using eq.(35) of \cite Lindblom2005qh (with \f$\gamma_1 = -1\f$) the first
      38             :  * time derivative of the spacetime metric may be expressed in terms of the
      39             :  * above variables:
      40             :  *
      41             :  * \f[
      42             :  * \partial_0 g_{ab} = - \alpha \Pi_{ab} + \beta^k \Phi_{kab}
      43             :  * \f]
      44             :  *
      45             :  * As such, its second time derivative is simply the following:
      46             :  *
      47             :  * \f[
      48             :  * \partial^2_0 g_{ab}
      49             :  *   = - (\partial_0 \alpha) \Pi_{ab} - \alpha \partial_0 \Pi_{ab}
      50             :  *     + (\partial_0 \beta^k) \Phi_{kab} + \beta^k \partial_0 \Phi_{kab}
      51             :  * \f]
      52             :  *
      53             :  */
      54             : template <typename DataType, size_t SpatialDim, typename Frame>
      55           1 : void second_time_deriv_of_spacetime_metric(
      56             :     gsl::not_null<tnsr::aa<DataType, SpatialDim, Frame>*> d2t2_spacetime_metric,
      57             :     const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
      58             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      59             :     const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
      60             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
      61             :     const tnsr::iaa<DataType, SpatialDim, Frame>& dt_phi,
      62             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
      63             :     const tnsr::aa<DataType, SpatialDim, Frame>& dt_pi);
      64             : 
      65             : template <typename DataType, size_t SpatialDim, typename Frame>
      66           1 : tnsr::aa<DataType, SpatialDim, Frame> second_time_deriv_of_spacetime_metric(
      67             :     const Scalar<DataType>& lapse, const Scalar<DataType>& dt_lapse,
      68             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      69             :     const tnsr::I<DataType, SpatialDim, Frame>& dt_shift,
      70             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
      71             :     const tnsr::iaa<DataType, SpatialDim, Frame>& dt_phi,
      72             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
      73             :     const tnsr::aa<DataType, SpatialDim, Frame>& dt_pi);
      74             : /// @}
      75             : 
      76             : namespace Tags {
      77             : /*!
      78             :  * \brief Compute item to get second time derivative of the spacetime metric
      79             :  *        from generalized harmonic and geometric variables
      80             :  *
      81             :  * \details See `second_time_deriv_of_spacetime_metric()`. Can be retrieved
      82             :  * using `gr::Tags::SpacetimeMetric` wrapped in `Tags::dt<Tags::dt>>`.
      83             :  */
      84             : template <size_t SpatialDim, typename Frame>
      85           1 : struct SecondTimeDerivOfSpacetimeMetricCompute
      86             :     : ::Tags::dt<
      87             :           ::Tags::dt<gr::Tags::SpacetimeMetric<DataVector, SpatialDim, Frame>>>,
      88             :       db::ComputeTag {
      89           0 :   using argument_tags =
      90             :       tmpl::list<gr::Tags::Lapse<DataVector>,
      91             :                  ::Tags::dt<gr::Tags::Lapse<DataVector>>,
      92             :                  gr::Tags::Shift<DataVector, SpatialDim, Frame>,
      93             :                  ::Tags::dt<gr::Tags::Shift<DataVector, SpatialDim, Frame>>,
      94             :                  Phi<DataVector, SpatialDim, Frame>,
      95             :                  ::Tags::dt<Phi<DataVector, SpatialDim, Frame>>,
      96             :                  Pi<DataVector, SpatialDim, Frame>,
      97             :                  ::Tags::dt<Pi<DataVector, SpatialDim, Frame>>>;
      98             : 
      99           0 :   using base = ::Tags::dt<
     100             :       ::Tags::dt<gr::Tags::SpacetimeMetric<DataVector, SpatialDim, Frame>>>;
     101           0 :   using return_type = typename base::type;
     102             : 
     103           0 :   static constexpr auto function = static_cast<void (*)(
     104             :       gsl::not_null<tnsr::aa<DataVector, SpatialDim, Frame>*>,
     105             :       const Scalar<DataVector>&, const Scalar<DataVector>&,
     106             :       const tnsr::I<DataVector, SpatialDim, Frame>&,
     107             :       const tnsr::I<DataVector, SpatialDim, Frame>&,
     108             :       const tnsr::iaa<DataVector, SpatialDim, Frame>&,
     109             :       const tnsr::iaa<DataVector, SpatialDim, Frame>&,
     110             :       const tnsr::aa<DataVector, SpatialDim, Frame>&,
     111             :       const tnsr::aa<DataVector, SpatialDim, Frame>&)>(
     112             :       &second_time_deriv_of_spacetime_metric<DataVector, SpatialDim, Frame>);
     113             : };
     114             : }  // namespace Tags
     115             : }  // namespace gh

Generated by: LCOV version 1.14