SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/ScalarWave - SphericalShellPowerMonitor.hpp Hit Total Coverage
Commit: 107e15b340886ae54549b1baa4bfc92e676f667e Lines: 4 9 44.4 %
Date: 2026-09-17 16:38:56
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 <array>
       7             : #include <cstddef>
       8             : #include <optional>
       9             : 
      10             : #include "DataStructures/DataVector.hpp"
      11             : #include "DataStructures/SimpleSparseMatrix.hpp"
      12             : #include "DataStructures/Tensor/TypeAliases.hpp"
      13             : #include "DataStructures/Variables.hpp"
      14             : #include "Evolution/Systems/ScalarWave/ApplyTensorYlmFilter.hpp"
      15             : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      16             : #include "Utilities/Gsl.hpp"
      17             : 
      18             : namespace ScalarWave::power_monitor {
      19             : 
      20             : /// Holds separate SW shell power monitors for each evolved SW variable.
      21             : /// Index 0 is the radial monitor and index 1 is the angular monitor.
      22           1 : struct SwShellPowerMonitors {
      23           0 :   std::array<DataVector, 2> psi{};
      24           0 :   std::array<DataVector, 2> pi{};
      25           0 :   std::array<DataVector, 2> phi{};
      26             : };
      27             : 
      28             : /// Sparse matrix for Cartesian-component to TensorYlm-basis transform.
      29             : /// Only the rank-1 (`i`) matrix is needed for the ScalarWave system, since
      30             : /// \f$\Phi_i\f$ is the only non-scalar evolved variable.
      31           1 : struct SwCartToSphereMatrix {
      32           0 :   std::optional<SimpleSparseMatrix> i{};
      33             : };
      34             : 
      35             : /// Fill the Cartesian-to-TensorYlm sparse matrix with Spherepack normalization
      36             : /// if not already filled.
      37           1 : void fill_sw_cart_to_sphere_matrix(gsl::not_null<SwCartToSphereMatrix*> matrix,
      38             :                                    size_t ell_max);
      39             : 
      40             : /*!
      41             :  * \brief Compute radial and angular power monitors for the evolved ScalarWave
      42             :  * variables on a spherical shell.
      43             :  *
      44             :  * Each monitor is an array containing the radial monitor at index 0 and the
      45             :  * angular monitor at index 1. Radial monitors are computed from the original
      46             :  * SW variables, matching SpEC's shell radial power monitor behavior. Angular
      47             :  * monitors are computed after transforming \f$\Phi_i\f$ to TensorYlm
      48             :  * coefficients using `jac_inertial_to_grid` for the frame transform.
      49             :  * \f$\Psi\f$ and \f$\Pi\f$ are scalars and need no frame transform.
      50             :  *
      51             :  * The Cartesian-to-TensorYlm matrix is filled on first use and reused on
      52             :  * subsequent calls.
      53             :  *
      54             :  * \param cart_to_sphere_matrix Cache for the Cartesian-to-TensorYlm sparse
      55             :  *   matrix.
      56             :  * \param sw_vars ScalarWave variables at collocation points on the shell mesh.
      57             :  * \param mesh The spherical-shell mesh with dimensions `(radial, theta, phi)`.
      58             :  * \param jac_inertial_to_grid Inverse Jacobian mapping inertial-frame spatial
      59             :  *   tensor components to the grid frame.
      60             :  */
      61           1 : SwShellPowerMonitors sw_shell_power_monitors(
      62             :     gsl::not_null<SwCartToSphereMatrix*> cart_to_sphere_matrix,
      63             :     const Variables<
      64             :         ylm::TensorYlm::filter_detail::sw_vars_list<Frame::Inertial>>& sw_vars,
      65             :     const Mesh<3>& mesh,
      66             :     const InverseJacobian<DataVector, 3, Frame::Inertial, Frame::Grid>&
      67             :         jac_inertial_to_grid);
      68             : 
      69             : }  // namespace ScalarWave::power_monitor

Generated by: LCOV version 1.14