thermo.eos_mix module¶

class
thermo.eos_mix.
GCEOSMIX
[source]¶ Bases:
thermo.eos.GCEOS
Class for solving a generic pressureexplicit threeparameter cubic equation of state for a mixture. Does not implement any parameters itself; must be subclassed by a mixture equation of state class which subclasses it. No routines for partial molar properties for a generic cubic equation of state have yet been implemented, although that would be desireable. The only partial molar property which is currently used is fugacity, which must be implemented in each mixture EOS that subclasses this.
\[P=\frac{RT}{Vb}\frac{a\alpha(T)}{V^2 + \delta V + \epsilon}\]Main methods are fugacities, solve_T, and a_alpha_and_derivatives.
fugacities is a helper method intended as a common interface for setting fugacities of each species in each phase; it calls fugacity_coefficients to actually calculate them, but that is not implemented here. This should be used when performing flash calculations, where fugacities are needed repeatedly. The fugacities change as a function of liquid/gas phase composition, but the entire EOS need not be solved to recalculate them.
solve_T is a wrapper around GCEOS‘s solve_T; the only difference is to use half the average mixture’s critical temperature as the initial guess.
a_alpha_and_derivatives implements the Van der Waals mixing rules for a mixture. It calls a_alpha_and_derivatives from the purecomponent EOS for each species via multiple inheritance.
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. Uses the parent class’s interface to compute pure component values. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. Calls setup_a_alpha_and_derivatives before calling a_alpha_and_derivatives for each species, which typically sets a and Tc. Calls cleanup_a_alpha_and_derivatives to remove the set properties after the calls are done.
For use in solve_T this returns only a_alpha if full is False.
\[ \begin{align}\begin{aligned}a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\end{aligned}\end{align} \]Parameters: T : float
Temperature, [K]
full : bool, optional
If False, calculates and returns only a_alpha
quick : bool, optional
Only the quick variant is implemented; it is little faster anyhow
Returns: a_alpha : float
Coefficient calculated by EOSspecific method, [J^2/mol^2/Pa]
da_alpha_dT : float
Temperature derivative of coefficient calculated by EOSspecific method, [J^2/mol^2/Pa/K]
d2a_alpha_dT2 : float
Second temperature derivative of coefficient calculated by EOSspecific method, [J^2/mol^2/Pa/K**2]
Notes
The exact expressions can be obtained with the following SymPy expression below, commented out for brevity.
>>> from sympy import * >>> a_alpha_i, a_alpha_j, kij, T = symbols('a_alpha_i, a_alpha_j, kij, T') >>> a_alpha_ij = (1kij)*sqrt(a_alpha_i(T)*a_alpha_j(T)) >>> #diff(a_alpha_ij, T) >>> #diff(a_alpha_ij, T, T)

fugacities
(xs=None, ys=None)[source]¶ Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase.
Requires fugacity_coefficients to be implemented by each subclassing EOS.
In addition to setting fugacities_l and/or fugacities_g, this also sets the fugacity coefficients phis_l and/or phis_g.
\[ \begin{align}\begin{aligned}\hat \phi_i^g = \frac{\hat f_i^g}{x_i P}\\\hat \phi_i^l = \frac{\hat f_i^l}{x_i P}\end{aligned}\end{align} \]Parameters: xs : list[float], optional
Liquidphase mole fractions of each species, []
ys : list[float], optional
Vaporphase mole fractions of each species, []
Notes
It is helpful to check that fugacity_coefficients has been implemented correctly using the following expression, from [R246].
\[\ln \hat \phi_i = \left[\frac{\partial (n\log \phi)}{\partial n_i}\right]_{T,P,n_j,V_t}\]For reference, several expressions for fugacity of a component are as follows, shown in [R246] and [R247].
\[ \begin{align}\begin{aligned}\ln \hat \phi_i = \int_{0}^P\left(\frac{\hat V_i} {RT}  \frac{1}{P}\right)dP\\\ln \hat \phi_i = \int_V^\infty \left[ \frac{1}{RT}\frac{\partial P}{ \partial n_i}  \frac{1}{V}\right] d V  \ln Z\end{aligned}\end{align} \]References
[R246] (1, 2, 3) Hu, Jiawen, Rong Wang, and Shide Mao. “Some Useful Expressions for Deriving Component Fugacity Coefficients from Mixture Fugacity Coefficient.” Fluid Phase Equilibria 268, no. 12 (June 25, 2008): 713. doi:10.1016/j.fluid.2008.03.007. [R247] (1, 2) Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.

