shut/close well based on physical limits

This commit is contained in:
Kai Bao 2018-11-17 23:30:27 +01:00
parent ea42d1de9d
commit 8e17d4aeba
3 changed files with 54 additions and 8 deletions

View File

@ -434,13 +434,21 @@ namespace Opm {
if( well_ecl->getAutomaticShutIn() ) {
// shut wells are not added to the well container
well_state_.bhp()[w] = 0;
// TODO: should we do this for all kinds of closing reasons?
// something like wellTestState_.hasWell(well_name)?
if ( wellTestState_.hasWell(well_name, WellTestConfig::Reason::ECONOMIC) ||
wellTestState_.hasWell(well_name, WellTestConfig::Reason::PHYSICAL) ) {
if( well_ecl->getAutomaticShutIn() ) {
// shut wells are not added to the well container
well_state_.thp()[w] = 0.;
well_state_.bhp()[w] = 0.;
const int np = numPhases();
for (int p = 0; p < np; ++p) {
well_state_.wellRates()[np * w + p] = 0;
well_state_.wellRates()[np * w + p] = 0.;
}
continue;
}
else {
} else {
// close wells are added to the container but marked as closed
struct WellControls* well_controls = wells()->ctrls[w];
well_controls_stop_well(well_controls);

View File

@ -367,6 +367,11 @@ namespace Opm
const bool write_message_to_opmlog,
WellTestState& well_test_state) const;
void updateWellTestStatePhysical(const WellState& well_state,
const double simulation_time,
const bool write_message_to_opmlog,
WellTestState& well_test_state) const;
void solveWellForTesting(Simulator& ebosSimulator, WellState& well_state, const std::vector<double>& B_avg, bool terminal_output);
void scaleProductivityIndex(const int perfIdx, double& productivity_index) const;

View File

@ -735,6 +735,15 @@ namespace Opm
return;
}
// if we understand correctly, only under prediction mode, we need to do well testing
// TODO: which remains to be corrected
if (!underPredictionMode() ) {
return;
}
// updating well test state based on physical (THP/BHP) limits.
updateWellTestStatePhysical(well_state, simulationTime, writeMessageToOPMLog, wellTestState);
// updating well test state based on Economic limits.
updateWellTestStateEconomic(well_state, simulationTime, writeMessageToOPMLog, wellTestState);
@ -745,6 +754,30 @@ namespace Opm
template<typename TypeTag>
void
WellInterface<TypeTag>::
updateWellTestStatePhysical(const WellState& well_state,
const double simulation_time,
const bool write_message_to_opmlog,
WellTestState& well_test_state) const
{
if (!isOperable()) {
well_test_state.addClosedWell(name(), WellTestConfig::Reason::PHYSICAL, simulation_time);
if (write_message_to_opmlog) {
// TODO: considering auto shut in?
const std::string msg = "well " + name()
+ std::string(" will be shut as it can not operate under current reservoir condition");
OpmLog::info(msg);
}
}
}
template<typename TypeTag>
void
WellInterface<TypeTag>::