OGS
|
This class gives an adaptive algorithm whose time step control is evolutionary PID controller. With an definition of relative solution change \(e_n=\frac{\|u^{n+1}-u^n\|}{\|u^{n+1}\|}\), the algorithm gives a time step size estimation as
\[ h_{n+1} = \left(\frac{e_{n-1}}{e_n}\right)^{k_P} \left(\frac{TOL}{e_n}\right)^{k_I} \left(\frac{e^2_{n-1}}{e_n e_{n-2}}\right)^{k_D} \]
where \(k_P=0.075\), \(k_I=0.175\), \(k_D=0.01\) are empirical PID parameters.
In the computation, \( e_n\) is calculated firstly. If \(e_n>TOL\), the current time step is rejected and repeated with a new time step size of \(h=\frac{TOL}{e_n} h_n\).
Limits of the time step size are given as
\[ h_{\mbox{min}} \leq h_{n+1} \leq h_{\mbox{max}}, l \leq \frac{h_{n+1}}{h_n} \leq L \]
Similar algorithm can be found in [1] .
Definition at line 46 of file EvolutionaryPIDcontroller.h.
#include <EvolutionaryPIDcontroller.h>
Public Member Functions | |
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::tuple< bool, double > | next (double solution_error, int number_iterations, NumLib::TimeStep ×tep_previous, NumLib::TimeStep ×tep_current) override |
bool | isSolutionErrorComputationNeeded () const override |
virtual bool | canReduceTimestepSize (NumLib::TimeStep const ×tep_previous, NumLib::TimeStep const ×tep_current) const override |
Query the timestepper if further time step size reduction is possible. | |
Public Member Functions inherited from NumLib::TimeStepAlgorithm | |
TimeStepAlgorithm (const double t0, const double t_end) | |
virtual | ~TimeStepAlgorithm ()=default |
Time | begin () const |
return the beginning of time steps | |
Time | end () const |
return the end of time steps | |
virtual void | resetCurrentTimeStep (const double, TimeStep &, TimeStep &) |
reset the current step size from the previous time | |
Private Member Functions | |
double | limitStepSize (const double h_new, const bool previous_step_accepted, NumLib::TimeStep const ×tep_current) const |
Private Attributes | |
const double | _kP = 0.075 |
Parameter. | |
const double | _kI = 0.175 |
Parameter. | |
const double | _kD = 0.01 |
Parameter. | |
const double | _h0 |
initial time step size. | |
const double | _h_min |
minimum step size. | |
const double | _h_max |
maximum step size. | |
const double | _rel_h_min |
\(l\) in \( h_{\mbox{min}} \leq h_{n+1} \leq h_{\mbox{max}},\) | |
const double | _rel_h_max |
\(L\) in \( h_{\mbox{min}} \leq h_{n+1} \leq h_{\mbox{max}},\) | |
const double | _tol |
double | _e_n_minus1 |
\(e_{n-1}\). | |
double | _e_n_minus2 |
\(e_{n-2}\). | |
std::vector< double > const | _fixed_times_for_output |
Additional Inherited Members | |
Protected Attributes inherited from NumLib::TimeStepAlgorithm | |
const Time | _t_initial |
initial time | |
const Time | _t_end |
end time | |
|
inline |
Definition at line 49 of file EvolutionaryPIDcontroller.h.
|
overridevirtual |
Query the timestepper if further time step size reduction is possible.
Reimplemented from NumLib::TimeStepAlgorithm.
Definition at line 171 of file EvolutionaryPIDcontroller.cpp.
References _h_min, and NumLib::canReduceTimestepSize().
|
inlineoverridevirtual |
Get a flag to indicate whether this algorithm needs to compute solution error. The default return value is false.
Reimplemented from NumLib::TimeStepAlgorithm.
Definition at line 72 of file EvolutionaryPIDcontroller.h.
|
private |
Force the computed time step size in the given range (see the formulas in the documentation of the class) or use the half of the previous time step size under some other constrains.
h_new | The computed time step size. |
previous_step_accepted | An indicator for whether the previous time step is rejected. |
timestep_current | the current time step |
Definition at line 105 of file EvolutionaryPIDcontroller.cpp.
References _fixed_times_for_output, _h_max, _h_min, _rel_h_max, _rel_h_min, NumLib::TimeStep::current(), and NumLib::TimeStep::dt().
Referenced by next().
|
overridevirtual |
Move to the next time step
solution_error | Solution error \(e_n\) between two successive time steps. |
number_iterations | Number of non-linear iterations used. |
ts_previous | the previous time step used to compute the size of the next step |
ts_current | the current time step used to compute the size of the next step |
Implements NumLib::TimeStepAlgorithm.
Definition at line 23 of file EvolutionaryPIDcontroller.cpp.
References _e_n_minus1, _e_n_minus2, _h0, _kD, _kI, _kP, _tol, NumLib::TimeStep::dt(), NumLib::TimeStep::isAccepted(), limitStepSize(), NumLib::TimeStep::setAccepted(), NumLib::TimeStep::timeStepNumber(), and WARN().
|
private |
|
private |
|
private |
Definition at line 97 of file EvolutionaryPIDcontroller.h.
Referenced by limitStepSize().
|
private |
initial time step size.
Definition at line 83 of file EvolutionaryPIDcontroller.h.
Referenced by next().
|
private |
maximum step size.
Definition at line 85 of file EvolutionaryPIDcontroller.h.
Referenced by limitStepSize().
|
private |
minimum step size.
Definition at line 84 of file EvolutionaryPIDcontroller.h.
Referenced by canReduceTimestepSize(), and limitStepSize().
|
private |
Parameter.
Definition at line 81 of file EvolutionaryPIDcontroller.h.
Referenced by next().
|
private |
Parameter.
Definition at line 80 of file EvolutionaryPIDcontroller.h.
Referenced by next().
|
private |
Parameter.
Definition at line 79 of file EvolutionaryPIDcontroller.h.
Referenced by next().
|
private |
\(L\) in \( h_{\mbox{min}} \leq h_{n+1} \leq h_{\mbox{max}},\)
Definition at line 90 of file EvolutionaryPIDcontroller.h.
Referenced by limitStepSize().
|
private |
\(l\) in \( h_{\mbox{min}} \leq h_{n+1} \leq h_{\mbox{max}},\)
Definition at line 88 of file EvolutionaryPIDcontroller.h.
Referenced by limitStepSize().
|
private |
Definition at line 92 of file EvolutionaryPIDcontroller.h.
Referenced by next().