stages-thermo (engine)
A staged-separation (distillation) learning library and fast steady-state
column solver, built on vle-thermo.
This is the Rust core crate. It walks the full pedagogical ladder of column methods — McCabe–Thiele → Ponchon–Savarit → Fenske–Underwood–Gilliland shortcut → rigorous MESH (Wang–Henke, Burningham–Otto, Naphtali–Sandholm) — each implemented from scratch and anchored to its textbook equations, and exposes a granular, batch-capable API ("numpy for distillation columns").
All thermodynamics (K-values, enthalpies, derivatives) come from vle-thermo;
this crate adds none of its own.
[]
= "0.1"
Status:
0.2.xships the first two rungs of the ladder — the binary McCabe–Thiele (Milestone 1) and Ponchon–Savarit (Milestone 2) layers: 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, and the binary column material balances. Multicomponent and rigorous MESH solvers land milestone by milestone — see the repo'sROADMAP.md. The API may still move before1.0.
use McCabeThieleSpec;
use ;
use CondenserKind;
use ThermoSystem;
// Peng–Robinson benzene–toluene at 1 atm, components from vle-thermo's
// built-in database (light component first). Units: K, kPa absolute.
let system = peng_robinson.unwrap;
let curve = from_thermo.unwrap;
// Minimum reflux by pinch detection, then the full construction at 1.5·R_min.
let r = rmin.unwrap;
let design = mccabe_thiele
.unwrap;
// Rich result objects, never bare numbers: stages, staircase polyline,
// operating lines, pinch analysis — everything on the diagram is queryable.
println!;
Rung 2 — Ponchon–Savarit — steps the same-shaped staircase on the enthalpy–composition (H–x–y) diagram, closing the energy balance through two difference points and returning the condenser/reboiler duties:
use EnthalpyCurve;
use ;
use CondenserKind;
use ThermoSystem;
let system = peng_robinson.unwrap;
// The H–x–y curve: saturated-liquid and -vapor enthalpies alongside y*(x).
let ec = from_thermo.unwrap;
let ps = ponchon_savarit
.unwrap;
println!;
The same constructions run on a γ-φ activity-model curve (ThermoSystem::van_laar
or the NRTL ThermoSystem::nrtl), the constant-α idealization
(EquilibriumCurve::constant_alpha — on which Fenske's and Underwood's closed
forms are exact, which is how the stepping kernels are unit-tested), or raw
literature data (EquilibriumCurve::from_points / EnthalpyCurve::from_points).
The Python bindings (PyO3) are gated behind the python feature, which maturin
enables when building the wheel published to PyPI as stages-thermo
(import stages). cargo add stages-thermo gets a pure-Rust crate with no
PyO3 in its dependency closure.
License
MIT © Miguel Roberto Jackson Ugueto