SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic - SpatialDerivOfShift.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 spatial derivatives of the shift vector from
      38             :  *        the generalized harmonic and geometric variables
      39             :  *
      40             :  * \details Spatial derivatives of the shift vector \f$\beta^i\f$ can be derived
      41             :  * from the following steps:
      42             :  * \f{align*}
      43             :  * \partial_i \beta^j
      44             :  *  =& \gamma^{jl} \gamma_{kl} \partial_i \beta^k \\
      45             :  *  =& \gamma^{jl} (\beta^k \partial_i \gamma_{lk}
      46             :  *         + \gamma_{kl}\partial_i \beta^k - \beta^k \partial_i \gamma_{kl}) \\
      47             :  *  =& \gamma^{jl} (\partial_i \beta_l - \beta^k \partial_i \gamma_{lk})
      48             :  *         (\because \gamma^{j0} = 0) \\
      49             :  *  =& \gamma^{ja} (\partial_i g_{a0} - \beta^k \partial _i g_{ak}) \\
      50             :  *  =& \alpha \gamma^{ja} n^b \partial_i g_{ab} \\
      51             :  *  =& (\gamma^{ja} - n^j n^a) \alpha n^b \Phi_{iab}
      52             :  *         - 2 n^j \partial_i \alpha \\
      53             :  *  =& g^{ja} \alpha n^b \Phi_{iab} - 2 n^j \partial_i \alpha \\
      54             :  *  =& \alpha (g^{ja} + n^j n^a) n^b \Phi_{iab}.
      55             :  * \f}
      56             :  * where we used the equation from spatial_deriv_of_lapse() for
      57             :  * \f$\partial_i \alpha\f$.
      58             :  */
      59             : template <typename DataType, size_t SpatialDim, typename Frame>
      60           1 : void spatial_deriv_of_shift(
      61             :     gsl::not_null<tnsr::iJ<DataType, SpatialDim, Frame>*> deriv_shift,
      62             :     const Scalar<DataType>& lapse,
      63             :     const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
      64             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      65             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
      66             : 
      67             : template <typename DataType, size_t SpatialDim, typename Frame>
      68           1 : tnsr::iJ<DataType, SpatialDim, Frame> spatial_deriv_of_shift(
      69             :     const Scalar<DataType>& lapse,
      70             :     const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
      71             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      72             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi);
      73             : /// @}
      74             : 
      75             : namespace Tags {
      76             : /*!
      77             :  * \brief Compute item to get spatial derivatives of the shift vector from
      78             :  *        generalized harmonic and geometric variables
      79             :  *
      80             :  * \details See `spatial_deriv_of_shift()`. Can be retrieved using
      81             :  * `gr::Tags::Shift` wrapped in `::Tags::deriv`.
      82             :  */
      83             : template <size_t SpatialDim, typename Frame>
      84           1 : struct DerivShiftCompute
      85             :     : ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
      86             :                     tmpl::size_t<SpatialDim>, Frame>,
      87             :       db::ComputeTag {
      88           0 :   using argument_tags = tmpl::list<
      89             :       gr::Tags::Lapse<DataVector>,
      90             :       gr::Tags::InverseSpacetimeMetric<DataVector, SpatialDim, Frame>,
      91             :       gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim, Frame>,
      92             :       Phi<DataVector, SpatialDim, Frame>>;
      93             : 
      94           0 :   using return_type = tnsr::iJ<DataVector, SpatialDim, Frame>;
      95             : 
      96           0 :   static constexpr auto function = static_cast<void (*)(
      97             :       gsl::not_null<tnsr::iJ<DataVector, SpatialDim, Frame>*>,
      98             :       const Scalar<DataVector>&, const tnsr::AA<DataVector, SpatialDim, Frame>&,
      99             :       const tnsr::A<DataVector, SpatialDim, Frame>&,
     100             :       const tnsr::iaa<DataVector, SpatialDim, Frame>&)>(
     101             :       &spatial_deriv_of_shift<DataVector, SpatialDim, Frame>);
     102             : 
     103           0 :   using base = ::Tags::deriv<gr::Tags::Shift<DataVector, SpatialDim, Frame>,
     104             :                              tmpl::size_t<SpatialDim>, Frame>;
     105             : };
     106             : }  // namespace Tags
     107             : }  // namespace gh

Generated by: LCOV version 1.14