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