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

Generated by: LCOV version 1.14