solve_T
(P, V, quick=True)[source]¶ Generic method to calculate T from a specified P and V. Provides SciPy’s newton solver, and iterates to solve the general equation for P, recalculating a_alpha as a function of temperature using a_alpha_and_derivatives each iteration.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Unimplemented, although it may be possible to derive explicit expressions as done for many purecomponent EOS
Returns: T : float
Temperature, [K]


class
thermo.eos_mix.
PRMIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.GCEOSMIX
,thermo.eos.PR
Class for solving the PengRobinson cubic equation of state for a mixture of any number of compounds. Subclasses PR. Solves the EOS on initialization and calculates fugacities for all components in all phases.
The implemented method here is fugacity_coefficients, which implements the formula for fugacity coefficients in a mixture as given in [R248]. Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i=0.45724\frac{R^2T_{c,i}^2}{P_{c,i}}\\ b_i=0.07780\frac{RT_{c,i}}{P_{c,i}}\\\alpha(T)_i=[1+\kappa_i(1\sqrt{T_{r,i}})]^2\\\kappa_i=0.37464+1.54226\omega_i0.26992\omega^2_i\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
For PV initializations, SciPy’s newton solver is used to find T.
References
[R248] (1, 2) Peng, DingYu, and Donald B. Robinson. “A New TwoConstant Equation of State.” Industrial & Engineering Chemistry Fundamentals 15, no. 1 (February 1, 1976): 5964. doi:10.1021/i160057a011. [R249] Robinson, Donald B., DingYu Peng, and Samuel YK Chung. “The Development of the Peng  Robinson Equation and Its Application to Phase Equilibrium in a System Containing Methanol.” Fluid Phase Equilibria 24, no. 1 (January 1, 1985): 2541. doi:10.1016/03783812(85)870357. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = PRMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (3.625735065042031e05, 0.0007006656856469095) >>> eos.fugacities_l, eos.fugacities_g ([793860.8382114634, 73468.55225303846], [436530.9247009119, 358114.63827532396])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, kappa, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 4¶

cleanup_a_alpha_and_derivatives
()[source]¶ Removes properties set by setup_a_alpha_and_derivatives; run by GCEOSMIX.a_alpha_and_derivatives after a_alpha is calculated for every component

fugacity_coefficients
(Z, zs)[source]¶ Literature formula for calculating fugacity coefficients for each species in a mixture. Verified numerically. Applicable to most derivatives of the PengRobinson equation of state as well. Called by fugacities on initialization, or by a solver routine which is performing a flash calculation.
\[ \begin{align}\begin{aligned}\ln \hat \phi_i = \frac{B_i}{B}(Z1)\ln(ZB) + \frac{A}{2\sqrt{2}B} \left[\frac{B_i}{B}  \frac{2}{a\alpha}\sum_i y_i(a\alpha)_{ij}\right] \log\left[\frac{Z + (1+\sqrt{2})B}{Z(\sqrt{2}1)B}\right]\\A = \frac{(a\alpha)P}{R^2 T^2}\\B = \frac{b P}{RT}\end{aligned}\end{align} \]Parameters: Z : float
Compressibility of the mixture for a desired phase, []
zs : list[float], optional
List of mole factions, either overall or in a specific phase, []
Returns: phis : float
Fugacity coefficient for each species, []
References
[R250] Peng, DingYu, and Donald B. Robinson. “A New TwoConstant Equation of State.” Industrial & Engineering Chemistry Fundamentals 15, no. 1 (February 1, 1976): 5964. doi:10.1021/i160057a011. [R251] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.


