Merge pull request #1117 from totto82/storeIfTimeStepFails

Store whether timestep failed or not
This commit is contained in:
Atgeirr Flø Rasmussen 2016-12-19 12:21:31 +01:00 committed by GitHub
commit 4ea6611ecc
5 changed files with 18 additions and 1 deletions

View File

@ -42,6 +42,7 @@ namespace Opm
, dt_( 0.0 )
, current_step_( 0 )
, steps_()
, lastStepFailed_( false )
{
// reserve memory for sub steps
steps_.reserve( 10 );

View File

@ -93,6 +93,12 @@ namespace Opm
/// \brief start date time of simulation
boost::posix_time::ptime startDateTime() const;
/// \brief Return true if last time step failed
bool lastStepFailed() const {return lastStepFailed_;}
/// \brief tell the timestepper whether timestep failed or not
void setLastStepFailed(bool lastStepFailed) {lastStepFailed_ = lastStepFailed;}
/// return copy of object
virtual std::unique_ptr< SimulatorTimerInterface > clone() const;
@ -108,6 +114,8 @@ namespace Opm
int current_step_;
std::vector< double > steps_;
bool lastStepFailed_;
};
} // namespace Opm

View File

@ -295,12 +295,13 @@ namespace Opm {
last_well_state = well_state;
report.converged = substepTimer.done();
substepTimer.setLastStepFailed(false);
}
else // in case of no convergence (linearIterations < 0)
{
report.converged = false;
substepTimer.setLastStepFailed(true);
// increase restart counter
if( restarts >= solver_restart_max_ ) {
const auto msg = std::string("Solver failed to converge after ")

View File

@ -110,6 +110,10 @@ namespace Opm
/// Return true if op++() has been called numSteps() times.
bool done() const;
/// Always return false. Timestep failures is handled in the
/// substepTimer
bool lastStepFailed() const {return false;}
/// return copy of object
virtual std::unique_ptr< SimulatorTimerInterface > clone() const;

View File

@ -101,6 +101,9 @@ namespace Opm
return std::mktime(&t);
}
/// Return true if last time step failed
virtual bool lastStepFailed() const = 0;
/// return copy of current timer instance
virtual std::unique_ptr< SimulatorTimerInterface > clone () const = 0;
};