SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Components - KleinGordonCharacteristicEvolution.hpp Hit Total Coverage
Commit: 6c07040310c093b5fbed1dd2b7e9a5199069d22a Lines: 1 16 6.2 %
Date: 2025-11-12 14:32:51
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/CleanHistory.hpp"
      19             : #include "Time/Actions/SelfStartActions.hpp"
      20             : #include "Time/ChangeStepSize.hpp"
      21             : #include "Time/ChangeTimeStepperOrder.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 = Cce::KleinGordonSystem<evolve_ccm>;
      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<
     124             :           UpdateU<cce_system, Metavariables::local_time_stepping>>>;
     125             : 
     126           0 :   using extract_action_list = tmpl::list<
     127             :       Actions::RequestBoundaryData<
     128             :           typename Metavariables::cce_boundary_component,
     129             :           KleinGordonCharacteristicEvolution<Metavariables>>,
     130             :       ::Actions::Label<CceEvolutionLabelTag>,
     131             :       tmpl::conditional_t<
     132             :           evolve_ccm, tmpl::list<>,
     133             :           tmpl::flatten<tmpl::list<
     134             :               std::conditional_t<Metavariables::local_time_stepping,
     135             :                                  evolution::Actions::RunEventsAndTriggers<
     136             :                                      Triggers::WhenToCheck::AtSteps>,
     137             :                                  tmpl::list<>>,
     138             :               evolution::Actions::RunEventsAndTriggers<
     139             :                   Triggers::WhenToCheck::AtSlabs>>>>,
     140             :       Actions::ReceiveWorldtubeData<
     141             :           Metavariables,
     142             :           typename Metavariables::cce_boundary_communication_tags>,
     143             :       Actions::ReceiveWorldtubeData<
     144             :           Metavariables,
     145             :           typename Metavariables::klein_gordon_boundary_communication_tags>,
     146             :       Actions::InitializeFirstHypersurface<
     147             :           evolve_ccm, typename Metavariables::cce_boundary_component>,
     148             :       Actions::InitializeKleinGordonFirstHypersurface,
     149             :       tmpl::conditional_t<
     150             :           tt::is_a_v<AnalyticWorldtubeBoundary,
     151             :                      typename Metavariables::cce_boundary_component>,
     152             :           Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
     153             :       Actions::PrecomputeGlobalCceDependencies,
     154             :       tmpl::conditional_t<evolve_ccm,
     155             :                           Actions::CalculatePsi0AndDerivAtInnerBoundary,
     156             :                           tmpl::list<>>,
     157             :       Actions::PrecomputeKleinGordonSourceVariables,
     158             :       tmpl::transform<
     159             :           bondi_hypersurface_step_tags,
     160             :           tmpl::bind<::Actions::MutateApply,
     161             :                      tmpl::bind<ComputeKleinGordonSource, tmpl::_1>>>,
     162             :       tmpl::transform<bondi_hypersurface_step_tags,
     163             :                       tmpl::bind<hypersurface_computation, tmpl::_1>>,
     164             :       klein_gordon_hypersurface_computation,
     165             :       Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
     166             :       Actions::FilterSwshVolumeQuantity<Tags::KleinGordonPi>,
     167             :       compute_scri_quantities_and_observe,
     168             :       ::Actions::MutateApply<
     169             :           ChangeStepSize<typename Metavariables::cce_step_choosers>>,
     170             :       ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
     171             :       ::Actions::MutateApply<
     172             :           UpdateU<cce_system, Metavariables::local_time_stepping>>,
     173             :       ::Actions::MutateApply<ChangeTimeStepperOrder<cce_system>>,
     174             :       ::Actions::CleanHistory<cce_system, false>,
     175             :       // We cannot know our next step for certain until after we've performed
     176             :       // step size selection, as we may need to reject a step.
     177             :       Actions::RequestNextBoundaryData<
     178             :           typename Metavariables::cce_boundary_component,
     179             :           KleinGordonCharacteristicEvolution<Metavariables>>,
     180             :       ::Actions::AdvanceTime, Actions::ExitIfEndTimeReached,
     181             :       ::Actions::Goto<CceEvolutionLabelTag>>;
     182             : 
     183           0 :   using phase_dependent_action_list = tmpl::list<
     184             :       Parallel::PhaseActions<Parallel::Phase::Initialization,
     185             :                              initialize_action_list>,
     186             :       Parallel::PhaseActions<Parallel::Phase::InitializeTimeStepperHistory,
     187             :                              SelfStart::self_start_procedure<
     188             :                                  self_start_extract_action_list, cce_system>>,
     189             :       Parallel::PhaseActions<Parallel::Phase::Evolve, extract_action_list>>;
     190             : 
     191           0 :   static void initialize(
     192             :       Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
     193             : 
     194           0 :   static void execute_next_phase(
     195             :       const Parallel::Phase next_phase,
     196             :       const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
     197             :     auto& local_cache = *Parallel::local_branch(global_cache);
     198             :     Parallel::get_parallel_component<
     199             :         KleinGordonCharacteristicEvolution<Metavariables>>(local_cache)
     200             :         .start_phase(next_phase);
     201             :   }
     202             : };
     203             : }  // namespace Cce

Generated by: LCOV version 1.14