Repository navigation
Load CoolProp without its superancillaries - #49
Conversation
CoolProp builds the superancillaries of all of its fluids when it first loads, 0.43 s of its 0.46 s load. optmat now sets COOLPROP_DISABLE_SUPERANCILLARIES_ENTIRELY before importing it (unless already set), hides CoolProp's stdout notice of it, and tells CoolProp a subcritical state is the vapour (iphase_gas), as every caller has checked, since without superancillaries CoolProp's own phase search refuses the domain's states just above the triple point. Densities are bitwise unchanged against 0.9.1 over every gas's domain; saturation pressures move by at most 3e-11 (oxygen at its triple point 2e-9). TC-1095. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HAYtF6Xu3t9Fr5Spcc6Y4i
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69b77b2205
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sys.stdout.flush() | ||
| saved = os.dup(1) |
There was a problem hiding this comment.
Flush native output before redirecting stdout
When stdout is redirected to a pipe or file, native libraries can have buffered output pending before the first real-gas call. sys.stdout.flush() only flushes Python's stream, so that native output remains buffered until _flush_c_streams() runs while descriptor 1 points to /dev/null, silently discarding the caller's output along with CoolProp's notice. This is reproducible by calling libc printf before entering _quiet_stdout(). Flush the native streams before redirecting descriptor 1 as well as before restoring it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7043d9b: _quiet_stdout now flushes C's buffers before redirecting descriptor 1 as well as before restoring it. test_native_output_written_before_the_block_is_kept checks it with libc printf; it fails without the fix.
# Conflicts: # REGISTER.md
…n standard output The switch stayed in os.environ after the import, so a child process took it for the user's and CoolProp printed its notice there (three tests that read a child's output failed in CI); it is now removed after the import. C's buffers are also flushed before descriptor 1 is redirected, so native output written earlier is not discarded (review). The register entry is TC-1096: main took TC-1095 for BBO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HAYtF6Xu3t9Fr5Spcc6Y4i
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… move without superancillaries Without superancillaries CoolProp reports an equation's stated critical temperature rather than its superancillary's critical point (oxygen 154.581 K for 154.599 K; others within 2e-5), a field of every equation's identity, and its saturation solve is less precise close to the critical point (up to 6.5e-8 within 1 K; worse within tens of microkelvin of helium's and SF6's). The macOS gate's golden identities failed on it. The maintainer chose to raise EVALUATION_VERSION; 57 golden identities re-recorded, no golden value changed. TC-1096, the changelog fragment and the manual now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HAYtF6Xu3t9Fr5Spcc6Y4i
CoolProp 8.0.0 builds the superancillaries of all of its ~120 fluids the first time it loads. That is 0.43 s of its 0.46 s load, and every solprop run with a built-in gas pays it (real-gas density, flow viscosity). With
COOLPROP_DISABLE_SUPERANCILLARIES_ENTIRELYset, the load takes 0.067 s.Changes (TC-1096)
_coolprop()sets the variable for the import alone, then removes it so child processes don't inherit it. It hides CoolProp's stdout notice about it, flushing C's buffers before and after the redirect._update_gastells CoolProp a state below the critical temperature is the vapour (iphase_gas); every caller has already checked that. Without superancillaries, CoolProp's own phase search refuses pressures below the triple point's, so every gas's round-trip test failed just above the triple point.EVALUATION_VERSIONofoptmat.gas.eosis raised to 2. 57 golden identities are re-recorded (equations of state, mixtures, transport and air models). No golden value changed.Checked against 0.9.1 (with superancillaries)
ValueError.Tests:
tests/test_coolprop_loading.pykeeps the density and saturation comparison and checks:Measured in a solprop capillary run (helium, RDW example): the recipe build takes 0.26 s instead of 0.52 s. solprop will need a release with this and a new pin.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HAYtF6Xu3t9Fr5Spcc6Y4i