Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "DataStructures/DataVector.hpp" 8 : #include "DataStructures/Tensor/Tensor.hpp" 9 : #include "Evolution/Systems/ScalarTensor/Tags.hpp" 10 : #include "Options/String.hpp" 11 : #include "Utilities/ErrorHandling/Error.hpp" 12 : 13 : /// \cond 14 : namespace ScalarTensor::OptionTags { 15 : struct Group; 16 : } // namespace ScalarTensor::OptionTags 17 : /// \endcond 18 : 19 : namespace ScalarTensor { 20 : namespace OptionTags { 21 : /*! 22 : * \brief Start time for ramp up function. 23 : */ 24 1 : struct RampUpStart { 25 0 : static std::string name() { return "RampUpStart"; } 26 0 : using type = double; 27 0 : static constexpr Options::String help{"Start time for ramp up function"}; 28 0 : using group = ::ScalarTensor::OptionTags::Group; 29 : }; 30 : 31 : /*! 32 : * \brief Start time for ramp up function. 33 : */ 34 1 : struct RampUpDuration { 35 0 : static std::string name() { return "RampUpDuration"; } 36 0 : using type = double; 37 0 : static constexpr Options::String help{"Duration time for ramp up function"}; 38 0 : using group = ::ScalarTensor::OptionTags::Group; 39 0 : static double lower_bound() { return 0.0; } 40 : }; 41 : 42 : } // namespace OptionTags 43 : 44 : namespace Tags { 45 : /*! 46 : * \brief Start and duration time for ramp up function. 47 : */ 48 1 : struct RampUpParameters : db::SimpleTag { 49 0 : using type = std::pair<double, double>; 50 0 : using option_tags = 51 : tmpl::list<OptionTags::RampUpStart, OptionTags::RampUpDuration>; 52 0 : static constexpr bool pass_metavariables = false; 53 0 : static std::pair<double, double> create_from_options( 54 : const double start_time, const double duration_time) { 55 : if (duration_time <= 0.0) { 56 : ERROR("Ramp up duration time must be greater than zero, but is " 57 : << duration_time); 58 : } 59 : return std::pair<double, double>{start_time, duration_time}; 60 : } 61 : }; 62 : 63 : } // namespace Tags 64 : } // namespace ScalarTensor