SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic - SpatialDerivOfShift.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/Tensor/TypeAliases.hpp"
      11             : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
      12             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : /// \cond
      17             : class DataVector;
      18             : /// \endcond
      19             : 
      20             : namespace gh {
      21             : /// @{
      22             : /*!
      23             :  * \ingroup GeneralRelativityGroup
      24             :  * \brief Computes spatial derivatives of the shift vector from
      25             :  *        the generalized harmonic and geometric variables
      26             :  *
      27             :  * \details Spatial derivatives of the shift vector \f$\beta^i\f$ can be derived
      28             :  * from the following steps:
      29             :  * \f{align*}
      30             :  * \partial_i \beta^j
      31             :  *  =& \gamma^{jl} \gamma_{kl} \partial_i \beta^k \\
      32             :  *  =& \gamma^{jl} (\beta^k \partial_i \gamma_{lk}
      33             :  *         + \gamma_{kl}\partial_i \beta^k - \beta^k \partial_i \gamma_{kl}) \\
      34             :  *  =& \gamma^{jl} (\partial_i \beta_l - \beta^k \partial_i \gamma_{lk})
      35             :  *         (\because \gamma^{j0} = 0) \\
      36             :  *  =& \gamma^{ja} (\partial_i g_{a0} - \beta^k \partial _i g_{ak}) \\
      37             :  *  =& \alpha \gamma^{ja} n^b \partial_i g_{ab} \\
      38             :  *  =& (\gamma^{ja} - n^j n^a) \alpha n^b \Phi_{iab}
      39             :  *         - 2 n^j \partial_i \alpha \\
      40             :  *  =& g^{ja} \alpha n^b \Phi_{iab} - 2 n^j \partial_i \alpha \\
      41             :  *  =& \alpha (g^{ja} + n^j n^a) n^b \Phi_{iab}.
      42             :  * \f}
      43             :  * where we used the equation from spatial_deriv_of_lapse() for
      44             :  * \f$\partial_i \alpha\f$.
      45             :  */
      46             : template <typename DataType, size_t SpatialDim, typename Frame>
      47           1 : void spatial_deriv_of_shift(
      48             :     gsl::not_null<tnsr::iJ<DataType, SpatialDim, Frame>*> deriv_shift,
      49             :     const Scalar<DataType>& lapse,
      50             :     const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
      51             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      52             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
      53             : 
      54             : template <typename DataType, size_t SpatialDim, typename Frame>
      55           1 : tnsr::iJ<DataType, SpatialDim, Frame> spatial_deriv_of_shift(
      56             :     const Scalar<DataType>& lapse,
      57             :     const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
      58             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      59             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
      60             : /// @}
      61             : 
      62             : namespace Tags {
      63             : /*!
      64             :  * \brief Compute item to get spatial derivatives of the shift vector from
      65             :  *        generalized harmonic and geometric variables
      66             :  *
      67             :  * \details See `spatial_deriv_of_shift()`. Can be retrieved using
      68             :  * `gr::Tags::Shift` wrapped in `::Tags::deriv`.
      69             :  */
      70             : template <size_t SpatialDim, typename Frame>
      71           1 : struct DerivShiftCompute
      72             :     : ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
      73             :                     tmpl::size_t<SpatialDim>, Frame>,
      74             :       db::ComputeTag {
      75           0 :   using argument_tags = tmpl::list<
      76             :       gr::Tags::Lapse<DataVector>,
      77             :       gr::Tags::InverseSpacetimeMetric<DataVector, SpatialDim, Frame>,
      78             :       gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
      79             :       Phi<DataVector, SpatialDim, Frame>>;
      80             : 
      81           0 :   using return_type = tnsr::iJ<DataVector, SpatialDim, Frame>;
      82             : 
      83           0 :   static constexpr auto function = static_cast<void (*)(
      84             :       gsl::not_null<tnsr::iJ<DataVector, SpatialDim, Frame>*>,
      85             :       const Scalar<DataVector>&, const tnsr::AA<DataVector, SpatialDim, Frame>&,
      86             :       const tnsr::A<DataVector, SpatialDim, Frame>&,
      87             :       const tnsr::iaa<DataVector, SpatialDim, Frame>&)>(
      88             :       &spatial_deriv_of_shift<DataVector, SpatialDim, Frame>);
      89             : 
      90           0 :   using base = ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
      91             :                              tmpl::size_t<SpatialDim>, Frame>;
      92             : };
      93             : }  // namespace Tags
      94             : }  // namespace gh

Generated by: LCOV version 1.14