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/ReadBoundaryDataH5.hpp"
11 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
12 #include "Options/Options.hpp"
13 
14 namespace Cce {
15 namespace OptionTags {
16 
17 /// %Option group
18 struct Cce {
19  static constexpr OptionString help = {"Options for the Cce evolution system"};
20 };
21 
22 /// %Option group
23 struct Filtering {
24  static constexpr OptionString help = {"Options for the filtering in Cce"};
25  using group = Cce;
26 };
27 
28 struct LMax {
29  using type = size_t;
30  static constexpr OptionString help{
31  "Maximum l value for spin-weighted spherical harmonics"};
32  using group = Cce;
33 };
34 
35 struct FilterLMax {
36  using type = size_t;
37  static constexpr OptionString help{"l mode cutoff for angular filtering"};
38  using group = Filtering;
39 };
40 
42  using type = double;
43  static constexpr OptionString help{
44  "alpha parameter in exponential radial filter"};
45  using group = Filtering;
46 };
47 
49  using type = size_t;
50  static constexpr OptionString help{
51  "Half-power of the exponential radial filter argument"};
52  using group = Filtering;
53 };
54 
56  using type = size_t;
57  static constexpr OptionString help{"Maximum l value for swsh output"};
58  using group = Cce;
59 };
60 
62  using type = size_t;
63  static constexpr OptionString help{
64  "Number of radial grid points in the spherical domain"};
65  using group = Cce;
66 };
67 
68 struct EndTime {
69  using type = double;
70  static constexpr OptionString help{"End time for the Cce Evolution."};
71  static double default_value() noexcept {
73  }
74  using group = Cce;
75 };
76 
77 struct StartTime {
78  using type = double;
79  static constexpr OptionString help{
80  "Cce Start time (default to earliest possible time)."};
81  static double default_value() noexcept {
83  }
84  using group = Cce;
85 };
86 
88  using type = double;
89  static constexpr OptionString help{"Target time step size for Cce Evolution"};
90  using group = Cce;
91 };
92 
94  using type = std::string;
95  static constexpr OptionString help{
96  "H5 file to read the wordltube data from."};
97  using group = Cce;
98 };
99 
101  using type = size_t;
102  static constexpr OptionString help{
103  "Number of times steps from the h5 to cache each read."};
104  static size_t default_value() noexcept { return 200; }
105  using group = Cce;
106 };
107 
110  static constexpr OptionString help{
111  "The interpolator for imported h5 worldtube data."};
112  using group = Cce;
113 };
114 
116  static std::string name() noexcept { return "ScriInterpOrder"; }
117  using type = size_t;
118  static constexpr OptionString help{"Order of time interpolation at scri+."};
119  static size_t default_value() noexcept { return 5; }
120  using group = Cce;
121 };
122 
124  using type = size_t;
125  static constexpr OptionString help{
126  "Number of scri output points per timestep."};
127  static size_t default_value() noexcept { return 1; }
128  using group = Cce;
129 };
130 
131 } // namespace OptionTags
132 
133 namespace InitializationTags {
134 /// An initialization tag that constructs a `WorldtubeDataManager` from options
136  using type = WorldtubeDataManager;
137  using option_tags =
140 
141  static constexpr bool pass_metavariables = false;
143  const size_t l_max, const std::string& filename,
144  const size_t number_of_lookahead_times,
145  const std::unique_ptr<intrp::SpanInterpolator>& interpolator) noexcept {
146  return WorldtubeDataManager{
147  std::make_unique<SpecWorldtubeH5BufferUpdater>(filename), l_max,
148  number_of_lookahead_times, interpolator->get_clone()};
149  }
150 };
151 
153  using type = size_t;
154  using option_tags = tmpl::list<OptionTags::ScriInterpolationOrder>;
155 
156  static constexpr bool pass_metavariables = false;
157  static size_t create_from_options(
158  const size_t scri_plus_interpolation_order) noexcept {
159  return scri_plus_interpolation_order;
160  }
161 };
162 
164  using type = double;
165  using option_tags = tmpl::list<OptionTags::TargetStepSize>;
166 
167  static constexpr bool pass_metavariables = false;
168  static double create_from_options(const double target_step_size) noexcept {
169  return target_step_size;
170  }
171 };
172 
174  using type = size_t;
175  using option_tags = tmpl::list<OptionTags::ScriOutputDensity>;
176 
177  static constexpr bool pass_metavariables = false;
178  static size_t create_from_options(const size_t scri_output_density) noexcept {
179  return scri_output_density;
180  }
181 };
182 } // namespace InitializationTags
183 
184 namespace Tags {
186  using type = size_t;
187  using option_tags = tmpl::list<OptionTags::LMax>;
188 
189  static constexpr bool pass_metavariables = false;
190  static size_t create_from_options(const size_t l_max) noexcept {
191  return l_max;
192  }
193 };
194 
197  using type = size_t;
198  using option_tags = tmpl::list<OptionTags::NumberOfRadialPoints>;
199 
200  static constexpr bool pass_metavariables = false;
201  static size_t create_from_options(
202  const size_t number_of_radial_points) noexcept {
203  return number_of_radial_points;
204  }
205 };
206 
208  using type = size_t;
209  using option_tags = tmpl::list<OptionTags::ObservationLMax>;
210 
211  static constexpr bool pass_metavariables = false;
212  static size_t create_from_options(const size_t observation_l_max) noexcept {
213  return observation_l_max;
214  }
215 };
216 
218  using type = size_t;
219  using option_tags = tmpl::list<OptionTags::FilterLMax>;
220 
221  static constexpr bool pass_metavariables = false;
222  static size_t create_from_options(const size_t filter_l_max) noexcept {
223  return filter_l_max;
224  }
225 };
226 
228  using type = double;
229  using option_tags = tmpl::list<OptionTags::RadialFilterAlpha>;
230 
231  static constexpr bool pass_metavariables = false;
232  static double create_from_options(const double radial_filter_alpha) noexcept {
233  return radial_filter_alpha;
234  }
235 };
236 
238  using type = size_t;
239  using option_tags = tmpl::list<OptionTags::RadialFilterHalfPower>;
240 
241  static constexpr bool pass_metavariables = false;
242  static size_t create_from_options(
243  const size_t radial_filter_half_power) noexcept {
244  return radial_filter_half_power;
245  }
246 };
247 
249  using type = double;
250  using option_tags =
251  tmpl::list<OptionTags::StartTime, OptionTags::BoundaryDataFilename>;
252 
253  static constexpr bool pass_metavariables = false;
254  static double create_from_options(double start_time,
255  const std::string& filename) noexcept {
256  if (start_time == -std::numeric_limits<double>::infinity()) {
257  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
258  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
259  start_time = time_buffer[0];
260  }
261  return start_time;
262  }
263 };
264 
265 /// \brief Represents the final time of a bounded CCE evolution, determined
266 /// either from option specification or from the file
267 ///
268 /// \details If the option `OptionTags::EndTime` is set to
269 /// `std::numeric_limits<double>::%infinity()`, this will find the end time from
270 /// the provided H5 file. If `OptionTags::EndTime` takes any other value, it
271 /// will be used directly as the end time for the CCE evolution instead.
273  using type = double;
274  using option_tags =
275  tmpl::list<OptionTags::EndTime, OptionTags::BoundaryDataFilename>;
276 
277  static constexpr bool pass_metavariables = false;
278  static double create_from_options(double end_time,
279  const std::string& filename) {
280  if (end_time == std::numeric_limits<double>::infinity()) {
281  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
282  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
283  end_time = time_buffer[time_buffer.size() - 1];
284  }
285  return end_time;
286  }
287 };
288 
289 } // namespace Tags
290 } // namespace Cce
Definition: OptionTags.hpp:77
Base Tag for the number of radial grid points in the three-dimensional representation of radially con...
Definition: SwshTags.hpp:200
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:24
Option group
Definition: OptionTags.hpp:18
Definition: OptionTags.hpp:123
Definition: OptionTags.hpp:87
Definition: OptionTags.hpp:173
Defines classes and functions for making classes creatable from input files.
Tags for the DataBox inherit from this type.
Definition: Tag.hpp:23
Definition: OptionTags.hpp:185
Definition: OptionTags.hpp:115
Definition: OptionTags.hpp:48
Base Tag for the maximum spin-weighted spherical harmonic l; sets angular resolution.
Definition: SwshTags.hpp:188
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:30
Definition: OptionTags.hpp:61
An initialization tag that constructs a WorldtubeDataManager from options.
Definition: OptionTags.hpp:135
T infinity(T... args)
Definition: Strahlkorper.hpp:167
Definition: OptionTags.hpp:237
Definition: DataBoxTag.hpp:27
Definition: OptionTags.hpp:68
Definition: OptionTags.hpp:248
Represents the final time of a bounded CCE evolution, determined either from option specification or ...
Definition: OptionTags.hpp:272
Definition: OptionTags.hpp:55
Definition: OptionTags.hpp:100
tuples::TaggedTuple< Tags... > create_from_options(const tuples::TaggedTuple< OptionTags... > &options, tmpl::list< Tags... >) noexcept
Given a list of tags and a tagged tuple containing items created from input options, return a tagged tuple of items constructed by calls to create_from_options for each tag in the list.
Definition: CreateFromOptions.hpp:37
Definition: OptionTags.hpp:227
Definition: OptionTags.hpp:41
Definition: OptionTags.hpp:35
Option group
Definition: OptionTags.hpp:23
Definition: OptionTags.hpp:195
Definition: OptionTags.hpp:28
Definition: OptionTags.hpp:163
Manages the cached buffer data associated with a CCE worldtube and interpolates to requested time poi...
Definition: ReadBoundaryDataH5.hpp:378
Definition: OptionTags.hpp:217
Definition: OptionTags.hpp:108
Definition: OptionTags.hpp:93
Definition: OptionTags.hpp:207
A WorldtubeBufferUpdater specialized to the CCE input worldtube H5 file produced by SpEC...
Definition: ReadBoundaryDataH5.hpp:173