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"
10#include "TimeStepAlgorithm.h"
11
12namespace NumLib
13{
15
17 BaseLib::ConfigTree const& config)
18{
20 config.checkConfigParameter("type", "EvolutionaryPIDcontroller");
21
23 auto const t0 = config.getConfigParameter<double>("t_initial");
25 auto const t_end = config.getConfigParameter<double>("t_end");
26
28 auto const h0 = config.getConfigParameter<double>("dt_guess");
29
31 auto const h_min = config.getConfigParameter<double>("dt_min");
33 auto const h_max = config.getConfigParameter<double>("dt_max");
35 auto const rel_h_min = config.getConfigParameter<double>("rel_dt_min");
37 auto const rel_h_max = config.getConfigParameter<double>("rel_dt_max");
38
40 auto const tol = config.getConfigParameter<double>("tol");
41
42 return {t0, t_end, h0, h_min, h_max, rel_h_min, rel_h_max, tol};
43}
44
45std::unique_ptr<TimeStepAlgorithm> createEvolutionaryPIDcontroller(
47 std::vector<double> const& fixed_times_for_output)
48{
49 if (Time(config.t_end) <= Time(config.t0))
50 {
52 "Evolutionary PID controller timestepping: end time ({}) must be "
53 "larger than initial time ({})",
54 config.t_end,
55 config.t0);
56 }
57
58 return std::make_unique<EvolutionaryPIDcontroller>(config.t0,
59 config.t_end,
60 config.h0,
61 config.h_min,
62 config.h_max,
63 config.rel_h_min,
64 config.rel_h_max,
65 config.tol,
66 fixed_times_for_output);
67}
68} // end of namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:10
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)