OptionTags.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <limits>
8 
9 #include "DataStructures/DataBox/Tag.hpp"
10 #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
11 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
12 #include "Evolution/Systems/Cce/InterfaceManagers/GhLockstep.hpp"
13 #include "Evolution/Systems/Cce/ReadBoundaryDataH5.hpp"
14 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
15 #include "Options/Options.hpp"
16 
17 namespace Cce {
18 namespace OptionTags {
19 
20 /// %Option group
21 struct Cce {
22  static constexpr OptionString help = {"Options for the Cce evolution system"};
23 };
24 
25 /// %Option group
26 struct Filtering {
27  static constexpr OptionString help = {"Options for the filtering in Cce"};
28  using group = Cce;
29 };
30 
31 struct LMax {
32  using type = size_t;
33  static constexpr OptionString help{
34  "Maximum l value for spin-weighted spherical harmonics"};
35  using group = Cce;
36 };
37 
38 struct FilterLMax {
39  using type = size_t;
40  static constexpr OptionString help{"l mode cutoff for angular filtering"};
41  using group = Filtering;
42 };
43 
45  using type = double;
46  static constexpr OptionString help{
47  "alpha parameter in exponential radial filter"};
48  using group = Filtering;
49 };
50 
52  using type = size_t;
53  static constexpr OptionString help{
54  "Half-power of the exponential radial filter argument"};
55  using group = Filtering;
56 };
57 
59  using type = size_t;
60  static constexpr OptionString help{"Maximum l value for swsh output"};
61  using group = Cce;
62 };
63 
65  using type = size_t;
66  static constexpr OptionString help{
67  "Number of radial grid points in the spherical domain"};
68  using group = Cce;
69 };
70 
72  using type = double;
73  static constexpr OptionString help{"Extraction radius from the GH system."};
74  using group = Cce;
75 };
76 
77 struct EndTime {
78  using type = double;
79  static constexpr OptionString help{"End time for the Cce Evolution."};
80  static double default_value() noexcept {
82  }
83  using group = Cce;
84 };
85 
86 struct StartTime {
87  using type = double;
88  static constexpr OptionString help{
89  "Cce Start time (default to earliest possible time)."};
90  static double default_value() noexcept {
92  }
93  using group = Cce;
94 };
95 
97  using type = double;
98  static constexpr OptionString help{"Target time step size for Cce Evolution"};
99  using group = Cce;
100 };
101 
103  using type = std::string;
104  static constexpr OptionString help{
105  "H5 file to read the wordltube data from."};
106  using group = Cce;
107 };
108 
110  using type = size_t;
111  static constexpr OptionString help{
112  "Number of times steps from the h5 to cache each read."};
113  static size_t default_value() noexcept { return 200; }
114  using group = Cce;
115 };
116 
119  static constexpr OptionString help{
120  "The interpolator for imported h5 worldtube data."};
121  using group = Cce;
122 };
123 
126  static constexpr OptionString help{
127  "Class to manage worldtube data from a GH system."};
128  using group = Cce;
129 };
130 
132  static std::string name() noexcept { return "ScriInterpOrder"; }
133  using type = size_t;
134  static constexpr OptionString help{"Order of time interpolation at scri+."};
135  static size_t default_value() noexcept { return 5; }
136  using group = Cce;
137 };
138 
140  using type = size_t;
141  static constexpr OptionString help{
142  "Number of scri output points per timestep."};
143  static size_t default_value() noexcept { return 1; }
144  using group = Cce;
145 };
146 
147 struct InitializeJ {
149  static constexpr OptionString help{
150  "The initialization for the first hypersurface for J"};
151  using group = Cce;
152 };
153 
154 } // namespace OptionTags
155 
156 namespace InitializationTags {
157 /// An initialization tag that constructs a `WorldtubeDataManager` from options
159  using type = WorldtubeDataManager;
160  using option_tags =
163 
164  static constexpr bool pass_metavariables = false;
165  static WorldtubeDataManager create_from_options(
166  const size_t l_max, const std::string& filename,
167  const size_t number_of_lookahead_times,
168  const std::unique_ptr<intrp::SpanInterpolator>& interpolator) noexcept {
169  return WorldtubeDataManager{
170  std::make_unique<SpecWorldtubeH5BufferUpdater>(filename), l_max,
171  number_of_lookahead_times, interpolator->get_clone()};
172  }
173 };
174 
176  using type = size_t;
177  using option_tags = tmpl::list<OptionTags::ScriInterpolationOrder>;
178 
179  static constexpr bool pass_metavariables = false;
180  static size_t create_from_options(
181  const size_t scri_plus_interpolation_order) noexcept {
182  return scri_plus_interpolation_order;
183  }
184 };
185 
187  using type = double;
188  using option_tags = tmpl::list<OptionTags::TargetStepSize>;
189 
190  static constexpr bool pass_metavariables = false;
191  static double create_from_options(const double target_step_size) noexcept {
192  return target_step_size;
193  }
194 };
195 
197  using type = double;
198  using option_tags = tmpl::list<OptionTags::ExtractionRadius>;
199 
200  template <typename Metavariables>
201  static double create_from_options(const double extraction_radius) noexcept {
202  return extraction_radius;
203  }
204 };
205 
207  using type = size_t;
208  using option_tags = tmpl::list<OptionTags::ScriOutputDensity>;
209 
210  static constexpr bool pass_metavariables = false;
211  static size_t create_from_options(const size_t scri_output_density) noexcept {
212  return scri_output_density;
213  }
214 };
215 } // namespace InitializationTags
216 
217 namespace Tags {
219  using type = size_t;
220  using option_tags = tmpl::list<OptionTags::LMax>;
221 
222  static constexpr bool pass_metavariables = false;
223  static size_t create_from_options(const size_t l_max) noexcept {
224  return l_max;
225  }
226 };
227 
230  using type = size_t;
231  using option_tags = tmpl::list<OptionTags::NumberOfRadialPoints>;
232 
233  static constexpr bool pass_metavariables = false;
234  static size_t create_from_options(
235  const size_t number_of_radial_points) noexcept {
236  return number_of_radial_points;
237  }
238 };
239 
241  using type = size_t;
242  using option_tags = tmpl::list<OptionTags::ObservationLMax>;
243 
244  static constexpr bool pass_metavariables = false;
245  static size_t create_from_options(const size_t observation_l_max) noexcept {
246  return observation_l_max;
247  }
248 };
249 
251  using type = size_t;
252  using option_tags = tmpl::list<OptionTags::FilterLMax>;
253 
254  static constexpr bool pass_metavariables = false;
255  static size_t create_from_options(const size_t filter_l_max) noexcept {
256  return filter_l_max;
257  }
258 };
259 
261  using type = double;
262  using option_tags = tmpl::list<OptionTags::RadialFilterAlpha>;
263 
264  static constexpr bool pass_metavariables = false;
265  static double create_from_options(const double radial_filter_alpha) noexcept {
266  return radial_filter_alpha;
267  }
268 };
269 
271  using type = size_t;
272  using option_tags = tmpl::list<OptionTags::RadialFilterHalfPower>;
273 
274  static constexpr bool pass_metavariables = false;
275  static size_t create_from_options(
276  const size_t radial_filter_half_power) noexcept {
277  return radial_filter_half_power;
278  }
279 };
280 
282  using type = double;
283  using option_tags =
284  tmpl::list<OptionTags::StartTime, OptionTags::BoundaryDataFilename>;
285 
286  static constexpr bool pass_metavariables = false;
287  static double create_from_options(double start_time,
288  const std::string& filename) noexcept {
289  if (start_time == -std::numeric_limits<double>::infinity()) {
290  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
291  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
292  start_time = time_buffer[0];
293  }
294  return start_time;
295  }
296 };
297 
298 /// \brief Represents the final time of a bounded CCE evolution, determined
299 /// either from option specification or from the file
300 ///
301 /// \details If the option `OptionTags::EndTime` is set to
302 /// `std::numeric_limits<double>::%infinity()`, this will find the end time from
303 /// the provided H5 file. If `OptionTags::EndTime` takes any other value, it
304 /// will be used directly as the end time for the CCE evolution instead.
306  using type = double;
307  using option_tags =
308  tmpl::list<OptionTags::EndTime, OptionTags::BoundaryDataFilename>;
309 
310  static constexpr bool pass_metavariables = false;
311  static double create_from_options(double end_time,
312  const std::string& filename) {
313  if (end_time == std::numeric_limits<double>::infinity()) {
314  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
315  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
316  end_time = time_buffer[time_buffer.size() - 1];
317  }
318  return end_time;
319  }
320 };
321 
324  using option_tags = tmpl::list<OptionTags::GhInterfaceManager>;
325 
326  template <typename Metavariables>
328  create_from_options(
330  interface_manager) noexcept {
331  return interface_manager->get_clone();
332  }
333 };
334 
337  using option_tags = tmpl::list<OptionTags::InitializeJ>;
338 
339  static constexpr bool pass_metavariables = false;
340  static std::unique_ptr<::Cce::InitializeJ::InitializeJ> create_from_options(
342  initialize_j) noexcept {
343  return initialize_j->get_clone();
344  }
345 };
346 
347 } // namespace Tags
348 } // namespace Cce
std::string
Cce::InitializationTags::ScriOutputDensity
Definition: OptionTags.hpp:206
Cce::OptionTags::ScriOutputDensity
Definition: OptionTags.hpp:139
Cce::Tags::NumberOfRadialPoints
Definition: OptionTags.hpp:228
Options.hpp
Cce::OptionTags::ObservationLMax
Definition: OptionTags.hpp:58
Cce::OptionTags::H5LookaheadTimes
Definition: OptionTags.hpp:109
Cce::OptionTags::LMax
Definition: OptionTags.hpp:31
db::SimpleTag
Tags for the DataBox inherit from this type.
Definition: Tag.hpp:23
Cce::OptionTags::FilterLMax
Definition: OptionTags.hpp:38
Cce::OptionTags::StartTime
Definition: OptionTags.hpp:86
Cce::OptionTags::EndTime
Definition: OptionTags.hpp:77
Cce::OptionTags::TargetStepSize
Definition: OptionTags.hpp:96
Cce::InitializationTags::H5WorldtubeBoundaryDataManager
An initialization tag that constructs a WorldtubeDataManager from options.
Definition: OptionTags.hpp:158
Cce::Tags::EndTime
Represents the final time of a bounded CCE evolution, determined either from option specification or ...
Definition: OptionTags.hpp:305
Cce::Tags::ObservationLMax
Definition: OptionTags.hpp:240
std::numeric_limits::infinity
T infinity(T... args)
Cce::OptionTags::Cce
Option group
Definition: OptionTags.hpp:21
Cce::SpecWorldtubeH5BufferUpdater
A WorldtubeBufferUpdater specialized to the CCE input worldtube H5 file produced by SpEC.
Definition: ReadBoundaryDataH5.hpp:173
Spectral::Swsh::Tags::NumberOfRadialPointsBase
Base Tag for the number of radial grid points in the three-dimensional representation of radially con...
Definition: SwshTags.hpp:212
cstddef
Cce::OptionTags::ExtractionRadius
Definition: OptionTags.hpp:71
Spectral::Swsh::Tags::LMaxBase
Base Tag for the maximum spin-weighted spherical harmonic l; sets angular resolution.
Definition: SwshTags.hpp:200
Cce::InitializationTags::TargetStepSize
Definition: OptionTags.hpp:186
Cce::OptionTags::RadialFilterHalfPower
Definition: OptionTags.hpp:51
Cce::Tags::RadialFilterAlpha
Definition: OptionTags.hpp:260
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:322
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
limits
Cce::Tags::FilterLMax
Definition: OptionTags.hpp:250
Cce::Tags::InitializeJ
Definition: OptionTags.hpp:335
Cce::Tags::RadialFilterHalfPower
Definition: OptionTags.hpp:270
Cce::OptionTags::InitializeJ
Definition: OptionTags.hpp:147
Cce::OptionTags::ScriInterpolationOrder
Definition: OptionTags.hpp:131
Cce::OptionTags::RadialFilterAlpha
Definition: OptionTags.hpp:44
Cce::Tags::LMax
Definition: OptionTags.hpp:218
Cce::OptionTags::H5Interpolator
Definition: OptionTags.hpp:117
Cce::OptionTags::Filtering
Option group
Definition: OptionTags.hpp:26
Cce::OptionTags::GhInterfaceManager
Definition: OptionTags.hpp:124
Cce::OptionTags::NumberOfRadialPoints
Definition: OptionTags.hpp:64
Cce::InitializationTags::ScriInterpolationOrder
Definition: OptionTags.hpp:175
std::unique_ptr< intrp::SpanInterpolator >
std::numeric_limits
Cce::Tags::StartTime
Definition: OptionTags.hpp:281
OptionString
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:30
Cce::WorldtubeDataManager
Manages the cached buffer data associated with a CCE worldtube and interpolates to requested time poi...
Definition: ReadBoundaryDataH5.hpp:378
Cce::InitializationTags::ExtractionRadius
Definition: OptionTags.hpp:196
Cce::OptionTags::BoundaryDataFilename
Definition: OptionTags.hpp:102