Skip to main content

stages-thermo

A staged-separation (distillation) learning library and fast steady-state column solver, built on vle-thermo.

import stages — walk the full pedagogical ladder of column methods (McCabe–Thiele → Ponchon–Savarit → Fenske–Underwood–Gilliland shortcut → rigorous MESH: bubble-point, sum-rates, inside-out, full Newton), each implemented from scratch and anchored to its textbook equations, with a granular, batch-capable API ("numpy for distillation columns"). All thermodynamics come from vle-thermo; this package adds none of its own.

The ladder's terminal target is an atmospheric crude distillation unit — hundreds of pseudocomponents, pumparounds, steam-stripped side strippers, and products specified on D86 95 % points and gaps rather than mole-fraction purity.

pip install stages-thermo           # import name is `stages`
pip install "stages-thermo[plot]"   # + matplotlib for the staircase diagrams

Status: 0.3.x ships the first three rungs of the ladder — the binary McCabe–Thiele (Milestone 1) and Ponchon–Savarit (Milestone 2) layers and the multicomponent FUG shortcut (Milestone 3): equilibrium and enthalpy–composition (H–x–y) curves from real thermodynamics, minimum reflux by geometric pinch detection (tangent pinches included), stage stepping with Murphree efficiency, total reflux, N(R), the energy-exact difference-point construction (with condenser/reboiler duties), the NRTL γ-φ model, per-phase enthalpies, Fenske–Underwood–Gilliland + Kirkbride + Winn with relative volatilities computed from vle-thermo K-values (fug), the multicomponent K-value / dew-point / flash surface on ThermoSystem, and the diagram plots (staircase, H–x–y, Gilliland). The rigorous MESH solvers land milestone by milestone — see the repo's ROADMAP.md. 1.0 ships inside-out (Boston–Britt/Russell) as the flagship rigorous solver alongside Wang–Henke and sum-rates; the crude-column capability follows at 2.0, and Naphtali–Sandholm (the specialist for strongly nonideal columns) at 2.1. The API may still move before 1.0.

import stages

# Real thermodynamics from vle-thermo: Peng–Robinson benzene–toluene at 1 atm
# (light component first; units K / kPa absolute / mole fractions).
sys = stages.ThermoSystem.peng_robinson(["benzene", "toluene"])
curve = stages.EquilibriumCurve.from_thermo(sys, 101.325)

# Minimum reflux by pinch detection — tangent pinches included …
r = stages.rmin(curve, x_distillate=0.95, x_bottoms=0.05, z_feed=0.50, q=1.0)

# … then the full construction. Rich result objects, never bare numbers:
design = stages.mccabe_thiele(curve, 0.95, 0.05, 0.50, reflux=1.5 * r.r_min)
print(f"N = {design.n_stages:.2f} stages, feed stage {design.feed_stage}, "
      f"R_min = {r.r_min:.3f}")

design.stages          # every (x, y) stage corner
design.staircase       # the full polyline, ready to plot
design.rectifying      # operating lines as slope/intercept
r.pinch, r.tangent     # where the pinch sits, and whether it's a tangent pinch

# The staircase diagram (requires the [plot] extra):
# from stages import plotting
# plotting.plot_mccabe_thiele(design, curve, show_rmin=True)

Strongly non-ideal systems go through the γ-φ route — the same construction, different thermodynamics:

# van Laar methanol–water (the system validated in vle's Chapter IV notebooks).
mw = stages.ThermoSystem.van_laar(["methanol", "water"], 0.5853, 0.3458)
curve_mw = stages.EquilibriumCurve.from_thermo(mw, 101.325)

Rung 2 — Ponchon–Savarit — closes the energy balance on the enthalpy–composition (H–x–y) diagram, so it also returns the condenser and reboiler duties (which McCabe–Thiele cannot):

# H–x–y curve: saturated-liquid and -vapor enthalpies alongside y*(x).
ec = stages.EnthalpyCurve.from_thermo(sys, 101.325)
ps = stages.ponchon_savarit(ec, x_distillate=0.95, x_bottoms=0.05,
                            z_feed=0.50, reflux=1.5)
print(f"N = {ps.n_stages:.2f} stages, feed stage {ps.feed_stage}")
print(f"Q_C/F = {ps.q_condenser:,.0f}, Q_R/F = {ps.q_reboiler:,.0f} kJ/kmol feed")
ps.delta_d, ps.delta_b   # the two difference points (poles), (x, H) in kJ/kmol