class
thermo.eos_mix.
SRKMIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.GCEOSMIX
,thermo.eos.SRK
Class for solving the SoaveRedlichKwong cubic equation of state for a mixture of any number of compounds. Subclasses SRK. Solves the EOS on initialization and calculates fugacities for all components in all phases.
The implemented method here is fugacity_coefficients, which implements the formula for fugacity coefficients in a mixture as given in [R252]. Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{Vb}  \frac{a\alpha(T)}{V(V+b)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i =\left(\frac{R^2(T_{c,i})^{2}}{9(\sqrt[3]{2}1)P_{c,i}} \right) =\frac{0.42748\cdot R^2(T_{c,i})^{2}}{P_{c,i}}\\b_i =\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_{c,i}}{P_{c,i}} =\frac{0.08664\cdot R T_{c,i}}{P_{c,i}}\\\alpha(T)_i = \left[1 + m_i\left(1  \sqrt{\frac{T}{T_{c,i}}}\right)\right]^2\\m_i = 0.480 + 1.574\omega_i  0.176\omega_i^2\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
For PV initializations, SciPy’s newton solver is used to find T.
References
[R252] (1, 2) Soave, Giorgio. “Equilibrium Constants from a Modified RedlichKwong Equation of State.” Chemical Engineering Science 27, no. 6 (June 1972): 11971203. doi:10.1016/00092509(72)800964. [R253] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. [R254] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> SRK_eos = SRKMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> SRK_eos.V_l, SRK_eos.V_g (4.104755570185178e05, 0.0007110155639819184) >>> SRK_eos.fugacities_l, SRK_eos.fugacities_g ([817841.6430546846, 72382.81925202628], [442137.1280124604, 361820.79211909405])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, m, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 4¶

cleanup_a_alpha_and_derivatives
()[source]¶ Removes properties set by setup_a_alpha_and_derivatives; run by GCEOSMIX.a_alpha_and_derivatives after a_alpha is calculated for every component

fugacity_coefficients
(Z, zs)[source]¶ Literature formula for calculating fugacity coefficients for each species in a mixture. Verified numerically. Applicable to most derivatives of the SRK equation of state as well. Called by fugacities on initialization, or by a solver routine which is performing a flash calculation.
\[ \begin{align}\begin{aligned}\ln \hat \phi_i = \frac{B_i}{B}(Z1)  \ln(ZB) + \frac{A}{B} \left[\frac{B_i}{B}  \frac{2}{a \alpha}\sum_i y_i(a\alpha)_{ij} \right]\ln\left(1+\frac{B}{Z}\right)\\A=\frac{a\alpha P}{R^2T^2}\\B = \frac{bP}{RT}\end{aligned}\end{align} \]Parameters: Z : float
Compressibility of the mixture for a desired phase, []
zs : list[float], optional
List of mole factions, either overall or in a specific phase, []
Returns: phis : float
Fugacity coefficient for each species, []
References
[R255] Soave, Giorgio. “Equilibrium Constants from a Modified RedlichKwong Equation of State.” Chemical Engineering Science 27, no. 6 (June 1972): 11971203. doi:10.1016/00092509(72)800964. [R256] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.


class
thermo.eos_mix.
PR78MIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.PRMIX
Class for solving the PengRobinson cubic equation of state for a mixture of any number of compounds according to the 1978 variant. Subclasses PR. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i=0.45724\frac{R^2T_{c,i}^2}{P_{c,i}}\\ b_i=0.07780\frac{RT_{c,i}}{P_{c,i}}\\\alpha(T)_i=[1+\kappa_i(1\sqrt{T_{r,i}})]^2\\\kappa_i = 0.37464+1.54226\omega_i0.26992\omega_i^2 \text{ if } \omega_i \le 0.491\\\kappa_i = 0.379642 + 1.48503 \omega_i  0.164423\omega_i^2 + 0.016666 \omega_i^3 \text{ if } \omega_i > 0.491\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
This variant is recommended over the original.
References
[R257] Peng, DingYu, and Donald B. Robinson. “A New TwoConstant Equation of State.” Industrial & Engineering Chemistry Fundamentals 15, no. 1 (February 1, 1976): 5964. doi:10.1021/i160057a011. [R258] Robinson, Donald B., DingYu Peng, and Samuel YK Chung. “The Development of the Peng  Robinson Equation and Its Application to Phase Equilibrium in a System Containing Methanol.” Fluid Phase Equilibria 24, no. 1 (January 1, 1985): 2541. doi:10.1016/03783812(85)870357. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa, with modified acentric factors to show the difference between PRMIX
>>> eos = PR78MIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.6, 0.7], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (3.239642793468722e05, 0.000504337849300222) >>> eos.fugacities_l, eos.fugacities_g ([833048.4511980319, 6160.908815331634], [460717.2776793947, 279598.90103207633])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, kappa, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 4¶


