Count Active UDAs From WELTARG Keyword
This commit introduces a new overload of the updateUDQActive member function of the WellInjectionProperties and WellProductionProperties classes. The new overload is specifically targeted at accounting for any active UDAs in WELTARG records. It is possible to have "regular" UDAs introduced in WCONPROD/WCONINJE and also a separate set of UDAs attributed to WELTARG at the same time so we need to be able to distinguish the two cases. Call the new overload from the WELTARG keyword handler.
This commit is contained in:
@@ -298,6 +298,7 @@ public:
|
||||
void setBHPLimit(const double limit);
|
||||
InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const;
|
||||
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
|
||||
bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
|
||||
void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
|
||||
void handleWTMULT(Well::WELTARGCMode cmode, double factor);
|
||||
|
||||
@@ -426,6 +427,7 @@ public:
|
||||
void clearControls();
|
||||
ProductionControls controls(const SummaryState& st, double udq_default) const;
|
||||
bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
|
||||
bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
|
||||
void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
|
||||
|
||||
void setBHPLimit(const double limit);
|
||||
|
||||
@@ -1538,15 +1538,21 @@ Well{0} entered with disallowed 'FIELD' parent group:
|
||||
update |= well2.updateWellGuideRate(new_arg.get<double>());
|
||||
|
||||
auto udq_active = this->snapshots.back().udq_active.get();
|
||||
if (prop->updateUDQActive(this->getUDQConfig(handlerContext.currentStep), udq_active))
|
||||
if (prop->updateUDQActive(this->getUDQConfig(handlerContext.currentStep), cmode, udq_active))
|
||||
this->snapshots.back().udq_active.update( std::move(udq_active));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
auto inj = std::make_shared<Well::WellInjectionProperties>(well2.getInjectionProperties());
|
||||
inj->handleWELTARG(cmode, new_arg, SiFactorP);
|
||||
update = well2.updateInjection(inj);
|
||||
if (cmode == Well::WELTARGCMode::GUID)
|
||||
update |= well2.updateWellGuideRate(new_arg.get<double>());
|
||||
|
||||
auto udq_active = this->snapshots.back().udq_active.get();
|
||||
if (inj->updateUDQActive(this->getUDQConfig(handlerContext.currentStep), cmode, udq_active))
|
||||
this->snapshots.back().udq_active.update(std::move(udq_active));
|
||||
}
|
||||
|
||||
if (update)
|
||||
{
|
||||
if (well2.isProducer()) {
|
||||
@@ -1558,6 +1564,7 @@ Well{0} entered with disallowed 'FIELD' parent group:
|
||||
}
|
||||
this->snapshots.back().wells.update( std::move(well2) );
|
||||
}
|
||||
|
||||
handlerContext.affected_well(well_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +311,36 @@ namespace Opm {
|
||||
return (update_count > 0);
|
||||
}
|
||||
|
||||
bool Well::WellInjectionProperties::updateUDQActive(const UDQConfig& udq_config,
|
||||
const WELTARGCMode cmode,
|
||||
UDQActive& active) const
|
||||
{
|
||||
switch (cmode) {
|
||||
case WELTARGCMode::ORAT:
|
||||
return (this->injectorType == InjectorType::OIL)
|
||||
&& (active.update(udq_config, this->surfaceInjectionRate, this->name, UDAControl::WELTARG_ORAT) > 0);
|
||||
|
||||
case WELTARGCMode::WRAT:
|
||||
return (this->injectorType == InjectorType::WATER)
|
||||
&& (active.update(udq_config, this->surfaceInjectionRate, this->name, UDAControl::WELTARG_WRAT) > 0);
|
||||
|
||||
case WELTARGCMode::GRAT:
|
||||
return (this->injectorType == InjectorType::GAS)
|
||||
&& (active.update(udq_config, this->surfaceInjectionRate, this->name, UDAControl::WELTARG_GRAT) > 0);
|
||||
|
||||
case WELTARGCMode::RESV:
|
||||
return active.update(udq_config, this->reservoirInjectionRate, this->name, UDAControl::WELTARG_RESV) > 0;
|
||||
|
||||
case WELTARGCMode::BHP:
|
||||
return active.update(udq_config, this->BHPTarget, this->name, UDAControl::WELTARG_BHP) > 0;
|
||||
|
||||
case WELTARGCMode::THP:
|
||||
return active.update(udq_config, this->THPTarget, this->name, UDAControl::WELTARG_THP) > 0;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Well::WellInjectionProperties::update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value) {
|
||||
switch (control) {
|
||||
|
||||
@@ -410,7 +410,45 @@ void Well::WellProductionProperties::handleWCONHIST(const std::optional<VFPProdT
|
||||
return (update_count > 0);
|
||||
}
|
||||
|
||||
void Well::WellProductionProperties::update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value) {
|
||||
bool Well::WellProductionProperties::updateUDQActive(const UDQConfig& udq_config,
|
||||
const Well::WELTARGCMode cmode,
|
||||
UDQActive& active) const
|
||||
{
|
||||
switch (cmode) {
|
||||
case WELTARGCMode::ORAT:
|
||||
return active.update(udq_config, this->OilRate, this->name, UDAControl::WELTARG_ORAT) > 0;
|
||||
|
||||
case WELTARGCMode::WRAT:
|
||||
return active.update(udq_config, this->WaterRate, this->name, UDAControl::WELTARG_WRAT) > 0;
|
||||
|
||||
case WELTARGCMode::GRAT:
|
||||
return active.update(udq_config, this->GasRate, this->name, UDAControl::WELTARG_GRAT) > 0;
|
||||
|
||||
case WELTARGCMode::LRAT:
|
||||
return active.update(udq_config, this->LiquidRate, this->name, UDAControl::WELTARG_LRAT) > 0;
|
||||
|
||||
case WELTARGCMode::RESV:
|
||||
return active.update(udq_config, this->ResVRate, this->name, UDAControl::WELTARG_RESV) > 0;
|
||||
|
||||
case WELTARGCMode::BHP:
|
||||
return active.update(udq_config, this->BHPTarget, this->name, UDAControl::WELTARG_BHP) > 0;
|
||||
|
||||
case WELTARGCMode::THP:
|
||||
return active.update(udq_config, this->THPTarget, this->name, UDAControl::WELTARG_THP) > 0;
|
||||
|
||||
case WELTARGCMode::LIFT:
|
||||
return active.update(udq_config, this->ALQValue, this->name, UDAControl::WELTARG_LIFT) > 0;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Well::WellProductionProperties::update_uda(const UDQConfig& udq_config,
|
||||
UDQActive& udq_active,
|
||||
const UDAControl control,
|
||||
const UDAValue& value)
|
||||
{
|
||||
switch (control) {
|
||||
case UDAControl::WCONPROD_ORAT:
|
||||
this->OilRate = value;
|
||||
|
||||
Reference in New Issue
Block a user