InitializeWorldtubeBoundary.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 #include <utility>
9 
12 #include "DataStructures/VariablesTag.hpp"
13 #include "Evolution/Systems/Cce/BoundaryData.hpp"
14 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
15 #include "Evolution/Systems/Cce/InterfaceManagers/GhLockstep.hpp"
16 #include "Evolution/Systems/Cce/OptionTags.hpp"
17 #include "Evolution/Systems/Cce/Tags.hpp"
18 #include "Evolution/Systems/Cce/WorldtubeDataManager.hpp"
19 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
20 #include "Parallel/Algorithm.hpp"
21 #include "Parallel/Info.hpp"
22 #include "Parallel/Invoke.hpp"
23 #include "ParallelAlgorithms/Initialization/MergeIntoDataBox.hpp"
24 #include "Utilities/Gsl.hpp"
25 #include "Utilities/Requires.hpp"
26 #include "Utilities/TMPL.hpp"
27 #include "Utilities/TaggedTuple.hpp"
28 
29 namespace Cce {
30 namespace Actions {
31 /*!
32  * \ingroup ActionsGroup
33  * \brief Initializes a H5WorldtubeBoundary
34  *
35  * \details Uses:
36  * - initialization tag
37  * `Cce::InitializationTags::H5WorldtubeBoundaryDataManager`,
38  * - const global cache tag `Cce::Tags::LMax`.
39  *
40  * Databox changes:
41  * - Adds:
42  * - `Cce::Tags::H5WorldtubeBoundaryDataManager`
43  * - `Tags::Variables<typename
44  * Metavariables::cce_boundary_communication_tags>`
45  * - Removes: nothing
46  * - Modifies: nothing
47  */
49  using initialization_tags =
50  tmpl::list<Tags::H5WorldtubeBoundaryDataManager>;
51  using initialization_tags_to_keep =
52  tmpl::list<Tags::H5WorldtubeBoundaryDataManager>;
53  using const_global_cache_tags =
54  tmpl::list<Tags::LMax, Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
55 
56  template <class Metavariables>
57  using h5_boundary_manager_simple_tags = db::AddSimpleTags<::Tags::Variables<
58  typename Metavariables::cce_boundary_communication_tags>>;
59 
60  template <class Metavariables>
61  using return_tag_list = h5_boundary_manager_simple_tags<Metavariables>;
62 
63  template <typename DbTags, typename... InboxTags, typename Metavariables,
64  typename ArrayIndex, typename ActionList,
65  typename ParallelComponent,
66  Requires<tmpl::list_contains_v<
67  DbTags, Tags::H5WorldtubeBoundaryDataManager>> = nullptr>
68  static auto apply(db::DataBox<DbTags>& box,
69  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
70  const Parallel::GlobalCache<Metavariables>& /*cache*/,
71  const ArrayIndex& /*array_index*/,
72  const ActionList /*meta*/,
73  const ParallelComponent* const /*meta*/) noexcept {
74  const size_t l_max = db::get<Tags::LMax>(box);
75  Variables<typename Metavariables::cce_boundary_communication_tags>
76  boundary_variables{
78 
79  auto initial_box = Initialization::merge_into_databox<
81  h5_boundary_manager_simple_tags<Metavariables>, db::AddComputeTags<>,
82  Initialization::MergePolicy::Overwrite>(std::move(box),
83  std::move(boundary_variables));
84 
85  return std::make_tuple(std::move(initial_box));
86  }
87 
88  template <typename DbTags, typename... InboxTags, typename Metavariables,
89  typename ArrayIndex, typename ActionList,
90  typename ParallelComponent,
91  Requires<not tmpl::list_contains_v<
92  DbTags, Tags::H5WorldtubeBoundaryDataManager>> = nullptr>
93  static auto apply(db::DataBox<DbTags>& box,
94  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
95  const Parallel::GlobalCache<Metavariables>& /*cache*/,
96  const ArrayIndex& /*array_index*/,
97  const ActionList /*meta*/,
98  const ParallelComponent* const /*meta*/) noexcept {
99  return std::make_tuple(std::move(box));
100  }
101 };
102 
103 /*!
104  * \ingroup ActionsGroup
105  * \brief Initializes a GhWorldtubeBoundary
106  *
107  * \details Uses:
108  * - initialization tag
109  * `Cce::InitializationTags::GhWorldtubeBoundaryDataManager`,
110  * - const global cache tags `InitializationTags::LMax`,
111  * `InitializationTags::ExtractionRadius`.
112  *
113  * Databox changes:
114  * - Adds:
115  * - `Tags::Variables<typename
116  * Metavariables::cce_boundary_communication_tags>`
117  * - `Tags::GhInterfaceManager` (cloned from
118  * `InitializationTags::GhInterfaceManager`)
119  * - Removes: nothing
120  * - Modifies: nothing
121  */
123  using initialization_tags = tmpl::list<Tags::GhInterfaceManager>;
124 
125  using initialization_tags_to_keep = tmpl::list<Tags::GhInterfaceManager>;
126 
127  using const_global_cache_tags =
131 
132  template <class Metavariables>
133  using gh_boundary_manager_simple_tags = db::AddSimpleTags<
135  typename Metavariables::cce_boundary_communication_tags>,
137 
138  template <typename DbTags, typename... InboxTags, typename Metavariables,
139  typename ArrayIndex, typename ActionList,
140  typename ParallelComponent,
142  nullptr>
143  static auto apply(db::DataBox<DbTags>& box,
144  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
145  const Parallel::GlobalCache<Metavariables>& /*cache*/,
146  const ArrayIndex& /*array_index*/,
147  const ActionList /*meta*/,
148  const ParallelComponent* const /*meta*/) noexcept {
149  const size_t l_max = db::get<Tags::LMax>(box);
150  Variables<typename Metavariables::cce_boundary_communication_tags>
151  boundary_variables{
153 
154  auto initial_box = Initialization::merge_into_databox<
156  gh_boundary_manager_simple_tags<Metavariables>, db::AddComputeTags<>,
157  Initialization::MergePolicy::Overwrite>(
158  std::move(box), std::move(boundary_variables),
159  db::get<Tags::GhInterfaceManager>(box).get_clone());
160 
161  return std::make_tuple(std::move(initial_box));
162  }
163 
164  template <
165  typename DbTags, typename... InboxTags, typename Metavariables,
166  typename ArrayIndex, typename ActionList, typename ParallelComponent,
168  nullptr>
169  static auto apply(db::DataBox<DbTags>& box,
170  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
171  const Parallel::GlobalCache<Metavariables>& /*cache*/,
172  const ArrayIndex& /*array_index*/,
173  const ActionList /*meta*/,
174  const ParallelComponent* const /*meta*/) noexcept {
175  ERROR(
176  "Required tag `Tags::GhInterfaceManager` is missing from the DataBox");
177  return std::make_tuple(std::move(box));
178  }
179 };
180 } // namespace Actions
181 } // namespace Cce
DataBoxTag.hpp
Cce::Actions::InitializeGhWorldtubeBoundary
Initializes a GhWorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:122
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
Cce::Tags::InterfaceManagerInterpolationStrategy
Intended for use in the const global cache to communicate to the sending elements when they should be...
Definition: OptionTags.hpp:433
Tags::Variables
Definition: VariablesTag.hpp:21
db::AddComputeTags
tmpl::flatten< tmpl::list< Tags... > > AddComputeTags
List of Compute Item Tags to add to the DataBox.
Definition: DataBox.hpp:1153
tuple
Info.hpp
ERROR
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:36
DataBox.hpp
cstddef
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
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Cce::Actions::InitializeH5WorldtubeBoundary
Initializes a H5WorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:48
db::AddSimpleTags
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1132
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:408
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Gsl.hpp
Cce::Tags::H5WorldtubeBoundaryDataManager
A tag that constructs a MetricWorldtubeDataManager from options.
Definition: OptionTags.hpp:218
Requires.hpp
Initialization::merge_into_databox
auto merge_into_databox(db::DataBox< DbTagsList > &&box, Args &&... args) noexcept
Add tags that are not yet in the DataBox.
Definition: MergeIntoDataBox.hpp:133
Cce::Tags::LMax
Definition: OptionTags.hpp:243
Requires
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t
Definition: Requires.hpp:67
Cce::Tags::SpecifiedStartTime
Represents the start time of a bounded CCE evolution that must be supplied in the input file (for e....
Definition: OptionTags.hpp:341
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
TMPL.hpp
Cce::InitializationTags::ExtractionRadius
Definition: OptionTags.hpp:195
Spectral::Swsh::number_of_swsh_collocation_points
constexpr size_t number_of_swsh_collocation_points(const size_t l_max) noexcept
Convenience function for determining the number of spin-weighted spherical harmonic collocation value...
Definition: SwshCollocation.hpp:25