class
thermo.eos_mix.
VDWMIX
(Tcs, Pcs, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.GCEOSMIX
,thermo.eos.VDW
Class for solving the Van der Waals cubic equation of state for a mixture of any number of compounds. Subclasses VDW. Solves the EOS on initialization and calculates fugacities for all components in all phases.
The implemented method here is fugacity_coefficients, which implements the formula for fugacity coefficients in a mixture as given in [R259]. Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P=\frac{RT}{Vb}\frac{a}{V^2}\\a = \sum_i \sum_j z_i z_j {a}_{ij}\\b = \sum_i z_i b_i\\a_{ij} = (1k_{ij})\sqrt{a_{i}a_{j}}\\a_i=\frac{27}{64}\frac{(RT_{c,i})^2}{P_{c,i}}\\b_i=\frac{RT_{c,i}}{8P_{c,i}}\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
For PV initializations, SciPy’s newton solver is used to find T.
References
[R259] (1, 2) Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985. [R260] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = VDWMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (5.8813678514166464e05, 0.0007770869741895237) >>> eos.fugacities_l, eos.fugacities_g ([854533.2669205095, 207126.8497276207], [448470.73633807345, 397826.5439999289])
Attributes
omega Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)Reimplementation of derivatives and excess property calculations, as ZeroDivisionError errors occur with the general solution. set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 4¶

cleanup_a_alpha_and_derivatives
()[source]¶ Removes properties set by setup_a_alpha_and_derivatives; run by GCEOSMIX.a_alpha_and_derivatives after a_alpha is calculated for every component

fugacity_coefficients
(Z, zs)[source]¶ Literature formula for calculating fugacity coefficients for each species in a mixture. Verified numerically. Called by fugacities on initialization, or by a solver routine which is performing a flash calculation.
\[\ln \hat \phi_i = \frac{b_i}{Vb}  \ln\left[Z\left(1  \frac{b}{V}\right)\right]  \frac{2\sqrt{aa_i}}{RTV}\]Parameters: Z : float
Compressibility of the mixture for a desired phase, []
zs : list[float], optional
List of mole factions, either overall or in a specific phase, []
Returns: phis : float
Fugacity coefficient for each species, []
References
[R261] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.


