-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iteration number based time stepping #2318
Conversation
EXECUTABLE_ARGS RichardsFlow_2d_small_iteration_adaptive_dt.prj | ||
TESTER vtkdiff | ||
REQUIREMENTS NOT OGS_USE_MPI | ||
# No vtkdiff comparison here, because of the different file names for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I guess you have to remove TESTER vtkdiff
-line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
dt = _min_ts; | ||
else if (dt > _max_ts) | ||
dt = _max_ts; | ||
if (dt < _min_dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dt = std::max(dt, _min_dt);
{ | ||
dt = _min_dt; | ||
} | ||
else if (dt > _max_dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dt = std::min(dt, _max_dt);
_min_dt(min_dt), | ||
_max_dt(max_dt), | ||
_initial_dt(initial_dt), | ||
_max_iter(_iter_times_vector.empty() ? 0 : _iter_times_vector.back()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not so familiar with the time stepping. Could you give a simple and short example what data is stored in Docu is below._iter_times_vector
?
"\n\tSingleStep," | ||
"\n\tFixedTimeStepping," | ||
"\n\tEvolutionaryPIDcontroller,", | ||
"\n\t IterationNumberBasedTimeStepping\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation of IterationNumberBasedTimeStepping is inconsistent with other time stepping schemas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. ⏩
I did some tests with the setup attached to this post on this and found some points, which were not exactly clear to me:
Hope this helps? |
Obligatory clang-format too. Choosing int over size_t for number of iterations -- nobody is going to wait that long anyway.
It is obviously adaptive.
It contains a boolean for met error norms and a number of iterations of the solver made. The number of iterations is needed for a timestepping scheme.
Same as the PID test.
Aside of the I/F changes, the expected result also changed. The first zero in nr_iterations is added, for the simulated first time step.
The iteration number is now set through the next() call.
Remove duplicate docu from the inherited functions.
Check vector sizes.
Otherwise the timestepper will repeat the second iteration of the first time step with the initial_dt and simulation will be aborted. In the current implementation the minimum dt will be taken for the second iteration.
Change the way a multiplier is computed, s.t. for a set of iterations and multipliers as: i = 5 8 10 m = 2 1 0.5 following multiplier is taken m(<5) = 2 m(5-7) = 2 m(8-9) = 1 m(>=10) = 0.5 This is easier to comprehend in the project files.
As @jbathmann mentioned above there are some issues with the repeating of the time steps for certain combinations of Real fix need a major rewrite of the time loop. Please review from the "[doc] Add IterationNumberBasedTS prj tags docu." commit 'til the end, especially the changes in the |
First removal force the convergence checks to be executed. Last two changes handle the t being (almost) equal to the end time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in these three commits.
@@ -431,7 +425,8 @@ double UncoupledProcessesTimeLoop::computeTimeStepping( | |||
} | |||
else | |||
{ | |||
if (t < _end_time) | |||
if (t < _end_time || std::abs(t - _end_time) < | |||
std::numeric_limits<double>::epsilon()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just found a std function: std::islessequal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know that function. But from cppreference it seems that the only difference to operator<=(x, y)
is that the floating point exceptions are not raised (and we do like exceptions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
@@ -451,7 +446,8 @@ double UncoupledProcessesTimeLoop::computeTimeStepping( | |||
} | |||
else | |||
{ | |||
if (t < _end_time) | |||
if (t < _end_time || std::abs(t - _end_time) < | |||
std::numeric_limits<double>::epsilon()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be replaced with std::islessequal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏩
OpenGeoSys development has been moved to GitLab. |
The main algorithm was implemented quite some time already, but there was no driver for it. Here it goes.
I'd suggest commit-wise review.