Commit Graph

121 Commits

Author SHA1 Message Date
Ian Bell
61351d449c docs: add predefined mixtures table to Mixtures page (#2719)
* docs: add predefined mixtures table to Mixtures documentation

Adds a new section "Predefined mixtures" to Web/fluid_properties/Mixtures.rst
listing all 154 predefined mixtures with their components and mole fractions.
Each mixture is tested at build time; those that fail (missing binary interaction
parameters or not present in the compiled library) are flagged in a Notes column.

Also updates the code examples in the new section to use the required .mix suffix,
and registers the generation script in the doc build task list.

Closes #2711

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: improve predefined mixtures table error messages and auto-count

- Replace CAS numbers with fluid names in binary interaction parameter errors
- Detect and report missing pure fluids by name
- Distinguish 'not registered as predefined mixture' from missing BIP
- Write PredefinedMixturesCount.rst so the mixture count in Mixtures.rst
  is generated automatically rather than hardcoded

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 20:12:33 -04:00
Ian Bell
c649586e8c feat(docs): add interactive 3D molecule viewers to fluid pages (#2707)
* feat(docs): add interactive 3D molecule viewers to fluid pages

Use py3Dmol + PubChem SDF data to embed a rotate-and-drag 3D (or 2D
fallback) molecule viewer on each pure fluid documentation page.

- fetch_pubchem_sdf(): downloads 3D conformer SDF from PubChem REST API
  (falls back to 2D), caching results in molecule_sdf/ to avoid repeated
  network calls on doc rebuilds
- generate_3dmol_rst(): inlines the SDF as a JS template literal inside a
  .. raw:: html block — no extra static files needed at Sphinx build time
- FluidGenerator.write(): validates InChIKey with regex before fetching;
  pseudo-pure fluids (Air, R404A, etc.) without InChIKeys are silently skipped
- conf.py: loads 3Dmol.js from CDN via html_js_files
- .gitignore: excludes the generated molecule_sdf/ cache directory

Restores molecule visualisation that was removed in April 2025 (the old
approach tried to embed an image directive inside a CSV table, which is
invalid RST; this implementation places the viewer in the RST template).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docs): serve 3Dmol.js locally to eliminate CORS errors

Download 3Dmol-min.js to _static/ at Sphinx build time (same pattern
as MathJax) instead of loading it from the CDN via html_js_files.
Serving the script same-origin removes the cross-origin restriction
that caused CORS errors when docs were opened from file:// or a local
dev server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docs): correct 3Dmol viewer positioning and initialization timing

3Dmol.js sets its canvas to position:absolute;top:0;left:0 and only
auto-sets the container to position:relative when the container's
inline style.position === "static". An unstyled div has style.position
=== "" so the check fails, and the canvas escapes the container and
anchors to the nearest positioned ancestor in the Sphinx page layout.

Fix: add position:relative explicitly to the viewer container div.

Also defer viewer init via DOMContentLoaded so layout is finalized
before createViewer reads the container dimensions, and call v.resize()
before v.render() to sync the WebGL canvas to the container size.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docs): disable MathJax SRE to prevent CORS errors on file:// URLs

MathJax 4.0's Speech Rule Engine fetches sre/mathmaps/base.json at
runtime via fetch(). Chrome blocks this when docs are opened from a
local file:// URL (null origin). Disabling enableExplorer and
enableAssistiveMml prevents SRE from initialising entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docs): load 3Dmol before require.js to fix AMD conflict

sphinx.ext.mathjax injects require.js at priority 500. When 3Dmol
loads after it, AMD detection fires and calls define([], factory)
instead of setting window.$3Dmol directly. Since nothing ever calls
require(['3Dmol-min']), the factory never runs and the viewer silently
fails (infinite setTimeout retry, no console errors).

Setting priority 450 ensures 3Dmol loads before require.js.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docs): add retry logic to downloads in conf.py using requests

