Merge pull request #1090 from atgeirr/convergence-failure-problem-not-error

Convergence failure is "problem" not "error"
This commit is contained in:
Atgeirr Flø Rasmussen 2016-10-21 12:49:10 +02:00 committed by GitHub
commit cc72693348
3 changed files with 19 additions and 12 deletions

View File

@ -42,7 +42,8 @@ namespace Opm
} }
RockCompressibility::RockCompressibility(const Opm::Deck& deck, RockCompressibility::RockCompressibility(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState) const Opm::EclipseState& eclipseState,
const bool is_io_rank)
: pref_(0.0), : pref_(0.0),
rock_comp_(0.0) rock_comp_(0.0)
{ {
@ -63,14 +64,14 @@ namespace Opm
} else if (deck.hasKeyword("ROCK")) { } else if (deck.hasKeyword("ROCK")) {
const auto& rockKeyword = deck.getKeyword("ROCK"); const auto& rockKeyword = deck.getKeyword("ROCK");
if (rockKeyword.size() != 1) { if (rockKeyword.size() != 1) {
// here it would be better not to use std::cout directly but to add the if (is_io_rank) {
// warning to some "warning list"... OpmLog::warning("Can only handle a single region in ROCK ("
OpmLog::warning("Can only handle a single region in ROCK (" + std::to_string(rockKeyword.size())
+ std::to_string(rockKeyword.size()) + " regions specified)."
+ " regions specified)." + " Ignoring all except for the first.\n"
+ " Ignoring all except for the first.\n" + "In file " + rockKeyword.getFileName()
+ "In file " + rockKeyword.getFileName() + ", line " + std::to_string(rockKeyword.getLineNumber()) + "\n");
+ ", line " + std::to_string(rockKeyword.getLineNumber()) + "\n"); }
} }
pref_ = rockKeyword.getRecord(0).getItem("PREF").getSIDouble(0); pref_ = rockKeyword.getRecord(0).getItem("PREF").getSIDouble(0);

View File

@ -36,7 +36,8 @@ namespace Opm
/// Construct from input deck. /// Construct from input deck.
/// Looks for the keywords ROCK and ROCKTAB. /// Looks for the keywords ROCK and ROCKTAB.
RockCompressibility(const Opm::Deck& deck, RockCompressibility(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState); const Opm::EclipseState& eclipseState,
const bool is_io_rank = true);
/// Construct from parameters. /// Construct from parameters.
/// Accepts the following parameters (with defaults). /// Accepts the following parameters (with defaults).

View File

@ -291,7 +291,12 @@ namespace Opm {
{ {
// increase restart counter // increase restart counter
if( restarts >= solver_restart_max_ ) { if( restarts >= solver_restart_max_ ) {
OPM_THROW(Opm::NumericalProblem,"Solver failed to converge after " << restarts << " restarts."); const auto msg = std::string("Solver failed to converge after ")
+ std::to_string(restarts) + " restarts.";
if (solver_verbose_) {
OpmLog::error(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
} }
const double newTimeStep = restart_factor_ * dt; const double newTimeStep = restart_factor_ * dt;
@ -301,7 +306,7 @@ namespace Opm {
std::string msg; std::string msg;
msg = "Solver convergence failed, restarting solver with new time step (" msg = "Solver convergence failed, restarting solver with new time step ("
+ std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days).\n"; + std::to_string(unit::convert::to( newTimeStep, unit::day )) + " days).\n";
OpmLog::error(msg); OpmLog::problem(msg);
} }
// reset states // reset states
state = last_state; state = last_state;