Merge pull request #1168 from nairr/term_output_mod

Logging of multiple problems/warnings
This commit is contained in:
Atgeirr Flø Rasmussen
2017-06-07 15:47:34 +02:00
committed by GitHub
2 changed files with 9 additions and 9 deletions

View File

@@ -162,11 +162,8 @@ namespace Opm
if (!converged) { if (!converged) {
failureReport_ += report; failureReport_ += report;
std::string msg = "Failed to complete a time step within " + std::to_string(maxIter()) + " iterations."; std::string msg = "Solver convergence failure - Failed to complete a time step within " + std::to_string(maxIter()) + " iterations.";
if (model_->terminalOutputEnabled()) { OPM_THROW_NOLOG(Opm::TooManyIterations, msg);
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
} }
// Do model-specific post-step actions. // Do model-specific post-step actions.

View File

@@ -64,9 +64,10 @@ namespace Opm {
{ {
if( verbose ) if( verbose )
{ {
std::ostringstream message; std::string message;
message << "Caught Exception: " << exception.what(); message = "Caught Exception: ";
OpmLog::debug(message.str()); message += exception.what();
OpmLog::debug(message);
} }
} }
} }
@@ -231,6 +232,7 @@ namespace Opm {
} }
SimulatorReport substepReport; SimulatorReport substepReport;
std::string cause_of_failure = "";
try { try {
substepReport = solver.step( substepTimer, state, well_state); substepReport = solver.step( substepTimer, state, well_state);
report += substepReport; report += substepReport;
@@ -242,6 +244,7 @@ namespace Opm {
} }
catch (const Opm::NumericalProblem& e) { catch (const Opm::NumericalProblem& e) {
substepReport += solver.failureReport(); substepReport += solver.failureReport();
cause_of_failure = e.what();
detail::logException(e, solver_verbose_); detail::logException(e, solver_verbose_);
// since linearIterations is < 0 this will restart the solver // since linearIterations is < 0 this will restart the solver
@@ -353,7 +356,7 @@ namespace Opm {
substepTimer.provideTimeStepEstimate( newTimeStep ); substepTimer.provideTimeStepEstimate( newTimeStep );
if( solver_verbose_ ) { if( solver_verbose_ ) {
std::string msg; std::string msg;
msg = "Solver convergence failed, cutting timestep to " msg = cause_of_failure + "\n Timestep chopped to "
+ std::to_string(unit::convert::to( substepTimer.currentStepLength(), unit::day )) + " days.\n"; + std::to_string(unit::convert::to( substepTimer.currentStepLength(), unit::day )) + " days.\n";
OpmLog::problem(msg); OpmLog::problem(msg);
} }