catch NumericalIssue instead of NumericalProblem

the underlying problem is that the OPM build system does not define a
HAVE_OPM_COMMON macro in config.h.
This commit is contained in:
Andreas Lauser 2018-02-08 12:02:25 +01:00
parent 58a1b7df1f
commit 7f3a9f1f43
10 changed files with 26 additions and 25 deletions

View File

@ -1562,7 +1562,7 @@ typedef Eigen::Array<double,
const double massBalanceResid = detail::infinityNorm( (*massBalanceIt),
linsolver_.parallelInformation() );
if (!std::isfinite(massBalanceResid)) {
OPM_THROW(Opm::NumericalProblem,
OPM_THROW(Opm::NumericalIssue,
"Encountered a non-finite residual");
}
residualNorms.push_back(massBalanceResid);
@ -1572,7 +1572,7 @@ typedef Eigen::Array<double,
const double wellFluxResid = detail::infinityNormWell( residual_.well_flux_eq,
linsolver_.parallelInformation() );
if (!std::isfinite(wellFluxResid)) {
OPM_THROW(Opm::NumericalProblem,
OPM_THROW(Opm::NumericalIssue,
"Encountered a non-finite residual");
}
residualNorms.push_back(wellFluxResid);
@ -1580,7 +1580,7 @@ typedef Eigen::Array<double,
const double wellResid = detail::infinityNormWell( residual_.well_eq,
linsolver_.parallelInformation() );
if (!std::isfinite(wellResid)) {
OPM_THROW(Opm::NumericalProblem,
OPM_THROW(Opm::NumericalIssue,
"Encountered a non-finite residual");
}
residualNorms.push_back(wellResid);
@ -1833,7 +1833,7 @@ typedef Eigen::Array<double,
if (terminal_output_) {
OpmLog::bug(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
if (mass_balance_residual[idx] > maxResidualAllowed()
|| CNV[idx] > maxResidualAllowed()
@ -1842,7 +1842,7 @@ typedef Eigen::Array<double,
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
}
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
@ -1850,7 +1850,7 @@ typedef Eigen::Array<double,
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
return converged;
@ -1912,14 +1912,14 @@ typedef Eigen::Array<double,
if (terminal_output_) {
OpmLog::bug(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
if (well_flux_residual[idx] > maxResidualAllowed()) {
const auto msg = std::string("Too large residual for phase ") + materialName(idx);
if (terminal_output_) {
OpmLog::problem(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
}

View File

@ -370,7 +370,7 @@ namespace Opm {
}
catch ( const Dune::FMatrixError& e )
{
OPM_THROW(Opm::NumericalProblem,"Error encounted when solving well equations");
OPM_THROW(Opm::NumericalIssue,"Error encounted when solving well equations");
}
return wellModel().lastReport();
@ -967,15 +967,15 @@ namespace Opm {
if (std::isnan(mass_balance_residual[compIdx])
|| std::isnan(CNV[compIdx])) {
OPM_THROW(Opm::NumericalProblem, "NaN residual for " << compName << " equation");
OPM_THROW(Opm::NumericalIssue, "NaN residual for " << compName << " equation");
}
if (mass_balance_residual[compIdx] > maxResidualAllowed()
|| CNV[compIdx] > maxResidualAllowed()) {
OPM_THROW(Opm::NumericalProblem, "Too large residual for " << compName << " equation");
OPM_THROW(Opm::NumericalIssue, "Too large residual for " << compName << " equation");
}
if (mass_balance_residual[compIdx] < 0
|| CNV[compIdx] < 0) {
OPM_THROW(Opm::NumericalProblem, "Negative residual for " << compName << " equation");
OPM_THROW(Opm::NumericalIssue, "Negative residual for " << compName << " equation");
}
}

View File

@ -31,6 +31,7 @@
#include <opm/core/utility/extractPvtTableIndex.hpp>
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
@ -970,7 +971,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
try {
Pb[i] = FluidSystem::oilPvt().saturationPressure(pvtRegionIdx, T[i], rs[i]);
}
catch (const NumericalProblem&) {
catch (const NumericalIssue&) {
// Ignore
}
}
@ -994,7 +995,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
try {
Pd[i] = FluidSystem::gasPvt().saturationPressure(pvtRegionIdx, T[i], rv[i]);
}
catch (const NumericalProblem&) {
catch (const NumericalIssue&) {
// Ignore
}
}

View File

@ -529,12 +529,12 @@ namespace Opm {
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));
OPM_THROW(Opm::NumericalIssue, "NaN residual for phase " << materialName(idx));
}
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));
OPM_THROW(Opm::NumericalIssue, "Too large residual for phase " << materialName(idx));
}
}

View File

@ -540,7 +540,7 @@ namespace Opm {
for (const auto& well : report.nan_residual_wells) {
OpmLog::debug("NaN residual found with phase " + well.phase_name + " for well " + well.well_name);
}
OPM_THROW(Opm::NumericalProblem, "NaN residual found!");
OPM_THROW(Opm::NumericalIssue, "NaN residual found!");
}
}
@ -555,7 +555,7 @@ namespace Opm {
for (const auto& well : report.too_large_residual_wells) {
OpmLog::debug("Too large residual found with phase " + well.phase_name + " fow well " + well.well_name);
}
OPM_THROW(Opm::NumericalProblem, "Too large residual found!");
OPM_THROW(Opm::NumericalIssue, "Too large residual found!");
}
}

View File

@ -55,7 +55,7 @@ namespace mswellhelpers
for (size_t i_block = 0; i_block < y.size(); ++i_block) {
for (size_t i_elem = 0; i_elem < y[i_block].size(); ++i_elem) {
if (std::isinf(y[i_block][i_elem]) || std::isnan(y[i_block][i_elem]) ) {
OPM_THROW(Opm::NumericalProblem, "nan or inf value found in invDXDirect due to singular matrix");
OPM_THROW(Opm::NumericalIssue, "nan or inf value found in invDXDirect due to singular matrix");
}
}
}
@ -107,7 +107,7 @@ namespace mswellhelpers
linsolver.apply(y, x, res);
if ( !res.converged ) {
OPM_THROW(Opm::NumericalProblem, "the invDX does not get converged! ");
OPM_THROW(Opm::NumericalIssue, "the invDX does not get converged! ");
}
return y;

View File

@ -1032,7 +1032,7 @@ namespace Opm
const EvalWell d = 1.0 - rv * rs;
if (d.value() == 0.0) {
OPM_THROW(Opm::NumericalProblem, "Zero d value obtained for well " << name() << " during flux calcuation"
OPM_THROW(Opm::NumericalIssue, "Zero d value obtained for well " << name() << " during flux calcuation"
<< " with rs " << rs << " and rv " << rv);
}

View File

@ -477,7 +477,7 @@ namespace Opm
const EvalWell d = 1.0 - rv * rs;
if (d.value() == 0.0) {
OPM_THROW(Opm::NumericalProblem, "Zero d value obtained for well " << name() << " during flux calcuation"
OPM_THROW(Opm::NumericalIssue, "Zero d value obtained for well " << name() << " during flux calcuation"
<< " with rs " << rs << " and rv " << rv);
}

View File

@ -774,7 +774,7 @@ namespace Opm
++number_iterations;
if (number_iterations > max_iterations) {
OPM_THROW(Opm::NumericalProblem, "Could not find proper control within " << number_iterations << " iterations!");
OPM_THROW(Opm::NumericalIssue, "Could not find proper control within " << number_iterations << " iterations!");
break;
}
} while (constraint_violated);

View File

@ -255,7 +255,7 @@ namespace Opm {
detail::logException(e, solver_verbose_);
// since linearIterations is < 0 this will restart the solver
}
catch (const Opm::NumericalProblem& e) {
catch (const Opm::NumericalIssue& e) {
substepReport += solver.failureReport();
cause_of_failure = "Solver convergence failure - Numerical problem encountered";
@ -361,7 +361,7 @@ namespace Opm {
if (solver_verbose_) {
OpmLog::error(msg);
}
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
}
const double newTimeStep = restart_factor_ * dt;