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/SelfStartActions.hpp"
38 : #include "Time/AdvanceTime.hpp"
39 : #include "Time/ChangeStepSize.hpp"
40 : #include "Time/ChangeTimeStepperOrder.hpp"
41 : #include "Time/CleanHistory.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 : Tags::CceEvolutionPrefix>>,
203 : ::Actions::MutateApply<
204 : CleanHistory<cce_system, Tags::CceEvolutionPrefix>>>;
205 :
206 0 : using extract_action_list = tmpl::list<
207 : Actions::RequestBoundaryData<
208 : typename Metavariables::cce_boundary_component,
209 : CharacteristicEvolution<Metavariables>>,
210 : ::Actions::Label<CceEvolutionLabelTag>,
211 : Actions::ReceiveWorldtubeData<
212 : Metavariables,
213 : typename Metavariables::cce_boundary_communication_tags>,
214 : Actions::InitializeFirstHypersurface<
215 : evolve_ccm, typename Metavariables::cce_boundary_component>,
216 : tmpl::conditional_t<
217 : tt::is_a_v<AnalyticWorldtubeBoundary,
218 : typename Metavariables::cce_boundary_component>,
219 : Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
220 : Actions::PrecomputeGlobalCceDependencies,
221 : tmpl::conditional_t<evolve_ccm,
222 : Actions::CalculatePsi0AndDerivAtInnerBoundary,
223 : tmpl::list<>>,
224 : tmpl::transform<bondi_hypersurface_step_tags,
225 : tmpl::bind<hypersurface_computation, tmpl::_1>>,
226 : Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
227 : tmpl::conditional_t<
228 : evolve_ccm, tmpl::list<>,
229 : tmpl::flatten<tmpl::list<
230 : std::conditional_t<Metavariables::local_time_stepping,
231 : evolution::Actions::RunEventsAndTriggers<
232 : Triggers::WhenToCheck::AtSteps>,
233 : tmpl::list<>>,
234 : evolution::Actions::RunEventsAndTriggers<
235 : Triggers::WhenToCheck::AtSlabs>>>>,
236 : compute_scri_quantities_and_observe,
237 : ::Actions::MutateApply<ChangeStepSize<
238 : typename Metavariables::cce_step_choosers, Tags::CceEvolutionPrefix>>,
239 : ::Actions::MutateApply<RecordTimeStepperData<cce_system>>,
240 : ::Actions::MutateApply<
241 : UpdateU<cce_system, Metavariables::local_time_stepping,
242 : Tags::CceEvolutionPrefix>>,
243 : ::Actions::MutateApply<
244 : ChangeTimeStepperOrder<cce_system, Tags::CceEvolutionPrefix>>,
245 : ::Actions::MutateApply<
246 : CleanHistory<cce_system, Tags::CceEvolutionPrefix>>,
247 : // We cannot know our next step for certain until after we've performed
248 : // step size selection, as we may need to reject a step.
249 : Actions::RequestNextBoundaryData<
250 : typename Metavariables::cce_boundary_component,
251 : CharacteristicEvolution<Metavariables>>,
252 : ::Actions::MutateApply<AdvanceTime<Tags::CceEvolutionPrefix>>,
253 : Actions::ExitIfEndTimeReached, ::Actions::Goto<CceEvolutionLabelTag>>;
254 :
255 0 : using phase_dependent_action_list = tmpl::list<
256 : Parallel::PhaseActions<Parallel::Phase::Initialization,
257 : initialize_action_list>,
258 : Parallel::PhaseActions<Parallel::Phase::InitializeTimeStepperHistory,
259 : SelfStart::self_start_procedure<
260 : self_start_extract_action_list, cce_system,
261 : Tags::CceEvolutionPrefix>>,
262 : Parallel::PhaseActions<Parallel::Phase::Evolve, extract_action_list>>;
263 :
264 0 : static void initialize(
265 : Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
266 :
267 0 : static void execute_next_phase(
268 : const Parallel::Phase next_phase,
269 : const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
270 : auto& local_cache = *Parallel::local_branch(global_cache);
271 : Parallel::get_parallel_component<CharacteristicEvolution<Metavariables>>(
272 : local_cache)
273 : .start_phase(next_phase);
274 : }
275 : };
276 : } // namespace Cce
|