MaximaLabsOpen app

Thermodynamics — Equations of State

Cubic EoS (Peng-Robinson, SRK) for hydrocarbons/light gases and activity-coefficient models (NRTL, UNIQUAC, electrolyte-NRTL) for polar/non-ideal liquid mixtures — selected per `thermo_package` on the flowsheet schema.

thermodynamicseosnrtlpeng-robinson
Concept

Two families, picked per-flowsheet via thermo_package. Cubic EoS (Peng-Robinson, SRK) model the whole fluid — vapor and liquid — from one equation, good for hydrocarbons/light gases across pressure. Activity-coefficient models (NRTL, UNIQUAC) instead correct an ideal-vapor assumption with a liquid non-ideality factor γᵢ, tuned to real VLE data — the right tool for polar/hydrogen-bonding mixtures like ethanol-water.

The math
Show the governing equations
P=RTV−b−a α(T)V(V+b)+b(V−b)(Peng-Robinson)P = \frac{RT}{V-b} - \frac{a\,\alpha(T)}{V(V+b)+b(V-b)} \quad \text{(Peng-Robinson)}
ln⁡γi=∑jτjiGjixj∑kGkixk+∑jxjGij∑kGkjxk(τij−∑mxmτmjGmj∑kGkjxk) (NRTL)\ln\gamma_i = \frac{\sum_j \tau_{ji}G_{ji}x_j}{\sum_k G_{ki}x_k} + \sum_j\frac{x_jG_{ij}}{\sum_k G_{kj}x_k}\left(\tau_{ij}-\frac{\sum_m x_m\tau_{mj}G_{mj}}{\sum_k G_{kj}x_k}\right)\ \text{(NRTL)}
Ki=γiPisatP(activity-coefficient K-value)K_i = \frac{\gamma_i P_i^{sat}}{P} \quad \text{(activity-coefficient K-value)}
Execution

Failure codes

SPEC_THERMODYNAMICALLY_IMPOSSIBLENRTL/UNIQUAC selected for a component pair with no pinned binary interaction parameters (only ethanol-water is pinned) — the server auto-coerces to Peng-Robinson and attaches a warning rather than crashing.
FLASH_NO_SOLUTIONRachford-Rice found no physically valid vapor fraction in [0,1] at the given T/P/composition.
The ethanol water distillation flowsheet in the MaximaLabs workbench

The example as it opens in the workbench. Click to enlarge.

Launch in MaximaLabs Workspace
Try it live

NRTL VLE curve

Live T-xy diagram — ethanol/water, NRTL, 1 atm
0.536037001351373x/y ethanolT (K)

Computed on load by the same NRTL gamma-phi flash the solver runs — including the minimum-boiling ethanol-water azeotrope at ~xethanol ≈ 0.89.