This commit is contained in:
Paul Egberts 2023-11-26 11:16:34 +00:00 committed by GitHub
commit 18acac4a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 1 deletions

View File

@ -502,6 +502,7 @@ public:
bool updateGroup(const std::string& group);
bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);
bool updateWellGuideRate(double guide_rate);
bool updateWellGuideRate(bool available);
bool updateEfficiencyFactor(double efficiency_factor);
bool updateSolventFraction(double solvent_fraction);

View File

@ -1035,6 +1035,31 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
node.terminal_pressure(pressure_item.getSIDouble(0));
if (as_choke) {
//Wells belong to a group with autochoke enabled are to be run on a common THP and guide rate should be ignored
const auto& group = this->getGroup(name, handlerContext.currentStep);
for (const std::string& wellName : group.wells()) {
auto well = this->snapshots.back().wells.get(wellName);
//Let the wells be operating on a THP Constraint
auto properties = std::make_shared<Well::WellProductionProperties>(well.getProductionProperties());
properties->clearControls();
properties->addProductionControl(Well::ProducerCMode::THP);
properties->controlMode = Well::ProducerCMode::THP;
well.updateProduction(properties);
// this->snapshots.back().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
// this->snapshots.back().wellgroup_events().addEvent( well2.name(), ScheduleEvents::PRODUCTION_UPDATE);
// Guide rate availablity should be set to false
const bool availableForGroupControl = false;
well.updateWellGuideRate(availableForGroupControl);
auto new_config = this->snapshots.back().guide_rate();
new_config.update_well(well);
this->snapshots.back().guide_rate.update( std::move(new_config) );
this->snapshots.back().wells.update( std::move(well) );
}
std::string target_group = name;
const auto& target_item = record.getItem<ParserKeywords::NODEPROP::CHOKE_GROUP>();
@ -1043,7 +1068,6 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
if (target_group != name) {
if (this->snapshots.back().groups.has(name)) {
const auto& group = this->getGroup(name, handlerContext.currentStep);
if (group.numWells() > 0)
throw std::invalid_argument("A manifold group must respond to its own target");
}

View File

@ -776,6 +776,16 @@ bool Well::updateWellGuideRate(bool available, double guide_rate_arg, GuideRateT
return update;
}
bool Well::updateWellGuideRate(bool available) {
bool update = false;
if (this->guide_rate.available != available) {
this->guide_rate.available = available;
update = true;
}
return update;
}