class
thermo.eos_mix.
PRSVMIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None, kappa1s=None)[source]¶ Bases:
thermo.eos_mix.PRMIX
,thermo.eos.PRSV
Class for solving the PengRobinsonStryjekVera equations of state for a mixture as given in [R262]. Subclasses PRMIX and PRSV. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Inherits the method of calculating fugacity coefficients from PRMIX. Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i=0.45724\frac{R^2T_{c,i}^2}{P_{c,i}}\\ b_i=0.07780\frac{RT_{c,i}}{P_{c,i}}\\\alpha(T)_i=[1+\kappa_i(1\sqrt{T_{r,i}})]^2\\\kappa_i = \kappa_{0,i} + \kappa_{1,i}(1 + T_{r,i}^{0.5})(0.7  T_{r,i})\\\kappa_{0,i} = 0.378893 + 1.4897153\omega_i  0.17131848\omega_i^2 + 0.0196554\omega_i^3\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
kappa1s : list[float], optional
Fit parameter; available in [R262] for over 90 compounds, []
Notes
[R262] recommends that kappa1 be set to 0 for Tr > 0.7. This is not done by default; the class boolean kappa1_Tr_limit may be set to True and the problem resolved with that specified if desired. kappa1_Tr_limit is not supported for PV inputs.
For PV initializations, SciPy’s newton solver is used to find T.
[R263] and [R264] are two more resources documenting the PRSV EOS. [R265] lists kappa values for 69 additional compounds. See also PRSV2. Note that tabulated kappa values should be used with the critical parameters used in their fits. Both [R262] and [R265] only considered vapor pressure in fitting the parameter.
References
[R262] (1, 2, 3, 4, 5) Stryjek, R., and J. H. Vera. “PRSV: An Improved PengRobinson Equation of State for Pure Compounds and Mixtures.” The Canadian Journal of Chemical Engineering 64, no. 2 (April 1, 1986): 32333. doi:10.1002/cjce.5450640224. [R263] (1, 2) Stryjek, R., and J. H. Vera. “PRSV  An Improved PengRobinson Equation of State with New Mixing Rules for Strongly Nonideal Mixtures.” The Canadian Journal of Chemical Engineering 64, no. 2 (April 1, 1986): 33440. doi:10.1002/cjce.5450640225. [R264] (1, 2) Stryjek, R., and J. H. Vera. “Vaporliquid Equilibrium of Hydrochloric Acid Solutions with the PRSV Equation of State.” Fluid Phase Equilibria 25, no. 3 (January 1, 1986): 27990. doi:10.1016/03783812(86)800048. [R265] (1, 2, 3) Proust, P., and J. H. Vera. “PRSV: The StryjekVera Modification of the PengRobinson Equation of State. Parameters for Other Pure Compounds of Industrial Interest.” The Canadian Journal of Chemical Engineering 67, no. 1 (February 1, 1989): 17073. doi:10.1002/cjce.5450670125. Examples
PT initialization, twophase, nitrogen and methane
>>> eos = PRSVMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l/g', 3.623552388375633e05, 6349.003406339961, 49.12403359687138)
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, kappa0, kappa1, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 5¶


class
thermo.eos_mix.
PRSV2MIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None, kappa1s=None, kappa2s=None, kappa3s=None)[source]¶ Bases:
thermo.eos_mix.PRMIX
,thermo.eos.PRSV2
Class for solving the PengRobinsonStryjekVera 2 equations of state for a Mixture as given in [R266]. Subclasses PRMIX and PRSV2. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Inherits the method of calculating fugacity coefficients from PRMIX. Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i=0.45724\frac{R^2T_{c,i}^2}{P_{c,i}}\\ b_i=0.07780\frac{RT_{c,i}}{P_{c,i}}\\\alpha(T)_i=[1+\kappa_i(1\sqrt{T_{r,i}})]^2\\\kappa_i = \kappa_{0,i} + [\kappa_{1,i} + \kappa_{2,i}(\kappa_{3,i}  T_{r,i})(1T_{r,i}^{0.5})] (1 + T_{r,i}^{0.5})(0.7  T_{r,i})\\\kappa_{0,i} = 0.378893 + 1.4897153\omega_i  0.17131848\omega_i^2 + 0.0196554\omega_i^3\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
kappa1s : list[float], optional
Fit parameter; available in [R266] for over 90 compounds, []
kappa2s : list[float], optional
Fit parameter; available in [R266] for over 90 compounds, []
kappa3s : list[float], optional
Fit parameter; available in [R266] for over 90 compounds, []
Notes
For PV initializations, SciPy’s newton solver is used to find T.
Note that tabulated kappa values should be used with the critical parameters used in their fits. [R266] considered only vapor pressure in fitting the parameter.
References
[R266] (1, 2, 3, 4, 5, 6) Stryjek, R., and J. H. Vera. “PRSV2: A Cubic Equation of State for Accurate Vaporliquid Equilibria Calculations.” The Canadian Journal of Chemical Engineering 64, no. 5 (October 1, 1986): 82026. doi:10.1002/cjce.5450640516. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = PRSV2MIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (3.623552388375633e05, 0.0007002421492037557) >>> eos.fugacities_l, eos.fugacities_g ([794057.5831840546, 72851.22327178407], [436553.6561835047, 357878.1106688996])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, kappa, kappa0, kappa1, kappa2, kappa3 and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 5¶


