WorldtubeBoundary.hpp
1 // 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/Actions/TerminatePhase.hpp"
10 #include "Parallel/Info.hpp"
11 #include "Parallel/Invoke.hpp"
12 #include "ParallelAlgorithms/Initialization/Actions/RemoveOptionsAndTerminatePhase.hpp"
13 
14 namespace Cce {
15 
16 /*!
17  * \brief Component that supplies CCE worldtube boundary data.
18  *
19  * \details The \ref DataBoxGroup associated with the worldtube boundary
20  * component contains a data manager (e.g. `WorldtubeDataManager`) linked to
21  * an H5 file. The data manager handles buffering and interpolating to desired
22  * target time points when requested via the simple action
23  * `BoundaryComputeAndSendToEvolution`, at which point it will send the required
24  * collection of boundary quantities to the identified 'CharacteristicEvolution'
25  * component. It is assumed that the simple action
26  * `BoundaryComputeAndSendToEvolution` will only be called during the
27  * `Evolve` phase.
28  *
29  * Uses const global tags:
30  * - `Tags::LMax`
31  *
32  * `Metavariables` must contain:
33  * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
34  * - a type alias `cce_boundary_communication_tags` for the set of tags to send
35  * from the worldtube to the evolution component. This will typically be
36  * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
37  */
38 template <class Metavariables>
41  using chare_type = Parallel::Algorithms::Singleton;
42  using metavariables = Metavariables;
43  using initialize_action_list =
46  using initialization_tags =
48 
49  using worldtube_boundary_computation_steps = tmpl::list<>;
50 
51  using phase_dependent_action_list =
52  tmpl::list<Parallel::PhaseActions<typename Metavariables::Phase,
53  Metavariables::Phase::Initialization,
54  initialize_action_list>,
55  Parallel::PhaseActions<typename Metavariables::Phase,
56  Metavariables::Phase::Evolve,
57  worldtube_boundary_computation_steps>>;
58 
59  using const_global_cache_tag_list =
60  Parallel::detail::get_const_global_cache_tags_from_pdal<
61  phase_dependent_action_list>;
62 
63  using options = tmpl::list<>;
64 
65  static void initialize(Parallel::CProxy_GlobalCache<
66  Metavariables>& /*global_cache*/) noexcept {}
67 
68  static void execute_next_phase(
69  const typename Metavariables::Phase next_phase,
70  const Parallel::CProxy_GlobalCache<Metavariables>&
71  global_cache) noexcept {
72  auto& local_cache = *(global_cache.ckLocalBranch());
73  if (next_phase == Metavariables::Phase::Evolve) {
74  Parallel::get_parallel_component<H5WorldtubeBoundary>(local_cache)
75  .perform_algorithm();
76  }
77  }
78 };
79 
80 /*!
81  * \brief Component that supplies CCE worldtube boundary data sourced from a
82  * running GH system.
83  *
84  * \details The \ref DataBoxGroup associated with the worldtube boundary
85  * component contains an interface manager (derived from
86  * `Cce::GhWorldtubeInterfaceManager`) that stores and provides the data
87  * received from the GH system. The data manager handles buffering
88  * and interpolating to desired target time points when requested via the simple
89  * action `Cce::Actions::BoundaryComputeAndSendToEvolution`, at which point it
90  * will send the required collection of boundary quantities to the identified
91  * `CharacteristicEvolution` component. It is assumed that the simple action
92  * `Cce::Actions::BoundaryComputeAndSendToEvolution` will only be called during
93  * the `Evolve` phase.
94  *
95  * Uses const global tags:
96  * - `InitializationTags::LMax`
97  * - `InitializationTags::ExtractionRadius`
98  *
99  * `Metavariables` must contain:
100  * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
101  * - a type alias `cce_boundary_communication_tags` for the set of tags to send
102  * from the worldtube to the evolution component. This will typically be
103  * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
104  */
105 template <class Metavariables>
108  using chare_type = Parallel::Algorithms::Singleton;
109  using metavariables = Metavariables;
110  using initialize_action_list =
113  using initialization_tags =
115 
116  using worldtube_boundary_computation_steps = tmpl::list<>;
117 
118  using phase_dependent_action_list =
119  tmpl::list<Parallel::PhaseActions<typename Metavariables::Phase,
120  Metavariables::Phase::Initialization,
121  initialize_action_list>,
122  Parallel::PhaseActions<typename Metavariables::Phase,
123  Metavariables::Phase::Evolve,
124  worldtube_boundary_computation_steps>>;
125 
126  using const_global_cache_tag_list =
127  Parallel::detail::get_const_global_cache_tags_from_pdal<
128  phase_dependent_action_list>;
129 
130  using options = tmpl::list<>;
131 
132  static void initialize(Parallel::CProxy_GlobalCache<
133  Metavariables>& /*global_cache*/) noexcept {}
134 
135  static void execute_next_phase(
136  const typename Metavariables::Phase next_phase,
137  const Parallel::CProxy_GlobalCache<Metavariables>&
138  global_cache) noexcept {
139  auto& local_cache = *(global_cache.ckLocalBranch());
140  if (next_phase == Metavariables::Phase::Evolve) {
141  Parallel::get_parallel_component<GhWorldtubeBoundary>(local_cache)
142  .start_phase(next_phase);
143  }
144  }
145 };
146 
147 } // namespace Cce
Cce::Actions::InitializeGhWorldtubeBoundary
Initializes a GhWorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:122
GlobalCache.hpp
Initialization::Actions::RemoveOptionsAndTerminatePhase
Definition: RemoveOptionsAndTerminatePhase.hpp:27
Info.hpp
Parallel::get_initialization_tags
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< AllocationTagsList, tmpl::transform< InitializationActionsList, detail::get_initialization_tags_from_action< tmpl::_1 > >> >> get_initialization_tags
Given a list of initialization actions, and possibly a list of tags needed for allocation of an array...
Definition: ParallelComponentHelpers.hpp:140
Parallel::PhaseActions
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
Cce::H5WorldtubeBoundary
Component that supplies CCE worldtube boundary data.
Definition: WorldtubeBoundary.hpp:39
Cce::Tags::NoEndTime
Represents the final time of a CCE evolution that should just proceed until it receives no more bound...
Definition: OptionTags.hpp:386
Cce::Tags::EndTimeFromFile
Represents the final time of a bounded CCE evolution, determined either from option specification or ...
Definition: OptionTags.hpp:359
Cce::Actions::InitializeH5WorldtubeBoundary
Initializes a H5WorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:48
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Cce::GhWorldtubeBoundary
Component that supplies CCE worldtube boundary data sourced from a running GH system.
Definition: WorldtubeBoundary.hpp:106