mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Ensure only first-rank logging.
Also classify convergence troubles or out-of-bounds residuals as "problem" not "error".
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user