Ensure only first-rank logging.

Also classify convergence troubles or out-of-bounds residuals as
"problem" not "error".
This commit is contained in:
Atgeirr Flø Rasmussen
2016-10-17 13:41:39 +02:00
parent 5559fbd233
commit 8ed3418245
2 changed files with 33 additions and 7 deletions

View File

@@ -1939,16 +1939,28 @@ namespace detail {
if (std::isnan(mass_balance_residual[idx])
|| std::isnan(CNV[idx])
|| (idx < np && std::isnan(well_flux_residual[idx]))) {
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << materialName(idx));
const auto msg = std::string("NaN residual for phase ") + materialName(idx);
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
}
if (mass_balance_residual[idx] > maxResidualAllowed()
|| CNV[idx] > maxResidualAllowed()
|| (idx < np && well_flux_residual[idx] > maxResidualAllowed())) {
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << materialName(idx));
const auto msg = std::string("Too large residual for phase ") + materialName(idx);
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
}
}
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
OPM_THROW(Opm::NumericalProblem, "NaN or too large residual for well control equation");
const auto msg = std::string("NaN or too large residual for well control equation");
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
}
return converged;
@@ -2004,10 +2016,18 @@ namespace detail {
// if one of the residuals is NaN, throw exception, so that the solver can be restarted
for (int idx = 0; idx < np; ++idx) {
if (std::isnan(well_flux_residual[idx])) {
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << materialName(idx));
const auto msg = std::string("NaN residual for phase ") + materialName(idx);
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
}
if (well_flux_residual[idx] > maxResidualAllowed()) {
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << materialName(idx));
const auto msg = std::string("Too large residual for phase ") + materialName(idx);
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
}
}