Skip to content

Conversation

plgbrts
Copy link
Contributor

@plgbrts plgbrts commented May 28, 2025

No description provided.

Copy link
Member

@bska bska left a comment

Choose a reason for hiding this comment

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

Looks good to me, with one small provision on the parameter name. Don't worry about the "failed check" for labels. I'll fix that.

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.

@bska bska added the manual:irrelevant This PR is a minor fix and should not appear in the manual label May 28, 2025
@bska
Copy link
Member

bska commented May 28, 2025

On a tangential note, we might want to add a unit test for this new function, both for the case of a node/group having a choke and for the case of there not being a choke.

@GitPaean
Copy link
Member

Hi, is the function used in some code already? Based on the usage, the design of the function can be some different. It is good to show the usage of the function in my opinion.

@plgbrts
Copy link
Contributor Author

plgbrts commented May 30, 2025

On a tangential note, we might want to add a unit test for this new function, both for the case of a node/group having a choke and for the case of there not being a choke.

Added a unit test for this

@plgbrts
Copy link
Contributor Author

plgbrts commented May 30, 2025

Hi, is the function used in some code already? Based on the usage, the design of the function can be some different. It is good to show the usage of the function in my opinion.

I am preparing a PR in simulators in which I make use of it.

@plgbrts
Copy link
Contributor Author

plgbrts commented May 30, 2025

jenkins build this please

@GitPaean
Copy link
Member

jenkins build this opm-simulators=6313 please

@GitPaean
Copy link
Member

Hi, is the function used in some code already? Based on the usage, the design of the function can be some different. It is good to show the usage of the function in my opinion.

I am preparing a PR in simulators in which I make use of it.

Thanks. I now see the downstream PR now. OPM/opm-simulators#6313

From the usage, it looks like it is checking whether an certain group is also serving as a network node with an active choke setup.

Maybe a more descriptive function name can be

groupAsChokeNode, isGroupChokeNode, or hasChokeAtGroup, since it is about a certain group.

@GitPaean
Copy link
Member

GitPaean commented Jun 2, 2025

With more thinking, it is okay to keep the function has_choke(), the parameter can be nodeName as @bska suggested. This function can be used to check whether auto-choke is associated with any name (group or node) we provide here.

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.

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

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants