Thermodynamic models¶
Convenience builders that turn component names into a ready EOS or gamma-phi
EquilibriumModel (Peng-Robinson, NRTL, UNIQUAC, UNIFAC), plus the lightweight
modified-Raoult helpers for quick ideal-ish estimates.
Model builders¶
models
¶
Model bridge: turn component names + a method choice into an equilibrium model.
The thermo equilibrium models (EOSModel and
GammaPhiModel) take array constants (tc, pc,
omega) and, for gamma-phi, an activity model. A flowsheet, however, works in
component names. This module resolves names to those arrays (reusing the cached
lookup in fugacio.sim.properties) and assembles the activity model from the
curated binary database (NRTL / UNIQUAC) or predictive group contribution
(UNIFAC / modified UNIFAC), returning a ready, differentiable
EquilibriumModel.
The returned object is what the gamma-phi-aware unit operations
(fugacio.sim.separations) and the T-x-y / P-x-y / azeotrope helpers
(fugacio.sim.diagrams) consume, so a flowsheet can switch from
Peng-Robinson to NRTL by swapping one constructor call, and stays end-to-end
differentiable, including with respect to the activity-model parameters.
Classes:
| Name | Description |
|---|---|
UnifacModel |
An |
Functions:
| Name | Description |
|---|---|
eos_model_for |
Build an |
nrtl_model_for |
Gamma-phi model with NRTL liquid from the curated binary database. |
uniquac_model_for |
Gamma-phi model with UNIQUAC liquid from the curated database (with |
unifac_model_for |
Gamma-phi model with a predictive UNIFAC liquid (no fitted parameters needed). |
UnifacModel
dataclass
¶
An ActivityModel adapter over predictive UNIFAC.
Wraps fugacio.thermo.unifac_activity (classic, Hansen VLE parameters)
or fugacio.thermo.modified_unifac_activity (Dortmund, T-dependent) so
that group-contribution predictions present the same ln_gamma(x, T) API as
the fitted activity models. Carries no fitted leaves: it is a pure predictor
keyed by the (static) component names.
Methods:
| Name | Description |
|---|---|
ln_gamma |
Log activity coefficients predicted by (modified) UNIFAC. |
ln_gamma
¶
Log activity coefficients predicted by (modified) UNIFAC.
eos_model_for
¶
eos_model_for(
components: Sequence[str],
*,
eos: CubicEOS = PR,
kij: Array | None = None,
use_database_kij: bool = False,
) -> EOSModel
Build an EOSModel for named components.
Pass use_database_kij=True to fill the binary interaction matrix from the
curated ChemSep Peng-Robinson k_ij set (fugacio.thermo.kij_from_database);
pairs without a curated value stay at zero. An explicit kij takes precedence.
nrtl_model_for
¶
nrtl_model_for(
components: Sequence[str],
*,
eos: CubicEOS = PR,
kij: Array | None = None,
vapor: str = "ideal",
poynting: bool = False,
phi_saturation: bool = False,
strict: bool = False,
alpha_default: float = 0.3,
) -> GammaPhiModel
Gamma-phi model with NRTL liquid from the curated binary database.
Pairs absent from the database default to athermal interaction unless
strict=True; see fugacio.thermo.nrtl_from_database.
uniquac_model_for
¶
uniquac_model_for(
components: Sequence[str],
*,
eos: CubicEOS = PR,
kij: Array | None = None,
vapor: str = "ideal",
poynting: bool = False,
phi_saturation: bool = False,
strict: bool = False,
) -> GammaPhiModel
Gamma-phi model with UNIQUAC liquid from the curated database (with r/q).
unifac_model_for
¶
unifac_model_for(
components: Sequence[str],
*,
dortmund: bool = False,
eos: CubicEOS = PR,
kij: Array | None = None,
vapor: str = "ideal",
poynting: bool = False,
phi_saturation: bool = False,
) -> GammaPhiModel
Gamma-phi model with a predictive UNIFAC liquid (no fitted parameters needed).
Set dortmund=True for modified UNIFAC (Dortmund) with temperature-dependent
group interactions; otherwise classic UNIFAC is used.
Modified-Raoult helpers¶
vle
¶
Vapor-liquid equilibrium for binary mixtures (modified Raoult's law).
A deliberately small but real vertical slice that sits on top of
fugacio.thermo: it combines Antoine vapor pressures with Margules
activity coefficients to compute a bubble-point pressure. Everything is
differentiable end-to-end with respect to composition, temperature, and the
activity-model parameters.
Functions:
| Name | Description |
|---|---|
antoine_psat |
Saturation pressure from the base-10 Antoine equation. |
bubble_pressure |
Bubble-point pressure and vapor composition for a binary at fixed |
antoine_psat
¶
Saturation pressure from the base-10 Antoine equation.
log10(Psat) = a - b / (temperature + c)
Pressure and temperature units follow whatever convention the Antoine constants were fit in; Fugacio does not impose one here.
bubble_pressure
¶
bubble_pressure(
x1: ArrayLike,
temperature: ArrayLike,
antoine1: Antoine,
antoine2: Antoine,
a12: ArrayLike = 0.0,
a21: ArrayLike = 0.0,
) -> tuple[Array, Array]
Bubble-point pressure and vapor composition for a binary at fixed T, x.
Uses modified Raoult's law p_i = x_i * gamma_i * Psat_i with two-parameter
Margules activity coefficients. Setting a12 = a21 = 0 recovers ideal
(Raoult's law) behaviour.
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
|