26 double const t_initial,
double const t_end,
double const min_dt,
27 double const max_dt,
double const initial_dt,
28 std::vector<int>&& iter_times_vector,
29 std::vector<double>&& multiplier_vector,
30 std::vector<double>
const& fixed_times_for_output)
32 _iter_times_vector(std::move(iter_times_vector)),
33 _multiplier_vector(std::move(multiplier_vector)),
36 _initial_dt(initial_dt),
37 _max_iter(_iter_times_vector.empty() ? 0 : _iter_times_vector.back()),
38 _fixed_times_for_output(fixed_times_for_output)
42 OGS_FATAL(
"Vector of iteration numbers must not be empty.");
47 "Vector of iteration numbers must be of the same size as the "
48 "vector of multipliers.");
53 OGS_FATAL(
"Vector of iteration numbers must be sorted.");
58 double const ,
int const number_iterations,
65 ts_previous = ts_current;
80 if (std::abs(dt - ts_current.
dt()) <
81 std::numeric_limits<double>::epsilon())
112 if (!ts_current.
isAccepted() && (multiplier >= 1.0))
147 auto fixed_output_time_it = std::find_if(
149 [&ts_current](
auto const fixed_output_time)
150 {
return ts_current.
current()() < fixed_output_time; });
156 if (*fixed_output_time_it < ts_current.
current()() + dt)
159 if (std::abs(*fixed_output_time_it - ts_current.
current()()) >
160 std::numeric_limits<double>::epsilon() * ts_current.
current()())
162 return *fixed_output_time_it - ts_current.
current()();
std::tuple< bool, double > next(double solution_error, int number_iterations, NumLib::TimeStep &ts_previous, NumLib::TimeStep &ts_current) override
std::vector< double > const _fixed_times_for_output
double getNextTimeStepSize(NumLib::TimeStep const &ts_previous, NumLib::TimeStep const &ts_current) const
Calculate the next time step size.
const double _max_dt
The maximum allowed time step size.
const std::vector< double > _multiplier_vector
This vector stores the multiplier coefficients.
double findMultiplier(int const number_iterations, NumLib::TimeStep const &ts_current) const
Find a multiplier for the given number of iterations.
IterationNumberBasedTimeStepping(double const t_initial, double const t_end, double const min_dt, double const max_dt, double const initial_dt, std::vector< int > &&iter_times_vector, std::vector< double > &&multiplier_vector, std::vector< double > const &fixed_times_for_output)
const std::vector< int > _iter_times_vector
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.
int _iter_times
The number of nonlinear iterations.
const double _min_dt
The minimum allowed time step size.
bool _previous_time_step_accepted
const double _initial_dt
Initial time step size.
Interface of time stepping algorithms.
Time current() const
return current time step
Time previous() const
return previous time step
double dt() const
time step size from _previous
std::size_t timeStepNumber() const
the time step number
bool canReduceTimestepSize(TimeStep const ×tep_previous, TimeStep const ×tep_current, double const min_dt)