OGS
EvolutionaryPIDcontroller.h
Go to the documentation of this file.
1
12#pragma once
13
14#include <memory>
15#include <vector>
16
17#include "TimeStepAlgorithm.h"
18
19namespace NumLib
20{
47{
48public:
49 EvolutionaryPIDcontroller(const double t0, const double t_end,
50 const double h0, const double h_min,
51 const double h_max, const double rel_h_min,
52 const double rel_h_max, const double tol,
53 std::vector<double> const& fixed_times_for_output)
54 : TimeStepAlgorithm(t0, t_end),
55 _h0(h0),
56 _h_min(h_min),
57 _h_max(h_max),
58 _rel_h_min(rel_h_min),
59 _rel_h_max(rel_h_max),
60 _tol(tol),
61 _e_n_minus1(0.),
62 _e_n_minus2(0.),
63 _fixed_times_for_output(fixed_times_for_output)
64 {
65 }
66
67 std::tuple<bool, double> next(double solution_error,
68 int number_iterations,
69 NumLib::TimeStep& timestep_previous,
70 NumLib::TimeStep& timestep_current) override;
71
72 bool isSolutionErrorComputationNeeded() const override { return true; }
73
74 virtual bool canReduceTimestepSize(
75 NumLib::TimeStep const& timestep_previous,
76 NumLib::TimeStep const& timestep_current) const override;
77
78private:
79 const double _kP = 0.075;
80 const double _kI = 0.175;
81 const double _kD = 0.01;
82
83 const double _h0;
84 const double _h_min;
85 const double _h_max;
86
88 const double _rel_h_min;
90 const double _rel_h_max;
91
92 const double _tol;
93
94 double _e_n_minus1;
95 double _e_n_minus2;
96
97 std::vector<double> const _fixed_times_for_output;
98
111 double limitStepSize(const double h_new,
112 const bool previous_step_accepted,
113 NumLib::TimeStep const& timestep_current) const;
114};
115
116} // end of namespace NumLib
const double _h_max
maximum step size.
EvolutionaryPIDcontroller(const double t0, const double t_end, const double h0, const double h_min, const double h_max, const double rel_h_min, const double rel_h_max, const double tol, std::vector< double > const &fixed_times_for_output)
std::vector< double > const _fixed_times_for_output
std::tuple< bool, double > next(double solution_error, int number_iterations, NumLib::TimeStep &timestep_previous, NumLib::TimeStep &timestep_current) override
const double _h_min
minimum step size.
virtual bool canReduceTimestepSize(NumLib::TimeStep const &timestep_previous, NumLib::TimeStep const &timestep_current) const override
Query the timestepper if further time step size reduction is possible.
bool isSolutionErrorComputationNeeded() const override
double limitStepSize(const double h_new, const bool previous_step_accepted, NumLib::TimeStep const &timestep_current) const
const double _h0
initial time step size.
Interface of time stepping algorithms.
Time step object.
Definition TimeStep.h:31