Merge pull request #4914 from vkip/extra_network_output

Allow output of network pressures based on rates at end of time step
This commit is contained in:
Bård Skaflestad 2023-11-09 23:19:48 +01:00 committed by GitHub
commit 16c8184e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 3 deletions

View File

@ -924,11 +924,44 @@ assignGroupValues(const int reportStepIdx,
void
BlackoilWellModelGeneric::
assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const
assignNodeValues(std::map<std::string, data::NodeData>& nodevalues, const int reportStepIdx) const
{
nodevalues.clear();
if (reportStepIdx < 0) return;
for (const auto& [node, pressure] : node_pressures_) {
nodevalues.emplace(node, data::NodeData{pressure});
// Assign node values of well groups to GPR:WELLNAME
const auto& sched = schedule();
if (!sched.hasGroup(node, reportStepIdx)) continue;
const auto& group = sched.getGroup(node, reportStepIdx);
for (const std::string& wellname : group.wells()) {
nodevalues.emplace(wellname, data::NodeData{pressure});
}
}
const auto& network = schedule()[reportStepIdx].network();
if (!network.active()) return;
auto converged_pressures = WellGroupHelpers::computeNetworkPressures(network,
this->wellState(),
this->groupState(),
*(vfp_properties_->getProd()),
schedule(),
reportStepIdx);
for (const auto& [node, converged_pressure] : converged_pressures) {
auto it = nodevalues.find(node);
assert(it != nodevalues.end() );
it->second.converged_pressure = converged_pressure;
// Assign node values of group to GPR:WELLNAME
const auto& sched = schedule();
if (!sched.hasGroup(node, reportStepIdx)) continue;
const auto& group = sched.getGroup(node, reportStepIdx);
for (const std::string& wellname : group.wells()) {
auto it2 = nodevalues.find(wellname);
assert(it2 != nodevalues.end());
it2->second.converged_pressure = converged_pressure;
}
}
}
@ -939,7 +972,7 @@ groupAndNetworkData(const int reportStepIdx) const
auto grp_nwrk_values = data::GroupAndNetworkValues{};
this->assignGroupValues(reportStepIdx, grp_nwrk_values.groupData);
this->assignNodeValues(grp_nwrk_values.nodeData);
this->assignNodeValues(grp_nwrk_values.nodeData, reportStepIdx-1); // Schedule state info at previous step
return grp_nwrk_values;
}

View File

@ -354,7 +354,7 @@ protected:
data::GroupData& gdata) const;
void assignGroupValues(const int reportStepIdx,
std::map<std::string, data::GroupData>& gvalues) const;
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const;
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues, const int reportStepIdx) const;
void calculateEfficiencyFactors(const int reportStepIdx);