mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
58a1b7df1f
commit
7f3a9f1f43
@ -1562,7 +1562,7 @@ typedef Eigen::Array<double,
|
|||||||
const double massBalanceResid = detail::infinityNorm( (*massBalanceIt),
|
const double massBalanceResid = detail::infinityNorm( (*massBalanceIt),
|
||||||
linsolver_.parallelInformation() );
|
linsolver_.parallelInformation() );
|
||||||
if (!std::isfinite(massBalanceResid)) {
|
if (!std::isfinite(massBalanceResid)) {
|
||||||
OPM_THROW(Opm::NumericalProblem,
|
OPM_THROW(Opm::NumericalIssue,
|
||||||
"Encountered a non-finite residual");
|
"Encountered a non-finite residual");
|
||||||
}
|
}
|
||||||
residualNorms.push_back(massBalanceResid);
|
residualNorms.push_back(massBalanceResid);
|
||||||
@ -1572,7 +1572,7 @@ typedef Eigen::Array<double,
|
|||||||
const double wellFluxResid = detail::infinityNormWell( residual_.well_flux_eq,
|
const double wellFluxResid = detail::infinityNormWell( residual_.well_flux_eq,
|
||||||
linsolver_.parallelInformation() );
|
linsolver_.parallelInformation() );
|
||||||
if (!std::isfinite(wellFluxResid)) {
|
if (!std::isfinite(wellFluxResid)) {
|
||||||
OPM_THROW(Opm::NumericalProblem,
|
OPM_THROW(Opm::NumericalIssue,
|
||||||
"Encountered a non-finite residual");
|
"Encountered a non-finite residual");
|
||||||
}
|
}
|
||||||
residualNorms.push_back(wellFluxResid);
|
residualNorms.push_back(wellFluxResid);
|
||||||
@ -1580,7 +1580,7 @@ typedef Eigen::Array<double,
|
|||||||
const double wellResid = detail::infinityNormWell( residual_.well_eq,
|
const double wellResid = detail::infinityNormWell( residual_.well_eq,
|
||||||
linsolver_.parallelInformation() );
|
linsolver_.parallelInformation() );
|
||||||
if (!std::isfinite(wellResid)) {
|
if (!std::isfinite(wellResid)) {
|
||||||
OPM_THROW(Opm::NumericalProblem,
|
OPM_THROW(Opm::NumericalIssue,
|
||||||
"Encountered a non-finite residual");
|
"Encountered a non-finite residual");
|
||||||
}
|
}
|
||||||
residualNorms.push_back(wellResid);
|
residualNorms.push_back(wellResid);
|
||||||
@ -1833,7 +1833,7 @@ typedef Eigen::Array<double,
|
|||||||
if (terminal_output_) {
|
if (terminal_output_) {
|
||||||
OpmLog::bug(msg);
|
OpmLog::bug(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
if (mass_balance_residual[idx] > maxResidualAllowed()
|
if (mass_balance_residual[idx] > maxResidualAllowed()
|
||||||
|| CNV[idx] > maxResidualAllowed()
|
|| CNV[idx] > maxResidualAllowed()
|
||||||
@ -1842,7 +1842,7 @@ typedef Eigen::Array<double,
|
|||||||
if (terminal_output_) {
|
if (terminal_output_) {
|
||||||
OpmLog::problem(msg);
|
OpmLog::problem(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
|
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
|
||||||
@ -1850,7 +1850,7 @@ typedef Eigen::Array<double,
|
|||||||
if (terminal_output_) {
|
if (terminal_output_) {
|
||||||
OpmLog::problem(msg);
|
OpmLog::problem(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return converged;
|
return converged;
|
||||||
@ -1912,14 +1912,14 @@ typedef Eigen::Array<double,
|
|||||||
if (terminal_output_) {
|
if (terminal_output_) {
|
||||||
OpmLog::bug(msg);
|
OpmLog::bug(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
if (well_flux_residual[idx] > maxResidualAllowed()) {
|
if (well_flux_residual[idx] > maxResidualAllowed()) {
|
||||||
const auto msg = std::string("Too large residual for phase ") + materialName(idx);
|
const auto msg = std::string("Too large residual for phase ") + materialName(idx);
|
||||||
if (terminal_output_) {
|
if (terminal_output_) {
|
||||||
OpmLog::problem(msg);
|
OpmLog::problem(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
catch ( const Dune::FMatrixError& e )
|
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();
|
return wellModel().lastReport();
|
||||||
@ -967,15 +967,15 @@ namespace Opm {
|
|||||||
|
|
||||||
if (std::isnan(mass_balance_residual[compIdx])
|
if (std::isnan(mass_balance_residual[compIdx])
|
||||||
|| std::isnan(CNV[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()
|
if (mass_balance_residual[compIdx] > maxResidualAllowed()
|
||||||
|| CNV[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
|
if (mass_balance_residual[compIdx] < 0
|
||||||
|| CNV[compIdx] < 0) {
|
|| CNV[compIdx] < 0) {
|
||||||
OPM_THROW(Opm::NumericalProblem, "Negative residual for " << compName << " equation");
|
OPM_THROW(Opm::NumericalIssue, "Negative residual for " << compName << " equation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <opm/core/utility/extractPvtTableIndex.hpp>
|
#include <opm/core/utility/extractPvtTableIndex.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||||
|
#include <opm/material/common/Exceptions.hpp>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
@ -970,7 +971,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
try {
|
try {
|
||||||
Pb[i] = FluidSystem::oilPvt().saturationPressure(pvtRegionIdx, T[i], rs[i]);
|
Pb[i] = FluidSystem::oilPvt().saturationPressure(pvtRegionIdx, T[i], rs[i]);
|
||||||
}
|
}
|
||||||
catch (const NumericalProblem&) {
|
catch (const NumericalIssue&) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -994,7 +995,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
try {
|
try {
|
||||||
Pd[i] = FluidSystem::gasPvt().saturationPressure(pvtRegionIdx, T[i], rv[i]);
|
Pd[i] = FluidSystem::gasPvt().saturationPressure(pvtRegionIdx, T[i], rv[i]);
|
||||||
}
|
}
|
||||||
catch (const NumericalProblem&) {
|
catch (const NumericalIssue&) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,12 +529,12 @@ namespace Opm {
|
|||||||
if (std::isnan(mass_balance_residual[idx])
|
if (std::isnan(mass_balance_residual[idx])
|
||||||
|| std::isnan(CNV[idx])
|
|| std::isnan(CNV[idx])
|
||||||
|| (idx < np && std::isnan(well_flux_residual[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()
|
if (mass_balance_residual[idx] > maxResidualAllowed()
|
||||||
|| CNV[idx] > maxResidualAllowed()
|
|| CNV[idx] > maxResidualAllowed()
|
||||||
|| (idx < np && well_flux_residual[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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ namespace Opm {
|
|||||||
for (const auto& well : report.nan_residual_wells) {
|
for (const auto& well : report.nan_residual_wells) {
|
||||||
OpmLog::debug("NaN residual found with phase " + well.phase_name + " for well " + well.well_name);
|
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) {
|
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);
|
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!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace mswellhelpers
|
|||||||
for (size_t i_block = 0; i_block < y.size(); ++i_block) {
|
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) {
|
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]) ) {
|
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);
|
linsolver.apply(y, x, res);
|
||||||
|
|
||||||
if ( !res.converged ) {
|
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;
|
return y;
|
||||||
|
@ -1032,7 +1032,7 @@ namespace Opm
|
|||||||
const EvalWell d = 1.0 - rv * rs;
|
const EvalWell d = 1.0 - rv * rs;
|
||||||
|
|
||||||
if (d.value() == 0.0) {
|
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);
|
<< " with rs " << rs << " and rv " << rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ namespace Opm
|
|||||||
const EvalWell d = 1.0 - rv * rs;
|
const EvalWell d = 1.0 - rv * rs;
|
||||||
|
|
||||||
if (d.value() == 0.0) {
|
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);
|
<< " with rs " << rs << " and rv " << rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ namespace Opm
|
|||||||
++number_iterations;
|
++number_iterations;
|
||||||
|
|
||||||
if (number_iterations > max_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;
|
break;
|
||||||
}
|
}
|
||||||
} while (constraint_violated);
|
} while (constraint_violated);
|
||||||
|
@ -255,7 +255,7 @@ namespace Opm {
|
|||||||
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
|
||||||
}
|
}
|
||||||
catch (const Opm::NumericalProblem& e) {
|
catch (const Opm::NumericalIssue& e) {
|
||||||
substepReport += solver.failureReport();
|
substepReport += solver.failureReport();
|
||||||
cause_of_failure = "Solver convergence failure - Numerical problem encountered";
|
cause_of_failure = "Solver convergence failure - Numerical problem encountered";
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ namespace Opm {
|
|||||||
if (solver_verbose_) {
|
if (solver_verbose_) {
|
||||||
OpmLog::error(msg);
|
OpmLog::error(msg);
|
||||||
}
|
}
|
||||||
OPM_THROW_NOLOG(Opm::NumericalProblem, msg);
|
OPM_THROW_NOLOG(Opm::NumericalIssue, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const double newTimeStep = restart_factor_ * dt;
|
const double newTimeStep = restart_factor_ * dt;
|
||||||
|
Loading…
Reference in New Issue
Block a user