SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Components - CharacteristicEvolution.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 5.9 % 17 1
Test Date: 2026-10-22 17:29:42
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 "DataStructures/VariablesTag.hpp"
       9              : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
      10              : #include "Evolution/Initialization/Evolution.hpp"
      11              : #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp"
      12              : #include "Evolution/Systems/Cce/Actions/CalculateScriInputs.hpp"
      13              : #include "Evolution/Systems/Cce/Actions/CharacteristicEvolutionBondiCalculations.hpp"
      14              : #include "Evolution/Systems/Cce/Actions/FilterSwshVolumeQuantity.hpp"
      15              : #include "Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionScri.hpp"
      16              : #include "Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionTime.hpp"
      17              : #include "Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionVariables.hpp"
      18              : #include "Evolution/Systems/Cce/Actions/InitializeFirstHypersurface.hpp"
      19              : #include "Evolution/Systems/Cce/Actions/InsertInterpolationScriData.hpp"
      20              : #include "Evolution/Systems/Cce/Actions/Psi0Matching.hpp"
      21              : #include "Evolution/Systems/Cce/Actions/RequestBoundaryData.hpp"
      22              : #include "Evolution/Systems/Cce/Actions/ScriObserveInterpolated.hpp"
      23              : #include "Evolution/Systems/Cce/Actions/TimeManagement.hpp"
      24              : #include "Evolution/Systems/Cce/Actions/UpdateGauge.hpp"
      25              : #include "Evolution/Systems/Cce/LinearSolve.hpp"
      26              : #include "Evolution/Systems/Cce/PreSwshDerivatives.hpp"
      27              : #include "Evolution/Systems/Cce/PrecomputeCceDependencies.hpp"
      28              : #include "Evolution/Systems/Cce/ScriPlusValues.hpp"
      29              : #include "Evolution/Systems/Cce/SwshDerivatives.hpp"
      30              : #include "IO/Observer/ObserverComponent.hpp"
      31              : #include "Parallel/GlobalCache.hpp"
      32              : #include "Parallel/Local.hpp"
      33              : #include "Parallel/Phase.hpp"
      34              : #include "ParallelAlgorithms/Actions/Goto.hpp"
      35              : #include "ParallelAlgorithms/Actions/InitializeItems.hpp"
      36              : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      37              : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
      38              : #include "Time/Actions/SelfStartActions.hpp"
      39              : #include "Time/AdvanceTime.hpp"
      40              : #include "Time/ChangeStepSize.hpp"
      41              : #include "Time/ChangeTimeStepperOrder.hpp"
      42              : #include "Time/CleanHistory.hpp"
      43              : #include "Time/RecordTimeStepperData.hpp"
      44              : #include "Time/UpdateU.hpp"
      45              : #include "Utilities/TMPL.hpp"
      46              : 
      47              : namespace Cce {
      48              : 
      49            0 : struct CceEvolutionLabelTag {};
      50              : 
      51              : /*!
      52              :  * \brief The component for handling the CCE evolution and waveform output.
      53              :  *
      54              :  * \details The \ref DataBoxGroup associated with the CharacteristicEvolution
      55              :  * will contain many spin-weighted volume tags associated with the ongoing CCE
      56              :  * computation, as well as storage for the boundary values and quantities
      57              :  * related to managing the evolution.
      58              :  *
      59              :  * Metavariables requirements:
      60              :  * - Phases:
      61              :  *  - `Initialization`
      62              :  *  - `Evolve`
      63              :  * - Type aliases:
      64              :  *  - `system::evolved_coordinates_variables_tag`: A `Tags::Variables` with
      65              :  * real-valued tensors associated with coordinates that must be evolved.
      66              :  *  - `system::evolved_swsh_tag`: The spin-weighted quantities to be evolved
      67              :  * (typically `BondiJ`).
      68              :  *  - `evolved_swsh_dt_tags`: The spin-weighed quantities associated that are to
      69              :  * act as the time derivative to evolve `evolved_swsh_tag` (typically
      70              :  * `BondiH`).
      71              :  *  - `cce_boundary_communication_tags`: A typelist of tags that will be
      72              :  * communicated between the worldtube boundary component and the extraction
      73              :  * component (typically
      74              :  * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`)
      75              :  *  - `cce_gauge_boundary_tags`: A typelist of tags that will be derived via
      76              :  * `GaugeAdjustedBoundaryValue` and corresponding gauge utilities
      77              :  *  - `cce_integrand_tags`: A typelist of tags needed as inputs to the
      78              :  * linear solve. Obtainable from the metafunction
      79              :  * `Cce::integrand_terms_to_compute_for_bondi_variable`.
      80              :  *  - `cce_integration_independent_tags`: A typelist of tags that are to be
      81              :  * computed and stored for each hypersurface iteration, but have no dependencies
      82              :  * on the intermediate hypersurface steps (typically
      83              :  * `Cce::pre_computation_steps`).
      84              :  *  - `cce_temporary_equations_tags`: A typelist of temporary buffers maintained
      85              :  * for intermediate steps in the integrand equations. Obtainable from the
      86              :  * metafunction `Cce::integrand_terms_to_compute_for_bondi_variable`.
      87              :  *  - `cce_pre_swsh_derivatives_tags`: A typelist of inputs to spin-weighted
      88              :  * derivative calculations to compute and cache for intermediate steps of the
      89              :  * CCE calculation. (typically `Cce::all_pre_swsh_derivative_tags`)
      90              :  *  - `cce_swsh_derivative_tags`: A typelist of spin-weighted derivatives to
      91              :  * compute and cache for intermediate steps of the CCE calculation. (typically
      92              :  * `Cce::all_swsh_derivative_tags`)
      93              :  *  - `cce_transform_buffer_tags`: A typelist of spin-weighted spherical
      94              :  * harmonic transform modes used to compute the spin-weighted derivatives in the
      95              :  * modal representation. (typically `Cce::all_transform_buffer_tags`).
      96              :  *  - `cce_angular_coordinate_tags`: A typelist of real-valued angular
      97              :  * coordinates that are not evolved.
      98              :  *  - `cce_scri_tags`: the tags of quantities to compute at scri+
      99              :  *  - `cce_hypersurface_initialization`: a mutator (for use with
     100              :  * `::Actions::MutateApply`) that is used to compute the initial hypersurface
     101              :  * data from the boundary data.
     102              :  */
     103              : template <class Metavariables>
     104            1 : struct CharacteristicEvolution {
     105            0 :   using chare_type = Parallel::Algorithms::Singleton;
     106            0 :   static constexpr bool checkpoint_data = true;
     107            0 :   using metavariables = Metavariables;
     108            0 :   static constexpr bool evolve_ccm = Metavariables::evolve_ccm;
     109            0 :   using cce_system = typename Metavariables::system;
     110              : 
     111            0 :   using initialize_action_list = tmpl::list<
     112              :       Actions::InitializeCharacteristicEvolutionVariables<Metavariables>,
     113              :       Actions::InitializeCharacteristicEvolutionTime,
     114              :       Actions::InitializeCharacteristicEvolutionScri<
     115              :           typename Metavariables::scri_values_to_observe,
     116              :           typename Metavariables::cce_boundary_component>,
     117              :       Initialization::Actions::InitializeItems<
     118              :           Initialization::TimeStepperHistory<cce_system,
     119              :                                              Tags::CceEvolutionPrefix>>,
     120              :       Parallel::Actions::TerminatePhase>;
     121              : 
     122            0 :   using simple_tags_from_options =
     123              :       Parallel::get_simple_tags_from_options<initialize_action_list>;
     124              : 
     125              :   // the list of actions that occur for each of the hypersurface-integrated
     126              :   // Bondi tags
     127              :   template <typename BondiTag>
     128            0 :   using hypersurface_computation = tmpl::list<
     129              :       ::Actions::MutateApply<GaugeAdjustedBoundaryValue<BondiTag>>,
     130              :       Actions::CalculateIntegrandInputsForTag<BondiTag>,
     131              :       tmpl::transform<integrand_terms_to_compute_for_bondi_variable<BondiTag>,
     132              :                       tmpl::bind<::Actions::MutateApply,
     133              :                                  tmpl::bind<ComputeBondiIntegrand, tmpl::_1>>>,
     134              :       ::Actions::MutateApply<
     135              :           RadialIntegrateBondi<Tags::EvolutionGaugeBoundaryValue, BondiTag>>,
     136              :       // Once we finish the U computation, we need to update all the quantities
     137              :       // that depend on the time derivative of the gauge
     138              :       tmpl::conditional_t<
     139              :           std::is_same_v<BondiTag, Tags::BondiU>,
     140              :           tmpl::list<
     141              :               ::Actions::MutateApply<GaugeUpdateTimeDerivatives>,
     142              :               tmpl::conditional_t<
     143              :                   tt::is_a_v<AnalyticWorldtubeBoundary,
     144              :                              typename Metavariables::cce_boundary_component>,
     145              :                   tmpl::list<>,
     146              :                   tmpl::conditional_t<evolve_ccm,
     147              :                                       ::Actions::MutateApply<
     148              :                                           GaugeUpdateInertialTimeDerivatives>,
     149              :                                       tmpl::list<>>>,
     150              :               ::Actions::MutateApply<
     151              :                   GaugeAdjustedBoundaryValue<Tags::DuRDividedByR>>,
     152              :               ::Actions::MutateApply<PrecomputeCceDependencies<
     153              :                   Tags::EvolutionGaugeBoundaryValue, Tags::DuRDividedByR>>>,
     154              :           tmpl::list<>>>;
     155              : 
     156            0 :   using compute_scri_quantities_and_observe = tmpl::list<
     157              :       ::Actions::MutateApply<
     158              :           CalculateScriPlusValue<::Tags::dt<Tags::InertialRetardedTime>>>,
     159              :       Actions::CalculateScriInputs,
     160              :       tmpl::transform<typename metavariables::cce_scri_tags,
     161              :                       tmpl::bind<::Actions::MutateApply,
     162              :                                  tmpl::bind<CalculateScriPlusValue, tmpl::_1>>>,
     163              :       tmpl::transform<
     164              :           typename metavariables::scri_values_to_observe,
     165              :           tmpl::bind<
     166              :               Actions::InsertInterpolationScriData, tmpl::_1,
     167              :               tmpl::pin<typename Metavariables::cce_boundary_component>>>,
     168              :       Actions::ScriObserveInterpolated<
     169              :           observers::ObserverWriter<Metavariables>,
     170              :           typename Metavariables::cce_boundary_component>>;
     171              : 
     172            0 :   using self_start_extract_action_list = tmpl::list<
     173              :       Actions::RequestBoundaryData<
     174              :           typename Metavariables::cce_boundary_component,
     175              :           CharacteristicEvolution<Metavariables>>,
     176              :       Actions::ReceiveWorldtubeData<
     177              :           Metavariables,
     178              :           typename Metavariables::cce_boundary_communication_tags>,
     179              :       // note that the initialization will only actually happen on the
     180              :       // iterations immediately following restarts
     181              :       Actions::InitializeFirstHypersurface<
     182              :           evolve_ccm, typename Metavariables::cce_boundary_component>,
     183              :       tmpl::conditional_t<
     184              :           tt::is_a_v<AnalyticWorldtubeBoundary,
     185              :                      typename Metavariables::cce_boundary_component>,
     186              :           Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
     187              :       Actions::PrecomputeGlobalCceDependencies,
     188              :       tmpl::conditional_t<evolve_ccm,
     189              :                           Actions::CalculatePsi0AndDerivAtInnerBoundary,
     190              :                           tmpl::list<>>,
     191              :       tmpl::transform<bondi_hypersurface_step_tags,
     192              :                       tmpl::bind<hypersurface_computation, tmpl::_1>>,
     193              :       Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
     194              :       ::Actions::MutateApply<
     195              :           CalculateScriPlusValue<::Tags::dt<Tags::InertialRetardedTime>>>,
     196              :       Actions::CalculateScriInputs,
     197              :       tmpl::transform<typename metavariables::cce_scri_tags,
     198              :                       tmpl::bind<::Actions::MutateApply,
     199              :                                  tmpl::bind<CalculateScriPlusValue, tmpl::_1>>>,
     200              :       ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
     201              :       ::Actions::MutateApply<UpdateU<cce_system, Tags::CceEvolutionPrefix>>,
     202              :       ::Actions::MutateApply<
     203              :           CleanHistory<cce_system, Tags::CceEvolutionPrefix>>>;
     204              : 
     205            0 :   using extract_action_list = tmpl::list<
     206              :       Actions::RequestBoundaryData<
     207              :           typename Metavariables::cce_boundary_component,
     208              :           CharacteristicEvolution<Metavariables>>,
     209              :       ::Actions::Label<CceEvolutionLabelTag>,
     210              :       Actions::ReceiveWorldtubeData<
     211              :           Metavariables,
     212              :           typename Metavariables::cce_boundary_communication_tags>,
     213              :       Actions::InitializeFirstHypersurface<
     214              :           evolve_ccm, typename Metavariables::cce_boundary_component>,
     215              :       tmpl::conditional_t<
     216              :           tt::is_a_v<AnalyticWorldtubeBoundary,
     217              :                      typename Metavariables::cce_boundary_component>,
     218              :           Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
     219              :       Actions::PrecomputeGlobalCceDependencies,
     220              :       tmpl::conditional_t<evolve_ccm,
     221              :                           Actions::CalculatePsi0AndDerivAtInnerBoundary,
     222              :                           tmpl::list<>>,
     223              :       tmpl::transform<bondi_hypersurface_step_tags,
     224              :                       tmpl::bind<hypersurface_computation, tmpl::_1>>,
     225              :       Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
     226              :       tmpl::conditional_t<
     227              :           evolve_ccm, tmpl::list<>,
     228              :           tmpl::flatten<tmpl::list<evolution::Actions::RunEventsAndTriggers<
     229              :                                        Triggers::WhenToCheck::AtSteps>,
     230              :                                    evolution::Actions::RunEventsAndTriggers<
     231              :                                        Triggers::WhenToCheck::AtSlabs>>>>,
     232              :       compute_scri_quantities_and_observe,
     233              :       ::Actions::MutateApply<ChangeStepSize<
     234              :           typename Metavariables::cce_step_choosers, Tags::CceEvolutionPrefix>>,
     235              :       ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
     236              :       ::Actions::MutateApply<UpdateU<cce_system, Tags::CceEvolutionPrefix>>,
     237              :       ::Actions::MutateApply<
     238              :           ChangeTimeStepperOrder<cce_system, Tags::CceEvolutionPrefix>>,
     239              :       ::Actions::MutateApply<
     240              :           CleanHistory<cce_system, Tags::CceEvolutionPrefix>>,
     241              :       // We cannot know our next step for certain until after we've performed
     242              :       // step size selection, as we may need to reject a step.
     243              :       Actions::RequestNextBoundaryData<
     244              :           typename Metavariables::cce_boundary_component,
     245              :           CharacteristicEvolution<Metavariables>>,
     246              :       ::Actions::MutateApply<AdvanceTime<Tags::CceEvolutionPrefix>>,
     247              :       Actions::ExitIfEndTimeReached, ::Actions::Goto<CceEvolutionLabelTag>>;
     248              : 
     249            0 :   using phase_dependent_action_list = tmpl::list<
     250              :       Parallel::PhaseActions<Parallel::Phase::Initialization,
     251              :                              initialize_action_list>,
     252              :       Parallel::PhaseActions<Parallel::Phase::InitializeTimeStepperHistory,
     253              :                              SelfStart::self_start_procedure<
     254              :                                  self_start_extract_action_list, cce_system,
     255              :                                  Tags::CceEvolutionPrefix>>,
     256              :       Parallel::PhaseActions<Parallel::Phase::Evolve, extract_action_list>>;
     257              : 
     258            0 :   static void initialize(
     259              :       Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
     260              : 
     261            0 :   static void execute_next_phase(
     262              :       const Parallel::Phase next_phase,
     263              :       const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
     264              :     auto& local_cache = *Parallel::local_branch(global_cache);
     265              :     Parallel::get_parallel_component<CharacteristicEvolution<Metavariables>>(
     266              :         local_cache)
     267              :         .start_phase(next_phase);
     268              :   }
     269              : };
     270              : }  // namespace Cce
        

Generated by: LCOV version 2.0-1