OGS
CreateEvolutionaryPIDcontroller.cpp
Go to the documentation of this file.
1
13
14#include "BaseLib/Algorithm.h"
15#include "BaseLib/ConfigTree.h"
17#include "TimeStepAlgorithm.h"
18
19namespace NumLib
20{
21class TimeStepAlgorithm;
22
24 BaseLib::ConfigTree const& config)
25{
27 config.checkConfigParameter("type", "EvolutionaryPIDcontroller");
28
30 auto const t0 = config.getConfigParameter<double>("t_initial");
32 auto const t_end = config.getConfigParameter<double>("t_end");
33
35 auto const h0 = config.getConfigParameter<double>("dt_guess");
36
38 auto const h_min = config.getConfigParameter<double>("dt_min");
40 auto const h_max = config.getConfigParameter<double>("dt_max");
42 auto const rel_h_min = config.getConfigParameter<double>("rel_dt_min");
44 auto const rel_h_max = config.getConfigParameter<double>("rel_dt_max");
45
47 auto const tol = config.getConfigParameter<double>("tol");
48
49 return {t0, t_end, h0, h_min, h_max, rel_h_min, rel_h_max, tol};
50}
51
52std::unique_ptr<TimeStepAlgorithm> createEvolutionaryPIDcontroller(
54 std::vector<double> const& fixed_times_for_output)
55{
56 if (config.t_end < config.t0)
57 {
59 "Evolutionary PID controller timestepping: end time ({}) is "
60 "smaller than initial time ({})",
61 config.t_end,
62 config.t0);
63 }
64
65 return std::make_unique<EvolutionaryPIDcontroller>(config.t0,
66 config.t_end,
67 config.h0,
68 config.h_min,
69 config.h_max,
70 config.rel_h_min,
71 config.rel_h_max,
72 config.tol,
73 fixed_times_for_output);
74}
75} // end of namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:26
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(EvolutionaryPIDcontrollerParameters const &config, std::vector< double > const &fixed_times_for_output)
EvolutionaryPIDcontrollerParameters parseEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)