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 <cstddef> 8 : #include <optional> 9 : #include <string> 10 : #include <variant> 11 : 12 : #include "DataStructures/DataVector.hpp" 13 : #include "Domain/Creators/TimeDependentOptions/FromVolumeFile.hpp" 14 : #include "Options/Auto.hpp" 15 : #include "Options/Context.hpp" 16 : #include "Options/String.hpp" 17 : #include "Utilities/TMPL.hpp" 18 : 19 0 : namespace domain::creators::time_dependent_options { 20 : /*! 21 : * \brief Class to be used as an option for initializing expansion map 22 : * coefficients. 23 : */ 24 1 : struct ExpansionMapOptions { 25 0 : using type = Options::Auto<ExpansionMapOptions, Options::AutoLabel::None>; 26 0 : static std::string name() { return "ExpansionMap"; } 27 0 : static constexpr Options::String help = { 28 : "Options for a time-dependent expansion of the coordinates. Specify " 29 : "'None' to not use this map."}; 30 : 31 0 : struct InitialValues { 32 0 : using type = 33 : std::variant<std::array<double, 3>, FromVolumeFile<names::Expansion>>; 34 0 : static constexpr Options::String help = { 35 : "Initial values for the expansion map, its velocity and " 36 : "acceleration."}; 37 : }; 38 : 39 0 : struct InitialValuesOuterBoundary { 40 0 : using type = 41 : std::variant<std::array<double, 3>, FromVolumeFile<names::Expansion>>; 42 0 : static constexpr Options::String help = { 43 : "Initial values for the expansion map, its velocity and " 44 : "acceleration at the outer boundary. Unless you are starting from a " 45 : "checkpoint or continuing an evolution, this option should likely be " 46 : "[1.0, 0.0, 0.0] at the start of an evolution"}; 47 : }; 48 : 49 0 : struct DecayTimescaleOuterBoundary { 50 0 : using type = Options::Auto<double>; 51 0 : static constexpr Options::String help = { 52 : "A timescale for how fast the outer boundary expansion approaches its " 53 : "asymptotic value. Can optionally specify 'Auto' when reading the " 54 : "initial values 'FromVolumeFile' to use the decay timescale from the " 55 : "function of time in the volume file. Cannot specify 'Auto' when " 56 : "initial values are specified directly."}; 57 : }; 58 : 59 0 : struct DecayTimescale { 60 0 : using type = Options::Auto<double>; 61 0 : static constexpr Options::String help = { 62 : "If specified, a SettleToConstant function of time will be used for " 63 : "the expansion map and this number will determine the timescale that " 64 : "the expansion approaches its asymptotic value. If 'Auto' is " 65 : "specified, a PiecewisePolynomial function of time will be used for " 66 : "the expansion map. Note that if you are reading the initial values " 67 : "from a volume file, you must specify 'Auto' for this option."}; 68 : }; 69 : 70 0 : struct AsymptoticVelocityOuterBoundary { 71 0 : using type = Options::Auto<double>; 72 0 : static constexpr Options::String help = { 73 : "There are two choices for this option. If a value is specified, a " 74 : "FixedSpeedCubic function of time will be used for the expansion map " 75 : "at the outer boundary and this number will determine its velocity. If " 76 : "'Auto' is specified, the behavior will depend on what is chosen for " 77 : "'InitialValuesOuterBoundary'. If values are specified for " 78 : "'InitialValuesOuterBoundary', then 'Auto' here means a " 79 : "SettleToConstant function of time will be used for the expansion map " 80 : "at the outer boundary. If 'FromVolumeFile' is specified for " 81 : "'InitialValuesOuterBoundary', then a FixedSpeedCubic function of time " 82 : "will be used and the velocity from the function of " 83 : "time in the volume file will be used."}; 84 : }; 85 : 86 0 : using options = tmpl::list<InitialValues, InitialValuesOuterBoundary, 87 : DecayTimescaleOuterBoundary, DecayTimescale, 88 : AsymptoticVelocityOuterBoundary>; 89 : 90 0 : ExpansionMapOptions() = default; 91 0 : ExpansionMapOptions( 92 : const std::variant<std::array<double, 3>, 93 : FromVolumeFile<names::Expansion>>& expansion_values, 94 : const std::variant<std::array<double, 3>, 95 : FromVolumeFile<names::Expansion>>& 96 : expansion_outer_boundary_values, 97 : std::optional<double> decay_timescale_outer_boundary_in, 98 : std::optional<double> decay_timescale_in, 99 : std::optional<double> asymptotic_velocity_outer_boundary_in, 100 : const Options::Context& context = {}); 101 : 102 0 : std::array<DataVector, 3> initial_values{}; 103 0 : std::array<DataVector, 3> initial_values_outer_boundary{}; 104 0 : double decay_timescale_outer_boundary{}; 105 0 : std::optional<double> decay_timescale{}; 106 0 : std::optional<double> asymptotic_velocity_outer_boundary{}; 107 : }; 108 : } // namespace domain::creators::time_dependent_options