Open, differentiable thermodynamics and process simulation, with an AI design copilot.
Fugacio is building an open-source alternative to closed, expensive process simulators. Its numerical core uses JAX to support gradients through physical properties, phase equilibrium, and converged flowsheets for optimization, parameter estimation, and machine learning.
The project is in pre-alpha. Model availability and numerical convergence don't establish experimental validity; see validation and qualification for the current evidence and limitations.
Documentation · API reference · Quickstart · Development
- Make process simulation open and accessible. Provide an inspectable, extensible foundation for thermodynamics, process design, and control without dependence on proprietary simulators or datasets.
- Make the full calculation differentiable. Carry gradients through equilibrium, recycle loops, and design calculations so engineers can optimize processes, fit parameters, and integrate machine learning with physical models.
- Make physical correctness continuously checkable. Treat conservation laws, thermodynamic consistency, reference comparisons, experimental evidence, and gradient checks as acceptance criteria as each model is added.
- Make AI-assisted design accountable to the engine. Give a provider-neutral copilot access to simulation and optimization tools, with numerical reports and physical acceptance checks to support its results.
Use Python 3.11 or later and uv. From a checkout of this repository, install the workspace packages and development dependencies:
uv sync --locked --all-packagesRun the following example with uv run python. It separates a hydrocarbon feed
with a Peng-Robinson flash and computes the sensitivity of vapor flow to drum
temperature. Temperature is in kelvins, pressure in pascals, and flow in moles per
second.
import jax
import jax.numpy as jnp
from fugacio.sim import Stream, flash_drum
feed = Stream.from_fractions(
("methane", "propane", "n-pentane"),
jnp.array([0.5, 0.3, 0.2]),
flow=100.0,
t=320.0,
p=20e5,
)
vapor, liquid = flash_drum(feed, 320.0, 20e5)
# Differentiate vapor flow through the converged phase-equilibrium solve.
d_vapor_dT = jax.grad(lambda t: flash_drum(feed, t, 20e5)[0].total)(320.0)
print(f"Vapor: {vapor.total:.3f} mol/s; liquid: {liquid.total:.3f} mol/s")
print(f"Vapor-flow sensitivity: {d_vapor_dT:.3f} mol/(s K)")Equilibrium and recycle solvers use implicit differentiation of converged
solutions. A failed solve never returns a plausible number: value-only calls
return NaN, checked *_with_info calls return a solve report, and eager unit
operations raise. The reliability guide explains solve
reports, stability checks, phase inventories, warm starts, continuation, and
derivative limits. Upgrading from 0.8? See the
upgrading guide.
Steady-state processes use a shared process graph. Sequential and simultaneous execution use the same physical unit kernels; plant sensitivities assemble local unit derivatives into a sparse implicit system. Saved design specifications join the process equations directly.
Each unit operation compiles once per property-package structure and
specification kind; new operating points and package parameters reuse the
compiled kernel. To reuse compiled kernels across processes, call
fugacio.sim.enable_compilation_cache(".jax_cache") before the first
calculation.
For a saved process workflow, export an example, solve it, and keep an audited run and engineering report:
uv run fugacio example heater heater.json
uv run fugacio run heater.json --output run.json --report report.md --jax-cache .jax_cache--jax-cache DIR (or the FUGACIO_JAX_CACHE environment variable) keeps
compiled kernels on disk, so later commands skip most compilation. The
process cases guide covers case revisions, both
flowsheet backends, bounded design specifications, sweeps, constrained
optimization, gradient checks, and copilot submissions tied to computed runs.
It includes a rigorous depropanizer with heat recovery, a measured NRTL heater
whose independent holdout is reevaluated when the case is loaded, and a
Joule-Thomson letdown into an adiabatic separator.
The performance guide covers compile-once kernels, the
persistent compilation cache, structured column solves, reusable forward and
reverse sensitivities, and benchmarks that retain timing, memory, and
physical-acceptance evidence.
The uv workspace contains three computational layers and an umbrella package:
| Package | Import | Role |
|---|---|---|
fugacio-thermo |
fugacio.thermo |
Physical properties, phase equilibrium, parameter regression, and reaction thermochemistry. |
fugacio-sim |
fugacio.sim |
Unit operations, flowsheets, optimization, dynamics, control, and heat integration. |
fugacio-copilot |
fugacio.copilot |
AI design agent with a JSON tool registry and provider-neutral tool-calling loop. |
fugacio |
No additional module | Installs all three component packages together. |
fugacio-copilot depends on fugacio-sim, which depends on fugacio-thermo.
Import Linter enforces these boundaries
in CI. The component packages share the fugacio namespace and are published as
separate distributions with coordinated versions.
The documentation site provides worked examples and an API reference generated from package docstrings.
- Thermodynamics: A common property-package interface covers cubic equations of state, activity-coefficient models, molecular PC-SAFT, and reference Helmholtz equations of state, including IAPWS-95 water and steam. Guides also cover phase equilibrium and stability, physical and transport properties, and parameter regression. UNIFAC and Joback provide group-contribution estimates where curated parameters aren't available.
- Steady-state simulation: Energy-balanced units, automatic recycle partitioning and tear selection, optional physical audits of every solved stream, and two-sided heat exchangers support flowsheeting. The engine also includes rigorous MESH distillation, reactors and reactive separations, and simultaneous equation-oriented flowsheet solving. Reactive workflows share validated reaction sets across package-based reactors and reactive MESH columns, with saved reaction/recycle and liquid reactive-separation examples, checked derivatives, and design studies.
- Process design: Differentiable constrained optimization, design specifications, equipment sizing, and screening economics are covered in the optimization guide. Heat integration adds pinch analysis, utility targets, area and cost targeting, and heat-exchanger network synthesis.
- Dynamics and control: Dynamic simulation combines differentiable ODE integrators, dynamic units, PID control, and controller tuning. Advanced control adds linear, nonlinear, and economic model predictive control, plus state estimation.
- AI design copilot: A tool registry exposes calculations across the stack through a multi-turn agent loop, with OpenAI, Anthropic (Claude Opus 5 by default), and mock providers. The accountable design loop requires an accepted current-case run and generates its final report from recorded metrics.
Physical correctness is a project requirement. Fugacio uses an executable acceptance harness with four complementary sources of evidence:
- Physical consistency: Mass and energy balances, Gibbs-Duhem and Maxwell relations, equifugacity, and tangent-plane phase-stability tests.
- Reference implementations: Differential tests against open codes, including CoolProp, chemicals, thermo, Clapeyron.jl, and Cantera.
- Experimental measurements: Data from the NIST ThermoML Archive, with source provenance, parameter fitting, and independent holdout validation.
- Derivative checks: Automatic-differentiation gradients compared with finite differences.
These checks provide repeatable feedback for incremental development, including long-running, AI-assisted development. Numerical convergence, physical acceptance, and agreement with measurements are assessed separately.
The measured qualification workflow covers 447 experimental conditions across 20 binary systems from seven NIST ThermoML records. The committed matrix contains two qualified property cases, two unqualified liquid-liquid equilibrium cases, and 18 cases without curated NRTL parameters. Qualification applies to specific systems and properties; it doesn't extend to every model family.
Parameter evidence distinguishes measured fits, curated data, predictive methods,
and explicit zero-interaction assumptions. package_for rejects missing NRTL
or UNIQUAC pairs unless the caller explicitly permits them with
parameter_policy="allow_ideal". The older bundled
parameter bank remains synthetic demonstration data, separate from the measured
corpus.
To rebuild the matrix and run the ethanol-water example, which fits one publication, validates against a second, and checks an energy-balanced heater:
just qualifyInstall just to use the repository's task runner,
then run just to list available tasks.
| Task | Command |
|---|---|
| Format and autofix | just fmt |
| Lint and check formatting | just lint |
| Check types | just types |
| Check import boundaries | just imports |
| Run tests without external reference packages | just test |
| Run lint, types, import boundaries, tests, and qualification | just check |
| Run reference comparison tests | just oracles |
| Rebuild measured qualification and process example | just qualify |
| Benchmark process solves and derivatives with resource limits | just benchmark |
| Run the pinned Julia/Clapeyron comparison | just clapeyron-oracles |
| Preview documentation | just docs-serve |
| Build documentation with warnings treated as errors | just docs-build |
just test runs uv run pytest, excluding tests marked oracle.
just oracles installs the optional reference dependencies through uv and runs
those tests explicitly. CI runs reference comparisons on pull requests, pushes
to main, and a weekly schedule. The separate Julia comparison requires Julia
1.10.10 and uses Clapeyron 0.6.25 with a committed dependency manifest.
On Intel Macs, uv.lock resolves JAX 0.4.38, the last release with Intel macOS
wheels, which cover Python 3.11 through 3.13. Everywhere else it resolves current
JAX. CI runs only current JAX, so a change that relies on a newer JAX API can pass
CI and still fail on an Intel Mac. The required-environments setting in
pyproject.toml keeps this fork in the lock. Once no one develops on an Intel
Mac, delete that setting and run uv lock.
Releases are automated. When a merge to main includes a feat, fix, or
perf commit, the release workflow stamps the next version, refreshes the lock,
and publishes every package to PyPI. CI rehearses that release on every pull
request with scripts/rehearse_release.py, so a release that would fail fails
before merge.
Documentation sources live in docs/. Public APIs use Google-style
docstrings, enforced by Ruff; keep their argument, return, and exception
descriptions accurate. just docs-serve provides live preview.
just docs-build matches the strict CI build and requires Cairo and Pango for
social-card rendering.
Fugacio is licensed under the Apache License 2.0.