Merge pull request #3701 from vkip/extra_network_output

Allow output of network pressure based on rates at end of timestep
This commit is contained in:
Bård Skaflestad 2023-11-09 23:04:34 +01:00 committed by GitHub
commit 7baccd0318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 3 deletions

View File

@ -172,37 +172,42 @@ namespace Opm { namespace data {
struct NodeData {
double pressure { 0.0 };
double converged_pressure { 0.0 };
template <class MessageBufferType>
void write(MessageBufferType& buffer) const
{
buffer.write(this->pressure);
buffer.write(this->converged_pressure);
}
template <class MessageBufferType>
void read(MessageBufferType& buffer)
{
buffer.read(this->pressure);
buffer.read(this->converged_pressure);
}
bool operator==(const NodeData& other) const
{
return this->pressure == other.pressure;
return this->pressure == other.pressure && this->converged_pressure == other.converged_pressure;
}
void init_json(Json::JsonObject& json_data) const {
json_data.add_item("pressure", this->pressure);
json_data.add_item("converged_pressure", this->converged_pressure);
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(pressure);
serializer(converged_pressure);
}
static NodeData serializationTestObject()
{
return NodeData{10.0};
return NodeData{10.0, 10.0};
}
};

View File

@ -397,7 +397,7 @@ struct SummaryConfigContext {
bool is_node_keyword(const std::string& keyword)
{
static const auto nodekw = keyword_set {
"GPR", "GPRG", "GPRW",
"GPR", "GPRG", "GPRW", "NPR", "GNETPR"
};
return is_in_set(nodekw, keyword);
@ -427,6 +427,14 @@ struct SummaryConfigContext {
for (auto step = 0*nstep; step < nstep; ++step) {
const auto& nodes = sched[step].network.get().node_names();
names.insert(nodes.begin(), nodes.end());
// Also insert wells belonging to groups in the network to be able to report network-computed THPs
for (const auto& node : nodes) {
if (!sched.hasGroup(node, step)) continue;
const auto& group = sched.getGroup(node, step);
for (const std::string& wellname : group.wells()) {
names.insert(wellname);
}
}
}
node_names.assign(names.begin(), names.end());
@ -1559,6 +1567,7 @@ SummaryConfigNode::Category parseKeywordCategory(const std::string& keyword)
case 'R': return Cat::Region;
case 'B': return Cat::Block;
case 'S': return Cat::Segment;
case 'N': return Cat::Node;
}
// TCPU, MLINEARS, NEWTON, &c

View File

@ -0,0 +1,20 @@
{
"name": "NETWORK_PROBE",
"sections": [
"SUMMARY"
],
"comment": "Network output",
"deck_names": [
"NPR",
"GNETPR"
],
"deck_name_regex": "NU.+",
"size": 1,
"items": [
{
"name": "NETWORK_NODES",
"size_type": "ALL",
"value_type": "STRING"
}
]
}

View File

@ -1119,6 +1119,7 @@ set( keywords
900_OPM/M/MICP
900_OPM/M/MICPPARA
900_OPM/M/MINNPCOL
900_OPM/N/NETWORK_PROBE
900_OPM/O/OCOMPIDX
900_OPM/O/OILDENT
900_OPM/O/OILJT

View File

@ -1390,6 +1390,16 @@ inline quantity node_pressure(const fn_args& args)
return { nodePos->second.pressure, measure::pressure };
}
inline quantity converged_node_pressure(const fn_args& args)
{
auto nodePos = args.grp_nwrk.nodeData.find(args.group_name);
if (nodePos == args.grp_nwrk.nodeData.end()) {
return { 0.0, measure::pressure };
}
return { nodePos->second.converged_pressure, measure::pressure };
}
template <Opm::data::WellBlockAvgPress::Quantity wbp_quantity>
quantity well_block_average_pressure(const fn_args& args)
{
@ -2114,6 +2124,8 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "GVPGR", group_guiderate<producer, Opm::data::GuideRateValue::Item::ResV> },
{ "GPR", node_pressure },
{ "NPR", converged_node_pressure },
{ "GNETPR", converged_node_pressure },
{ "GWPT", mul( rate< rt::wat, producer >, duration ) },
{ "GOPT", mul( rate< rt::oil, producer >, duration ) },