Peng-Robinson EoS: added setState_DP #1847
Peng-Robinson EoS: added setState_DP #1847TJP-Karpowski wants to merge 9 commits intoCantera:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is
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. |
…hitespaces. These should be solve now.
|
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 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. |
|
Hi @ischoegl, thank you for the comment. I understand the issue. As short primer my usecase: I have Cantera embedded in a CFD solver doing the thermo-update, Looping over each cell and updating the properties. So I know the temperature from the last timestep which is already a very good guess. Solutions:
I will definitely add the tolerance (tol) as the third parameter to the call, as it is currently hard coded. Kind Regards |
|
@TJP-Karpowski ... thanks for providing the context: the use case is definitely warranting a guess to be provided. I agree that option (3) is the cleanest solution. Leaving things in an unphysical state is a dangerous proposition, especially for APIs that may be used by inexperienced users. |
…ith other setState functions. Enabled tolerance and TGuess in the python API .DP .DPX .DPY
…/cantera into cubicIntegrationInSolution
|
Hi @TJP-Karpowski ... thanks for addressing. Before further commenting, I'd like to ask you to rebase your PR to the current Edit: please have a look at the Python code as well - please run |
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.
TODO
Checklist
scons build&scons test) and unit tests address code coverage