OGS
CreateEvolutionaryPIDcontroller.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include "BaseLib/Algorithm.h"
9#include "TimeStepAlgorithm.h"
10
11namespace NumLib
12{
14
16 BaseLib::ConfigTree const& config)
17{
19 config.checkConfigParameter("type", "EvolutionaryPIDcontroller");
20
22 auto const t0 = config.getConfigParameter<double>("t_initial");
24 auto const t_end = config.getConfigParameter<double>("t_end");
25
27 auto const h0 = config.getConfigParameter<double>("dt_guess");
28
30 auto const h_min = config.getConfigParameter<double>("dt_min");
32 auto const h_max = config.getConfigParameter<double>("dt_max");
34 auto const rel_h_min = config.getConfigParameter<double>("rel_dt_min");
36 auto const rel_h_max = config.getConfigParameter<double>("rel_dt_max");
37
39 auto const tol = config.getConfigParameter<double>("tol");
40
41 return {t0, t_end, h0, h_min, h_max, rel_h_min, rel_h_max, tol};
42}
43
44std::unique_ptr<TimeStepAlgorithm> createEvolutionaryPIDcontroller(
46 std::vector<double> const& fixed_times_for_output)
47{
48 if (config.t_end < config.t0)
49 {
51 "Evolutionary PID controller timestepping: end time ({}) is "
52 "smaller than initial time ({})",
53 config.t_end,
54 config.t0);
55 }
56
57 return std::make_unique<EvolutionaryPIDcontroller>(config.t0,
58 config.t_end,
59 config.h0,
60 config.h_min,
61 config.h_max,
62 config.rel_h_min,
63 config.rel_h_max,
64 config.tol,
65 fixed_times_for_output);
66}
67} // end of namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:19
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
Interface of time stepping algorithms.
std::unique_ptr< TimeStepAlgorithm > createEvolutionaryPIDcontroller(EvolutionaryPIDcontrollerParameters const &config, std::vector< double > const &fixed_times_for_output)
EvolutionaryPIDcontrollerParameters parseEvolutionaryPIDcontroller(BaseLib::ConfigTree const &config)