pub struct EquationOfState {
pub r_gas: f64,
pub temperature: f64,
}Expand description
Classical cubic equations of state for real gases.
Provides van der Waals, Peng-Robinson, and Redlich-Kwong equations.
Fields§
§r_gas: f64Universal gas constant R.
temperature: f64Temperature T.
Implementations§
Source§impl EquationOfState
impl EquationOfState
Sourcepub fn new(r_gas: f64, temperature: f64) -> Self
pub fn new(r_gas: f64, temperature: f64) -> Self
Creates a new EOS calculator.
r_gas is usually 8.314 J/(mol·K).
Sourcepub fn van_der_waals_pressure(&self, molar_volume: f64, a: f64, b: f64) -> f64
pub fn van_der_waals_pressure(&self, molar_volume: f64, a: f64, b: f64) -> f64
Van der Waals pressure: P = RT/(V-b) - a/V².
§Arguments
molar_volume- Molar volume V (m³/mol).a- Attractive parameter a (Pa·m⁶/mol²).b- Repulsive parameter b (m³/mol).
Sourcepub fn vdw_critical_constants(a: f64, b: f64, r_gas: f64) -> (f64, f64, f64)
pub fn vdw_critical_constants(a: f64, b: f64, r_gas: f64) -> (f64, f64, f64)
Van der Waals critical constants from parameters a and b.
Returns (T_c, P_c, V_c).
Sourcepub fn peng_robinson_pressure(
&self,
molar_volume: f64,
a_c: f64,
b: f64,
kappa: f64,
tc: f64,
) -> f64
pub fn peng_robinson_pressure( &self, molar_volume: f64, a_c: f64, b: f64, kappa: f64, tc: f64, ) -> f64
Peng-Robinson pressure.
P = RT/(V-b) - a(T) / (V(V+b) + b(V-b))
where a(T) = a_c · α(T), α(T) = [1 + κ(1 - √(T/T_c))]².
Sourcepub fn redlich_kwong_pressure(&self, molar_volume: f64, a: f64, b: f64) -> f64
pub fn redlich_kwong_pressure(&self, molar_volume: f64, a: f64, b: f64) -> f64
Redlich-Kwong pressure.
P = RT/(V-b) - a / (T^0.5 V(V+b))
Sourcepub fn compressibility_factor(&self, pressure: f64, molar_volume: f64) -> f64
pub fn compressibility_factor(&self, pressure: f64, molar_volume: f64) -> f64
Compressibility factor Z = PV/(RT).
Trait Implementations§
Source§impl Clone for EquationOfState
impl Clone for EquationOfState
Source§fn clone(&self) -> EquationOfState
fn clone(&self) -> EquationOfState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EquationOfState
impl RefUnwindSafe for EquationOfState
impl Send for EquationOfState
impl Sync for EquationOfState
impl Unpin for EquationOfState
impl UnsafeUnpin for EquationOfState
impl UnwindSafe for EquationOfState
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.