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 "Evolution/Systems/Cce/ReadBoundaryDataH5.hpp"
10 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
11 #include "Options/Options.hpp"
12 
13 namespace Cce {
14 /// \cond
15 class Interpolator;
16 /// \endcond
17 
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 
71 struct EndTime {
72  using type = double;
73  static constexpr OptionString help{"End time for the Cce Evolution."};
74  static double default_value() noexcept {
76  }
77  using group = Cce;
78 };
79 
80 struct StartTime {
81  using type = double;
82  static constexpr OptionString help{
83  "Cce Start time (default to earliest possible time)."};
84  static double default_value() noexcept {
86  }
87  using group = Cce;
88 };
89 
91  using type = double;
92  static constexpr OptionString help{"Target time step size for Cce Evolution"};
93  using group = Cce;
94 };
95 
97  using type = std::string;
98  static constexpr OptionString help{
99  "H5 file to read the wordltube data from."};
100  using group = Cce;
101 };
102 
104  using type = size_t;
105  static constexpr OptionString help{
106  "Number of times steps from the h5 to cache each read."};
107  static size_t default_value() noexcept { return 200; }
108  using group = Cce;
109 };
110 
113  static constexpr OptionString help{
114  "The interpolator for imported h5 worldtube data."};
115  using group = Cce;
116 };
117 
119  static std::string name() noexcept { return "ScriInterpOrder"; }
120  using type = size_t;
121  static constexpr OptionString help{"Order of time interpolation at scri+."};
122  static size_t default_value() noexcept { return 5; }
123  using group = Cce;
124 };
125 } // namespace OptionTags
126 
127 namespace InitializationTags {
128 /// An initialization tag that constructs a `WorldtubeDataManager` from options
130  using type = WorldtubeDataManager;
131  using option_tags =
134 
136  const size_t l_max, const std::string& filename,
137  const size_t number_of_lookahead_times,
138  const std::unique_ptr<intrp::SpanInterpolator>& interpolator) noexcept {
139  return WorldtubeDataManager{
140  std::make_unique<SpecWorldtubeH5BufferUpdater>(filename), l_max,
141  number_of_lookahead_times, interpolator->get_clone()};
142  }
143 };
144 
145 struct LMax : db::SimpleTag {
146  using type = size_t;
147  using option_tags = tmpl::list<OptionTags::LMax>;
148 
149  static size_t create_from_options(const size_t l_max) noexcept {
150  return l_max;
151  }
152 };
153 
155  using type = size_t;
156  using option_tags = tmpl::list<OptionTags::NumberOfRadialPoints>;
157 
158  static size_t create_from_options(
159  const size_t number_of_radial_points) noexcept {
160  return number_of_radial_points;
161  }
162 };
163 
165  using type = double;
166  using option_tags =
167  tmpl::list<OptionTags::StartTime, OptionTags::BoundaryDataFilename>;
168 
169  static double create_from_options(double start_time,
170  const std::string& filename) noexcept {
171  if (start_time == -std::numeric_limits<double>::infinity()) {
172  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
173  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
174  start_time = time_buffer[0];
175  }
176  return start_time;
177  }
178 };
179 
181  using type = double;
182  using option_tags = tmpl::list<OptionTags::TargetStepSize>;
183 
184  static double create_from_options(const double target_step_size) noexcept {
185  return target_step_size;
186  }
187 };
188 
190  using type = double;
191  using option_tags =
192  tmpl::list<OptionTags::EndTime, OptionTags::BoundaryDataFilename>;
193 
194  static double create_from_options(double end_time,
195  const std::string& filename) {
196  if (end_time == std::numeric_limits<double>::infinity()) {
197  SpecWorldtubeH5BufferUpdater h5_boundary_updater{filename};
198  const auto& time_buffer = h5_boundary_updater.get_time_buffer();
199  end_time = time_buffer[time_buffer.size() - 1];
200  }
201  return end_time;
202  }
203 };
204 } // namespace InitializationTags
205 
206 namespace Tags {
208  using type = size_t;
209  using option_tags = tmpl::list<OptionTags::FilterLMax>;
210 
211  static size_t create_from_options(const size_t filter_l_max) noexcept {
212  return filter_l_max;
213  }
214 };
215 
217  using type = double;
218  using option_tags = tmpl::list<OptionTags::RadialFilterAlpha>;
219 
220  static double create_from_options(const double radial_filter_alpha) noexcept {
221  return radial_filter_alpha;
222  }
223 };
224 
226  using type = size_t;
227  using option_tags = tmpl::list<OptionTags::RadialFilterHalfPower>;
228 
229  static size_t create_from_options(
230  const size_t radial_filter_half_power) noexcept {
231  return radial_filter_half_power;
232  }
233 };
234 } // namespace Tags
235 } // namespace Cce
Definition: OptionTags.hpp:154
Definition: OptionTags.hpp:80
Contains functionality for Cauchy Characteristic Extraction.
Definition: BoundaryComputeAndSendToEvolution.hpp:24
Option group
Definition: OptionTags.hpp:21
Definition: OptionTags.hpp:90
Defines classes and functions for making classes creatable from input files.
Tags for the DataBox inherit from this type.
Definition: DataBoxTag.hpp:64
Definition: OptionTags.hpp:145
Definition: OptionTags.hpp:118
Definition: OptionTags.hpp:51
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:29
Definition: OptionTags.hpp:189
Definition: OptionTags.hpp:64
An initialization tag that constructs a WorldtubeDataManager from options.
Definition: OptionTags.hpp:129
T infinity(T... args)
Definition: Strahlkorper.hpp:167
Definition: OptionTags.hpp:225
Definition: DataBoxTag.hpp:29
Definition: OptionTags.hpp:71
Definition: OptionTags.hpp:58
Definition: OptionTags.hpp:103
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: ParallelComponentHelpers.hpp:184
Definition: OptionTags.hpp:216
Definition: OptionTags.hpp:44
Definition: OptionTags.hpp:38
Option group
Definition: OptionTags.hpp:26
Definition: OptionTags.hpp:31
Definition: OptionTags.hpp:180
Manages the cached buffer data associated with a CCE worldtube and interpolates to requested time poi...
Definition: ReadBoundaryDataH5.hpp:372
Definition: OptionTags.hpp:207
Definition: OptionTags.hpp:111
Definition: OptionTags.hpp:96
A WorldtubeBufferUpdater specialized to the CCE input worldtube H5 file produced by SpEC...
Definition: ReadBoundaryDataH5.hpp:167
Definition: OptionTags.hpp:164