pub struct ThermoSystem { /* private fields */ }Expand description
An owned mixture + model selection that answers equilibrium questions.
vle_thermo::flash::SystemSpec borrows all its data, so this struct owns
the components and parameter matrices and assembles a fresh (cheap, Copy)
spec per call. Construct once per column problem, reuse for every
evaluation.
Implementations§
Source§impl ThermoSystem
impl ThermoSystem
Sourcepub fn peng_robinson(names: &[&str]) -> Result<Self>
pub fn peng_robinson(names: &[&str]) -> Result<Self>
A φ-φ system: Peng–Robinson (1976) for both phases, classical mixing,
all kij = 0. Components are loaded from vle-thermo’s built-in
database by (case-insensitive) name.
This is the right default for near-ideal hydrocarbon pairs like benzene–toluene.
§Errors
StagesError::Thermo if any name is not in the database.
Sourcepub fn van_laar(names: &[&str; 2], a12: f64, a21: f64) -> Result<Self>
pub fn van_laar(names: &[&str; 2], a12: f64, a21: f64) -> Result<Self>
A γ-φ system: van Laar activity coefficients for the liquid, ideal-gas vapor. Components are loaded from vle-thermo’s built-in database by (case-insensitive) name.
§Arguments
a12,a21— the dimensionless van Laar parameters, in the component order given bynames(a12multiplies the first component’s infinite-dilution log-γ:ln γ₁^∞ = A₁₂).
For methanol(1)–water(2), vle Chapter IV (Orbey & Sandler Table 4.5)
regressed A₁₂ = 0.5853, A₂₁ = 0.3458.
§Errors
StagesError::Thermo if any name is not in the database.
Sourcepub fn nrtl(names: &[&str; 2], a12: f64, a21: f64, alpha12: f64) -> Result<Self>
pub fn nrtl(names: &[&str; 2], a12: f64, a21: f64, alpha12: f64) -> Result<Self>
A γ-φ system: NRTL activity coefficients (Renon & Prausnitz, AIChE J. 1968, 14, 135) for the liquid, ideal-gas vapor. Components are loaded from vle-thermo’s built-in database by (case-insensitive) name.
NRTL is the general aqueous-organic infrastructure the ladder needs from M2 on (Ponchon–Savarit’s ammonia–water showcase, and the later extractive/azeotropic ternaries). Its binary form has three parameters: two interaction energies plus one shared non-randomness factor.
§Arguments
a12,a21— the NRTL interaction energiesgᵢⱼ − gⱼⱼin kJ/kmol, in the component order given bynames. vle-thermo formsτᵢⱼ = aᵢⱼ / (R·T)internally (R = 8.31451 kJ/(kmol·K)), so these are the energy parameters, not the dimensionless τ.alpha12— the (symmetric) non-randomness parameter α₁₂ = α₂₁, dimensionless, typically 0.2–0.47.
§Errors
StagesError::Thermo if any name is not in the database.
Sourcepub fn n_components(&self) -> usize
pub fn n_components(&self) -> usize
Number of components in the mixture.
Sourcepub fn component_names(&self) -> Vec<String>
pub fn component_names(&self) -> Vec<String>
Component names, in the order compositions are indexed.
Sourcepub fn bubble_temperature(&self, p: f64, x: &[f64]) -> Result<BubblePoint>
pub fn bubble_temperature(&self, p: f64, x: &[f64]) -> Result<BubblePoint>
Bubble temperature of a liquid of composition x at pressure p.
§Arguments
p— pressure in kPa (absolute)x— liquid mole fractions (must sum to 1)
§Returns
BubblePoint with value = bubble temperature in K.
Sourcepub fn bubble_pressure(&self, t: f64, x: &[f64]) -> Result<BubblePoint>
pub fn bubble_pressure(&self, t: f64, x: &[f64]) -> Result<BubblePoint>
Bubble pressure of a liquid of composition x at temperature t.
§Arguments
t— temperature in Kx— liquid mole fractions (must sum to 1)
§Returns
BubblePoint with value = bubble pressure in kPa (absolute).
Sourcepub fn phase_enthalpy(
&self,
t: f64,
p: f64,
comp: &[f64],
phase: Phase,
) -> Result<f64>
pub fn phase_enthalpy( &self, t: f64, p: f64, comp: &[f64], phase: Phase, ) -> Result<f64>
Molar enthalpy of comp in the given phase at (t, p).
This is the energy quantity Ponchon–Savarit needs: the H–x–y diagram is
saturated-liquid and saturated-vapor enthalpy versus composition. The
call routes to vle-thermo’s phase_enthalpy_entropy, which for the γ-φ
liquid assembles ideal-gas terms minus the per-component
Clausius–Clapeyron condensation enthalpy plus the excess enthalpy
Hᴱ — the γ-φ enthalpy route (see the M2 lesson in
docs/theory/ponchon-savarit.md). Entropy is computed alongside but
deliberately discarded — P–S never uses it; widen the return to a
pair only when a later milestone needs S.
§Arguments
t— temperature in Kp— pressure in kPa (absolute)comp— phase mole fractions (must sum to 1, length = n components)phase—Phase::LiquidorPhase::Vapor
§Returns
Molar enthalpy in kJ/kmol, relative to the system’s t_ref/p_ref
datum with per-component reference enthalpy zero (P–S uses differences).
§Errors
StagesError::Dimension on a length mismatch; StagesError::Thermo
if the property evaluation fails.
Trait Implementations§
Source§impl Clone for ThermoSystem
impl Clone for ThermoSystem
Source§fn clone(&self) -> ThermoSystem
fn clone(&self) -> ThermoSystem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ThermoSystem
impl RefUnwindSafe for ThermoSystem
impl Send for ThermoSystem
impl Sync for ThermoSystem
impl Unpin for ThermoSystem
impl UnsafeUnpin for ThermoSystem
impl UnwindSafe for ThermoSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.