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"
26 #include "Utilities/TMPL.hpp"
27 #include "Utilities/TaggedTuple.hpp"
28 
29 namespace Cce {
30 /// \cond
31 template <typename Metavariables>
32 struct H5WorldtubeBoundary;
33 template <typename Metavariables>
34 struct AnalyticWorldtubeBoundary;
35 template <typename Metavariables>
36 struct GhWorldtubeBoundary;
37 /// \endcond
38 namespace Actions {
39 
40 namespace detail {
41 template <typename Initializer, typename ManagerTag,
42  typename BoundaryCommunicationTagsList>
43 struct InitializeWorldtubeBoundaryBase {
44  using initialization_tags = tmpl::list<ManagerTag>;
45  using initialization_tags_to_keep = tmpl::list<ManagerTag>;
46  using const_global_cache_tags = tmpl::list<Tags::LMax>;
47 
48  using simple_tags =
49  tmpl::list<::Tags::Variables<BoundaryCommunicationTagsList>>;
50 
51  template <typename DataBoxTagsList, typename... InboxTags,
52  typename ArrayIndex, typename Metavariables, typename ActionList,
53  typename ParallelComponent>
54  static auto apply(db::DataBox<DataBoxTagsList>& box,
55  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
56  const Parallel::GlobalCache<Metavariables>& /*cache*/,
57  const ArrayIndex& /*array_index*/,
58  const ActionList /*meta*/,
59  const ParallelComponent* const /*meta*/) noexcept {
60  if constexpr (tmpl::list_contains_v<DataBoxTagsList, ManagerTag>) {
61  const size_t l_max = db::get<Tags::LMax>(box);
62  Variables<BoundaryCommunicationTagsList> boundary_variables{
64 
65  Initialization::mutate_assign<simple_tags>(make_not_null(&box),
66  std::move(boundary_variables));
67  return std::make_tuple(std::move(box));
68  } else {
69  ERROR(MakeString{} << "Missing required boundary manager tag : "
70  << db::tag_name<ManagerTag>);
71  }
72  }
73 };
74 } // namespace detail
75 
76 /*!
77  * \ingroup ActionsGroup
78  * \brief Generic action for initializing various worldtube boundary components.
79  *
80  * \details See specializations of this class for initialization details for
81  * individual worldtube components.
82  */
83 template <typename WorldtubeComponent>
85 
86 /*!
87  * \ingroup ActionsGroup
88  * \brief Initializes a H5WorldtubeBoundary
89  *
90  * \details Uses:
91  * - initialization tag
92  * `Cce::Tags::H5WorldtubeBoundaryDataManager`,
93  * - const global cache tag `Cce::Tags::LMax`.
94  *
95  * Databox changes:
96  * - Adds:
97  * - `Cce::Tags::H5WorldtubeBoundaryDataManager`
98  * - `Tags::Variables<typename
99  * Metavariables::cce_boundary_communication_tags>`
100  * - Removes: nothing
101  * - Modifies: nothing
102  *
103  * \note This action relies on the `SetupDataBox` aggregated initialization
104  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
105  * phase action list prior to this action.
106  */
107 template <typename Metavariables>
109  : public detail::InitializeWorldtubeBoundaryBase<
110  InitializeWorldtubeBoundary<H5WorldtubeBoundary<Metavariables>>,
111  Tags::H5WorldtubeBoundaryDataManager,
112  typename Metavariables::cce_boundary_communication_tags> {
113  using base_type = detail::InitializeWorldtubeBoundaryBase<
116  typename Metavariables::cce_boundary_communication_tags>;
117  using base_type::apply;
118  using typename base_type::simple_tags;
119  using const_global_cache_tags =
120  tmpl::list<Tags::LMax, Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
121  using typename base_type::initialization_tags;
122  using typename base_type::initialization_tags_to_keep;
123 };
124 
125 /*!
126  * \ingroup ActionsGroup
127  * \brief Initializes a GhWorldtubeBoundary
128  *
129  * \details Uses:
130  * - initialization tags
131  * `Cce::Tags::GhWorldtubeBoundaryDataManager`, `Tags::GhInterfaceManager`
132  * - const global cache tags `Tags::LMax`, `Tags::ExtractionRadius`.
133  *
134  * Databox changes:
135  * - Adds:
136  * - `Tags::Variables<typename
137  * Metavariables::cce_boundary_communication_tags>`
138  * - Removes: nothing
139  * - Modifies: nothing
140  *
141  * \note This action relies on the `SetupDataBox` aggregated initialization
142  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
143  * phase action list prior to this action.
144  */
145 template <typename Metavariables>
147  : public detail::InitializeWorldtubeBoundaryBase<
148  InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
149  Tags::GhInterfaceManager,
150  typename Metavariables::cce_boundary_communication_tags> {
151  using base_type = detail::InitializeWorldtubeBoundaryBase<
154  typename Metavariables::cce_boundary_communication_tags>;
155  using base_type::apply;
156  using typename base_type::simple_tags;
157 
158  using const_global_cache_tags =
162  using typename base_type::initialization_tags;
163  using typename base_type::initialization_tags_to_keep;
164 };
165 
166 /*!
167  * \ingroup ActionsGroup
168  * \brief Initializes an AnalyticWorldtubeBoundary
169  *
170  * \details Uses:
171  * - initialization tag
172  * `Cce::Tags::AnalyticBoundaryDataManager`,
173  * - const global cache tags `Tags::LMax`,
174  * `Tags::ExtractionRadius`.
175  *
176  * Databox changes:
177  * - Adds:
178  * - `Tags::Variables<typename
179  * Metavariables::cce_boundary_communication_tags>`
180  * - Removes: nothing
181  * - Modifies: nothing
182  *
183  * \note This action relies on the `SetupDataBox` aggregated initialization
184  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
185  * phase action list prior to this action.
186  */
187 template <typename Metavariables>
189  : public detail::InitializeWorldtubeBoundaryBase<
190  InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
191  Tags::AnalyticBoundaryDataManager,
192  typename Metavariables::cce_boundary_communication_tags> {
193  using base_type = detail::InitializeWorldtubeBoundaryBase<
196  typename Metavariables::cce_boundary_communication_tags>;
197  using base_type::apply;
198  using typename base_type::simple_tags;
199  using const_global_cache_tags =
200  tmpl::list<Tags::LMax, Tags::SpecifiedEndTime, Tags::SpecifiedStartTime>;
201  using typename base_type::initialization_tags;
202  using typename base_type::initialization_tags_to_keep;
203 };
204 } // namespace Actions
205 } // 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
tuple
Cce::H5WorldtubeBoundary
Component that supplies CCE worldtube boundary data.
Definition: CharacteristicExtractFwd.hpp:8
ERROR
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:37
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: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:529
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:460
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: CharacteristicExtractFwd.hpp:6
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:166
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:84
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
Cce::AnalyticWorldtubeBoundary
Component that supplies CCE worldtube boundary data sourced from an analytic solution.
Definition: CharacteristicExtractFwd.hpp:11
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