Make MixtureFugacityTP::cubicSolver more robust#2141
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2141 +/- ##
==========================================
+ Coverage 78.02% 78.06% +0.03%
==========================================
Files 452 452
Lines 54104 54115 +11
Branches 9063 9065 +2
==========================================
+ Hits 42213 42243 +30
+ Misses 8853 8835 -18
+ Partials 3038 3037 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'm not quite sure what behavior we're trying to ensure with the test in question. There are bound to be threshold conditions in any calculation that maps a floating point values to a discrete set. The most that you can expect is that the threshold value where it flips between different outputs is close (i.e. small multiple of machine precision) for when using different compilers / systems. The test was (apparently) getting past the relative comparison Creating a radius around the critical point that effectively snaps to this triple root just moves the threshold condition to some set of points near but not quite at the critical point. I do agree that the change to use |
|
Thanks, @speth!
I agree with this interpretation. The MinGW failure exposed that the old test was asserting a liquid/gas branch sign at the critical point, where that distinction is degenerate. I’ve updated the fix so the detected triple-root case returns
I kept the |
Changes proposed in this pull request
cbrtfor signed cube roots and correct validation of the negative-root branch.If applicable, fill in the issue number this pull request is fixing
Closes #1157
Extensive use of generative AI.
Significant portions of code or documentation were generated with AI, including logic and implementation decisions. All generated code and documentation were reviewed and understood by the contributor. Specifically, OpenAI Codex (gpt-5.5) was used to diagnose and fix the issue.
Checklist