Merge pull request #2225 from atgeirr/fix-zero-wconprod

Shut wells under zero WCONPROD when disallowing crossflow
This commit is contained in:
Atgeirr Flø Rasmussen 2019-12-13 14:41:52 +01:00 committed by GitHub
commit f769b97198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 1 deletions

View File

@ -636,6 +636,8 @@ namespace Opm {
{
std::vector<WellInterfacePtr> well_container;
Opm::DeferredLogger local_deferredLogger;
const int nw = numLocalWells();
if (nw > 0) {
@ -684,6 +686,40 @@ namespace Opm {
continue;
}
// If a production well disallows crossflow and its
// (prediction type) rate control is zero, then it is effectively shut.
if (!well_ecl.getAllowCrossFlow() && well_ecl.isProducer() && well_ecl.predictionMode()) {
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
auto prod_controls = well_ecl.productionControls(summaryState);
bool zero_rate_control = false;
switch (prod_controls.cmode) {
case Well::ProducerCMode::ORAT:
zero_rate_control = (prod_controls.oil_rate == 0.0);
break;
case Well::ProducerCMode::WRAT:
zero_rate_control = (prod_controls.water_rate == 0.0);
break;
case Well::ProducerCMode::GRAT:
zero_rate_control = (prod_controls.gas_rate == 0.0);
break;
case Well::ProducerCMode::LRAT:
zero_rate_control = (prod_controls.liquid_rate == 0.0);
break;
case Well::ProducerCMode::RESV:
zero_rate_control = (prod_controls.resv_rate == 0.0);
break;
default:
// Might still have zero rate controls, but is pressure controlled.
zero_rate_control = false;
}
if (zero_rate_control) {
// Treat as shut, do not add to container.
local_deferredLogger.info(" Well shut due to zero rate control and disallowing crossflow: " + well_ecl.name());
well_state_.shutWell(w);
continue;
}
}
if (well_status == Well::Status::STOP) {
well_state_.thp()[w] = 0.;
wellIsStopped = true;
@ -721,6 +757,12 @@ namespace Opm {
}
}
// Collect log messages and print.
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
if (terminal_output_) {
global_deferredLogger.logMessages();
}
return well_container;
}

View File

@ -2593,6 +2593,20 @@ namespace Opm
const WellState& /* well_state */,
Opm::DeferredLogger& deferred_logger)
{
const bool checkOperability = EWOMS_GET_PARAM(TypeTag, bool, EnableWellOperabilityCheck);
if (!checkOperability) {
return;
}
// focusing on PRODUCER for now
if (this->isInjector()) {
return;
}
if (!this->underPredictionMode() ) {
return;
}
const std::string msg = "Support of well operability checking for multisegment wells is not implemented "
"yet, checkWellOperability() for " + name() + " will do nothing";
deferred_logger.warning("NO_OPERATABILITY_CHECKING_MS_WELLS", msg);

View File

@ -63,7 +63,7 @@ namespace Opm
const int nw = wells_ecl.size();
// const int np = wells->number_of_phases;
const int np = pu.num_phases;
open_for_output_.resize(nw, true);
open_for_output_.assign(nw, true);
bhp_.resize(nw, 0.0);
thp_.resize(nw, 0.0);
temperature_.resize(nw, 273.15 + 20); // standard temperature for now