SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Components - KleinGordonCharacteristicEvolution.hpp Hit Total Coverage
Commit: ecb8a275e1aebab77dcce48a5e098ed4e486ab4b Lines: 1 16 6.2 %
Date: 2026-08-22 01:05:40
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 <type_traits>
       7             : 
       8             : #include "Evolution/Systems/Cce/Actions/InitializeKleinGordonFirstHypersurface.hpp"
       9             : #include "Evolution/Systems/Cce/Actions/InitializeKleinGordonVariables.hpp"
      10             : #include "Evolution/Systems/Cce/Actions/PrecomputeKleinGordonSourceVariables.hpp"
      11             : #include "Evolution/Systems/Cce/Components/CharacteristicEvolution.hpp"
      12             : #include "Evolution/Systems/Cce/KleinGordonSource.hpp"
      13             : #include "Parallel/GlobalCache.hpp"
      14             : #include "Parallel/Local.hpp"
      15             : #include "Parallel/Phase.hpp"
      16             : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      17             : #include "Time/Actions/SelfStartActions.hpp"
      18             : #include "Time/AdvanceTime.hpp"
      19             : #include "Time/ChangeStepSize.hpp"
      20             : #include "Time/ChangeTimeStepperOrder.hpp"
      21             : #include "Time/CleanHistory.hpp"
      22             : #include "Time/RecordTimeStepperData.hpp"
      23             : #include "Time/UpdateU.hpp"
      24             : #include "Utilities/TMPL.hpp"
      25             : 
      26             : namespace Cce {
      27             : 
      28             : /*!
      29             :  * \brief The component for handling the CCE evolution for the Klein-Gordon
      30             :  * system coupled with General Relativity.
      31             :  *
      32             :  * \details The \ref DataBoxGroup associated with
      33             :  * KleinGordonCharacteristicEvolution will contain all the tags of
      34             :  * CharacteristicEvolution, with additional tags related to the scalar field.
      35             :  *
      36             :  * Metavariables requirements:
      37             :  * - Phases:
      38             :  *  - `Initialization`
      39             :  *  - `Evolve`
      40             :  * - Modified type aliases in comparison to CharacteristicEvolution:
      41             :  *  - `evolved_swsh_tags`: The spin-weighted quantities to be evolved (
      42             :  * `KleinGordonPsi` and `BondiJ`).
      43             :  *  - `evolved_swsh_dt_tags`: The spin-weighed quantities associated that are to
      44             :  * act as the time derivative to evolve `evolved_swsh_tags` (`KleinGordonPi` and
      45             :  * `BondiH`).
      46             :  * - Additional type aliases related to the scalar field:
      47             :  *  - `klein_gordon_boundary_communication_tags`:  A typelist of tags that will
      48             :  * be communicated between the worldtube boundary component and the extraction
      49             :  * component (`Cce::Tags::klein_gordon_worldtube_boundary_tags`).
      50             :  *  - `klein_gordon_gauge_boundary_tags`: A typelist of tags that will be
      51             :  * derived via `GaugeAdjustedBoundaryValue` and corresponding gauge utilities
      52             :  *  - `klein_gordon_scri_tags`: the tags of quantities to compute at scri+
      53             :  */
      54             : template <class Metavariables>
      55           1 : struct KleinGordonCharacteristicEvolution
      56             :     : CharacteristicEvolution<Metavariables> {
      57           0 :   using metavariables = Metavariables;
      58           0 :   static constexpr bool evolve_ccm = Metavariables::evolve_ccm;
      59           0 :   using cce_system = typename Metavariables::system;
      60             : 
      61           0 :   using cce_base = CharacteristicEvolution<Metavariables>;
      62           0 :   using initialize_action_list = tmpl::append<
      63             :       tmpl::list<Actions::InitializeKleinGordonVariables<Metavariables>>,
      64             :       typename cce_base::initialize_action_list>;
      65             : 
      66             :   template <typename BondiTag>
      67           0 :   using hypersurface_computation =
      68             :       typename cce_base::template hypersurface_computation<BondiTag>;
      69             : 
      70           0 :   using klein_gordon_hypersurface_computation = tmpl::list<
      71             :       ::Actions::MutateApply<GaugeAdjustedBoundaryValue<Tags::KleinGordonPi>>,
      72             :       Actions::CalculateIntegrandInputsForTag<Tags::KleinGordonPi>,
      73             :       tmpl::transform<
      74             :           integrand_terms_to_compute_for_bondi_variable<Tags::KleinGordonPi>,
      75             :           tmpl::bind<::Actions::MutateApply,
      76             :                      tmpl::bind<ComputeBondiIntegrand, tmpl::_1>>>>;
      77             : 
      78           0 :   using simple_tags_from_options =
      79             :       Parallel::get_simple_tags_from_options<initialize_action_list>;
      80             : 
      81           0 :   using typename cce_base::compute_scri_quantities_and_observe;
      82             : 
      83           0 :   using self_start_extract_action_list = tmpl::list<
      84             :       Actions::RequestBoundaryData<
      85             :           typename Metavariables::cce_boundary_component,
      86             :           KleinGordonCharacteristicEvolution<Metavariables>>,
      87             :       Actions::ReceiveWorldtubeData<
      88             :           Metavariables,
      89             :           typename Metavariables::cce_boundary_communication_tags>,
      90             :       Actions::ReceiveWorldtubeData<
      91             :           Metavariables,
      92             :           typename Metavariables::klein_gordon_boundary_communication_tags>,
      93             :       // note that the initialization will only actually happen on the
      94             :       // iterations immediately following restarts
      95             :       Actions::InitializeFirstHypersurface<
      96             :           evolve_ccm, typename Metavariables::cce_boundary_component>,
      97             :       Actions::InitializeKleinGordonFirstHypersurface,
      98             :       tmpl::conditional_t<
      99             :           tt::is_a_v<AnalyticWorldtubeBoundary,
     100             :                      typename Metavariables::cce_boundary_component>,
     101             :           Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
     102             :       Actions::PrecomputeGlobalCceDependencies,
     103             :       tmpl::conditional_t<evolve_ccm,
     104             :                           Actions::CalculatePsi0AndDerivAtInnerBoundary,
     105             :                           tmpl::list<>>,
     106             :       Actions::PrecomputeKleinGordonSourceVariables,
     107             :       tmpl::transform<
     108             :           bondi_hypersurface_step_tags,
     109             :           tmpl::bind<::Actions::MutateApply,
     110             :                      tmpl::bind<ComputeKleinGordonSource, tmpl::_1>>>,
     111             :       tmpl::transform<bondi_hypersurface_step_tags,
     112             :                       tmpl::bind<hypersurface_computation, tmpl::_1>>,
     113             :       klein_gordon_hypersurface_computation,
     114             :       Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
     115             :       Actions::FilterSwshVolumeQuantity<Tags::KleinGordonPi>,
     116             :       ::Actions::MutateApply<
     117             :           CalculateScriPlusValue<::Tags::dt<Tags::InertialRetardedTime>>>,
     118             :       Actions::CalculateScriInputs,
     119             :       tmpl::transform<typename metavariables::cce_scri_tags,
     120             :                       tmpl::bind<::Actions::MutateApply,
     121             :                                  tmpl::bind<CalculateScriPlusValue, tmpl::_1>>>,
     122             :       ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
     123             :       ::Actions::MutateApply<UpdateU<cce_system, Tags::CceEvolutionPrefix>>>;
     124             : 
     125           0 :   using extract_action_list = tmpl::list<
     126             :       Actions::RequestBoundaryData<
     127             :           typename Metavariables::cce_boundary_component,
     128             :           KleinGordonCharacteristicEvolution<Metavariables>>,
     129             :       ::Actions::Label<CceEvolutionLabelTag>,
     130             :       tmpl::conditional_t<
     131             :           evolve_ccm, tmpl::list<>,
     132             :           tmpl::flatten<tmpl::list<evolution::Actions::RunEventsAndTriggers<
     133             :                                        Triggers::WhenToCheck::AtSteps>,
     134             :                                    evolution::Actions::RunEventsAndTriggers<
     135             :                                        Triggers::WhenToCheck::AtSlabs>>>>,
     136             :       Actions::ReceiveWorldtubeData<
     137             :           Metavariables,
     138             :           typename Metavariables::cce_boundary_communication_tags>,
     139             :       Actions::ReceiveWorldtubeData<
     140             :           Metavariables,
     141             :           typename Metavariables::klein_gordon_boundary_communication_tags>,
     142             :       Actions::InitializeFirstHypersurface<
     143             :           evolve_ccm, typename Metavariables::cce_boundary_component>,
     144             :       Actions::InitializeKleinGordonFirstHypersurface,
     145             :       tmpl::conditional_t<
     146             :           tt::is_a_v<AnalyticWorldtubeBoundary,
     147             :                      typename Metavariables::cce_boundary_component>,
     148             :           Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
     149             :       Actions::PrecomputeGlobalCceDependencies,
     150             :       tmpl::conditional_t<evolve_ccm,
     151             :                           Actions::CalculatePsi0AndDerivAtInnerBoundary,
     152             :                           tmpl::list<>>,
     153             :       Actions::PrecomputeKleinGordonSourceVariables,
     154             :       tmpl::transform<
     155             :           bondi_hypersurface_step_tags,
     156             :           tmpl::bind<::Actions::MutateApply,
     157             :                      tmpl::bind<ComputeKleinGordonSource, tmpl::_1>>>,
     158             :       tmpl::transform<bondi_hypersurface_step_tags,
     159             :                       tmpl::bind<hypersurface_computation, tmpl::_1>>,
     160             :       klein_gordon_hypersurface_computation,
     161             :       Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
     162             :       Actions::FilterSwshVolumeQuantity<Tags::KleinGordonPi>,
     163             :       compute_scri_quantities_and_observe,
     164             :       ::Actions::MutateApply<ChangeStepSize<
     165             :           typename Metavariables::cce_step_choosers, Tags::CceEvolutionPrefix>>,
     166             :       ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
     167             :       ::Actions::MutateApply<UpdateU<cce_system, Tags::CceEvolutionPrefix>>,
     168             :       ::Actions::MutateApply<
     169             :           ChangeTimeStepperOrder<cce_system, Tags::CceEvolutionPrefix>>,
     170             :       ::Actions::MutateApply<
     171             :           CleanHistory<cce_system, Tags::CceEvolutionPrefix>>,
     172             :       // We cannot know our next step for certain until after we've performed
     173             :       // step size selection, as we may need to reject a step.
     174             :       Actions::RequestNextBoundaryData<
     175             :           typename Metavariables::cce_boundary_component,
     176             :           KleinGordonCharacteristicEvolution<Metavariables>>,
     177             :       ::Actions::MutateApply<AdvanceTime<Tags::CceEvolutionPrefix>>,
     178             :       Actions::ExitIfEndTimeReached, ::Actions::Goto<CceEvolutionLabelTag>>;
     179             : 
     180           0 :   using phase_dependent_action_list = tmpl::list<
     181             :       Parallel::PhaseActions<Parallel::Phase::Initialization,
     182             :                              initialize_action_list>,
     183             :       Parallel::PhaseActions<Parallel::Phase::InitializeTimeStepperHistory,
     184             :                              SelfStart::self_start_procedure<
     185             :                                  self_start_extract_action_list, cce_system,
     186             :                                  Tags::CceEvolutionPrefix>>,
     187             :       Parallel::PhaseActions<Parallel::Phase::Evolve, extract_action_list>>;
     188             : 
     189           0 :   static void initialize(
     190             :       Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
     191             : 
     192           0 :   static void execute_next_phase(
     193             :       const Parallel::Phase next_phase,
     194             :       const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
     195             :     auto& local_cache = *Parallel::local_branch(global_cache);
     196             :     Parallel::get_parallel_component<
     197             :         KleinGordonCharacteristicEvolution<Metavariables>>(local_cache)
     198             :         .start_phase(next_phase);
     199             :   }
     200             : };
     201             : }  // namespace Cce

Generated by: LCOV version 1.14