class
thermo.eos_mix.
TWUPRMIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.PRMIX
,thermo.eos.TWUPR
Class for solving the Twu [R267] variant of the PengRobinson cubic equation of state for a mixture. Subclasses TWUPR. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\ a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\ (a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\ b = \sum_i z_i b_i\\ a_i=0.45724\frac{R^2T_{c,i}^2}{P_{c,i}}\\ b_i=0.07780\frac{RT_{c,i}}{P_{c,i}}\\\alpha_i = \alpha_i^{(0)} + \omega_i(\alpha_i^{(1)}\alpha_i^{(0)})\\\alpha^{(\text{0 or 1})} = T_{r,i}^{N(M1)}\exp[L(1T_{r,i}^{NM})]\end{aligned}\end{align} \]For subcritical conditions:
L0, M0, N0 = 0.125283, 0.911807, 1.948150;
L1, M1, N1 = 0.511614, 0.784054, 2.812520
For supercritical conditions:
L0, M0, N0 = 0.401219, 4.963070, 0.2;
L1, M1, N1 = 0.024955, 1.248089, 8.
Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
For PV initializations, SciPy’s newton solver is used to find T. Claimed to be more accurate than the PR, PR78 and PRSV equations.
References
[R267] (1, 2) Twu, Chorng H., John E. Coon, and John R. Cunningham. “A New Generalized Alpha Function for a Cubic Equation of State Part 1. PengRobinson Equation.” Fluid Phase Equilibria 105, no. 1 (March 15, 1995): 4959. doi:10.1016/03783812(94)02601V. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = TWUPRMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (3.62456981315702e05, 0.0007004398944116554) >>> eos.fugacities_l, eos.fugacities_g ([792155.0221633187, 73305.88829726784], [436468.96776424424, 358049.2495573095])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, omega, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 5¶


class
thermo.eos_mix.
TWUSRKMIX
(Tcs, Pcs, omegas, zs, kijs=None, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos_mix.SRKMIX
,thermo.eos.TWUSRK
Class for solving the Twu variant of the SoaveRedlichKwong cubic equation of state for a mixture. Subclasses TWUSRK. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{Vb}  \frac{a\alpha(T)}{V(V+b)}\\a_i =\left(\frac{R^2(T_{c,i})^{2}}{9(\sqrt[3]{2}1)P_{c,i}} \right) =\frac{0.42748\cdot R^2(T_{c,i})^{2}}{P_{c,i}}\\b_i =\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_{c,i}}{P_{c,i}} =\frac{0.08664\cdot R T_{c,i}}{P_{c,i}}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\\alpha_i = \alpha^{(0,i)} + \omega_i(\alpha^{(1,i)}\alpha^{(0,i)})\\\alpha^{(\text{0 or 1, i})} = T_{r,i}^{N(M1)}\exp[L(1T_{r,i}^{NM})]\end{aligned}\end{align} \]For subcritical conditions:
L0, M0, N0 = 0.141599, 0.919422, 2.496441
L1, M1, N1 = 0.500315, 0.799457, 3.291790
For supercritical conditions:
L0, M0, N0 = 0.441411, 6.500018, 0.20
L1, M1, N1 = 0.032580, 1.289098, 8.0
Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
For PV initializations, SciPy’s newton solver is used to find T. Claimed to be more accurate than the SRK equation.
References
[R268] Twu, Chorng H., John E. Coon, and John R. Cunningham. “A New Generalized Alpha Function for a Cubic Equation of State Part 2. RedlichKwong Equation.” Fluid Phase Equilibria 105, no. 1 (March 15, 1995): 6169. doi:10.1016/03783812(94)02602W. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = TWUSRKMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (4.108791361639091e05, 0.0007117070840276789) >>> eos.fugacities_l, eos.fugacities_g ([809692.8308266952, 74093.63881572781], [441783.43148985505, 362470.31741077645])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, omega, and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 5¶


