From fec96cdfa617e0464faa9d5f3a1d7e3d52719ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Thu, 28 Sep 2023 16:17:29 +0000 Subject: [PATCH] [timeloop] add comment on setDt check --- dumux/common/timeloop.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh index 7b4098e7b9..2038555384 100644 --- a/dumux/common/timeloop.hh +++ b/dumux/common/timeloop.hh @@ -245,6 +245,12 @@ public: { using std::min; timeStepSize_ = min(dt, maxTimeStepSize()); + // Warn if dt is so small w.r.t. current time that it renders float addition meaningless + // For instance, consider (may depend on architecture): + // double cien = 100; + // double mil = 1000; + // if (cien + 1e-14 == cien) std::cout << "Will not be printed" << std::endl; + // if (mil + 1e-14 == mil) std::cout << "Will be printed" << std::endl; if (!finished() && (time_ + timeStepSize_ == time_)) std::cerr << Fmt::format("You have set a very small timestep size (dt = {:.5g}).", timeStepSize_) << " This might lead to numerical problems!\n"; -- GitLab