Commit bdad3f02 authored by Lukas Riedel's avatar Lukas Riedel

Recover initial time step after simulation end

This ensures that after every data assimilation step, the simulation
reverts to the original time step. Users may now use the setting for
`startTimestep` to optimize the time steps to the data assimilation
steps.
parent 2886e967
......@@ -32,6 +32,7 @@ private:
R tBegin; //!< simulation time limits
R tEnd; //!< simulation time limits
const int itmax, itmin; //!< newton iteration limits
const R dt_begin; //!< beginning time step
const TSC& tsc; //!< Class with Function getNextTimeStamp()
......@@ -61,6 +62,7 @@ public:
, itmax(config.get<int>("time.maxIterations"))
, itmin(config.get<int>("time.minIterations"))
, tsc(tsc_)
, dt_begin(dt)
{
if (not input_valid()) {
DUNE_THROW(IOError, "Invalid input for time controller");
......@@ -134,11 +136,13 @@ public:
// Simulation has ended. Do nothing
if (time > tEnd) {
dt = dt_begin; // in case this was a data assimilation step
return true;
}
// NOTE: Simulation needs to know that we are actually at the end
else if (time <= tEnd && time >= tEnd-eps) {
time = tEnd;
dt = dt_begin; // in case this was a data assimilation step
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment