diff --git a/opm/autodiff/BlackoilWellModel.hpp b/opm/autodiff/BlackoilWellModel.hpp index 5ab53cc49..ffc3c4ce7 100644 --- a/opm/autodiff/BlackoilWellModel.hpp +++ b/opm/autodiff/BlackoilWellModel.hpp @@ -239,8 +239,8 @@ namespace Opm { /// Return true if any well has a THP constraint. bool hasTHPConstraints() const; - /// Shut down any single well. - void forceShutWellByName(const std::string& wellname, const double simulation_time); + /// Shut down any single well, but only if it is in prediction mode. + void forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time); protected: diff --git a/opm/autodiff/BlackoilWellModel_impl.hpp b/opm/autodiff/BlackoilWellModel_impl.hpp index fd85ed6d8..0d9ffea67 100644 --- a/opm/autodiff/BlackoilWellModel_impl.hpp +++ b/opm/autodiff/BlackoilWellModel_impl.hpp @@ -137,14 +137,16 @@ namespace Opm { template void BlackoilWellModel:: - forceShutWellByName(const std::string& wellname, - const double simulation_time) + forceShutWellByNameIfPredictionMode(const std::string& wellname, + const double simulation_time) { // Only add the well to the closed list on the // process that owns it. for (const auto& well : well_container_) { if (well->name() == wellname) { - wellTestState_.addClosedWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time); + if (well->underPredictionMode()) { + wellTestState_.addClosedWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time); + } break; } } diff --git a/opm/autodiff/WellInterface.hpp b/opm/autodiff/WellInterface.hpp index 60e2ad332..2808c69be 100644 --- a/opm/autodiff/WellInterface.hpp +++ b/opm/autodiff/WellInterface.hpp @@ -231,6 +231,9 @@ namespace Opm /// Returns true if the well has one or more THP limits/constraints. bool wellHasTHPConstraints() const; + /// Returns true if the well is currently in prediction mode (i.e. not history mode). + bool underPredictionMode() const; + protected: // to indicate a invalid completion @@ -325,8 +328,6 @@ namespace Opm bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits, const WellState& well_state) const; - bool underPredictionMode() const; - double getTHPConstraint() const; int getTHPControlIndex() const; diff --git a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp index 1048e75a4..3a79d48b3 100644 --- a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp +++ b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp @@ -378,7 +378,7 @@ namespace Opm { } else { // Close all consistently failing wells. for (const auto& well : failing_wells) { - solver.model().wellModel().forceShutWellByName(well, substepTimer.simulationTimeElapsed()); + solver.model().wellModel().forceShutWellByNameIfPredictionMode(well, substepTimer.simulationTimeElapsed()); } substepTimer.provideTimeStepEstimate(dt); if (solverVerbose_) {