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 
11 #include "DataStructures/VariablesTag.hpp"
12 #include "Evolution/Systems/Cce/AnalyticBoundaryDataManager.hpp"
13 #include "Evolution/Systems/Cce/BoundaryData.hpp"
14 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
15 #include "Evolution/Systems/Cce/InterfaceManagers/GhLocalTimeStepping.hpp"
16 #include "Evolution/Systems/Cce/InterfaceManagers/GhLockstep.hpp"
17 #include "Evolution/Systems/Cce/OptionTags.hpp"
18 #include "Evolution/Systems/Cce/Tags.hpp"
19 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
20 #include "NumericalAlgorithms/Spectral/SwshCollocation.hpp"
21 #include "Parallel/Invoke.hpp"
22 #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
23 #include "Utilities/Gsl.hpp"
24 #include "Utilities/MakeString.hpp"
25 #include "Utilities/Requires.hpp"
27 #include "Utilities/TMPL.hpp"
28 #include "Utilities/TaggedTuple.hpp"
29 
30 namespace Cce {
31 /// \cond
32 template <typename Metavariables>
33 struct H5WorldtubeBoundary;
34 template <typename Metavariables>
35 struct AnalyticWorldtubeBoundary;
36 template <typename Metavariables>
37 struct GhWorldtubeBoundary;
38 /// \endcond
39 namespace Actions {
40 
41 namespace detail {
42 template <typename Initializer, typename ManagerTag,
43  typename BoundaryCommunicationTagsList>
44 struct InitializeWorldtubeBoundaryBase {
45  using initialization_tags = tmpl::list<ManagerTag>;
46  using initialization_tags_to_keep = tmpl::list<ManagerTag>;
47  using const_global_cache_tags = tmpl::list<Tags::LMax>;
48 
49  using simple_tags =
50  tmpl::list<::Tags::Variables<BoundaryCommunicationTagsList>>;
51 
52  template <typename DataBoxTagsList, typename... InboxTags,
53  typename ArrayIndex, typename Metavariables, typename ActionList,
54  typename ParallelComponent>
55  static auto apply(db::DataBox<DataBoxTagsList>& box,
56  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
57  const Parallel::GlobalCache<Metavariables>& /*cache*/,
58  const ArrayIndex& /*array_index*/,
59  const ActionList /*meta*/,
60  const ParallelComponent* const /*meta*/) noexcept {
61  if constexpr (tmpl::list_contains_v<DataBoxTagsList, ManagerTag>) {
62  const size_t l_max = db::get<Tags::LMax>(box);
63  Variables<BoundaryCommunicationTagsList> boundary_variables{
65 
66  Initialization::mutate_assign<simple_tags>(make_not_null(&box),
67  std::move(boundary_variables));
68  return std::make_tuple(std::move(box));
69  } else {
70  ERROR(MakeString{} << "Missing required boundary manager tag : "
71  << db::tag_name<ManagerTag>);
72  }
73  }
74 };
75 } // namespace detail
76 
77 /*!
78  * \ingroup ActionsGroup
79  * \brief Generic action for initializing various worldtube boundary components.
80  *
81  * \details See specializations of this class for initialization details for
82  * individual worldtube components.
83  */
84 template <typename WorldtubeComponent>
86 
87 /*!
88  * \ingroup ActionsGroup
89  * \brief Initializes a H5WorldtubeBoundary
90  *
91  * \details Uses:
92  * - initialization tag
93  * `Cce::Tags::H5WorldtubeBoundaryDataManager`,
94  * - const global cache tag `Cce::Tags::LMax`.
95  *
96  * Databox changes:
97  * - Adds:
98  * - `Cce::Tags::H5WorldtubeBoundaryDataManager`
99  * - `Tags::Variables<typename
100  * Metavariables::cce_boundary_communication_tags>`
101  * - Removes: nothing
102  * - Modifies: nothing
103  *
104  * \note This action relies on the `SetupDataBox` aggregated initialization
105  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
106  * phase action list prior to this action.
107  */
108 template <typename Metavariables>
110  : public detail::InitializeWorldtubeBoundaryBase<
111  InitializeWorldtubeBoundary<H5WorldtubeBoundary<Metavariables>>,
112  Tags::H5WorldtubeBoundaryDataManager,
113  typename Metavariables::cce_boundary_communication_tags> {
114  using base_type = detail::InitializeWorldtubeBoundaryBase<
117  typename Metavariables::cce_boundary_communication_tags>;
118  using base_type::apply;
119  using typename base_type::simple_tags;
120  using const_global_cache_tags =
121  tmpl::list<Tags::LMax, Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
122  using typename base_type::initialization_tags;
123  using typename base_type::initialization_tags_to_keep;
124 };
125 
126 /*!
127  * \ingroup ActionsGroup
128  * \brief Initializes a GhWorldtubeBoundary
129  *
130  * \details Uses:
131  * - initialization tags
132  * `Cce::Tags::GhWorldtubeBoundaryDataManager`, `Tags::GhInterfaceManager`
133  * - const global cache tags `Tags::LMax`, `Tags::ExtractionRadius`.
134  *
135  * Databox changes:
136  * - Adds:
137  * - `Tags::Variables<typename
138  * Metavariables::cce_boundary_communication_tags>`
139  * - Removes: nothing
140  * - Modifies: nothing
141  *
142  * \note This action relies on the `SetupDataBox` aggregated initialization
143  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
144  * phase action list prior to this action.
145  */
146 template <typename Metavariables>
148  : public detail::InitializeWorldtubeBoundaryBase<
149  InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
150  Tags::GhInterfaceManager,
151  typename Metavariables::cce_boundary_communication_tags> {
152  using base_type = detail::InitializeWorldtubeBoundaryBase<
155  typename Metavariables::cce_boundary_communication_tags>;
156  using base_type::apply;
157  using typename base_type::simple_tags;
158 
159  using const_global_cache_tags =
163  using typename base_type::initialization_tags;
164  using typename base_type::initialization_tags_to_keep;
165 };
166 
167 /*!
168  * \ingroup ActionsGroup
169  * \brief Initializes an AnalyticWorldtubeBoundary
170  *
171  * \details Uses:
172  * - initialization tag
173  * `Cce::Tags::AnalyticBoundaryDataManager`,
174  * - const global cache tags `Tags::LMax`,
175  * `Tags::ExtractionRadius`.
176  *
177  * Databox changes:
178  * - Adds:
179  * - `Tags::Variables<typename
180  * Metavariables::cce_boundary_communication_tags>`
181  * - Removes: nothing
182  * - Modifies: nothing
183  *
184  * \note This action relies on the `SetupDataBox` aggregated initialization
185  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
186  * phase action list prior to this action.
187  */
188 template <typename Metavariables>
190  : public detail::InitializeWorldtubeBoundaryBase<
191  InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
192  Tags::AnalyticBoundaryDataManager,
193  typename Metavariables::cce_boundary_communication_tags> {
194  using base_type = detail::InitializeWorldtubeBoundaryBase<
197  typename Metavariables::cce_boundary_communication_tags>;
198  using base_type::apply;
199  using typename base_type::simple_tags;
200  using const_global_cache_tags =
201  tmpl::list<Tags::LMax, Tags::SpecifiedEndTime, Tags::SpecifiedStartTime>;
202  using typename base_type::initialization_tags;
203  using typename base_type::initialization_tags_to_keep;
204 };
205 } // namespace Actions
206 } // namespace Cce
std::apply
T apply(T... args)
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
Cce::Tags::InterfaceManagerInterpolationStrategy
Intended for use in the const global cache to communicate to the sending elements when they should be...
Definition: OptionTags.hpp:485
ParallelInfo.hpp
tuple
Cce::AnalyticWorldtubeBoundary
Component that supplies CCE worldtube boundary data sourced from an analytic solution.
Definition: WorldtubeBoundary.hpp:127
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::H5WorldtubeBoundary
Component that supplies CCE worldtube boundary data.
Definition: WorldtubeBoundary.hpp:86
Cce::Tags::NoEndTime
Represents the final time of a CCE evolution that should just proceed until it receives no more bound...
Definition: OptionTags.hpp:432
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Cce::Tags::AnalyticBoundaryDataManager
A tag that constructs a AnalyticBoundaryDataManager from options.
Definition: OptionTags.hpp:510
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:460
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:246
Requires.hpp
Cce::Tags::LMax
Definition: OptionTags.hpp:285
Cce::GhWorldtubeBoundary
Component that supplies CCE worldtube boundary data sourced from a running GH system.
Definition: WorldtubeBoundary.hpp:170
make_not_null
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:880
Cce::Actions::InitializeWorldtubeBoundary
Generic action for initializing various worldtube boundary components.
Definition: InitializeWorldtubeBoundary.hpp:85
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:382
TMPL.hpp
Cce::InitializationTags::ExtractionRadius
Definition: OptionTags.hpp:223
MakeString
Make a string by streaming into object.
Definition: MakeString.hpp:18
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