From bc5efb1180f659d3797fcb22ab54c5c1f568daab Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Thu, 27 Feb 2020 13:54:11 +0100 Subject: [PATCH] [dt] Avoided the infinite time loop when a rejected step gives no change in the step size --- ProcessLib/TimeLoop.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index 1fca367abd4..e14acebcb78 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -399,6 +399,25 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, dt = _end_time - t; } + // Check whether the time stepping is stabilized + if (std::fabs(dt - prev_dt) < std::numeric_limits<double>::epsilon()) + { + if (_last_step_rejected) + { + OGS_FATAL( + "The new step size of %g is the same as that of the previous " + "rejected time step. \nPlease re-run ogs with a proper " + "adjustment in the numerical settings, \ne.g those for " + "time stepper, local or global non-linear solver.", + dt); + } + else + { + DBUG("The time stepping is stabilized with the step size of %g.", + dt); + } + } + return dt; } -- GitLab