Merge pull request #5601 from vkip/network_alq

Avoid adding gas lift of non-open wells to network
This commit is contained in:
Kai Bao 2024-09-20 14:00:44 +02:00 committed by GitHub
commit dddcfad298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 6 deletions

View File

@ -36,6 +36,7 @@ GlobalWellInfo::GlobalWellInfo(const Schedule& sched, std::size_t report_step, c
auto num_wells = sched.numWells(report_step);
this->m_in_injecting_group.resize(num_wells);
this->m_in_producing_group.resize(num_wells);
this->m_is_open.resize(num_wells);
for (const auto& wname : sched.wellNames(report_step)) {
const auto& well = sched.getWell(wname, report_step);
auto global_well_index = well.seqIndex();
@ -58,20 +59,33 @@ bool GlobalWellInfo::in_producing_group(const std::string& wname) const {
return this->m_in_producing_group[global_well_index];
}
bool GlobalWellInfo::is_open(const std::string& wname) const {
auto global_well_index = this->name_map.at(wname);
return this->m_is_open[global_well_index];
}
void GlobalWellInfo::update_injector(std::size_t well_index, Well::Status well_status, Well::InjectorCMode injection_cmode) {
if (well_status == Well::Status::OPEN && injection_cmode == Well::InjectorCMode::GRUP)
this->m_in_injecting_group[this->local_map[well_index]] = 1;
if (well_status == Well::Status::OPEN) {
this->m_is_open[this->local_map[well_index]] = 1;
if (injection_cmode == Well::InjectorCMode::GRUP) {
this->m_in_injecting_group[this->local_map[well_index]] = 1;
}
}
}
void GlobalWellInfo::update_producer(std::size_t well_index, Well::Status well_status, Well::ProducerCMode production_cmode) {
if (well_status == Well::Status::OPEN && production_cmode == Well::ProducerCMode::GRUP)
this->m_in_producing_group[this->local_map[well_index]] = 1;
if (well_status == Well::Status::OPEN) {
this->m_is_open[this->local_map[well_index]] = 1;
if (production_cmode == Well::ProducerCMode::GRUP) {
this->m_in_producing_group[this->local_map[well_index]] = 1;
}
}
}
void GlobalWellInfo::clear() {
this->m_in_injecting_group.assign(this->name_map.size(), 0);
this->m_in_producing_group.assign(this->name_map.size(), 0);
this->m_is_open.assign(this->name_map.size(), 0);
}

View File

@ -63,6 +63,7 @@ public:
auto size = this->m_in_injecting_group.size();
comm.sum( this->m_in_injecting_group.data(), size);
comm.sum( this->m_in_producing_group.data(), size);
comm.sum( this->m_is_open.data(), size);
}
@ -70,6 +71,7 @@ public:
GlobalWellInfo(const Schedule& sched, std::size_t report_step, const std::vector<Well>& local_wells);
bool in_producing_group(const std::string& wname) const;
bool in_injecting_group(const std::string& wname) const;
bool is_open(const std::string& wname) const;
std::size_t well_index(const std::string& wname) const;
const std::string& well_name(std::size_t well_index) const;
void update_injector(std::size_t well_index, WellStatus well_status, WellInjectorCMode injection_cmode);
@ -82,6 +84,7 @@ private:
std::map<std::string, std::size_t> name_map; // string -> global_index
std::vector<int> m_in_injecting_group; // global_index -> int/bool
std::vector<int> m_in_producing_group; // global_index -> int/bool
std::vector<int> m_is_open; // global_index -> int/bool
};

View File

@ -859,7 +859,7 @@ computeNetworkPressures(const Network::ExtNetwork& network,
const auto& group = schedule.getGroup(node, report_time_step);
for (const std::string& wellname : group.wells()) {
const Well& well = schedule.getWell(wellname, report_time_step);
if (well.isInjector()) continue;
if (well.isInjector() || !well_state.isOpen(wellname)) continue;
// Here we use the efficiency unconditionally, but if WEFAC item 3
// for the well is false (it defaults to true) then we should NOT use
// the efficiency factor. Fixing this requires not only changing the
@ -916,7 +916,12 @@ computeNetworkPressures(const Network::ExtNetwork& network,
auto rates = node_inflows[node];
for (auto& r : rates) { r *= -1.0; }
assert(rates.size() == 3);
const Scalar alq = 0.0; // TODO: Do not ignore ALQ
// NB! ALQ in extended network is never implicitly the gas lift rate (GRAT), i.e., the
// gas lift rates only enters the network pressure calculations through the rates
// (e.g., in GOR calculations) unless a branch ALQ is set in BRANPROP.
//
// @TODO: Standard network
Scalar alq = (*upbranch).alq_value().value_or(0.0);
node_pressures[node] = vfp_prod_props.bhp(*vfp_table,
rates[BlackoilPhases::Aqua],
rates[BlackoilPhases::Liquid],

View File

@ -173,6 +173,11 @@ public:
return this->global_well_info.value().in_producing_group(name);
}
bool isOpen(const std::string& name) const
{
return this->global_well_info.value().is_open(name);
}
Scalar getALQ(const std::string& name) const
{
return this->alq_state.get(name);