Replace urllib.request.urlretrieve with a requests-based _download()
helper that retries up to 5 times (exponential backoff, factor=2) on
transient HTTP errors and timeouts. Fixes CI build failures when
the MathJax or 3Dmol.js downloads time out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 10:41:10 -04:00
Ian Bell
267d64533a Superancillaries for pure fluids (#2511)
* Expansions are fully wrapped, looking good. Next step is the set of expansions that is the 1D approximation

* Get 1D approx working via cython

* Count solutions

* SuperAncillary class is working

>1000x speedup for water
Time for C++!

* Superancillaries are working!

In C++, speedup is more than 2000x. In Python, more like 150x because of Python <-> C++ overhead

* Add pmax check for PQ superancillary calls

* Update tests

* Allow T limits to be obtained

* Implement get_fluid_parameter_double for getting superanc value

* Add tests for getting parameters from superanc

* Script for testing superancillaries for sphinx

* Microoptimizations; don't help speed

The limiting factor remains the clear function, which takes about 30 ns

* Add R125 superancillary

* Use the release from fastchebpure for the files

* Drop a .gitignore in the unzipped folder

* Update superancillary injection script

* Turn on superancillaries by default

* Missing header

* Many int conversions in superancillary

* Another int cast

* More annoying solution for boost iter max

* Fix warnings

* One more warning

* Clear up the calculation of rho

* Update docs_docker-build.yml

Use arm64 since the containers were built on mac

* Superfluous ;

* Update backend.py

* Get the critical points working for superancillaries

* Fix wrapping changes of xmin&xmax methods

* squelch warnings

* Version 0 of jupyter notebook for docs

* Try to add the notebook to the docs

* Add jupyter notebook for superancillary

* Lots of updates to superancillary notebook

* More updates to docs

* Skip pseudo-pure for superancillary docs

* Fix output of superancillary figures

* Add superancillary plots to docs for the page for each fluid

* Make a placeholder figure for fluids without superancillary

* Add superancillary plots to task list

* Bump to release fixing m-xylene

* Relax the location of the REFPROP stuff

* Change default name for R-1336mzz(E)

* No need for figures to be so large

* Don't need REFPROP setting

* Bump to fastchebpure release with methanol

* Benchmark caching options

* Benchmark more granularly

* Add the fast methods to public API for HEOS class

* Back to memset - can memset with 0 but no other value

* Fix how caching is managed in Helmholtz class

* Close to final implementation

Perhaps a tiny bit more optimization possible?

* Update function name

* Make message more accurate

* Fix init order

* Expose update_QT_pure_superanc to Python

* Fix when _reducing is set for pures

* Fix the post_update

* Indent

* Notebook

* Notebook

* Make ln(p) construction lazy

Only really matters for debug builds

* Also make reference non-const

* Inject superancillary for methanol

* Make the superancillary loading entirely lazy in debug

* Fix PH bug for Nitrogen

 Closes #2470

* Force the clear to be called on SatL and SatV

To invalidate them at start

* Default is non-lazy superancillary loading

* Add CMake option to have lazy-loading superancillaries [skip ci]

Not a good idea unless doing very narrow testing
2025-05-17 20:27:19 -04:00
Ian Bell
b19c29128d Render the formulae with roman characters [skip ci] 2025-04-21 11:01:27 -04:00
Ian Bell
27a58a8962 Fix scientific notation for vapor pressures [skip ci] 2025-04-21 10:22:09 -04:00
Ian Bell
b21fec98ae Squelch some imagemagick warnings 2025-04-07 20:45:37 -04:00
Ian Bell
cde223a6b3 Fix MPL deprecation 2025-04-07 19:36:48 -04:00
Ian Bell
e3032baf45 Pick the runner script based on the platform 2025-04-07 19:36:38 -04:00
Ian Bell
8bbc985a5c More updates for new py/np 2025-04-07 08:37:21 -04:00
Ian Bell
87a738ecaf escape latex for new python 2025-04-07 07:34:21 -04:00
Jorrit Wronski
698ea7b2e2 Avoid killing the script with invalid inputs 2023-08-08 14:34:31 +02:00
Jorrit Wronski
f00c36a9ce Support act to run local debugging sessions of the github actions 2023-08-08 14:34:00 +02:00
Jorrit Wronski
2841dfe217 Build the docs for v6.4.2 (#2191)
- Streamlined the build of the HTML documentation based on a private docker image.
- Invoke doxygen and Sphinx to create the final HTML pages.
- Employ a cache for the GitHub actions to store the output of the expensive tasks.
- Restructured the GitHub actions builders and introduced a naming scheme.
- Fixed a few typos in the docs.
- Automatically publish the documentation to GitHub pages.
2022-12-07 11:55:16 +01:00
Julien Marrec
6913fc41dc Format macros, they keep getting picked incrementally by clang format + Strip trailing whitespaces
```
find . -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx|py)$' | xargs -I@ sed -i 's/[ \t]*$//' "@"
```
2022-04-01 07:39:35 -04:00
Ian Bell
135cb41ae5 REFPROP comparison is not too slow 2020-05-03 13:45:02 -04:00
ian
e72110bd65 Fix CP import 2019-11-09 13:24:34 -07:00
ian
479171ecb9 Fix import 2019-11-08 22:11:32 -07:00
ian
9ce757a80b Fix delimiter 2019-11-08 21:22:37 -07:00
Jorrit Wronski
bbbde3b164 Feature/docs py3 (#1814)
* Add main example

* Modified the writer object in an attempt to fix #1786

* More Python 3 fixes, see #1786

* Added more Python 3
2019-04-06 11:33:48 -06:00
Ian Bell
3b1eb50324 More pep8 whitespace; see #1612 2019-01-12 20:45:25 -07:00
Ian Bell
8d131a2e59 More safe whitespace changes 2019-01-12 20:24:55 -07:00
Ian Bell
f0f5c484bc Return error code on failure; see #1786 2019-01-12 10:31:44 -07:00
Ian Bell
d1765dc0ab Fix minor issues in sphinx docs 2019-01-12 10:19:08 -07:00
Ian Bell
3ecd5e0104 Run python scripts unbuffered 2019-01-12 01:24:40 -07:00
Ian Bell
7484314882 One more six 2019-01-12 00:59:41 -07:00
Ian Bell
96483e04a8 Remove prints 2019-01-12 00:34:57 -07:00
Ian Bell
05bd19547b Some more 2->3 2019-01-12 00:34:24 -07:00
Ian Bell
f4bbb24471 Remove unused imports (besides they are Py 2.x only) 2019-01-11 22:34:24 -07:00
Ian Bell
51449edef1 Switch over to new example script 2019-01-11 18:58:28 -07:00
scls19fr
5045c96322 Fix Python print (#1746)
* Fix print

* Some manual fixes

* Revert
2018-10-19 22:59:31 +02:00
luzpaz
93f4a986e2 Misc. typos (#1726)
Found via `codespell -i 3 -w -I ../coolprop-word-whitelist.txt` whereby whitelist consists of:
```
cas
formate
hel
nd
te
tim
ue
uint
```
2018-08-14 23:06:49 -06:00
Matthis Thorade
19a4875879 More autopep8 (#1621)
* autopep8 rule-groups E101,W1,W2,W3

* autopep8 with rule group E3 (blank lines)

autopep8 --in-place --recursive --max-line-length=200 --exclude="externals" --select="E101,E3,W1,W2,W3" .

* tabs and space W191

* autopep8 aggressive
2017-12-13 14:43:41 +01:00
Matthis Thorade
526cb198a4 autopep8 whitespace (#1613)
* autopep8 whitespace only:

--select="E101,W1,W2"

* revert single file: web2py_online.py

Should this be a .py file at all?

* revert file Tickets/1443.py because the diff looked strange:

maybe there is an encoding problem?

* Rename web2py_online.py to web2py_online.rst
2017-12-12 08:32:38 -07:00
Jeff Henning
1837540aca Documentation Update (#1589)
* Add misc ignores so dynamic doc content can be built in repository

* Update to documentation Makefile for clean html build on Windows

* Updates to instructions for doc builds on Windows with Anaconda

* Added documentation page for IF97

* Fix errors on documentation page for Fluid_Properties/Mixtures

* Updated HighLevelAPI docs for clarity, IF97 ref, Python 3 support, and typos

* Modify print command to support build on Python 2 or 3

* Update to documentation to compile the Python wrapper with VC++
2017-11-14 04:49:01 -05:00
Ian Bell
3d7a072201 Fix some small backwards compatibility issues with pandas 2016-11-07 20:35:35 -07:00
Ian Bell
f5eebdff5b Add InChI and friends to web pages; see #1069 2016-07-27 20:08:28 -06:00
Jorrit Wronski
1d279031d2 Added the validation script and figure to the incompressible page, might resolve #1045 2016-07-17 12:12:49 +02:00
Jorrit Wronski
fe0cd37294 Started to include the transport properties for LiBr 2016-07-16 00:16:21 +02:00
Jorrit Wronski
68d646166e Fixed the last (?) viscosity factor 2016-07-16 00:16:20 +02:00
Jorrit Wronski
b8a0f48d30 Started to work on #1045 2016-07-12 20:11:57 +02:00
Ian Bell
75d121d9fd Add acentric factor to web docs; see #1075 2016-05-22 13:03:01 +02:00
Ian Bell
7ac9b3d787 Shorten title for REFPROP validation figures; closes #1076 2016-05-22 12:32:33 +02:00
Ian Bell
03b76960ce Workaround hang in plot_directive 2016-05-11 09:41:10 -06:00
Ian Bell
02d74f6844 Touch the time-stamped file for expensive builds only after success 2016-05-07 20:30:54 -06:00
Ian Bell
e305f2b7f4 Fix REFPROP comparison string 2016-05-07 16:47:38 -06:00
Ian Bell
a117eedbb0 Disable image resizing
Could be done by setting DPI in savefig
2016-05-02 08:19:39 -06:00
Ian Bell
09ac0afcfa Tidy up sphinx docs; closes #1029 2016-05-01 18:40:59 -06:00
Ian Bell
47e24ad294 Add REFPROP version to REFPROP comparison script; closes #1026 2016-05-01 16:38:27 -06:00
Ian Bell
987c8eafa5 Make the logo smaller 2016-04-28 09:07:12 -06:00
Jorrit Wronski
dbd07f1387 forgot the match the aspect ratio, see #1029 2016-04-26 13:47:19 +02:00