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>
40  using chare_type = Parallel::Algorithms::Singleton;
41  using metavariables = Metavariables;
42  using initialize_action_list =
45  using initialization_tags =
47 
48  using worldtube_boundary_computation_steps = tmpl::list<>;
49 
50  using phase_dependent_action_list =
51  tmpl::list<Parallel::PhaseActions<typename Metavariables::Phase,
52  Metavariables::Phase::Initialization,
53  initialize_action_list>,
54  Parallel::PhaseActions<typename Metavariables::Phase,
55  Metavariables::Phase::Evolve,
56  worldtube_boundary_computation_steps>>;
57 
58  using const_global_cache_tag_list =
59  Parallel::detail::get_const_global_cache_tags_from_pdal<
60  phase_dependent_action_list>;
61 
62  using options = tmpl::list<>;
63 
64  static void initialize(Parallel::CProxy_ConstGlobalCache<
65  Metavariables>& /*global_cache*/) noexcept {}
66 
67  static void execute_next_phase(
68  const typename Metavariables::Phase next_phase,
69  const Parallel::CProxy_ConstGlobalCache<Metavariables>&
70  global_cache) noexcept {
71  auto& local_cache = *(global_cache.ckLocalBranch());
72  if (next_phase == Metavariables::Phase::Evolve) {
73  Parallel::get_parallel_component<H5WorldtubeBoundary>(local_cache)
74  .perform_algorithm();
75  }
76  }
77 };
78 
79 /*!
80  * \brief Component that supplies CCE worldtube boundary data sourced from a
81  * running GH system.
82  *
83  * \details The \ref DataBoxGroup associated with the worldtube boundary
84  * component contains an interface manager (derived from
85  * `Cce::GhWorldtubeInterfaceManager`) that stores and provides the data
86  * received from the GH system. The data manager handles buffering
87  * and interpolating to desired target time points when requested via the simple
88  * action `Cce::Actions::BoundaryComputeAndSendToEvolution`, at which point it
89  * will send the required collection of boundary quantities to the identified
90  * `CharacteristicEvolution` component. It is assumed that the simple action
91  * `Cce::Actions::BoundaryComputeAndSendToEvolution` will only be called during
92  * the `Evolve` phase.
93  *
94  * Uses const global tags:
95  * - `InitializationTags::LMax`
96  * - `InitializationTags::ExtractionRadius`
97  *
98  * `Metavariables` must contain:
99  * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases.
100  * - a type alias `cce_boundary_communication_tags` for the set of tags to send
101  * from the worldtube to the evolution component. This will typically be
102  * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`.
103  */
104 template <class Metavariables>
106  using chare_type = Parallel::Algorithms::Singleton;
107  using metavariables = Metavariables;
108  using initialize_action_list =
111  using initialization_tags =
113 
114  using worldtube_boundary_computation_steps = tmpl::list<>;
115 
116  using phase_dependent_action_list =
117  tmpl::list<Parallel::PhaseActions<typename Metavariables::Phase,
118  Metavariables::Phase::Initialization,
119  initialize_action_list>,
120  Parallel::PhaseActions<typename Metavariables::Phase,
121  Metavariables::Phase::Evolve,
122  worldtube_boundary_computation_steps>>;
123 
124  using const_global_cache_tag_list =
125  Parallel::detail::get_const_global_cache_tags_from_pdal<
126  phase_dependent_action_list>;
127 
128  using options = tmpl::list<>;
129 
130  static void initialize(Parallel::CProxy_ConstGlobalCache<
131  Metavariables>& /*global_cache*/) noexcept {}
132 
133  static void execute_next_phase(
134  const typename Metavariables::Phase next_phase,
135  const Parallel::CProxy_ConstGlobalCache<Metavariables>&
136  global_cache) noexcept {
137  auto& local_cache = *(global_cache.ckLocalBranch());
138  if (next_phase == Metavariables::Phase::Evolve) {
139  Parallel::get_parallel_component<H5WorldtubeBoundary>(local_cache)
140  .start_phase(next_phase);
141  }
142  }
143 };
144 
145 } // namespace Cce
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
Defines functions for interfacing with the parallelization framework.
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Initializes a H5WorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:48
Component that supplies CCE worldtube boundary data.
Definition: WorldtubeBoundary.hpp:39
Definition: RemoveOptionsAndTerminatePhase.hpp:27
Initializes a GhWorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:132
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
Component that supplies CCE worldtube boundary data sourced from a running GH system.
Definition: WorldtubeBoundary.hpp:105
Defines class template ConstGlobalCache.