Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peng-Robinson EoS: added setState_DP #1847

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

TJP-Karpowski
Copy link

@TJP-Karpowski TJP-Karpowski commented Feb 3, 2025

Changes proposed in this pull request

The Peng-Robinson EoS does not implement a DP update, which is added by this merge request.
The setState_DP function was extended with a Tguess value to enable the efficient search for the correct temperature.
The downstream application requires the SolutionBranch of the cubic EoS to be settable; thus, the API is exposed on the ThermoPhase level.

  • added setState_DP for Peng-Robinson EoS
  • added Tguess for the setState_DP function
  • the setForcedSolutionBranch is exposed on the ThermoPhase level

TODO

  • Add test of functionality to the Peng-Robinson Testset.

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

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 87.03704% with 7 lines in your changes missing coverage. Please review.

Project coverage is 74.42%. Comparing base (e6f3e9d) to head (5249dce).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/thermo/PengRobinson.cpp 90.00% 2 Missing and 3 partials ⚠️
include/cantera/thermo/ThermoPhase.h 50.00% 1 Missing ⚠️
src/thermo/MixtureFugacityTP.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1847      +/-   ##
==========================================
+ Coverage   74.41%   74.42%   +0.01%     
==========================================
  Files         386      386              
  Lines       53628    53681      +53     
  Branches     9063     9075      +12     
==========================================
+ Hits        39905    39950      +45     
- Misses      10652    10656       +4     
- Partials     3071     3075       +4     

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

@ischoegl
Copy link
Member

ischoegl commented Feb 16, 2025

Hi @TJP-Karpowski ... thank you for the PR!

While I believe that your PR targets a feature we'd like to see, there are some aspects that you should consider. Most people will use the setState_DP class method from the Python API, - via DPX/DPY, - which currently does not support the optional parameter. Also, from an API design aspect, the third parameter isn't consistent with what's used for other comparable setters, all of which use tol as a third parameter, e.g.:

void setState_HP(double h, double p, double tol=1e-9);

Can you think of a way to provide an automatic initial guess instead? As an aside, it would be interesting to compare to CoolProp directly in the Python test suite - it's relatively straightforward to include optional dependencies for testing purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants