diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 5b53145cb..62b595b15 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2234,9 +2234,13 @@ namespace Opm } else { this->operability_status_.operable_under_only_bhp_limit = !is_stopped; } - // We reset the well status to it's original state. Status is updated + // We reset the well status to its original state. Status is updated // on the outside based on operability status - // TODO: this looks strange, let us check + // \Note for future reference: For the well to update its status to stop/shut, + // the flag changed_to_stopped_this_step_ in prepareWellBeforeAssembling needs to be set to true. + // For this to happen, isOperableAndSolvable() must change from true to false, + // and (until the most recent commit) the well needs to be open for this to trigger. + // Hence, the resetting of status. this->wellStatus_ = well_status; } } else { diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 1d7072f54..3f8bf122b 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -626,10 +626,22 @@ namespace Opm const bool well_operable = this->operability_status_.isOperableAndSolvable(); if (!well_operable && old_well_operable) { - if (!this->wellIsStopped()) { + if (this->param_.local_well_solver_control_switching_) { deferred_logger.info(" well " + this->name() + " gets STOPPED during iteration "); this->stopWell(); changed_to_stopped_this_step_ = true; + } else { + // \Note: keep the old manner for now for testing checking. + // Will be investgiated and fixed in a later PR + if (this->well_ecl_.getAutomaticShutIn()) { + deferred_logger.info(" well " + this->name() + " gets SHUT during iteration "); + } else { + if (!this->wellIsStopped()) { + deferred_logger.info(" well " + this->name() + " gets STOPPED during iteration "); + this->stopWell(); + changed_to_stopped_this_step_ = true; + } + } } } else if (well_operable && !old_well_operable) { deferred_logger.info(" well " + this->name() + " gets REVIVED during iteration ");