Skip to content
Snippets Groups Projects
Commit 5d4b1372 authored by Martin Schneider's avatar Martin Schneider
Browse files

Merge branch 'fix/timeloop-dont-exceed-end-time' into 'master'

[timeloop] ensure that end time is never exceeded

See merge request !1167
parents 6d387dab 4fcd481d
No related branches found
No related tags found
1 merge request!1167[timeloop] ensure that end time is never exceeded
......@@ -134,15 +134,16 @@ public:
time_ = startTime;
endTime_ = tEnd;
timeStepSize_ = dt;
lastTimeStepSize_ = 0.0;
maxTimeStepSize_ = std::numeric_limits<Scalar>::max();
userSetMaxTimeStepSize_ = maxTimeStepSize_;
userSetMaxTimeStepSize_ = std::numeric_limits<Scalar>::max();
timeStepIdx_ = 0;
finished_ = false;
timeAfterLastTimeStep_ = 0.0;
timeStepWallClockTime_ = 0.0;
// ensure that dt is not greater than tEnd-startTime
setTimeStepSize(dt);
timer_.stop();
timer_.reset();
}
......@@ -160,6 +161,9 @@ public:
const auto cpuTime = wallClockTime();
timeStepWallClockTime_ = cpuTime - timeAfterLastTimeStep_;
timeAfterLastTimeStep_ = cpuTime;
// ensure that using current dt we don't exceed tEnd in next time step
setTimeStepSize(timeStepSize_);
}
/*!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment