1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Flash, bubble/dew, critical-point, and parameter-regression algorithms
//! (Milestone 9, Phase 15 of MODERNIZATION_PLAN.md).
//!
//! This module is the top of the VLE calculation stack: it turns the
//! fugacity/energy building blocks from the EOS, activity, virial, and
//! mixture layers into the phase-equilibrium answers a user actually asks
//! for — "at this T and P, how does my mixture split into liquid and
//! vapor?" and its inverses (bubble/dew), plus the mixture critical point
//! and the kij/Aij parameter fits.
//!
//! ## Algorithm choices (Track A of PERFORMANCE_PROPOSAL.md)
//!
//! The thesis-era iteration schemes are replaced by the modern
//! Michelsen-derived methodology; the legacy two-stage schemes are kept
//! only as test oracles. All Newton loops consume the Milestone 8.3
//! analytic/AD composition Jacobians (§L). See the per-file docs:
//!
//! - [`init`] — Wilson K-value initialization (§I)
//! - [`stability`] — tangent-plane-distance stability analysis (§I)
//! - [`isothermal`] — GDEM-accelerated SS → Newton, Rachford-Rice via
//! Halley inside the Leibovici–Neoschil window (§J, §F)
//! - `bubble` / `dew` — log-variable Newton (§K) *(later in M9)*
//! - `critical` — Heidemann with analytic Helmholtz derivatives (§G)
//! - `kij_regression` / `aij_regression` — Brent / Levenberg-Marquardt
//!
//! ## The two thermodynamic paths
//!
//! K-values `Kᵢ = yᵢ/xᵢ` come from equal component fugacities across the
//! phases, and the engine supports both classical routes (see [`SystemSpec`]
//! and [`k_values`]):
//!
//! - **φ-φ** — an EOS models *both* phases; `Kᵢ = φ̂ᵢᴸ/φ̂ᵢⱽ` from the liquid
//! and vapor mixture fugacity coefficients (Chapter IV cases 1, 2, 7).
//! - **γ-φ** — an activity model for the liquid, an EOS/virial/ideal vapor;
//! `Kᵢ = γᵢ·Psat,ᵢ·φᵢˢᵃᵗ / (φ̂ᵢⱽ·P)` (modified Raoult; Chapter IV cases
//! 3–6). With an ideal vapor this collapses to `Kᵢ = γᵢ·Psat,ᵢ/P`.
//! - **Refinery methods (M20)** — `LiquidModel::GraysonStreed`
//! (`Kᵢ = νᵢγᵢ/φ̂ᵢⱽ`) and `LiquidModel::BraunK10` (`Kᵢ = Pᵢᴹᴮ/(φ̂ᵢⱽP)`),
//! plus [`free_water::flash_free_water`] for steam-stripped feeds.
use Error;
pub use ;
/// Errors from the flash / equilibrium layer.