Skip to content

Zerod connector nodes#1848

Merged
speth merged 18 commits intoCantera:mainfrom
ischoegl:zerod-connector-nodes
Mar 21, 2025
Merged

Zerod connector nodes#1848
speth merged 18 commits intoCantera:mainfrom
ischoegl:zerod-connector-nodes

Conversation

@ischoegl
Copy link
Copy Markdown
Member

@ischoegl ischoegl commented Feb 4, 2025

Changes proposed in this pull request

This PR pulls out the less controversial modifications from #1788, while improving the nomenclature (see Cantera/enhancements#213 (comment)):

  • Create a new ConnectorNode base, which combine Wall and FlowDevice objects; all objects are captured in updated factories.
  • Changes are propagated to all relevant API’s, i.e. Python, CLib and MATLAB.

If applicable, fill in the issue number this pull request is fixing

Addresses Cantera/enhancements#213

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 59.06433% with 70 lines in your changes missing coverage. Please review.

Project coverage is 74.35%. Comparing base (e6f3e9d) to head (c791052).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
src/clib/ctreactor.cpp 13.95% 37 Missing ⚠️
src/zeroD/ConnectorFactory.cpp 65.00% 12 Missing and 2 partials ⚠️
interfaces/cython/cantera/reactor.pyx 80.00% 6 Missing ⚠️
src/zeroD/FlowDevice.cpp 86.36% 3 Missing ⚠️
src/zeroD/Wall.cpp 66.66% 3 Missing ⚠️
include/cantera/zeroD/ConnectorNode.h 80.00% 2 Missing ⚠️
src/zeroD/ReactorBase.cpp 66.66% 2 Missing ⚠️
include/cantera/zeroD/FlowDevice.h 0.00% 1 Missing ⚠️
include/cantera/zeroD/Wall.h 0.00% 1 Missing ⚠️
src/zeroD/ConnectorNode.cpp 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1848      +/-   ##
==========================================
- Coverage   74.41%   74.35%   -0.06%     
==========================================
  Files         386      387       +1     
  Lines       53628    53631       +3     
  Branches     9063     9068       +5     
==========================================
- Hits        39905    39876      -29     
- Misses      10652    10686      +34     
+ Partials     3071     3069       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ischoegl ischoegl force-pushed the zerod-connector-nodes branch 5 times, most recently from 3ca0fab to 3822451 Compare February 4, 2025 14:50
@ischoegl ischoegl marked this pull request as ready for review February 4, 2025 16:01
@ischoegl ischoegl requested a review from a team February 4, 2025 16:01
Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks for separating this out, @ischoegl. I think introducing the ConnectorNode object type is useful and avoids some repetition. Broadly, though, the interface for the different derived types of connectors is different enough that I think the interface for using them should continue to be through objects of those particular types to avoid the need for dynamically casting to the derived types, both internally and for external users.

Comment on lines +18 to +19
* In a reactor network, walls and flow devices (valves, pressure regulators, etc.)
* form edges of a directed graph that connect reactors that form nodes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to get into the nomenclature question -- are connectors nodes (vertices) as the name ConnectorNode implies, or edges, as described here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I corrected this based on the discussion in Cantera/enhancements#213 (comment)

Comment on lines +63 to +66
//! Pair of reactors forming end points of the connector.
pair<shared_ptr<ReactorBase>, shared_ptr<ReactorBase>> m_nodes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think the pair adds much here -- two separate member variables ends up being easier to use.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have a (slight?) preference for pair as it is a directed graph, where a ConnectorNode connects to exactly two reactors. As it is an implementation detail, we can always adjust at a later point.

@ischoegl ischoegl force-pushed the zerod-connector-nodes branch from 3822451 to 967735b Compare February 16, 2025 16:49
@ischoegl ischoegl force-pushed the zerod-connector-nodes branch from 967735b to c791052 Compare February 16, 2025 16:59
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Feb 16, 2025

@speth - Thank you for the review (and for catching some pre-3.1 remnants of #1788). I believe your comment regarding not restricting the interface to newConnectorNode is valid, so I added two updated versions that retain the original split between newWall and newFlowDevice. Regarding your CLib comment, the exact implementation will be fleshed out according to Cantera/enhancements#220, so I'd like to table this for the moment.

@ischoegl ischoegl requested a review from speth February 16, 2025 17:38
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Mar 9, 2025

@speth ... let me know if there's anything else that needs to be done before this can be merged.

Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks, @ischoegl. This looks good to me. Sorry for the delayed in reviewing.

@speth speth merged commit a3eb9cd into Cantera:main Mar 21, 2025
47 of 49 checks passed
@ischoegl ischoegl deleted the zerod-connector-nodes branch March 21, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants