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