diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.cpp b/opm/simulators/wells/WellInterfaceFluidSystem.cpp index 0821db8db..f7faff4a3 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.cpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.cpp @@ -24,7 +24,6 @@ #include -#include #include #include @@ -513,12 +512,13 @@ updateWellTestState(const SingleWellState& ws, WellTestState& wellTestState, DeferredLogger& deferred_logger) const { - // updating well test state based on physical (THP/BHP) limits. - updateWellTestStatePhysical(simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger); - // updating well test state based on Economic limits for operable wells - if (this->isOperableAndSolvable()) + if (this->isOperableAndSolvable()) { WellTest(*this).updateWellTestStateEconomic(ws, simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger); + } else { + // updating well test state based on physical (THP/BHP) limits. + WellTest(*this).updateWellTestStatePhysical(simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger); + } // TODO: well can be shut/closed due to other reasons } diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 26134ed7d..ea15573f8 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -394,26 +394,6 @@ bool WellInterfaceGeneric::isVFPActive(DeferredLogger& deferred_logger) const } } -void WellInterfaceGeneric::updateWellTestStatePhysical(const double simulation_time, - const bool write_message_to_opmlog, - WellTestState& well_test_state, - DeferredLogger& deferred_logger) const -{ - if (!isOperableAndSolvable()) { - if (well_test_state.well_is_closed(name())) { - // Already closed, do nothing. - } else { - well_test_state.close_well(name(), WellTestConfig::Reason::PHYSICAL, simulation_time); - if (write_message_to_opmlog) { - const std::string action = well_ecl_.getAutomaticShutIn() ? "shut" : "stopped"; - const std::string msg = "Well " + name() - + " will be " + action + " as it can not operate under current reservoir conditions."; - deferred_logger.info(msg); - } - } - } -} - bool WellInterfaceGeneric::isOperableAndSolvable() const { return operability_status_.isOperableAndSolvable(); diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index 3972ad7e8..ce9199e01 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -202,10 +202,6 @@ public: protected: bool getAllowCrossFlow() const; double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const; - void updateWellTestStatePhysical(const double simulation_time, - const bool write_message_to_opmlog, - WellTestState& well_test_state, - DeferredLogger& deferred_logger) const; std::optional bhpMax(const std::function& fflo, const double bhp_limit, diff --git a/opm/simulators/wells/WellTest.cpp b/opm/simulators/wells/WellTest.cpp index 64fe4c006..1c0549bef 100644 --- a/opm/simulators/wells/WellTest.cpp +++ b/opm/simulators/wells/WellTest.cpp @@ -437,4 +437,23 @@ void WellTest::updateWellTestStateEconomic(const SingleWellState& ws, } } +void WellTest::updateWellTestStatePhysical(const double simulation_time, + const bool write_message_to_opmlog, + WellTestState& well_test_state, + DeferredLogger& deferred_logger) const +{ + if (well_test_state.well_is_closed(well_.name())) { + // Already closed, do nothing. + } else { + well_test_state.close_well(well_.name(), WellTestConfig::Reason::PHYSICAL, simulation_time); + if (write_message_to_opmlog) { + const std::string action = well_.wellEcl().getAutomaticShutIn() ? "shut" : "stopped"; + const std::string msg = "Well " + well_.name() + + " will be " + action + " as it can not operate under current reservoir conditions."; + deferred_logger.info(msg); + } + } +} + + } // namespace Opm diff --git a/opm/simulators/wells/WellTest.hpp b/opm/simulators/wells/WellTest.hpp index 29f9e8b16..c643207d9 100644 --- a/opm/simulators/wells/WellTest.hpp +++ b/opm/simulators/wells/WellTest.hpp @@ -49,6 +49,11 @@ public: WellTestState& well_test_state, DeferredLogger& deferred_logger) const; + void updateWellTestStatePhysical(const double simulation_time, + const bool write_message_to_opmlog, + WellTestState& well_test_state, + DeferredLogger& deferred_logger) const; + private: struct RatioLimitCheckReport { static constexpr int INVALIDCOMPLETION = std::numeric_limits::max();