Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "Evolution/Systems/Cce/Actions/InitializeWorldtubeBoundary.hpp"
7 : #include "Evolution/Systems/Cce/BoundaryData.hpp"
8 : #include "Parallel/GlobalCache.hpp"
9 : #include "Parallel/Invoke.hpp"
10 : #include "Parallel/Local.hpp"
11 : #include "Parallel/Phase.hpp"
12 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
13 :
14 : namespace Cce {
15 :
16 : /*!
17 : * \brief Generic base class for components that supply CCE worldtube boundary
18 : * data. See class specializations for specific worldtube boundary components.
19 : */
20 : template <typename WorldtubeComponent, typename Metavariables>
21 1 : struct WorldtubeComponentBase {
22 0 : using chare_type = Parallel::Algorithms::Singleton;
23 0 : static constexpr bool checkpoint_data = true;
24 0 : using metavariables = Metavariables;
25 0 : using initialize_action_list =
26 : tmpl::list<Actions::InitializeWorldtubeBoundary<WorldtubeComponent>,
27 : Parallel::Actions::TerminatePhase>;
28 :
29 0 : using simple_tags_from_options =
30 : Parallel::get_simple_tags_from_options<initialize_action_list>;
31 :
32 0 : using worldtube_boundary_computation_steps = tmpl::list<>;
33 :
34 0 : using phase_dependent_action_list =
35 : tmpl::list<Parallel::PhaseActions<Parallel::Phase::Initialization,
36 : initialize_action_list>,
37 : Parallel::PhaseActions<Parallel::Phase::Evolve,
38 : worldtube_boundary_computation_steps>>;
39 :
40 0 : using options = tmpl::list<>;
41 :
42 0 : static void initialize(
43 : Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {}
44 :
45 0 : static void execute_next_phase(
46 : const Parallel::Phase next_phase,
47 : const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
48 : auto& local_cache = *Parallel::local_branch(global_cache);
49 : if (next_phase == Parallel::Phase::Evolve) {
50 : Parallel::get_parallel_component<WorldtubeComponent>(local_cache)
51 : .start_phase(next_phase);
52 : }
53 : }
54 : };
55 :
56 : /*!
57 : * \brief Component that supplies CCE worldtube boundary data.
58 : *
59 : * \details The \ref DataBoxGroup associated with the worldtube boundary
60 : * component contains a data manager (e.g. `WorldtubeDataManager`) linked to
61 : * an H5 file. The data manager handles buffering and interpolating to desired
62 : * target time points when requested via the simple action
63 : * `BoundaryComputeAndSendToEvolution`, at which point it will send the required
64 : * collection of boundary quantities to the identified 'CharacteristicEvolution'
65 : * component. It is assumed that the simple action
66 : * `BoundaryComputeAndSendToEvolution` will only be called during the
67 : * `Evolve` phase.
68 : *
69 : * Uses const global tags:
70 : * - `Tags::LMax`
71 : *
72 : * `Metavariables` must contain:
73 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
74 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send
75 : * from the worldtube to the evolution component. This will typically be
76 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
77 : */
78 : template <class Metavariables>
79 1 : struct H5WorldtubeBoundary
80 : : public WorldtubeComponentBase<H5WorldtubeBoundary<Metavariables>,
81 : Metavariables> {
82 0 : using base_type =
83 : WorldtubeComponentBase<H5WorldtubeBoundary<Metavariables>, Metavariables>;
84 0 : using base_type::execute_next_phase;
85 0 : using base_type::initialize;
86 : using typename base_type::chare_type;
87 0 : using const_global_cache_tags =
88 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>;
89 : using typename base_type::metavariables;
90 : using typename base_type::options;
91 : using typename base_type::phase_dependent_action_list;
92 : using typename base_type::simple_tags_from_options;
93 0 : using end_time_tag = Tags::EndTimeFromFile;
94 : };
95 :
96 : /*!
97 : * \brief Component that supplies scalar-tensor worldtube boundary data.
98 : *
99 : * \details The \ref DataBoxGroup associated with the worldtube boundary
100 : * component contains two data managers (`WorldtubeDataManager`) linked to
101 : * one or two H5 files (scalar and tensor sectors, respectively). The data
102 : * managers handle buffering and interpolating to desired target time points
103 : * when requested via the simple action `BoundaryComputeAndSendToEvolution`, at
104 : * which point they will send the required collection of boundary quantities to
105 : * the identified `KleinGordonCharacteristicEvolution` component. It is assumed
106 : * that the simple action `BoundaryComputeAndSendToEvolution` will only be
107 : * called during the `Evolve` phase.
108 : *
109 : * Uses const global tags:
110 : * - `Tags::LMax`
111 : *
112 : * `Metavariables` must contain:
113 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
114 : * - a type alias `cce_boundary_communication_tags` for the set of tensor tags
115 : * to send from the worldtube to the evolution component. This will typically be
116 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
117 : * - a type alias `klein_gordon_boundary_communication_tags` for the set of
118 : * scalar tags to send from the worldtube to the evolution component. This will
119 : * typically be `Cce::Tags::klein_gordon_worldtube_boundary_tags`.
120 : */
121 : template <class Metavariables>
122 1 : struct KleinGordonH5WorldtubeBoundary
123 : : public WorldtubeComponentBase<
124 : KleinGordonH5WorldtubeBoundary<Metavariables>, Metavariables> {
125 0 : using base_type =
126 : WorldtubeComponentBase<KleinGordonH5WorldtubeBoundary<Metavariables>,
127 : Metavariables>;
128 0 : using base_type::execute_next_phase;
129 0 : using base_type::initialize;
130 : using typename base_type::chare_type;
131 0 : using const_global_cache_tags =
132 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>;
133 : using typename base_type::metavariables;
134 : using typename base_type::options;
135 : using typename base_type::phase_dependent_action_list;
136 : using typename base_type::simple_tags_from_options;
137 0 : using end_time_tag = Tags::EndTimeFromFile;
138 : };
139 :
140 : /*!
141 : * \brief Component that supplies CCE worldtube boundary data sourced from an
142 : * analytic solution.
143 : *
144 : * \details The \ref DataBoxGroup associated with the worldtube boundary
145 : * component contains a data manager (e.g. `AnalyticBoundaryDataManager`) that
146 : * contains the analytic solution being provided. The data manager handles
147 : * computation of the analytic solution boundary data when requested via
148 : * the simple action `BoundaryComputeAndSendToEvolution`, at which point it will
149 : * send the required collection of boundary quantities to the identified
150 : * 'CharacteristicEvolution' component. It is assumed that the simple action
151 : * `BoundaryComputeAndSendToEvolution` will only be called during the
152 : * `Evolve` phase.
153 : *
154 : * Uses const global tags:
155 : * - `Tags::LMax`
156 : * - `Tags::SpecifiedEndTime`
157 : *
158 : * `Metavariables` must contain:
159 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
160 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send
161 : * from the worldtube to the evolution component. This will typically be
162 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
163 : */
164 : template <class Metavariables>
165 1 : struct AnalyticWorldtubeBoundary
166 : : public WorldtubeComponentBase<AnalyticWorldtubeBoundary<Metavariables>,
167 : Metavariables> {
168 0 : using base_type =
169 : WorldtubeComponentBase<AnalyticWorldtubeBoundary<Metavariables>,
170 : Metavariables>;
171 0 : using base_type::execute_next_phase;
172 0 : using base_type::initialize;
173 : using typename base_type::chare_type;
174 0 : using const_global_cache_tags = tmpl::list<Tags::AnalyticInitializeJ>;
175 : using typename base_type::metavariables;
176 : using typename base_type::options;
177 : using typename base_type::phase_dependent_action_list;
178 : using typename base_type::simple_tags_from_options;
179 0 : using end_time_tag = Tags::SpecifiedEndTime;
180 : };
181 :
182 : /*!
183 : * \brief Component that supplies CCE worldtube boundary data sourced from a
184 : * running GH system.
185 : *
186 : * \details The \ref DataBoxGroup associated with the worldtube boundary
187 : * component contains an interface manager (derived from
188 : * `Cce::GhWorldtubeInterfaceManager`) that stores and provides the data
189 : * received from the GH system. The data manager handles buffering
190 : * and interpolating to desired target time points when requested via the simple
191 : * action `Cce::Actions::BoundaryComputeAndSendToEvolution`, at which point it
192 : * will send the required collection of boundary quantities to the identified
193 : * `CharacteristicEvolution` component. It is assumed that the simple action
194 : * `Cce::Actions::BoundaryComputeAndSendToEvolution` will only be called during
195 : * the `Evolve` phase.
196 : *
197 : * Uses const global tags:
198 : * - `InitializationTags::LMax`
199 : * - `InitializationTags::ExtractionRadius`
200 : *
201 : * `Metavariables` must contain:
202 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
203 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send
204 : * from the worldtube to the evolution component. This will typically be
205 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
206 : */
207 : template <class Metavariables>
208 1 : struct GhWorldtubeBoundary
209 : : public WorldtubeComponentBase<GhWorldtubeBoundary<Metavariables>,
210 : Metavariables> {
211 0 : using base_type =
212 : WorldtubeComponentBase<GhWorldtubeBoundary<Metavariables>, Metavariables>;
213 0 : using base_type::execute_next_phase;
214 0 : using base_type::initialize;
215 : using typename base_type::chare_type;
216 0 : using const_global_cache_tags =
217 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>;
218 : using typename base_type::metavariables;
219 : using typename base_type::options;
220 : using typename base_type::phase_dependent_action_list;
221 : using typename base_type::simple_tags_from_options;
222 0 : using end_time_tag = Tags::NoEndTime;
223 : };
224 : } // namespace Cce
|