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