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 "Evolution/Systems/Cce/Actions/InitializeKleinGordonFirstHypersurface.hpp"
9 : #include "Evolution/Systems/Cce/Actions/InitializeKleinGordonVariables.hpp"
10 : #include "Evolution/Systems/Cce/Actions/PrecomputeKleinGordonSourceVariables.hpp"
11 : #include "Evolution/Systems/Cce/Components/CharacteristicEvolution.hpp"
12 : #include "Evolution/Systems/Cce/KleinGordonSource.hpp"
13 : #include "Evolution/Systems/Cce/KleinGordonSystem.hpp"
14 : #include "Parallel/GlobalCache.hpp"
15 : #include "Parallel/Local.hpp"
16 : #include "Parallel/Phase.hpp"
17 : #include "Time/Actions/SelfStartActions.hpp"
18 : #include "Utilities/TMPL.hpp"
19 :
20 : namespace Cce {
21 :
22 : /*!
23 : * \brief The component for handling the CCE evolution for the Klein-Gordon
24 : * system coupled with General Relativity.
25 : *
26 : * \details The \ref DataBoxGroup associated with
27 : * KleinGordonCharacteristicEvolution will contain all the tags of
28 : * CharacteristicEvolution, with additional tags related to the scalar field.
29 : *
30 : * Metavariables requirements:
31 : * - Phases:
32 : * - `Initialization`
33 : * - `Evolve`
34 : * - Modified type aliases in comparison to CharacteristicEvolution:
35 : * - `evolved_swsh_tags`: The spin-weighted quantities to be evolved (
36 : * `KleinGordonPsi` and `BondiJ`).
37 : * - `evolved_swsh_dt_tags`: The spin-weighed quantities associated that are to
38 : * act as the time derivative to evolve `evolved_swsh_tags` (`KleinGordonPi` and
39 : * `BondiH`).
40 : * - Additional type aliases related to the scalar field:
41 : * - `klein_gordon_boundary_communication_tags`: A typelist of tags that will
42 : * be communicated between the worldtube boundary component and the extraction
43 : * component (`Cce::Tags::klein_gordon_worldtube_boundary_tags`).
44 : * - `klein_gordon_gauge_boundary_tags`: A typelist of tags that will be
45 : * derived via `GaugeAdjustedBoundaryValue` and corresponding gauge utilities
46 : * - `klein_gordon_scri_tags`: the tags of quantities to compute at scri+
47 : */
48 : template <class Metavariables>
49 1 : struct KleinGordonCharacteristicEvolution
50 : : CharacteristicEvolution<Metavariables> {
51 0 : using metavariables = Metavariables;
52 0 : static constexpr bool evolve_ccm = Metavariables::evolve_ccm;
53 0 : using cce_system = Cce::KleinGordonSystem<evolve_ccm>;
54 :
55 0 : using cce_base = CharacteristicEvolution<Metavariables>;
56 0 : using initialize_action_list = tmpl::append<
57 : tmpl::list<Actions::InitializeKleinGordonVariables<Metavariables>>,
58 : typename cce_base::initialize_action_list>;
59 :
60 : template <typename BondiTag>
61 0 : using hypersurface_computation =
62 : typename cce_base::template hypersurface_computation<BondiTag>;
63 :
64 0 : using klein_gordon_hypersurface_computation = tmpl::list<
65 : ::Actions::MutateApply<GaugeAdjustedBoundaryValue<Tags::KleinGordonPi>>,
66 : Actions::CalculateIntegrandInputsForTag<Tags::KleinGordonPi>,
67 : tmpl::transform<
68 : integrand_terms_to_compute_for_bondi_variable<Tags::KleinGordonPi>,
69 : tmpl::bind<::Actions::MutateApply,
70 : tmpl::bind<ComputeBondiIntegrand, tmpl::_1>>>>;
71 :
72 0 : using simple_tags_from_options =
73 : Parallel::get_simple_tags_from_options<initialize_action_list>;
74 :
75 0 : using typename cce_base::compute_scri_quantities_and_observe;
76 :
77 0 : using self_start_extract_action_list = tmpl::list<
78 : Actions::RequestBoundaryData<
79 : typename Metavariables::cce_boundary_component,
80 : KleinGordonCharacteristicEvolution<Metavariables>>,
81 : Actions::ReceiveWorldtubeData<
82 : Metavariables,
83 : typename Metavariables::cce_boundary_communication_tags>,
84 : Actions::ReceiveWorldtubeData<
85 : Metavariables,
86 : typename Metavariables::klein_gordon_boundary_communication_tags>,
87 : // note that the initialization will only actually happen on the
88 : // iterations immediately following restarts
89 : Actions::InitializeFirstHypersurface<
90 : evolve_ccm, typename Metavariables::cce_boundary_component>,
91 : Actions::InitializeKleinGordonFirstHypersurface,
92 : tmpl::conditional_t<
93 : tt::is_a_v<AnalyticWorldtubeBoundary,
94 : typename Metavariables::cce_boundary_component>,
95 : Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
96 : Actions::PrecomputeGlobalCceDependencies,
97 : tmpl::conditional_t<evolve_ccm,
98 : Actions::CalculatePsi0AndDerivAtInnerBoundary,
99 : tmpl::list<>>,
100 : Actions::PrecomputeKleinGordonSourceVariables,
101 : tmpl::transform<
102 : bondi_hypersurface_step_tags,
103 : tmpl::bind<::Actions::MutateApply,
104 : tmpl::bind<ComputeKleinGordonSource, tmpl::_1>>>,
105 : tmpl::transform<bondi_hypersurface_step_tags,
106 : tmpl::bind<hypersurface_computation, tmpl::_1>>,
107 : klein_gordon_hypersurface_computation,
108 : Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
109 : Actions::FilterSwshVolumeQuantity<Tags::KleinGordonPi>,
110 : ::Actions::MutateApply<
111 : CalculateScriPlusValue<::Tags::dt<Tags::InertialRetardedTime>>>,
112 : Actions::CalculateScriInputs,
113 : tmpl::transform<typename metavariables::cce_scri_tags,
114 : tmpl::bind<::Actions::MutateApply,
115 : tmpl::bind<CalculateScriPlusValue, tmpl::_1>>>,
116 : ::Actions::RecordTimeStepperData<cce_system>,
117 : ::Actions::UpdateU<cce_system>>;
118 :
119 0 : using extract_action_list = tmpl::list<
120 : Actions::RequestBoundaryData<
121 : typename Metavariables::cce_boundary_component,
122 : KleinGordonCharacteristicEvolution<Metavariables>>,
123 : ::Actions::Label<CceEvolutionLabelTag>,
124 : tmpl::conditional_t<evolve_ccm, tmpl::list<>,
125 : evolution::Actions::RunEventsAndTriggers>,
126 : Actions::ReceiveWorldtubeData<
127 : Metavariables,
128 : typename Metavariables::cce_boundary_communication_tags>,
129 : Actions::ReceiveWorldtubeData<
130 : Metavariables,
131 : typename Metavariables::klein_gordon_boundary_communication_tags>,
132 : Actions::InitializeFirstHypersurface<
133 : evolve_ccm, typename Metavariables::cce_boundary_component>,
134 : Actions::InitializeKleinGordonFirstHypersurface,
135 : tmpl::conditional_t<
136 : tt::is_a_v<AnalyticWorldtubeBoundary,
137 : typename Metavariables::cce_boundary_component>,
138 : Actions::UpdateGauge<false>, Actions::UpdateGauge<evolve_ccm>>,
139 : Actions::PrecomputeGlobalCceDependencies,
140 : tmpl::conditional_t<evolve_ccm,
141 : Actions::CalculatePsi0AndDerivAtInnerBoundary,
142 : tmpl::list<>>,
143 : Actions::PrecomputeKleinGordonSourceVariables,
144 : tmpl::transform<
145 : bondi_hypersurface_step_tags,
146 : tmpl::bind<::Actions::MutateApply,
147 : tmpl::bind<ComputeKleinGordonSource, tmpl::_1>>>,
148 : tmpl::transform<bondi_hypersurface_step_tags,
149 : tmpl::bind<hypersurface_computation, tmpl::_1>>,
150 : klein_gordon_hypersurface_computation,
151 : Actions::FilterSwshVolumeQuantity<Tags::BondiH>,
152 : Actions::FilterSwshVolumeQuantity<Tags::KleinGordonPi>,
153 : compute_scri_quantities_and_observe,
154 : ::Actions::RecordTimeStepperData<cce_system>,
155 : ::Actions::UpdateU<cce_system>,
156 : ::Actions::ChangeStepSize<typename Metavariables::cce_step_choosers>,
157 : // We cannot know our next step for certain until after we've performed
158 : // step size selection, as we may need to reject a step.
159 : Actions::RequestNextBoundaryData<
160 : typename Metavariables::cce_boundary_component,
161 : KleinGordonCharacteristicEvolution<Metavariables>>,
162 : ::Actions::AdvanceTime, Actions::ExitIfEndTimeReached,
163 : ::Actions::Goto<CceEvolutionLabelTag>>;
164 :
165 0 : using phase_dependent_action_list = tmpl::list<
166 : Parallel::PhaseActions<Parallel::Phase::Initialization,
167 : initialize_action_list>,
168 : Parallel::PhaseActions<Parallel::Phase::InitializeTimeStepperHistory,
169 : SelfStart::self_start_procedure<
170 : self_start_extract_action_list, cce_system>>,
171 : Parallel::PhaseActions<Parallel::Phase::Evolve, extract_action_list>>;
172 :
173 0 : static void initialize(
174 : Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
175 :
176 0 : static void execute_next_phase(
177 : const Parallel::Phase next_phase,
178 : const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
179 : auto& local_cache = *Parallel::local_branch(global_cache);
180 : Parallel::get_parallel_component<
181 : KleinGordonCharacteristicEvolution<Metavariables>>(local_cache)
182 : .start_phase(next_phase);
183 : }
184 : };
185 : } // namespace Cce
|