Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <optional>
8 : #include <string>
9 :
10 : #include "DataStructures/DataVector.hpp"
11 : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
12 : #include "Options/Auto.hpp"
13 : #include "Options/Context.hpp"
14 : #include "Options/String.hpp"
15 : #include "Utilities/TMPL.hpp"
16 :
17 : namespace domain::creators::time_dependent_options {
18 : /*!
19 : * \brief Class that holds map options from the grid centers location.
20 : *
21 : * This is needed in BNS simulations where the stars are not at the centers of
22 : * the cubes.
23 : *
24 : * \details This class can also be used as an option tag with the \p type type
25 : * alias, `name()` function, and \p help string.
26 : */
27 1 : struct GridCentersOptions {
28 0 : using type = Options::Auto<GridCentersOptions, Options::AutoLabel::None>;
29 0 : static std::string name() { return "GridCenters"; }
30 :
31 0 : struct SpecEvolutionParametersPerlFile {
32 0 : using type = std::string;
33 0 : static constexpr Options::String help = {
34 : "Path to the EvolutionParameters.perl file that SpEC outputs to parse "
35 : "for the initial positions and velocities."};
36 : };
37 :
38 0 : struct ScaleInspiralRateBy {
39 0 : using type = Options::Auto<double>;
40 0 : static constexpr Options::String help = {
41 : "The inspiral rate from the initial data is not exact because of gauge "
42 : "changes and in general that initial data is not perfect. The control "
43 : "system can have an easier time if the inspiral rate is scaled in some "
44 : "cases. You typically shouldn't need to scale by more than a factor of "
45 : "2 larger or smaller."};
46 : };
47 :
48 0 : using options =
49 : tmpl::list<SpecEvolutionParametersPerlFile, ScaleInspiralRateBy>;
50 0 : static constexpr Options::String help = {
51 : "Sets the initial value of the GridCenters of the objects."};
52 :
53 0 : GridCentersOptions();
54 0 : explicit GridCentersOptions(
55 : const std::string& spec_evolution_parameters_perl_file,
56 : std::optional<double> in_scale_inspiral_rate_by,
57 : const Options::Context& context = {});
58 :
59 0 : std::array<DataVector, 3> initial_values{};
60 0 : std::optional<double> scale_inspiral_rate_by{std::nullopt};
61 : };
62 :
63 : /*!
64 : * \brief Helper function that creates the FunctionOfTime from the center
65 : * options, initial time, and expiration time.
66 : */
67 1 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime> get_grid_centers(
68 : const GridCentersOptions& grid_centers_options, double initial_time,
69 : double expiration_time);
70 : } // namespace domain::creators::time_dependent_options
|