diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 95c432e5b..dab1ce8e4 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1405,48 +1405,43 @@ namespace Opm { BlackoilWellModel:: prepareTimeStep(DeferredLogger& deferred_logger) { - OPM_BEGIN_PARALLEL_TRY_CATCH(); - { - for (const auto& well : well_container_) { - const bool old_well_operable = well->isOperable(); - well->checkWellOperability(ebosSimulator_, this->wellState(), deferred_logger); + for (const auto& well : well_container_) { + const bool old_well_operable = well->isOperable(); + well->checkWellOperability(ebosSimulator_, this->wellState(), deferred_logger); - if (!well->isOperable() ) continue; + if (!well->isOperable() ) continue; - auto& events = this->wellState().well(well->indexOfWell()).events; - if (events.hasEvent(WellState::event_mask)) { - well->updateWellStateWithTarget(ebosSimulator_, this->groupState(), this->wellState(), deferred_logger); - // There is no new well control change input within a report step, - // so next time step, the well does not consider to have effective events anymore. - events.clearEvent(WellState::event_mask); - } + auto& events = this->wellState().well(well->indexOfWell()).events; + if (events.hasEvent(WellState::event_mask)) { + well->updateWellStateWithTarget(ebosSimulator_, this->groupState(), this->wellState(), deferred_logger); + // There is no new well control change input within a report step, + // so next time step, the well does not consider to have effective events anymore. + events.clearEvent(WellState::event_mask); + } - // solve the well equation initially to improve the initial solution of the well model - if (param_.solve_welleq_initially_) { - well->solveWellEquation(ebosSimulator_, this->wellState(), this->groupState(), deferred_logger); - } + // solve the well equation initially to improve the initial solution of the well model + if (param_.solve_welleq_initially_) { + well->solveWellEquation(ebosSimulator_, this->wellState(), this->groupState(), deferred_logger); + } - const bool well_operable = well->isOperable(); - if (!well_operable && old_well_operable) { - const Well& well_ecl = getWellEcl(well->name()); - if (well_ecl.getAutomaticShutIn()) { - deferred_logger.info(" well " + well->name() + " gets SHUT at the beginning of the time step "); - } else { - if (!well->wellIsStopped()) { - deferred_logger.info(" well " + well->name() + " gets STOPPED at the beginning of the time step "); - well->stopWell(); - } + const bool well_operable = well->isOperable(); + if (!well_operable && old_well_operable) { + const Well& well_ecl = getWellEcl(well->name()); + if (well_ecl.getAutomaticShutIn()) { + deferred_logger.info(" well " + well->name() + " gets SHUT at the beginning of the time step "); + } else { + if (!well->wellIsStopped()) { + deferred_logger.info(" well " + well->name() + " gets STOPPED at the beginning of the time step "); + well->stopWell(); } - } else if (well_operable && !old_well_operable) { - deferred_logger.info(" well " + well->name() + " gets REVIVED at the beginning of the time step "); - well->openWell(); } + } else if (well_operable && !old_well_operable) { + deferred_logger.info(" well " + well->name() + " gets REVIVED at the beginning of the time step "); + well->openWell(); + } - } // end of for (const auto& well : well_container_) - updatePrimaryVariables(deferred_logger); - } - OPM_END_PARALLEL_TRY_CATCH_LOG(deferred_logger, "prepareTimestep() failed: ", - terminal_output_); + } // end of for (const auto& well : well_container_) + updatePrimaryVariables(deferred_logger); }