Checking if time points reached manully set check points doesn't work when time is accurate
Bug report When time points are extremely close to check points (even when the difference is less than machine precision), it can never be considered that it really reaches the check point.
What happened / Problem description:
In dumux/common/timeloop.hh
currently we use the implementation of Dune::FloatCmp::eq(t0, t1, this->baseEps_*this->timeStepSize())
, where t0
is the distance between current time points and check point and t1
is always 0. In Dune, FloatCmp::eq
has different compare type and the default one is relativeWeak
which means |t0-t1|/|t0| <= epsilon || |t0-t1|/|t1| <= epsilon
. With current implementation, the time point can only get to check points if they are exactly equal, (t0 = t1 = 0
), This is apparently not what is expected here.\
-
change the comparison policy to absolute !4002 (merged) -
check the issue with increasing the time-step size to reach the next close checkpoint !3965
What you expected to happen: When current time is extremely close to the check points, it should be considered as check point.
How to reproduce it (as minimally and precisely as possible):
Suggested solutions
We can either use Dune::FloatCmp::eq<Scalar, Dune::FloatCmp::CmpStyle::absolute>(t0, t1, this->baseEps_*this->timeStepSize())
or we use Dune::FloatCmp::eq(t, checkPoints_.front())
.
Anything else we need to know?:
Environment:
- Dune version:
- DuMux version:
- Others: