From d07aed204fa3d2e4a3a99cf829f1d58749ffa5be Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 5 Oct 2021 11:27:44 +0200 Subject: [PATCH] Catch numerial issues due to problems with inner iterations wells --- opm/simulators/wells/WellInterface_impl.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index adcd1bf20..c210a704e 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -330,8 +330,15 @@ namespace Opm const auto& summary_state = ebosSimulator.vanguard().summaryState(); const auto inj_controls = this->well_ecl_.isInjector() ? this->well_ecl_.injectionControls(summary_state) : Well::InjectionControls(0); const auto prod_controls = this->well_ecl_.isProducer() ? this->well_ecl_.productionControls(summary_state) : Well::ProductionControls(0); - - return this->iterateWellEqWithControl(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger); + bool converged = false; + try { + converged = this->iterateWellEqWithControl(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger); + } catch (NumericalIssue& e ) { + const std::string msg = "Inner well iterations failed for well " + this->name() + " Treat the well as unconverged. "; + deferred_logger.warning("INNER_ITERATION_FAILED", msg); + converged = false; + } + return converged; }