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 #include <optional>
9 
10 #include "DataStructures/DataBox/Tag.hpp"
11 #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
12 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
13 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterpolationStrategies.hpp"
14 #include "Evolution/Systems/Cce/InterfaceManagers/GhLockstep.hpp"
15 #include "Evolution/Systems/Cce/WorldtubeDataManager.hpp"
16 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
17 #include "Options/Auto.hpp"
18 #include "Options/Options.hpp"
19 #include "Parallel/Printf.hpp"
20 
21 namespace Cce {
22 namespace OptionTags {
23 
24 /// %Option group
25 struct Cce {
26  static constexpr Options::String help = {
27  "Options for the Cce evolution system"};
28 };
29 
30 /// %Option group
31 struct Filtering {
32  static constexpr Options::String help = {"Options for the filtering in Cce"};
33  using group = Cce;
34 };
35 
36 struct LMax {
37  using type = size_t;
38  static constexpr Options::String help{
39  "Maximum l value for spin-weighted spherical harmonics"};
40  using group = Cce;
41 };
42 
43 struct FilterLMax {
44  using type = size_t;
45  static constexpr Options::String help{"l mode cutoff for angular filtering"};
46  using group = Filtering;
47 };
48 
50  using type = double;
51  static constexpr Options::String help{
52  "alpha parameter in exponential radial filter"};
53  using group = Filtering;
54 };
55 
57  using type = size_t;
58  static constexpr Options::String help{
59  "Half-power of the exponential radial filter argument"};
60  using group = Filtering;
61 };
62 
64  using type = size_t;
65  static constexpr Options::String help{"Maximum l value for swsh output"};
66  using group = Cce;
67 };
68 
70  using type = size_t;
71  static constexpr Options::String help{
72  "Number of radial grid points in the spherical domain"};
73  using group = Cce;
74 };
75 
77  using type = double;
78  static constexpr Options::String help{"Extraction radius of the CCE system."};
79  using group = Cce;
80 };
81 
83  static std::string name() noexcept { return "ExtractionRadius"; }
85 
86  static constexpr Options::String help{
87  "Extraction radius of the CCE system for a standalone run. This may be "
88  "set to \"Auto\" to infer the radius from the filename (often used for "
89  "SpEC worldtube data). This option is unused if `H5IsBondiData` is "
90  "`true`, and should be \"Auto\" for such runs."};
91  using group = Cce;
92 };
93 
94 struct EndTime {
96  static constexpr Options::String help{"End time for the Cce Evolution."};
97  static type suggested_value() noexcept { return {}; }
98  using group = Cce;
99 };
100 
101 struct StartTime {
102  using type = Options::Auto<double>;
103  static constexpr Options::String help{
104  "Cce Start time (default to earliest possible time)."};
105  static type suggested_value() noexcept { return {}; }
106  using group = Cce;
107 };
108 
110  using type = double;
111  static constexpr Options::String help{
112  "Target time step size for Cce Evolution"};
113  using group = Cce;
114 };
115 
117  using type = std::string;
118  static constexpr Options::String help{
119  "H5 file to read the wordltube data from."};
120  using group = Cce;
121 };
122 
124  using type = size_t;
125  static constexpr Options::String help{
126  "Number of times steps from the h5 to cache each read."};
127  static size_t suggested_value() noexcept { return 200; }
128  using group = Cce;
129 };
130 
133  static constexpr Options::String help{
134  "The interpolator for imported h5 worldtube data."};
135  using group = Cce;
136 };
137 
139  using type = bool;
140  static constexpr Options::String help{
141  "true for boundary data in Bondi form, false for metric data. Metric "
142  "data is more readily available from Cauchy simulations, so historically "
143  "has been the typical format provided by SpEC simulations. Bondi data is "
144  "much more efficient for storage size and performance, but both must be "
145  "supported for compatibility with current CCE data sources."};
146  using group = Cce;
147 };
148 
150  using type = bool;
151  static constexpr Options::String help{
152  "Set to true if corrections for SpEC data impurities should be applied "
153  "automatically based on the `VersionHist.ver` data set in the H5. "
154  "Typically, this should be set to true if the metric data is created "
155  "from SpEC, and false otherwise."};
156  using group = Cce;
157 };
158 
161  static constexpr Options::String help{
162  "Class to manage worldtube data from a GH system."};
163  using group = Cce;
164 };
165 
167  static std::string name() noexcept { return "ScriInterpOrder"; }
168  using type = size_t;
169  static constexpr Options::String help{
170  "Order of time interpolation at scri+."};
171  static size_t suggested_value() noexcept { return 5; }
172  using group = Cce;
173 };
174 
176  using type = size_t;
177  static constexpr Options::String help{
178  "Number of scri output points per timestep."};
179  static size_t suggested_value() noexcept { return 1; }
180  using group = Cce;
181 };
182 
183 struct InitializeJ {
185  static constexpr Options::String help{
186  "The initialization for the first hypersurface for J"};
187  using group = Cce;
188 };
189 
190 } // namespace OptionTags
191 
192 namespace InitializationTags {
194  using type = size_t;
195  using option_tags = tmpl::list<OptionTags::ScriInterpolationOrder>;
196 
197  static constexpr bool pass_metavariables = false;
198  static size_t create_from_options(
199  const size_t scri_plus_interpolation_order) noexcept {
200  return scri_plus_interpolation_order;
201  }
202 };
203 
205  using type = double;
206  using option_tags = tmpl::list<OptionTags::TargetStepSize>;
207 
208  static constexpr bool pass_metavariables = false;
209  static double create_from_options(const double target_step_size) noexcept {
210  return target_step_size;
211  }
212 };
213 
215  using type = double;
216  using option_tags = tmpl::list<OptionTags::ExtractionRadius>;
217 
218  static constexpr bool pass_metavariables = false;
219  static double create_from_options(const double extraction_radius) noexcept {
220  return extraction_radius;
221  }
222 };
223 
225  using type = size_t;
226  using option_tags = tmpl::list<OptionTags::ScriOutputDensity>;
227 
228  static constexpr bool pass_metavariables = false;
229  static size_t create_from_options(const size_t scri_output_density) noexcept {
230  return scri_output_density;
231  }
232 };
233 } // namespace InitializationTags
234 
235 namespace Tags {
236 /// A tag that constructs a `MetricWorldtubeDataManager` from options
239  using option_tags =
244 
245  static constexpr bool pass_metavariables = false;
246  static type create_from_options(
247  const size_t l_max, const std::string& filename,
248  const size_t number_of_lookahead_times,
249  const std::unique_ptr<intrp::SpanInterpolator>& interpolator,
250  const bool h5_is_bondi_data, const bool fix_spec_normalization,
251  const std::optional<double> extraction_radius) noexcept {
252  if (h5_is_bondi_data) {
253  if (static_cast<bool>(extraction_radius)) {
255  "Warning: Option ExtractionRadius is set to a specific value and "
256  "H5IsBondiData is set to `true` -- the ExtractionRadius will not "
257  "be used, because all radius information is specified in the input "
258  "file for the Bondi worldtube data format. It is recommended to "
259  "set `ExtractionRadius` to `\"Auto\"` to make the input file "
260  "clearer.");
261  }
262  return std::make_unique<BondiWorldtubeDataManager>(
263  std::make_unique<BondiWorldtubeH5BufferUpdater>(filename,
264  extraction_radius),
265  l_max, number_of_lookahead_times, interpolator->get_clone());
266  } else {
267  return std::make_unique<MetricWorldtubeDataManager>(
268  std::make_unique<MetricWorldtubeH5BufferUpdater>(filename,
269  extraction_radius),
270  l_max, number_of_lookahead_times, interpolator->get_clone(),
271  fix_spec_normalization);
272  }
273  }
274 };
275 
277  using type = size_t;
278  using option_tags = tmpl::list<OptionTags::LMax>;
279 
280  static constexpr bool pass_metavariables = false;
281  static size_t create_from_options(const size_t l_max) noexcept {
282  return l_max;
283  }
284 };
285 
288  using type = size_t;
289  using option_tags = tmpl::list<OptionTags::NumberOfRadialPoints>;
290 
291  static constexpr bool pass_metavariables = false;
292  static size_t create_from_options(
293  const size_t number_of_radial_points) noexcept {
294  return number_of_radial_points;
295  }
296 };
297 
299  using type = size_t;
300  using option_tags = tmpl::list<OptionTags::ObservationLMax>;
301 
302  static constexpr bool pass_metavariables = false;
303  static size_t create_from_options(const size_t observation_l_max) noexcept {
304  return observation_l_max;
305  }
306 };
307 
309  using type = size_t;
310  using option_tags = tmpl::list<OptionTags::FilterLMax>;
311 
312  static constexpr bool pass_metavariables = false;
313  static size_t create_from_options(const size_t filter_l_max) noexcept {
314  return filter_l_max;
315  }
316 };
317 
319  using type = double;
320  using option_tags = tmpl::list<OptionTags::RadialFilterAlpha>;
321 
322  static constexpr bool pass_metavariables = false;
323  static double create_from_options(const double radial_filter_alpha) noexcept {
324  return radial_filter_alpha;
325  }
326 };
327 
329  using type = size_t;
330  using option_tags = tmpl::list<OptionTags::RadialFilterHalfPower>;
331 
332  static constexpr bool pass_metavariables = false;
333  static size_t create_from_options(
334  const size_t radial_filter_half_power) noexcept {
335  return radial_filter_half_power;
336  }
337 };
338 
339 /// \brief Represents the start time of a bounded CCE evolution, determined
340 /// either from option specification or from the file
341 ///
342 /// \details If no start time is specified in the input file (so the option
343 /// `OptionTags::StartTime` is set to "Auto"), this will find the start time
344 /// from the provided H5 file. If `OptionTags::StartTime` takes any other value,
345 /// it will be used directly as the start time for the CCE evolution instead.
347  using type = double;
348  using option_tags =
351 
352  static constexpr bool pass_metavariables = false;
353  static double create_from_options(const std::optional<double> start_time,
354  const std::string& filename,
355  const bool is_bondi_data) noexcept {
356  if (start_time) {
357  return *start_time;
358  }
359  if (is_bondi_data) {
360  BondiWorldtubeH5BufferUpdater h5_boundary_updater{filename};
361  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
362  return time_buffer[0];
363  } else {
364  MetricWorldtubeH5BufferUpdater h5_boundary_updater{filename};
365  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
366  return time_buffer[0];
367  }
368  }
369 };
370 
371 /// \brief Represents the start time of a bounded CCE evolution that must be
372 /// supplied in the input file (for e.g. analytic tests).
374  using type = double;
375  using option_tags = tmpl::list<OptionTags::StartTime>;
376 
377  static constexpr bool pass_metavariables = false;
378  static double create_from_options(const double start_time) noexcept {
379  return start_time;
380  }
381 };
382 
383 /// \brief Represents the final time of a bounded CCE evolution, determined
384 /// either from option specification or from the file
385 ///
386 /// \details If no end time is specified in the input file (so the option
387 /// `OptionTags::EndTime` is set to "Auto"), this will find the end time
388 /// from the provided H5 file. If `OptionTags::EndTime` takes any other value,
389 /// it will be used directly as the final time for the CCE evolution instead.
391  using type = double;
392  using option_tags =
395 
396  static constexpr bool pass_metavariables = false;
397  static double create_from_options(const std::optional<double> end_time,
398  const std::string& filename,
399  const bool is_bondi_data) {
400  if (end_time) {
401  return *end_time;
402  }
403  if (is_bondi_data) {
404  BondiWorldtubeH5BufferUpdater h5_boundary_updater{filename};
405  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
406  return time_buffer[time_buffer.size() - 1];
407  } else {
408  MetricWorldtubeH5BufferUpdater h5_boundary_updater{filename};
409  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
410  return time_buffer[time_buffer.size() - 1];
411  }
412  }
413 };
414 
415 /// \brief Represents the final time of a CCE evolution that should just proceed
416 /// until it receives no more boundary data and becomes quiescent.
418  using type = double;
419  using option_tags = tmpl::list<>;
420 
421  static constexpr bool pass_metavariables = false;
422  static double create_from_options() noexcept {
424  }
425 };
426 
427 /// \brief Represents the final time of a bounded CCE evolution that must be
428 /// supplied in the input file (for e.g. analytic tests).
430  using type = double;
431  using option_tags = tmpl::list<OptionTags::EndTime>;
432 
433  static constexpr bool pass_metavariables = false;
434  static double create_from_options(const double end_time) noexcept {
435  return end_time;
436  }
437 };
438 
441  using option_tags = tmpl::list<OptionTags::GhInterfaceManager>;
442 
443  static constexpr bool pass_metavariables = false;
445  create_from_options(
447  interface_manager) noexcept {
448  return interface_manager->get_clone();
449  }
450 };
451 
452 /// \brief Intended for use in the const global cache to communicate to the
453 /// sending elements when they should be sending worldtube data for CCE to the
454 /// interpolator.
455 ///
456 /// \details This tag is not specifiable by independent options in the yaml, and
457 /// instead is entirely determined by the choice of interface manager, which
458 /// sets by virtual member function the interpolation strategy that is
459 /// compatible with the interface manager. The choice to extract this
460 /// information at option-parsing is to avoid needing to pass any information
461 /// from the interpolation manager that is typically stored in the
462 /// `WorldtubeBoundary` component \ref DataBoxGroup to the components that
463 /// provide data for CCE.
466  using option_tags = tmpl::list<OptionTags::GhInterfaceManager>;
467 
468  static constexpr bool pass_metavariables = false;
470  create_from_options(
472  interface_manager) noexcept {
473  return interface_manager->get_interpolation_strategy();
474  }
475 };
476 
479  using option_tags = tmpl::list<OptionTags::InitializeJ>;
480 
481  static constexpr bool pass_metavariables = false;
482  static std::unique_ptr<::Cce::InitializeJ::InitializeJ> create_from_options(
484  initialize_j) noexcept {
485  return initialize_j->get_clone();
486  }
487 };
488 
489 } // namespace Tags
490 } // namespace Cce
Cce::MetricWorldtubeH5BufferUpdater
A WorldtubeBufferUpdater specialized to the CCE input worldtube H5 file produced by SpEC.
Definition: WorldtubeBufferUpdater.hpp:175
std::string
Cce::InitializationTags::ScriOutputDensity
Definition: OptionTags.hpp:224
Cce::OptionTags::ScriOutputDensity
Definition: OptionTags.hpp:175
Cce::Tags::InterfaceManagerInterpolationStrategy
Intended for use in the const global cache to communicate to the sending elements when they should be...
Definition: OptionTags.hpp:464
Cce::Tags::NumberOfRadialPoints
Definition: OptionTags.hpp:286
Options.hpp
Parallel::printf
void printf(const std::string &format, Args &&... args)
Print an atomic message to stdout with C printf usage.
Definition: Printf.hpp:103
Cce::OptionTags::ObservationLMax
Definition: OptionTags.hpp:63
Cce::OptionTags::H5LookaheadTimes
Definition: OptionTags.hpp:123
Cce::OptionTags::LMax
Definition: OptionTags.hpp:36
db::SimpleTag
Mark a struct as a simple tag by inheriting from this.
Definition: Tag.hpp:36
Cce::OptionTags::StandaloneExtractionRadius
Definition: OptionTags.hpp:82
Cce::OptionTags::FilterLMax
Definition: OptionTags.hpp:43
Cce::OptionTags::StartTime
Definition: OptionTags.hpp:101
Cce::OptionTags::EndTime
Definition: OptionTags.hpp:94
Cce::OptionTags::TargetStepSize
Definition: OptionTags.hpp:109
Cce::BondiWorldtubeH5BufferUpdater
A WorldtubeBufferUpdater specialized to the CCE input worldtube H5 file produced by the reduced SpEC ...
Definition: WorldtubeBufferUpdater.hpp:261
Cce::Tags::EndTime
Definition: Tags.hpp:311
Cce::Tags::SpecifiedEndTime
Represents the final time of a bounded CCE evolution that must be supplied in the input file (for e....
Definition: OptionTags.hpp:429
Cce::Tags::ObservationLMax
Definition: OptionTags.hpp:298
Cce::OptionTags::H5IsBondiData
Definition: OptionTags.hpp:138
Printf.hpp
std::numeric_limits::infinity
T infinity(T... args)
Cce::OptionTags::Cce
Option group
Definition: OptionTags.hpp:25
Spectral::Swsh::Tags::NumberOfRadialPointsBase
Base Tag for the number of radial grid points in the three-dimensional representation of radially con...
Definition: SwshTags.hpp:209
cstddef
Cce::OptionTags::ExtractionRadius
Definition: OptionTags.hpp:76
Spectral::Swsh::Tags::LMaxBase
Base Tag for the maximum spin-weighted spherical harmonic l; sets angular resolution.
Definition: SwshTags.hpp:197
Cce::InitializationTags::TargetStepSize
Definition: OptionTags.hpp:204
Cce::OptionTags::RadialFilterHalfPower
Definition: OptionTags.hpp:56
Cce::Tags::NoEndTime
Represents the final time of a CCE evolution that should just proceed until it receives no more bound...
Definition: OptionTags.hpp:417
Cce::OptionTags::FixSpecNormalization
Definition: OptionTags.hpp:149
Cce::Tags::EndTimeFromFile
Represents the final time of a bounded CCE evolution, determined either from option specification or ...
Definition: OptionTags.hpp:390
Options::Auto
A class indicating that a parsed value can be automatically computed instead of specified.
Definition: Auto.hpp:32
Cce::Tags::RadialFilterAlpha
Definition: OptionTags.hpp:318
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:439
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:308
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Cce::Tags::InitializeJ
Definition: OptionTags.hpp:477
Cce::Tags::RadialFilterHalfPower
Definition: OptionTags.hpp:328
Cce::Tags::H5WorldtubeBoundaryDataManager
A tag that constructs a MetricWorldtubeDataManager from options.
Definition: OptionTags.hpp:237
Cce::OptionTags::InitializeJ
Definition: OptionTags.hpp:183
Cce::OptionTags::ScriInterpolationOrder
Definition: OptionTags.hpp:166
Cce::OptionTags::RadialFilterAlpha
Definition: OptionTags.hpp:49
optional
Cce::Tags::LMax
Definition: OptionTags.hpp:276
Cce::OptionTags::H5Interpolator
Definition: OptionTags.hpp:131
Cce::OptionTags::Filtering
Option group
Definition: OptionTags.hpp:31
Cce::OptionTags::GhInterfaceManager
Definition: OptionTags.hpp:159
Cce::OptionTags::NumberOfRadialPoints
Definition: OptionTags.hpp:69
Cce::InitializationTags::ScriInterpolationOrder
Definition: OptionTags.hpp:193
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:373
std::unique_ptr< intrp::SpanInterpolator >
Cce::Tags::StartTimeFromFile
Represents the start time of a bounded CCE evolution, determined either from option specification or ...
Definition: OptionTags.hpp:346
Cce::Tags::StartTime
Definition: Tags.hpp:313
Cce::InterfaceManagers::InterpolationStrategy
InterpolationStrategy
Enumeration of possibilities for the collection of worldtube data that will be collected by the inter...
Definition: GhInterpolationStrategies.hpp:31
Cce::InitializationTags::ExtractionRadius
Definition: OptionTags.hpp:214
Cce::OptionTags::BoundaryDataFilename
Definition: OptionTags.hpp:116