SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/ScalarWave - Constraints.hpp Hit Total Coverage
Commit: 35a1e98cd3e4fdea528eb8100f99c2f707894fda Lines: 6 15 40.0 %
Date: 2024-04-19 00:10:48
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/Tag.hpp"
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "Evolution/Systems/ScalarWave/Tags.hpp"
      11             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      12             : 
      13             : /// \cond
      14             : namespace gsl {
      15             : template <typename T>
      16             : class not_null;
      17             : }  // namespace gsl
      18             : /// \endcond
      19             : 
      20             : namespace ScalarWave {
      21             : /// @{
      22             : /*!
      23             :  * \brief Compute the scalar-wave one-index constraint.
      24             :  *
      25             :  * \details Computes the scalar-wave one-index constraint,
      26             :  * \f$C_{i} = \partial_i\psi - \Phi_{i},\f$ which is
      27             :  * given by Eq. (19) of \cite Holst2004wt
      28             :  */
      29             : template <size_t SpatialDim>
      30           1 : tnsr::i<DataVector, SpatialDim, Frame::Inertial> one_index_constraint(
      31             :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
      32             :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
      33             : 
      34             : template <size_t SpatialDim>
      35           1 : void one_index_constraint(
      36             :     gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> constraint,
      37             :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
      38             :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
      39             : /// @}
      40             : 
      41             : /// @{
      42             : /*!
      43             :  * \brief Compute the scalar-wave 2-index constraint.
      44             :  *
      45             :  * \details Computes the scalar-wave 2-index constraint
      46             :  * \f$C_{ij} = \partial_i\Phi_j - \partial_j\Phi_i,\f$
      47             :  * where \f$\Phi_{i} = \partial_i\psi\f$, that is given by
      48             :  * Eq. (20) of \cite Holst2004wt
      49             :  *
      50             :  * \note We do not support custom storage for antisymmetric tensors yet.
      51             :  */
      52             : template <size_t SpatialDim>
      53           1 : tnsr::ij<DataVector, SpatialDim, Frame::Inertial> two_index_constraint(
      54             :     const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi);
      55             : 
      56             : template <size_t SpatialDim>
      57           1 : void two_index_constraint(
      58             :     gsl::not_null<tnsr::ij<DataVector, SpatialDim, Frame::Inertial>*>
      59             :         constraint,
      60             :     const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi);
      61             : /// @}
      62             : 
      63             : namespace Tags {
      64             : /*!
      65             :  * \brief Compute item to get the one-index constraint for the scalar-wave
      66             :  * evolution system.
      67             :  *
      68             :  * \details See `one_index_constraint()`. Can be retrieved using
      69             :  * `ScalarWave::Tags::OneIndexConstraint`.
      70             :  */
      71             : template <size_t SpatialDim>
      72           1 : struct OneIndexConstraintCompute : OneIndexConstraint<SpatialDim>,
      73             :                                    db::ComputeTag {
      74           0 :   using argument_tags =
      75             :       tmpl::list<::Tags::deriv<Psi, tmpl::size_t<SpatialDim>, Frame::Inertial>,
      76             :                  Phi<SpatialDim>>;
      77           0 :   using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
      78           0 :   static constexpr void (*function)(
      79             :       const gsl::not_null<return_type*> result,
      80             :       const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&,
      81             :       const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) =
      82             :       &one_index_constraint<SpatialDim>;
      83           0 :   using base = OneIndexConstraint<SpatialDim>;
      84             : };
      85             : 
      86             : /*!
      87             :  * \brief Compute item to get the two-index constraint for the scalar-wave
      88             :  * evolution system.
      89             :  *
      90             :  * \details See `two_index_constraint()`. Can be retrieved using
      91             :  * `ScalarWave::Tags::TwoIndexConstraint`.
      92             :  */
      93             : template <size_t SpatialDim>
      94           1 : struct TwoIndexConstraintCompute : TwoIndexConstraint<SpatialDim>,
      95             :                                    db::ComputeTag {
      96           0 :   using argument_tags =
      97             :       tmpl::list<::Tags::deriv<Phi<SpatialDim>, tmpl::size_t<SpatialDim>,
      98             :                                Frame::Inertial>>;
      99           0 :   using return_type = tnsr::ij<DataVector, SpatialDim, Frame::Inertial>;
     100           0 :   static constexpr void (*function)(
     101             :       const gsl::not_null<return_type*> result,
     102             :       const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>&) =
     103             :       &two_index_constraint<SpatialDim>;
     104           0 :   using base = TwoIndexConstraint<SpatialDim>;
     105             : };
     106             : 
     107             : }  // namespace Tags
     108             : }  // namespace ScalarWave

Generated by: LCOV version 1.14