diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 44bf82183f..a08f3abcf7 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -262,9 +262,20 @@ namespace Opm return; } - BVectorWell xw(1); - this->linSys_.recoverSolutionWell(x, xw); - updateWellState(simulator, xw, well_state, deferred_logger); + try { + BVectorWell xw(1); + this->linSys_.recoverSolutionWell(x, xw); + + updateWellState(simulator, xw, well_state, deferred_logger); + } + catch (const NumericalProblem& exp) { + // Add information about the well and log to deferred logger + // (Logging done inside of recoverSolutionWell() (i.e. by UMFpack) will only be seen if + // this is the process with rank zero) + deferred_logger.problem("In MultisegmentWell::recoverWellSolutionAndUpdateWellState for well " + + this->name() +": "+exp.what()); + throw; + } } diff --git a/opm/simulators/wells/VFPHelpers.cpp b/opm/simulators/wells/VFPHelpers.cpp index 3210ff9af9..1f88460988 100644 --- a/opm/simulators/wells/VFPHelpers.cpp +++ b/opm/simulators/wells/VFPHelpers.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -368,6 +369,9 @@ findTHP(const std::vector& bhp_array, { int nthp = thp_array.size(); + if (std::isnan(bhp)) { + throw NumericalProblem("findTHP: Error bhp is nan"); + } Scalar thp = -1e100; //Check that our thp axis is sorted