From e2d38f6ddc629bb57d8ac3d3e382d691e90c0aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Tue, 25 Jul 2023 14:23:10 +0000 Subject: [PATCH] [TimeLoop] define base tolerance --- dumux/common/timeloop.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh index a34e90ef9a..190ff9e1bb 100644 --- a/dumux/common/timeloop.hh +++ b/dumux/common/timeloop.hh @@ -99,6 +99,8 @@ public: template <class Scalar> class TimeLoop : public TimeLoopBase<Scalar> { + static constexpr Scalar baseEps_ = 1e-10; + public: TimeLoop(Scalar startTime, Scalar dt, Scalar tEnd, bool verbose = true) : timer_(false) @@ -245,7 +247,7 @@ public: { using std::min; timeStepSize_ = min(dt, maxTimeStepSize()); - if (!finished() && Dune::FloatCmp::le(timeStepSize_, 0.0, 1e-14*(endTime_ - startTime_))) + if (!finished() && Dune::FloatCmp::le(timeStepSize_, 0.0, baseEps_*(endTime_ - startTime_))) std::cerr << Fmt::format("You have set a very small timestep size (dt = {:.5g}).", timeStepSize_) << " This might lead to numerical problems!\n"; } @@ -301,7 +303,7 @@ public: */ bool finished() const override { - return finished_ || (endTime_ - time_) < 1e-10*(time_ - startTime_); + return finished_ || (endTime_ - time_) < baseEps_*(time_ - startTime_); } /*! @@ -310,7 +312,7 @@ public: */ bool willBeFinished() const { - return finished() || (endTime_ - time_ - timeStepSize_) < 1e-10*timeStepSize_; + return finished() || (endTime_ - time_ - timeStepSize_) < baseEps_*timeStepSize_; } /*! -- GitLab