Repository navigation
CoolPlot 1.7.0: CoolProp 8.1, whole quality lines of wide-glide blends such as R436A, Fluid.phase - #56
Conversation
CoolProp 8.1.0 is the first release with CoolProp.CoolProp.Plot, so CoolPlot now computes fluid lines there by default; CI tests 8.1.0 throughout and keeps one job on 8.0.0, still the minimum. On 8.1 the lines of quality 0.3 to 0.9 of R436A stopped at 140 K with their evaluation budget used up. CoolProp's quality flash alternates between the right root and a wrong one (its phases miss the mixture by 1e-2 in mole fraction, 3 % in pressure), and the stepping shrank its step below MIN_STEP at every turn until the temperature stopped moving. - stepping: next_step keeps MIN_STEP of the range as its floor - isolines: a two-phase state of a mixture must satisfy (1 - Q) x + Q y = z to 1e-6, calibrated on the 113 predefined blends - native: lines of intermediate quality of a mixture stay in Python, since the port in 8.1 has neither safeguard (port_draws) - example wide_glide_blend.py: an R436A heat pump in a p-h chart Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
The MIN_STEP floor in next_step changed the points of ordinary lines, so the Python numerics no longer matched CoolProp's port of the stepping (test_the_port_agrees_with_the_python_reference, h and rho lines). It is taken out again: R436A draws whole lines through the mass balance check and the routing alone. The stepping test is expected to fail until both copies get the floor together. native.py finds CoolProp.CoolProp.Plot with getattr: the type stubs of CoolProp 8.1 declare it, those of 8.0 do not, and mypy has to pass with both. Release 1.6.1: version, changelog and a section in the upgrade guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
From the review of the 1.6.1 changes: - The check also refuses some nearly right states: Ekofisk's line of quality 0.1 gets five gaps between 6.6 and 6.8 MPa. The comment, the changelog and the upgrade guide say so, and why a tolerance relative to |x - y| would not spare them. - The changelog gives the measured cost of the stall: the lines stopped between 129 and 146 K, the example took 15 s instead of about 1.3 s. - The calibration used 39 temperatures, not 40. - The branding guide shows CoolPlot 1.6.1. - Tests: a state that misses by 1e-5 is refused (a tolerance of 1e-4 passed before), and the R436A lines end at the top of the envelope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
… check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
…-v8-1-wemgio # Conflicts: # CHANGELOG.md
…e mass balance The wrong states on lines of constant quality come from CoolProp's fallback: where newton_raphson_twophase fails, the QT flash answers with the bubble/dew solver, which has no mass balance (CoolProp#3585). The code comments, the changelog, the blends guide and the example said the flash converged on a wrong root; they now say what happens and link the issue. The routing to Python and the expected failure of the stepping test point at CoolProp#3586, which asks for the same check and the step floor in CoolProp's port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
With CoolProp 8.1.0, CI runs the tests of CoolProp's port for the first time, and two failed on every GitHub runner while passing locally: point 12 of the R32/R125 isenthalp of 300 kJ/kg in a T-s chart differs by 3.1e-9, a point of an R290 isentrope in the chart scene by 1.5e-8. The Python values are bit for bit the same on the runners and here; the port's differ. The isenthalp point amplifies the last bits of CoolProp's arithmetic: with glibc's FMA variants of the maths functions switched off it moves by exactly that 3.1e-9, here on both sides alike. Why the two sides take different variants on the runners is not known. The value comparisons between the port and Python use PORT_RTOL = 1e-7. Point counts, gaps and diagnostics are still compared exactly, scenes composed from the same curves still to 1e-9, and a port that is off by 1e-6 fails all eleven cases of the agreement test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
Fluid.phase (#53) is an addition to the public API, so the release is a minor one. Its changelog entry moves from Unreleased into 1.7.0, next to the new example; the upgrade guide gets a section from 1.6 to 1.7, and the branding guide shows CoolPlot 1.7.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bsHH8feNGnWqjY7RbruVh
Moves CoolPlot's CoolProp reference to 8.1.0 and adds a p-h chart of R436A, a blend with a wide glide, to the gallery. On 8.1 that chart exposed a CoolProp problem, which this PR works around and which is reported upstream as CoolProp/CoolProp#3585 and CoolProp/CoolProp#3586.
CoolProp 8.1
coolprop>=8.0is unchanged).CoolProp.CoolProp.Plot, so CoolPlot computes fluid lines there by default, and the 41 tests of the port run in CI for the first time.coolplot.thermo.nativelooks upCoolProp.CoolProp.Plotwithgetattr: the 8.1 type stubs declare it, the 8.0 stubs do not, and mypy failed with 8.1.R436A on 8.1
The lines of quality 0.3 to 0.9 of R436A stopped between 129 and 146 K with their evaluation budget used up, and the example took 15 s. Cause: where CoolProp's two-phase QT solver fails, CoolProp falls back to the bubble/dew solver and returns its state, which misses the mass balance (R436A: 2.8 % in pressure at 140 K). On 8.1.0 that happens for 32 of the 113 predefined blends (CoolProp/CoolProp#3585). The line then zig-zags between the two solutions, and the stepping shrinks its step to nothing.
_is_saturation_stateinthermo/isolines.py): a two-phase state of a mixture on a quality line is drawn only ifmax |(1 - Q) x + Q y - z| <= 1e-6, calibrated on all predefined blends. Cost: a few nearly right states are refused too (5 gaps on the quality 0.1 line of Ekofisk).native.port_draws): lines of intermediate quality of mixtures are computed in Python, since CoolProp's port lacks the check (CoolProp.Plot: lines of constant quality of R436A stop with the evaluation budget used up CoolProp#3586).next_stephas no floor atMIN_STEP. A floor in Python alone broke the point-for-point agreement with CoolProp's port (test_the_port_agrees_with_the_python_reference), so it has to land in both together.test_a_line_that_jumps_between_two_roots_reaches_its_endis a strict xfail until then. Listed under "Known issues" in the changelog.Port vs Python: compared to 1e-7 (f8755fb)
With the port tests running in CI for the first time, two failed on every GitHub runner while passing locally: one point of the R32/R125 isenthalp in a T-s chart differed by 3.1e-9, one point of an R290 isentrope in the chart scene by 1.5e-8, against 1e-9. The Python values are bit for bit the same on the runners and locally; the port's differ. The isenthalp point amplifies the last bits of CoolProp's arithmetic: switching off glibc's FMA variants of the maths functions moves it by exactly 3.1e-9. Why the two sides take different variants on the runners is not known (not the runners' glibc 2.43: the tests pass in an Ubuntu 26.04 container).
The value comparisons between the port and Python now use
PORT_RTOL = 1e-7(tests/test_native.py). Point counts, gaps and diagnostics are still compared exactly, scenes composed from the same curves still to 1e-9, and a port that is off by 1e-6 fails all eleven cases of the agreement test.Example
examples/wide_glide_blend.py: a heat pump with R436A evaporating at -5 deg C (dew) and condensing at 45 deg C (bubble), glide 7.8 K and 6.3 K. It runs in the docs gallery (built locally with-W, 1.4 s) and is linked from the blends how-to. Its test fails on the old code with 8.1.Release
Release 1.7.0 (2b4276f):
VERSIONis 1.7.0, and the changelog section[1.7.0]includesFluid.phase(#53) frommain, an API addition, so a minor release. The upgrade guide has a section from 1.6 to 1.7.Testing
main: CoolProp 8.0.0 628 passed, 8.1.0 670 passed, through coolplot-core (COOLPLOT_NATIVE=1,-W error::CoreFallbackWarning) 707 passed; each with the one expected xfail.Summary by CodeRabbit