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