OGS
IterationNumberBasedTimeStepping.h
Go to the documentation of this file.
1
13#pragma once
14
15#include <vector>
16
17#include "TimeStepAlgorithm.h"
18
19namespace NumLib
20{
67{
68public:
87 double const t_initial,
88 double const t_end,
89 double const min_dt,
90 double const max_dt,
91 double const initial_dt,
92 std::vector<int>&& iter_times_vector,
93 std::vector<double>&& multiplier_vector,
94 std::vector<double> const& fixed_times_for_output);
95
97
98 std::tuple<bool, double> next(double solution_error, int number_iterations,
99 NumLib::TimeStep& ts_previous,
100 NumLib::TimeStep& ts_current) override;
101
102 bool isSolutionErrorComputationNeeded() const override { return true; }
103
105 NumLib::TimeStep const& timestep_previous,
106 NumLib::TimeStep const& timestep_current) const override;
107
108private:
110 double getNextTimeStepSize(NumLib::TimeStep const& ts_previous,
111 NumLib::TimeStep const& ts_current) const;
112
114 double findMultiplier(int const number_iterations,
115 NumLib::TimeStep const& ts_current) const;
116
119 const std::vector<int> _iter_times_vector;
121 const std::vector<double> _multiplier_vector;
123 const double _min_dt;
125 const double _max_dt;
127 const double _initial_dt;
129 const int _max_iter;
131 int _iter_times = 0;
132
134 std::vector<double> const _fixed_times_for_output;
135};
136
137} // namespace NumLib
Iteration number based adaptive time stepping.
~IterationNumberBasedTimeStepping() override=default
std::tuple< bool, double > next(double solution_error, int number_iterations, NumLib::TimeStep &ts_previous, NumLib::TimeStep &ts_current) override
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)
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.
int _iter_times
The number of nonlinear iterations.
const double _min_dt
The minimum allowed time step size.
const int _max_iter
The maximum allowed iteration number to accept current time step.
Interface of time stepping algorithms.
Time step object.
Definition TimeStep.h:28