# NRTL for strongly non-ideal aqueous-organic systems (a12/a21 in kJ/kmol):
aw = stages.ThermoSystem.nrtl(["ammonia", "water"], a12=-1800.0, a21=-1200.0, alpha=0.2)
# from stages import plotting; plotting.plot_ponchon_savarit(ps, ec)

Rung 3 — the FUG shortcut — is multicomponent. Every relative volatility comes from vle-thermo K-values at the two ends of the column (the "FUG(K)" form that a simulator uses to seed its rigorous solver), refined to self-consistency; each rung is also callable on its own (fenske_n_min, underwood_roots, gilliland_stages, kirkbride_split, winn_fit, …):

# A depropanizer: propane (LK) / isobutane (HK), 98 % key recoveries, R = 1.3 R_min.
c3 = stages.ThermoSystem.peng_robinson(["ethane", "propane", "isobutane", "n-butane", "n-pentane"])
fug = stages.fug(c3, 1500.0, feed=[5, 40, 20, 25, 10], light_key=1, heavy_key=2,
                 lk_recovery=0.98, hk_recovery=0.98, q=1.0, reflux_factor=1.3)
print(fug)   # FugResult(N_min=12.95, R_min=1.885, R=2.450, N=26.47, feed_stage=15, ...)
fug.underwood_roots, fug.n_min_winn, fug.d, fug.x_d, fug.t_top   # every intermediate
# from stages import plotting; plotting.plot_gilliland(fug)

The executable learning path lives in the repo's notebooks/ — 01-mccabe-thiele.ipynb, 02-ponchon-savarit.ipynb and 03-shortcut-design.ipynb design benzene–toluene, methanol–water, acetone–water and ammonia–water binaries (the last on a reference chart digitized from the Pátek–Klomfar correlation) and a C2–C5 depropanizer end-to-end, with exercises.

The native core is a Rust crate (stages-thermo on crates.io) with PyO3 bindings; wheels are abi3 (cp310-abi3-*), so one wheel per (OS, arch) covers CPython 3.10+.

License

MIT © Miguel Roberto Jackson Ugueto

Metadata

Release files for stages-thermo 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stages-thermo 0.3.0
File Size Uploaded Provenance Actions
stages_thermo-0.3.0.tar.gz 89.7 kB With provenance Details for stages_thermo-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for stages-thermo 0.3.0
File Actions
stages_thermo-0.3.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for stages_thermo-0.3.0-cp310-abi3-win_amd64.whl
stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl
stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl
stages_thermo-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for stages_thermo-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 2.0 MB

Release files / stages_thermo-0.3.0.tar.gz

Download URL stages_thermo-0.3.0.tar.gz
Size 89.7 kB
Tags Source
SHA-256 checksum
How to use checksums
81194cfef17802c9967287aad332cacdb338b55a86831077e49e22197c442534
BLAKE2b-256 checksum
How to use checksums
02d318ce8ffca34da0dc2d2ed3934f43b22ca80a94a6c39e7e57bc6a94d925d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / stages_thermo-0.3.0-cp310-abi3-win_amd64.whl

Download URL stages_thermo-0.3.0-cp310-abi3-win_amd64.whl
Size 409.5 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b46b589e7919ed77bb24cc2af6d1dac9a0a5162bdadcec8f40b7f03e4c406e82
BLAKE2b-256 checksum
How to use checksums
eb97377696db256f669b73a56881b255fd844d4b77ebcfdcb45bf50be8ef366b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 514.5 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
59a83153401e98f048fd3e6b2e9611bc11649a48f028d4902b61dcb3513ba6c4
BLAKE2b-256 checksum
How to use checksums
97d64b71a5d2bdc1fa0e4e08092d35b03fb5e50db86834b4f22b28bd25376b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL stages_thermo-0.3.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 496.0 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
a078a19ad83cf09f06277304b07fda6c1b15a34ce8d188a8cfa9fa0d4cfa4888
BLAKE2b-256 checksum
How to use checksums
692882d5777d96f719abfe6fb88042b15b03ee693c2773cac79c3a5292c7ca8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / stages_thermo-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL stages_thermo-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 469.7 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5dc64074f9e88c0b2e52f56e5c943a6368eb3ac5c4fc43b1f280d13ad0228f66
BLAKE2b-256 checksum
How to use checksums
253c59c158f69f307aa59157b025e8ebe3edca4abaae4fdbb5571da2e9e9823d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Security for stages-thermo 0.3.0

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for stages_thermo-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page