![]() |
OGS
|
Iteration number based adaptive time stepping.
This algorithm estimates a time step size depending on the number of iterations (e.g. of iterative linear solvers, nonlinear methods, partitioned coupling) needed in the last time step (see Hoffmann (2010) for Newton-Raphson case). The new time step \(\Delta t_{n+1}\) size is calculated as
\[ \Delta t_{n+1} = \alpha \Delta t_n \]
with the previous time step size \(\Delta t_{n}\) and a multiplier coefficient \(\alpha\) depending on the iteration number. Note that a time step size is always bounded by the minimum and maximum allowed value.
\[ \Delta t_{\min} \le \Delta t \le \Delta t_{\max} \]
For example, users can setup the following time stepping strategy based on the iteration number of the Newton-Raphson method in the last time step.
| Num. of Newton steps | 0-2 | 3-6 | 7-8 | 9< |
|---|---|---|---|---|
| Time step size multiplier | 1.6 | 1. | 0.5 | 0.25 (repeat time step) |
| Upper and lower bound | \( 1. \le \Delta t \le 10.\) | |||
A time step size is increased for the small iteration number, and decreased for the large iteration number. If the iteration number exceeds a user-defined threshold (e.g. 9), a time step is repeated with a smaller time step size.
Reference
Definition at line 67 of file IterationNumberBasedTimeStepping.h.
#include <IterationNumberBasedTimeStepping.h>
Public Member Functions | |
| IterationNumberBasedTimeStepping (double const t_initial, double const t_end, double const min_dt, double const max_dt, double const initial_dt, MultiplyerInterpolationType const multiplier_interpolation_type, std::vector< int > &&iter_times_vector, std::vector< double > &&multiplier_vector, std::vector< double > const &fixed_times_for_output) | |
| ~IterationNumberBasedTimeStepping () override=default | |
| double | next (double solution_error, int number_iterations, NumLib::TimeStep &ts_previous, NumLib::TimeStep &ts_current) override |
| bool | isSolutionErrorComputationNeeded () const override |
| 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 | |
Private Member Functions | |
| double | getNextTimeStepSize (NumLib::TimeStep const &ts_previous, NumLib::TimeStep const &ts_current) const |
| Calculate the next time step size. | |
Private Attributes | |
| const std::vector< int > | _iter_times_vector |
| const std::vector< double > | _multiplier_vector |
| This vector stores the multiplier coefficients. | |
| const double | _min_dt |
| The minimum allowed time step size. | |
| const double | _max_dt |
| The maximum allowed time step size. | |
| const double | _initial_dt |
| Initial time step size. | |
| const MultiplyerInterpolationType | _multiplier_interpolation_type |
| Interpolation type for the multiplier. | |
| const int | _max_iter |
| The maximum allowed iteration number to accept current time step. | |
| int | _iter_times = 0 |
| The number of nonlinear iterations. | |
| 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 | |
| NumLib::IterationNumberBasedTimeStepping::IterationNumberBasedTimeStepping | ( | double const | t_initial, |
| double const | t_end, | ||
| double const | min_dt, | ||
| double const | max_dt, | ||
| double const | initial_dt, | ||
| MultiplyerInterpolationType const | multiplier_interpolation_type, | ||
| std::vector< int > && | iter_times_vector, | ||
| std::vector< double > && | multiplier_vector, | ||
| std::vector< double > const & | fixed_times_for_output ) |
| t_initial | start time |
| t_end | end time |
| min_dt | the minimum allowed time step size |
| max_dt | the maximum allowed time step size |
| initial_dt | initial time step size |
| iter_times_vector | a vector of iteration numbers ( \(i_1\), \(i_2\), ..., \(i_n\)) which defines intervals as \([i_1,i_2)\), \([i_2,i_3)\), ..., \([i_n,\infty)\). If an iteration number is larger than \(i_n\), current time step is repeated with the new time step size. |
| multiplier_vector | a vector of multiplier coefficients ( \(a_1\), \(a_2\), ..., \(a_n\)) corresponding to the intervals given by iter_times_vector. A time step size is calculated by \(\Delta t_{n+1} = a * \Delta t_{n}\) |
| fixed_times_for_output | a vector of fixed time points for output |
Definition at line 28 of file IterationNumberBasedTimeStepping.cpp.
References _iter_times_vector, _multiplier_vector, and OGS_FATAL.
|
overridedefault |
|
overridevirtual |
Query the timestepper if further time step size reduction is possible.
Reimplemented from NumLib::TimeStepAlgorithm.
Definition at line 192 of file IterationNumberBasedTimeStepping.cpp.
References _min_dt, and NumLib::canReduceTimestepSize().
|
private |
Calculate the next time step size.
Definition at line 138 of file IterationNumberBasedTimeStepping.cpp.
References _fixed_times_for_output, _initial_dt, _iter_times, _iter_times_vector, _max_dt, _min_dt, _multiplier_interpolation_type, _multiplier_vector, NumLib::TimeStep::current(), NumLib::TimeStep::dt(), NumLib::findMultiplier(), NumLib::TimeStep::isAccepted(), and NumLib::TimeStep::timeStepNumber().
Referenced by next().
|
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 104 of file IterationNumberBasedTimeStepping.h.
|
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 62 of file IterationNumberBasedTimeStepping.cpp.
References _iter_times, NumLib::TimeStep::dt(), getNextTimeStepSize(), NumLib::TimeStep::isAccepted(), NumLib::TimeStep::previous(), NumLib::TimeStep::setAccepted(), and NumLib::TimeStep::timeStepNumber().
|
private |
Definition at line 133 of file IterationNumberBasedTimeStepping.h.
Referenced by getNextTimeStepSize().
|
private |
Initial time step size.
Definition at line 125 of file IterationNumberBasedTimeStepping.h.
Referenced by getNextTimeStepSize().
|
private |
The number of nonlinear iterations.
Definition at line 131 of file IterationNumberBasedTimeStepping.h.
Referenced by getNextTimeStepSize(), and next().
|
private |
This vector stores the number of iterations to which the respective multiplier coefficient will be applied.
Definition at line 117 of file IterationNumberBasedTimeStepping.h.
Referenced by IterationNumberBasedTimeStepping(), and getNextTimeStepSize().
|
private |
The maximum allowed time step size.
Definition at line 123 of file IterationNumberBasedTimeStepping.h.
Referenced by getNextTimeStepSize().
|
private |
The maximum allowed iteration number to accept current time step.
Definition at line 129 of file IterationNumberBasedTimeStepping.h.
|
private |
The minimum allowed time step size.
Definition at line 121 of file IterationNumberBasedTimeStepping.h.
Referenced by canReduceTimestepSize(), and getNextTimeStepSize().
|
private |
Interpolation type for the multiplier.
Definition at line 127 of file IterationNumberBasedTimeStepping.h.
Referenced by getNextTimeStepSize().
|
private |
This vector stores the multiplier coefficients.
Definition at line 119 of file IterationNumberBasedTimeStepping.h.
Referenced by IterationNumberBasedTimeStepping(), and getNextTimeStepSize().