diff --git a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp index 9de0a127f..bba49159f 100644 --- a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp +++ b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp @@ -171,7 +171,10 @@ public: if (enableAdaptive) { const UnitSystem& unitSystem = this->ebosSimulator_.vanguard().eclState().getUnits(); if (enableTUNING) { - adaptiveTimeStepping_ = std::make_unique(schedule()[timer.currentStepNum()].tuning(), + const auto& sched_state = schedule()[timer.currentStepNum()]; + auto max_next_tstep = sched_state.max_next_tstep(); + adaptiveTimeStepping_ = std::make_unique(max_next_tstep, + sched_state.tuning(), unitSystem, terminalOutput_); } else { @@ -244,7 +247,10 @@ public: const auto& events = schedule()[timer.currentStepNum()].events(); if (enableTUNING) { if (events.hasEvent(ScheduleEvents::TUNING_CHANGE)) { - adaptiveTimeStepping_->updateTUNING(schedule()[timer.currentStepNum()].tuning()); + const auto& sched_state = schedule()[timer.currentStepNum()]; + const auto& tuning = sched_state.tuning(); + const auto& max_next_tstep = sched_state.max_next_tstep(); + adaptiveTimeStepping_->updateTUNING(max_next_tstep, tuning); } } bool event = events.hasEvent(ScheduleEvents::NEW_WELL) || diff --git a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp index 3b0b2a557..fb090afc5 100644 --- a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp +++ b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include namespace Opm::Properties { @@ -289,7 +290,8 @@ namespace Opm { //! \brief contructor taking parameter object //! \param tuning Pointer to ecl TUNING keyword //! \param timeStep current report step - AdaptiveTimeSteppingEbos(const Tuning& tuning, + AdaptiveTimeSteppingEbos(double max_next_tstep, + const Tuning& tuning, const UnitSystem& unitSystem, const bool terminalOutput = true) : timeStepControl_() @@ -302,7 +304,7 @@ namespace Opm { , solverRestartMax_(EWOMS_GET_PARAM(TypeTag, int, SolverMaxRestarts)) // 10 , solverVerbose_(EWOMS_GET_PARAM(TypeTag, int, SolverVerbosity) > 0 && terminalOutput) // 2 , timestepVerbose_(EWOMS_GET_PARAM(TypeTag, int, TimeStepVerbosity) > 0 && terminalOutput) // 2 - , suggestedNextTimestep_(tuning.TSINIT) // 1.0 + , suggestedNextTimestep_(max_next_tstep) // 1.0 , fullTimestepInitially_(EWOMS_GET_PARAM(TypeTag, bool, FullTimeStepInitially)) // false , timestepAfterEvent_(tuning.TMAXWC) // 1e30 , useNewtonIteration_(false) @@ -637,13 +639,13 @@ namespace Opm { void setSuggestedNextStep(const double x) { suggestedNextTimestep_ = x; } - void updateTUNING(const Tuning& tuning) + void updateTUNING(double max_next_tstep, const Tuning& tuning) { restartFactor_ = tuning.TSFCNV; growthFactor_ = tuning.TFDIFF; maxGrowth_ = tuning.TSFMAX; maxTimeStep_ = tuning.TSMAXZ; - suggestedNextTimestep_ = tuning.TSINIT; + suggestedNextTimestep_ = max_next_tstep; timestepAfterEvent_ = tuning.TMAXWC; }