SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/CurvedScalarWave - Constraints.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 46.7 % 15 7
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            1 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : ///\file
       5              : /// Defines functions to calculate the scalar wave constraints in
       6              : /// curved spacetime
       7              : 
       8              : #pragma once
       9              : 
      10              : #include <cstddef>
      11              : 
      12              : #include "DataStructures/DataBox/Tag.hpp"
      13              : #include "DataStructures/Tensor/Tensor.hpp"
      14              : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp"
      15              : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      16              : #include "Utilities/Gsl.hpp"
      17              : #include "Utilities/TMPL.hpp"
      18              : 
      19              : namespace CurvedScalarWave {
      20              : /// @{
      21              : /*!
      22              :  * \brief Computes the scalar-wave one-index constraint.
      23              :  *
      24              :  * \details Computes the scalar-wave one-index constraint,
      25              :  * \f$C_{i} = \partial_i\psi - \Phi_{i},\f$ which is
      26              :  * given by Eq. (19) of \cite Holst2004wt
      27              :  */
      28              : template <size_t SpatialDim>
      29            1 : tnsr::i<DataVector, SpatialDim, Frame::Inertial> one_index_constraint(
      30              :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
      31              :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
      32              : 
      33              : template <size_t SpatialDim>
      34            1 : void one_index_constraint(
      35              :     gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> constraint,
      36              :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
      37              :     const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
      38              : /// @}
      39              : 
      40              : /// @{
      41              : /*!
      42              :  * \brief Computes the scalar-wave 2-index constraint.
      43              :  *
      44              :  * \details Computes the scalar-wave 2-index FOSH constraint
      45              :  * [Eq. (20) of \cite Holst2004wt],
      46              :  *
      47              :  * \f{eqnarray}{
      48              :  * C_{ij} &\equiv& \partial_i \Phi_j - \partial_j \Phi_i
      49              :  * \f}
      50              :  *
      51              :  * where \f$\Phi_{i} = \partial_i\psi\f$; and \f$\psi\f$ is the scalar field.
      52              :  */
      53              : template <size_t SpatialDim>
      54            1 : tnsr::ij<DataVector, SpatialDim, Frame::Inertial> two_index_constraint(
      55              :     const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi);
      56              : 
      57              : template <size_t SpatialDim>
      58            1 : void two_index_constraint(
      59              :     gsl::not_null<tnsr::ij<DataVector, SpatialDim, Frame::Inertial>*>
      60              :         constraint,
      61              :     const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi);
      62              : /// @}
      63              : 
      64              : namespace Tags {
      65              : /*!
      66              :  * \brief Compute item to get the one-index constraint for the scalar-wave
      67              :  * evolution system.
      68              :  *
      69              :  * \details See `one_index_constraint()`. Can be retrieved using
      70              :  * `CurvedScalarWave::Tags::OneIndexConstraint`.
      71              :  */
      72              : template <size_t SpatialDim>
      73            1 : struct OneIndexConstraintCompute : OneIndexConstraint<SpatialDim>,
      74              :                                    db::ComputeTag {
      75            0 :   using argument_tags =
      76              :       tmpl::list<::Tags::deriv<Psi, tmpl::size_t<SpatialDim>, Frame::Inertial>,
      77              :                  Phi<SpatialDim>>;
      78            0 :   using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
      79            0 :   static constexpr void (*function)(
      80              :       const gsl::not_null<return_type*> result,
      81              :       const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&,
      82              :       const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) =
      83              :       &one_index_constraint<SpatialDim>;
      84            0 :   using base = OneIndexConstraint<SpatialDim>;
      85              : };
      86              : 
      87              : /*!
      88              :  * \brief Compute item to get the two-index constraint for the scalar-wave
      89              :  * evolution system.
      90              :  *
      91              :  * \details See `two_index_constraint()`. Can be retrieved using
      92              :  * `CurvedScalarWave::Tags::TwoIndexConstraint`.
      93              :  */
      94              : template <size_t SpatialDim>
      95            1 : struct TwoIndexConstraintCompute : TwoIndexConstraint<SpatialDim>,
      96              :                                    db::ComputeTag {
      97            0 :   using argument_tags =
      98              :       tmpl::list<::Tags::deriv<Phi<SpatialDim>, tmpl::size_t<SpatialDim>,
      99              :                                Frame::Inertial>>;
     100            0 :   using return_type = tnsr::ij<DataVector, SpatialDim, Frame::Inertial>;
     101            0 :   static constexpr void (*function)(
     102              :       const gsl::not_null<return_type*> result,
     103              :       const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>&) =
     104              :       &two_index_constraint<SpatialDim>;
     105            0 :   using base = TwoIndexConstraint<SpatialDim>;
     106              : };
     107              : }  // namespace Tags
     108              : }  // namespace CurvedScalarWave
        

Generated by: LCOV version 2.0-1