22 "A text name to associate with the solver. This name will be used "
23 "in status messages and verbose iterative convergence monitors.");
28 "start_time", 0.0,
"Transient start-time if applicable.");
30 "end_time", 1.0,
"Transient end-time if applicable.");
34 "Maximum number of timesteps to allow. Negative values disables this.");
39 "Handle to a timestepper. If not supplied then a ConstantTimeStepper "
49 : timestepper_(InitTimeStepper(GetInputParameters())),
50 text_name_(std::move(in_text_name))
55 std::initializer_list<BasicOption> in_options)
56 : basic_options_(in_options),
57 timestepper_(InitTimeStepper(GetInputParameters())),
58 text_name_(std::move(in_text_name))
64 timestepper_(InitTimeStepper(params)),
65 text_name_(params.GetParamValue<std::string>(
"name"))
69std::shared_ptr<TimeStepper>
74 if (user_params.Has(
"timestepper"))
76 auto stepper = Chi::GetStackItemPtrAsType<TimeStepper>(
83 stepper->SetStartTime(params.
GetParamValue<
double>(
"start_time"));
84 stepper->SetEndTime(params.
GetParamValue<
double>(
"end_time"));
85 stepper->SetMaxTimeSteps(params.
GetParamValue<
int>(
"max_time_steps"));
93 const std::string obj_type =
"chi_physics::ConstantTimeStepper";
94 auto valid_params = factory.GetRegisteredObjectParameters(obj_type);
106 valid_params.AssignParameters(custom_params);
108 auto stepper = std::make_shared<ConstantTimeStepper>(valid_params);
122std::vector<std::shared_ptr<FieldFunctionGridBased>>&
140const std::vector<std::shared_ptr<FieldFunctionGridBased>>&
174 if (not params.
Has(
"name"))
177 "\"name\" in the parameter list";
197 for (
const auto& param : params)
199 const std::string param_name = param.Name();
201 if (param_name ==
"dt")
202 timestepper_->SetTimeStepSize(param.GetValue<
double>());
203 if (param_name ==
"time")
205 if (param_name ==
"start_time")
207 if (param_name ==
"end_time")
209 if (param_name ==
"max_time_steps")
211 if (param_name ==
"dt_min")
212 timestepper_->SetMinimumTimeStepSize(param.GetValue<
int>());
#define ChiLogicalErrorIf(condition, message)
static std::vector< ChiObjectPtr > object_stack
static ChiObjectFactory & GetInstance() noexcept
static chi::InputParameters GetInputParameters()
LogStream Log(LOG_LVL level=LOG_0)
LogStream LogAllWarning()
bool Has(const std::string ¶m_name) const
size_t NumParameters() const
void AddParameter(ParameterBlock block)
T GetParamValue(const std::string ¶m_name) const
ParameterBlock & GetParam(const std::string ¶m_name)
std::vector< std::shared_ptr< FieldFunctionGridBased > > field_functions_
TimeStepper & GetTimeStepper()
std::string TextName() const
virtual void Initialize()
const std::string text_name_
static std::shared_ptr< TimeStepper > InitTimeStepper(const chi::InputParameters ¶ms)
static chi::InputParameters GetInputParameters()
BasicOptions & GetBasicOptions()
Solver(std::string in_text_name)
std::shared_ptr< TimeStepper > timestepper_
virtual void SetProperties(const chi::ParameterBlock ¶ms)
BasicOptions basic_options_
std::vector< std::shared_ptr< FieldFunctionGridBased > > & GetFieldFunctions()
virtual chi::ParameterBlock GetInfo(const chi::ParameterBlock ¶ms) const
chi::ParameterBlock GetInfoWithPreCheck(const chi::ParameterBlock ¶ms) const