Skip to content

Fugacio

Open, differentiable thermodynamics and process simulation, with an AI design copilot. See the project README for the full overview.

Fugacio is built as three layered packages (strict direction thermo < sim < copilot, enforced in CI):

Everything is written in JAX and the iterative solvers carry implicit-function-theorem gradient rules, so an entire flowsheet is end-to-end differentiable, including through phase equilibrium.

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)

# Exact sensitivity of vapour product flow to drum temperature:
jax.grad(lambda T: flash_drum(feed, T, 20e5)[0].total)(320.0)

Correctness as an executable harness

Physical correctness is continuously machine-checked: first-principles consistency laws that need no external data (Gibbs-Duhem, equifugacity, fugacity-pressure identity, phase stability), automatic-differentiation gradients checked against finite differences, and opt-in differential testing against open reference codes: CoolProp and chemicals for pure-fluid properties and the reference Helmholtz EOS layer (IAPWS-95, Span–Wagner), thermo / Clapeyron.jl for activity coefficients, and Cantera for reaction equilibrium and standard-state thermochemistry.