Imagine cooling a closed bottle containing methane and butane. Initially it may contain only gas; after cooling, a liquid can appear. Both substances can be present in both phases, but in different proportions.
These routines predict equilibrium according to the selected model. They do not describe how fast droplets form, heat transfer, or the time required to reach equilibrium.
In yaeos, most phase-equilibrium procedures return the
EquilibriumState type, which holds the phase compositions, molar volumes,
pressure, temperature, phase fraction, and iteration information. Multiphase
calculations return MPEquilibriumState.
Use mole fractions throughout: z = n/sum(n) converts component mole amounts
n to a normalized feed z. Keep the component order identical to the model’s
critical constants and interaction parameters. Temperatures are in K,
pressures in bar, and phase molar volumes in L/mol.
For a mixture at fixed temperature and pressure, phase equilibrium requires the equality of the chemical potentials, or equivalently the fugacities, of each component in every phase:
together with the overall mass balance
where is the feed mole fraction, and are the heavy- and light-phase mole fractions, and is the light-phase mole fraction. Eliminating and with the K-factors gives the Rachford-Rice equation:
Here is the number of components, selects one component, and
is its dimensionless fugacity coefficient, a measure of
non-ideal behavior. and label liquid and vapor. Equal fugacity
means there is no thermodynamic driving force to transfer a component between
the phases. means component is enriched in the y phase,
not that it is absent from the x phase.
The fraction is on a mole basis, not a mass or volume basis. For a feed of moles, the phases contain and moles. Their volumes are therefore and . A small vapor mole fraction can occupy a large volume.
For the GeModel flash and stability routines discussed here, activity
coefficients replace fugacity coefficients to describe liquid-liquid
equilibrium. These routines do not automatically add vapor pressures or a
vapor-phase model to create a vapor-liquid calculation.
The main phase-equilibrium calculations are:
| Calculation | Specification | Routine |
|---|---|---|
| Two-phase flash | flash, flash_second_order | |
| Two-phase flash | flash | |
| Bubble/dew pressure | Feed composition and ; solve and incipient composition | saturation_pressure |
| Bubble/dew temperature | Feed composition and ; solve and incipient composition | saturation_temperature |
| Phase envelope | Continuation from a saturation point | pt_envelope_2ph |
| Stability analysis | Tangent-plane distance | min_tpd |
| Critical point | Critical conditions | critical_point |
| Multiphase flash | several phases | pt_mp_flash |
The detailed pages are organized as follows:
An equation of state can have several volumes at the same composition,
temperature, and pressure. root_type="liquid" or "vapor" selects a root;
"stable" selects the preferred homogeneous root at that composition. This
does not test whether a lower-Gibbs-energy state exists at different phase
compositions.
Likewise, equality of fugacities and material balance give a candidate equilibrium. A local solver can converge to identical phases, a metastable split, or an equilibrium that is unstable to a third phase. Global equilibrium requires the lowest appropriate thermodynamic potential among all admissible states. Stability searches help test this but finite numerical searches are not a proof that no other state exists.
EquilibriumState typeA two-phase result contains:
| Field | Meaning |
|---|---|
kind |
Routine-dependent: "split", "bubble", "dew", "liquid-liquid", "critical", or "failed" |
x |
Heavy-phase mole fractions |
y |
Light-phase mole fractions |
Vx, Vy |
Phase molar volumes [L/mol] |
T, P |
Temperature [K] and pressure [bar] |
beta |
Mole fraction of the light phase |
iters |
Iterations used |
A typical phase-equilibrium workflow is:
Start with the complete PT flash example. Its material-balance and fugacity checks are useful even when the solver reports success.
k0, p0, t0, y0) from previous calculations when
scanning a region. Continuation is more robust than independent calculations.flash; min_tpd can provide one. flash_second_order
initializes these models with stability analysis when k0 is absent.