Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions opm/input/eclipse/Schedule/Schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,11 @@ Defaulted grid coordinates is not allowed for COMPDAT as part of ACTIONX)"
return this->snapshots[timeStep].groups.get(groupName);
}

bool Schedule::hasChoke(const std::string& nodeName, std::size_t timeStep) const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When reviewing the downstream PR, I saw there is the following function,

bool Group::as_choke() const {
    return this->m_choke_group.has_value();
}

Does this function overlap with the new function introduced here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this function overlap with the new function introduced here?

Kind of. This particular function exists for the "standard network" model (GRUPNET keyword).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it looks like updated in the function handleNODEPROP(), which is for extended network.

Potentially we can reuse as_choke() function instead of introducing a new one?

const auto& network = this->snapshots[timeStep].network();
return network.has_node(nodeName) && network.node(nodeName).as_choke();
}

void Schedule::updateGuideRateModel(const GuideRateModel& new_model, std::size_t report_step) {
auto new_config = this->snapshots[report_step].guide_rate();
if (new_config.update_model(new_model))
Expand Down
1 change: 1 addition & 0 deletions opm/input/eclipse/Schedule/Schedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ namespace Opm {
GTNode groupTree(std::size_t report_step) const;
GTNode groupTree(const std::string& root_node, std::size_t report_step) const;
const Group& getGroup(const std::string& groupName, std::size_t timeStep) const;
bool hasChoke(const std::string& groupName, std::size_t timeStep) const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably use a different parameter name here, since the predicate typically applies to a node named in the (extended) network. While groups may indeed be network nodes, not all network nodes are expected to be groups in this case.

Maybe nodeName instead of groupName?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bska. I was trying to fix the label but could not change it myself which I should be able to do, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to fix the label but could not change it myself which I should be able to do, right?

You need "triage" privileges in the repository in order to set/change PR labels. At the moment, "triage" is effectively the same as "administrator" so only repository administrators have that ability. It's possible that we'll revise the PR labelling policy in light of this fact.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably use a different parameter name here, since the predicate typically applies to a node named in the (extended) network. While groups may indeed be network nodes, not all network nodes are expected to be groups in this case.

Maybe nodeName instead of groupName?

From the downstream PR, it looks like the function is to check whether a group is also a choke node in a network. Maybe groupName can be more appropriate as the input argument? But I also understand your arguments, so there is no strong objection to your suggestion either. Just for discussion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether or not something is a choke is inherently a node property, since this is governed by item 3 of the NODEPROP keyword. It's very misleading to give the impression that this pertains only to groups.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plgbrts , you changed to use nodeName in the .cpp file, it is good to have the consistency in the .hpp file also.


std::optional<std::size_t> first_RFT() const;
/*
Expand Down
7 changes: 6 additions & 1 deletion tests/parser/NetworkTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ BRANPROP
C1 PLAT-A 0 1* /
/


NODEPROP
-- Node_name Pr autoChock? addGasLift? Group_name
C1 1* NO NO 1* /
/
)";

auto sched = make_schedule(deck_string);
Expand Down Expand Up @@ -298,6 +301,7 @@ BRANPROP
BOOST_CHECK_EQUAL(B1_uptree->uptree_node(), "PLAT-A");

BOOST_CHECK(network.active());
BOOST_CHECK(sched.hasChoke("B1", 0));
}
{
const auto& network = sched[1].network.get();
Expand Down Expand Up @@ -326,6 +330,7 @@ BRANPROP
BOOST_CHECK( !network.uptree_branch("C1") );

BOOST_CHECK(network.active());
BOOST_CHECK(!sched.hasChoke("C1", 1));
}
}

Expand Down