move updateWellTestStatePhysical to WellTest

This commit is contained in:
Arne Morten Kvarving 2022-10-24 11:06:35 +02:00
parent e2b5fc8082
commit 8b503f9a00
5 changed files with 29 additions and 29 deletions

View File

@ -24,7 +24,6 @@
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/simulators/utils/DeferredLogger.hpp>
@ -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
}

View File

@ -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();

View File

@ -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<double> bhpMax(const std::function<double(const double)>& fflo,
const double bhp_limit,

View File

@ -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

View File

@ -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<int>::max();