JAXprop
JAX-compatible Python package for real-fluid thermodynamic properties, phase equilibria and metastable states, with automatic differentiation.
🔗 Docs: turbo-sim.github.io/jaxprop
📦 PyPI: pypi.org/project/jaxprop
Note: This project is based on the CoolProp library but is not affiliated with or endorsed by the CoolProp project.
Key features
- Compute and plot phase envelopes and spinodal lines for pure fluids.
- Evaluate thermodynamic properties from Helmholtz energy–based equations of state, including metastable states inside the two-phase region.
- Perform flash calculations for any input pair with a custom solver and user-defined initial guesses.
- Work with structured property dictionaries and immutable
FluidStateobjects. - Evaluate properties over arrays of input conditions for efficient parametric studies and plotting.
- Use JAX-enabled evaluators with
jit,gradandvmap, according to each model's declared capabilities.
Installation
pip install jaxprop
Uniform fluid constructor (0.6.0)
Version 0.6.0 is published on PyPI. The release passed hosted Linux and Windows HEOS tests and downstream Barotropy verification. See the 0.6.0 release notes and migration guide before upgrading.
import jaxprop as jxp
fluid = jxp.Fluid("CO2", method="coolprop", backend="HEOS")
state = fluid.get_state(jxp.PT_INPUTS, 10e6, 400.0)
print(state.density)
callback = jxp.Fluid("CO2", method="coolprop_jax", backend="HEOS")
gas = jxp.Fluid("Air", method="perfect_gas")
table = jxp.Fluid(
"CO2",
method="bicubic",
backend="HEOS",
table_options={
"h_min": 600e3, "h_max": 850e3,
"p_min": 5e6, "p_max": 12e6,
"N_h": 16, "N_p": 16,
},
)
method selects the evaluator or approximate physical model. backend selects
the CoolProp source used for evaluation, table generation, calibration and
reference data; it defaults to HEOS. Inspect fluid.capabilities before using
phase operations, diagnostics or JAX transformations.
CoolProp and its callback accept errors="raise" (default) or errors="mask".
Mask mode preserves successful batch elements and exposes failed elements as
NaNs with integer state.status codes. Transformed callback calls require it:
import jax
temperature = jax.jit(
lambda h: callback.get_state(jxp.HmassP_INPUTS, h, 8e6, errors="mask").T
)
The callback supports first-order finite-difference derivatives. Perfect gas
and bicubic tables support raise, mask and clip; their transformed calls
require explicit mask or clip mode. For example:
adjusted = gas.get_state(jxp.PT_INPUTS, -1.0, 300.0, errors="clip")
print(adjusted.p, adjusted.clipped, adjusted.status)
Clipping returns a consistent adjusted state with a clipping flag. Nonfinite
inputs remain failed elements. Perfect gas now preserves calibrated source
enthalpy/entropy and heat capacity with consistent ideal-gas equations, enabling
22 properties. Gradient helpers return PropertyDerivatives with SI units and
a separate .primal state. Bicubic clipping projects onto the configured
enthalpy/pressure rectangle. Fixed-coordinate inverses can also project a target
when the table proves a monotone response; unsuccessful or ambiguous inverses
remain failed elements. Inverse budgets are configured once with the
inverse_max_steps and inverse_tolerance table options. Inspect capabilities
and the public contract or
implementation checklist for current support.
Binary mixtures
Configure fixed mass fractions once, then use the same three-argument state call:
nitrogen = jxp.Fluid("Nitrogen", method="perfect_gas")
oxygen = jxp.Fluid("Oxygen", method="perfect_gas")
mixture = jxp.Fluid(
"working_mix",
method="binary_mixture",
model_options={
"components": (nitrogen, oxygen),
"mass_fractions": (0.4, 0.6),
},
)
state = mixture.get_state(jxp.PT_INPUTS, 1e6, 500.0)
The model supports PT, HmassP and PSmass, returning 27 fields. It represents
constituent parcels at common pressure and temperature without mass exchange or
molecular mixing entropy. Heat capacities and compressibilities follow that
model's thermodynamic identities. speed_of_sound and speed_of_sound_pT are
the pressure/temperature equilibrium speed; speed_of_sound_p is the distinct
thermally frozen Wood speed. Composition is not vapor quality; composite quality
and saturation requests are explicitly unsupported.
Active perfect-gas/bicubic components use native JAX with explicit mask/clip
inside transformations. All-active FluidJAX components use one whole-mixture
callback with mask mode and first-order state-input derivatives. Direct-source
and source/native/callback hybrids use eager raise/mask; compiled hybrid support
remains deferred. Host configurations are fixed component snapshots; native
component numerical parameters remain dynamic. Inspect mixture.capabilities.
FluidMix translates the legacy name/mass-ratio constructor once and returns
the same FluidBinaryMixture class; FluidTwoComponent is an alias of that class.
Optional inverse controls belong in model_options. See the binary contract
and the water/nitrogen example.
See the verified Phase 9 checklist
and full-state timing report.
For application-owned JAX settings, complete compiled consumers, worker serialization, source-EOS plotting and physical/formal metastable tables, see the fluid lifecycle guide. Configuration snapshots are inspection records; verified evaluator snapshots preserve the full model.
For interface changes and reproducible example commands, see the migration guide and example workflows.
Development and citation
Roberto Agromayor is the main developer, with contributions from Srinivas Prakash Diwanji, Alberto Bergamin and Andrea Cioffi.
Citation metadata is provided in CITATION.cff. For version-specific reproducibility, also record the release or commit used.
Metadata
Release files for jaxprop 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jaxprop-0.6.1.tar.gz | 177.6 kB | Without provenance | Details for jaxprop-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jaxprop-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for jaxprop-0.6.1-py3-none-any.whl |
Total release size: 368.7 kB
Release files / jaxprop-0.6.1.tar.gz
| Download URL | jaxprop-0.6.1.tar.gz |
|---|---|
| Size | 177.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e010f3f964e907491f6effec3bb7eb8881c23fa28f2864c4cc30b35d0cf7ab9c
|
|
BLAKE2b-256 checksum How to use checksums |
619b3a42b16b3f60825bbb4a488d26738778a9ec67b5d7fe932d956233084af6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.16 Linux/7.0.0-1019-azure
|
Release files / jaxprop-0.6.1-py3-none-any.whl
| Download URL | jaxprop-0.6.1-py3-none-any.whl |
|---|---|
| Size | 191.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9195aab3df0b258c2197ba1dcd6a1cc417e896e545e9a625e209fb0ccd1e6bf0
|
|
BLAKE2b-256 checksum How to use checksums |
df26cd0d084138ba07d94fb8d29b6d65e996950d4e1515d9544f9ee8bab70da6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.16 Linux/7.0.0-1019-azure
|
Security for jaxprop 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.