class
thermo.eos_mix.
APISRKMIX
(Tcs, Pcs, zs, omegas=None, kijs=None, T=None, P=None, V=None, S1s=None, S2s=None)[source]¶ Bases:
thermo.eos_mix.SRKMIX
,thermo.eos.APISRK
Class for solving the Refinery SoaveRedlichKwong cubic equation of state for a mixture of any number of compounds, as shown in the API Databook [R269]. Subclasses APISRK. Solves the EOS on initialization and calculates fugacities for all components in all phases.
Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P = \frac{RT}{Vb}  \frac{a\alpha(T)}{V(V+b)}\\a \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}\\(a\alpha)_{ij} = (1k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}\\b = \sum_i z_i b_i\\a_i =\left(\frac{R^2(T_{c,i})^{2}}{9(\sqrt[3]{2}1)P_{c,i}} \right) =\frac{0.42748\cdot R^2(T_{c,i})^{2}}{P_{c,i}}\\b_i =\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_{c,i}}{P_{c,i}} =\frac{0.08664\cdot R T_{c,i}}{P_{c,i}}\\\alpha(T)_i = \left[1 + S_{1,i}\left(1\sqrt{T_{r,i}}\right) + S_{2,i} \frac{1 \sqrt{T_{r,i}}}{\sqrt{T_{r,i}}}\right]^2\\S_{1,i} = 0.48508 + 1.55171\omega_i  0.15613\omega_i^2 \text{ if S1 is not tabulated }\end{aligned}\end{align} \]Parameters: Tcs : float
Critical temperatures of all compounds, [K]
Pcs : float
Critical pressures of all compounds, [Pa]
omegas : float
Acentric factors of all compounds, []
zs : float
Overall mole fractions of all species, []
kijs : list[list[float]], optional
n*n size list of lists with binary interaction parameters for the Van der Waals mixing rules, default all 0 []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
S1s : float, optional
Fit constant or estimated from acentric factor if not provided []
S2s : float, optional
Fit constant or 0 if not provided []
Notes
For PV initializations, SciPy’s newton solver is used to find T.
References
[R269] (1, 2) API Technical Data Book: General Properties & Characterization. American Petroleum Institute, 7E, 2005. Examples
TP initialization, nitrogenmethane at 115 K and 1 MPa:
>>> eos = APISRKMIX(T=115, P=1E6, Tcs=[126.1, 190.6], Pcs=[33.94E5, 46.04E5], omegas=[0.04, 0.011], zs=[0.5, 0.5], kijs=[[0,0],[0,0]]) >>> eos.V_l, eos.V_g (4.101590920556748e05, 0.0007104685894929316) >>> eos.fugacities_l, eos.fugacities_g ([817882.3033490349, 71620.48238123364], [442158.29113191745, 361519.7987757053])
Methods
Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. V_g_sat
(T)Method to calculate molar volume of the vapor phase along the saturation line. V_l_sat
(T)Method to calculate molar volume of the liquid phase along the saturation line. a_alpha_and_derivatives
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. check_sufficient_inputs
()Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given. cleanup_a_alpha_and_derivatives
()Removes properties set by setup_a_alpha_and_derivatives; run by dPsat_dT
(T)Generic method to calculate the temperature derivative of vapor pressure for a specified T. derivatives_and_departures
(T, P, V, b, ...)fugacities
([xs, ys])Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase. fugacity_coefficients
(Z, zs)Literature formula for calculating fugacity coefficients for each species in a mixture. main_derivatives_and_departures
(T, P, V, b, ...)set_from_PT
(Vs)Counts the number of real volumes in Vs, and determines what to do. set_properties_from_solution
(T, P, V, b, ...)Sets all interesting properties which can be calculated from an EOS alone. setup_a_alpha_and_derivatives
(i[, T])Sets a, S1, S2 and Tc for a specific component before the purespecies EOS’s a_alpha_and_derivatives method is called. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V[, quick])Generic method to calculate T from a specified P and V. to_TP
(T, P)to_TP_zs
(T, P, zs)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
a_alpha_mro
= 5¶
