thermo.eos module¶

class
thermo.eos.
GCEOS
[source]¶ Bases:
object
Class for solving a generic Pressureexplicit threeparameter cubic equation of state. Does not implement any parameters itself; must be subclassed by an equation of state class which uses it. Works for mixtures or pure species for all properties except fugacity. All properties are derived with the CAS SymPy, not relying on any derivations previously published.
\[P=\frac{RT}{Vb}\frac{a\alpha(T)}{V^2 + \delta V + \epsilon}\]Main methods (in order they are called) are solve, set_from_PT, volume_solutions, set_properties_from_solution, and derivatives_and_departures.
solve calls check_sufficient_input, which checks if two of T, P, and V were set. It then solves for the remaining variable. If T is missing, method solve_T is used; it is parameter specific, and so must be implemented in each specific EOS. If P is missing, it is directly calculated. If V is missing, it is calculated with the method volume_solutions. At this point, either three possible volumes or one user specified volume are known. The value of a_alpha, and its first and second temperature derivative are calculated with the EOSspecific method a_alpha_and_derivatives.
If V is not provided, volume_solutions calculates the three possible molar volumes which are solutions to the EOS; in the singlephase region, only one solution is real and correct. In the twophase region, all volumes are real, but only the largest and smallest solution are physically meaningful, with the largest being that of the gas and the smallest that of the liquid.
set_from_PT is called to sort out the possible molar volumes. For the case of a userspecified V, the possibility of there existing another solution is ignored for speed. If there is only one real volume, the method set_properties_from_solution is called with it. If there are two real volumes, set_properties_from_solution is called once with each volume. The phase is returned by set_properties_from_solution, and the volumes is set to either V_l or V_g as appropriate.
set_properties_from_solution is a beast which calculates all relevant partial derivatives and properties of the EOS. 15 derivatives and excess enthalpy and entropy are calculated first. If the method was called with the quick flag, the method derivatives_and_departures uses a mess derived with SymPy’s cse function to perform the calculation as quickly as possible. Otherwise, the independent formulas for each property are used.
set_properties_from_solution next calculates beta (isobaric expansion coefficient), kappa (isothermal compressibility), Cp_minus_Cv, Cv_dep, Cp_dep, V_dep molar volume departure, U_dep internal energy departure, G_dep Gibbs energy departure, A_dep Helmholtz energy departure, fugacity, and phi (fugacity coefficient). It then calculates PIP or phase identification parameter, and determines the fluid phase with it. Finally, it sets all these properties as attibutes or either the liquid or gas phase with the convention of adding on _l or _g to the variable names.
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])Dummy method to calculate a_alpha and its first and second derivatives. 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, ...)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)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Hvap
(T)[source]¶ Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration.
\[\frac{dP^{sat}}{dT}=\frac{\Delta H_{vap}}{T(V_g  V_l)}\]Results above the critical temperature are meaningless. A firstorder polynomial is used to extrapolate under 0.32 Tc; however, there is normally not a volume solution to the EOS which can produce that low of a pressure.
Parameters: T : float
Temperature, [K]
Returns: Hvap : float
Increase in enthalpy needed for vaporization of liquid phase along the saturation line, [J/mol]
Notes
Calculates vapor pressure and its derivative with Psat and dPsat_dT as well as molar volumes of the saturation liquid and vapor phase in the process.
Very near the critical point this provides unrealistic results due to Psat‘s polynomials being insufficiently accurate.
References
[R116] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.

Psat
(T, polish=False)[source]¶ Generic method to calculate vapor pressure for a specified T.
From Tc to 0.32Tc, uses a 10th order polynomial of the following form:
\[\ln\frac{P_r}{T_r} = \sum_{k=0}^{10} C_k\left(\frac{\alpha}{T_r} 1\right)^{k}\]If polish is True, SciPy’s newton solver is launched with the calculated vapor pressure as an initial guess in an attempt to get more accuracy. This may not converge however.
Results above the critical temperature are meaningless. A firstorder polynomial is used to extrapolate under 0.32 Tc; however, there is normally not a volume solution to the EOS which can produce that low of a pressure.
Parameters: T : float
Temperature, [K]
polish : bool, optional
Whether to attempt to use a numerical solver to make the solution more precise or not
Returns: Psat : float
Vapor pressure, [Pa]
Notes
EOSs sharing the same b, delta, and epsilon have the same coefficient sets.
All coefficients were derived with numpy’s polyfit. The intersection between the polynomials is continuous, but there is a step change in its derivative.
Form for the regression is inspired from [R117].
References
[R117] (1, 2) Soave, G. “Direct Calculation of PureCompound Vapour Pressures through Cubic Equations of State.” Fluid Phase Equilibria 31, no. 2 (January 1, 1986): 2037. doi:10.1016/03783812(86)900130.

V_g_sat
(T)[source]¶ Method to calculate molar volume of the vapor phase along the saturation line.
Parameters: T : float
Temperature, [K]
Returns: V_g_sat : float
Gas molar volume along the saturation line, [m^3/mol]
Notes
Computers Psat, and then uses volume_solutions to obtain the three possible molar volumes. The highest value is returned.

V_l_sat
(T)[source]¶ Method to calculate molar volume of the liquid phase along the saturation line.
Parameters: T : float
Temperature, [K]
Returns: V_l_sat : float
Liquid molar volume along the saturation line, [m^3/mol]
Notes
Computers Psat, and then uses volume_solutions to obtain the three possible molar volumes. The lowest value is returned.

a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Dummy method to calculate a_alpha and its first and second derivatives. Should be implemented with the same function signature in each EOS variant; this only raises a NotImplemented Exception. Should return ‘a_alpha’, ‘da_alpha_dT’, and ‘d2a_alpha_dT2’.
For use in solve_T, returns only a_alpha if full is False.
Parameters: T : float
Temperature, [K]
full : bool, optional
If False, calculates and returns only a_alpha
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
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]

check_sufficient_inputs
()[source]¶ Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given.

dPsat_dT
(T)[source]¶ Generic method to calculate the temperature derivative of vapor pressure for a specified T. Implements the analytical derivative of the two polynomials described in Psat.
As with Psat, results above the critical temperature are meaningless. The firstorder polynomial which is used to calculate it under 0.32 Tc may not be physicall meaningful, due to there normally not being a volume solution to the EOS which can produce that low of a pressure.
Parameters: T : float
Temperature, [K]
Returns: dPsat_dT : float
Derivative of vapor pressure with respect to temperature, [Pa/K]
Notes
There is a small step change at 0.32 Tc for all EOS due to the two switch between polynomials at that point.
Useful for calculating enthalpy of vaporization with the Clausius Clapeyron Equation. Derived with SymPy’s diff and cse.

derivatives_and_departures
(T, P, V, b, delta, epsilon, a_alpha, da_alpha_dT, d2a_alpha_dT2, quick=True)[source]¶

kwargs
= {}¶

static
main_derivatives_and_departures
(T, P, V, b, delta, epsilon, a_alpha, da_alpha_dT, d2a_alpha_dT2, quick=True)[source]¶

set_from_PT
(Vs)[source]¶ Counts the number of real volumes in Vs, and determines what to do. If there is only one real volume, the method set_properties_from_solution is called with it. If there are two real volumes, set_properties_from_solution is called once with each volume. The phase is returned by set_properties_from_solution, and the volumes is set to either V_l or V_g as appropriate.
Parameters: Vs : list[float]
Three possible molar volumes, [m^3/mol]

set_properties_from_solution
(T, P, V, b, delta, epsilon, a_alpha, da_alpha_dT, d2a_alpha_dT2, quick=True)[source]¶ Sets all interesting properties which can be calculated from an EOS alone. Determines which phase the fluid is on its own; for details, see phase_identification_parameter.
The list of properties set is as follows, with all properties suffixed with ‘_l’ or ‘_g’.
dP_dT, dP_dV, dV_dT, dV_dP, dT_dV, dT_dP, d2P_dT2, d2P_dV2, d2V_dT2, d2V_dP2, d2T_dV2, d2T_dP2, d2V_dPdT, d2P_dTdV, d2T_dPdV, H_dep, S_dep, beta, kappa, Cp_minus_Cv, V_dep, U_dep, G_dep, A_dep, fugacity, phi, and PIP.
Parameters: T : float
Temperature, [K]
P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
b : float
Coefficient calculated by EOSspecific method, [m^3/mol]
delta : float
Coefficient calculated by EOSspecific method, [m^3/mol]
epsilon : float
Coefficient calculated by EOSspecific method, [m^6/mol^2]
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]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: phase : str
Either ‘l’ or ‘g’
Notes
The individual formulas for the derivatives and excess properties are as follows. For definitions of beta, see isobaric_expansion; for kappa, see isothermal_compressibility; for Cp_minus_Cv, see Cp_minus_Cv; for phase_identification_parameter, see phase_identification_parameter.
First derivatives; in part using the Triple Product Rule [R119], [R120]:
\[ \begin{align}\begin{aligned}\left(\frac{\partial P}{\partial T}\right)_V = \frac{R}{V  b}  \frac{a \frac{d \alpha{\left (T \right )}}{d T}}{V^{2} + V \delta + \epsilon}\\\left(\frac{\partial P}{\partial V}\right)_T =  \frac{R T}{\left( V  b\right)^{2}}  \frac{a \left( 2 V  \delta\right) \alpha{ \left (T \right )}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}\\\left(\frac{\partial V}{\partial T}\right)_P =\frac{ \left(\frac{\partial P}{\partial T}\right)_V}{ \left(\frac{\partial P}{\partial V}\right)_T}\\\left(\frac{\partial V}{\partial P}\right)_T =\frac{ \left(\frac{\partial V}{\partial T}\right)_P}{ \left(\frac{\partial P}{\partial T}\right)_V} \\\left(\frac{\partial T}{\partial V}\right)_P = \frac{1} {\left(\frac{\partial V}{\partial T}\right)_P}\\\left(\frac{\partial T}{\partial P}\right)_V = \frac{1} {\left(\frac{\partial P}{\partial T}\right)_V}\end{aligned}\end{align} \]Second derivatives with respect to one variable; those of T and V use identities shown in [R118] and verified numerically:
\[ \begin{align}\begin{aligned}\left(\frac{\partial^2 P}{\partial T^2}\right)_V =  \frac{a \frac{d^{2} \alpha{\left (T \right )}}{d T^{2}}}{V^{2} + V \delta + \epsilon}\\\left(\frac{\partial^2 P}{\partial V^2}\right)_T = 2 \left(\frac{ R T}{\left(V  b\right)^{3}}  \frac{a \left(2 V + \delta\right)^{ 2} \alpha{\left (T \right )}}{\left(V^{2} + V \delta + \epsilon \right)^{3}} + \frac{a \alpha{\left (T \right )}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}\right)\\\left(\frac{\partial^2 T}{\partial P^2}\right)_V = \left(\frac{ \partial^2 P}{\partial T^2}\right)_V \left(\frac{\partial P}{ \partial T}\right)^{3}_V\\\left(\frac{\partial^2 V}{\partial P^2}\right)_T = \left(\frac{ \partial^2 P}{\partial V^2}\right)_T \left(\frac{\partial P}{ \partial V}\right)^{3}_T\\\left(\frac{\partial^2 T}{\partial V^2}\right)_P = \left[ \left(\frac{\partial^2 P}{\partial V^2}\right)_T \left(\frac{\partial P}{\partial T}\right)_V  \left(\frac{\partial P}{\partial V}\right)_T \left(\frac{\partial^2 P}{\partial T \partial V}\right) \right] \left(\frac{\partial P}{\partial T}\right)^{2}_V + \left[\left(\frac{\partial^2 P}{\partial T\partial V}\right) \left(\frac{\partial P}{\partial T}\right)_V  \left(\frac{\partial P}{\partial V}\right)_T \left(\frac{\partial^2 P}{\partial T^2}\right)_V\right] \left(\frac{\partial P}{\partial T}\right)_V^{3} \left(\frac{\partial P}{\partial V}\right)_T\\\left(\frac{\partial^2 V}{\partial T^2}\right)_P = \left[ \left(\frac{\partial^2 P}{\partial T^2}\right)_V \left(\frac{\partial P}{\partial V}\right)_T  \left(\frac{\partial P}{\partial T}\right)_V \left(\frac{\partial^2 P}{\partial T \partial V}\right) \right] \left(\frac{\partial P}{\partial V}\right)^{2}_T + \left[\left(\frac{\partial^2 P}{\partial T\partial V}\right) \left(\frac{\partial P}{\partial V}\right)_T  \left(\frac{\partial P}{\partial T}\right)_V \left(\frac{\partial^2 P}{\partial V^2}\right)_T\right] \left(\frac{\partial P}{\partial V}\right)_T^{3} \left(\frac{\partial P}{\partial T}\right)_V\end{aligned}\end{align} \]Second derivatives with respect to the other two variables; those of T and V use identities shown in [R118] and verified numerically:
\[ \begin{align}\begin{aligned}\left(\frac{\partial^2 P}{\partial T \partial V}\right) =  \frac{ R}{\left(V  b\right)^{2}} + \frac{a \left(2 V + \delta\right) \frac{d \alpha{\left (T \right )}}{d T}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}\\\left(\frac{\partial^2 T}{\partial P\partial V}\right) =  \left[\left(\frac{\partial^2 P}{\partial T \partial V}\right) \left(\frac{\partial P}{\partial T}\right)_V  \left(\frac{\partial P}{\partial V}\right)_T \left(\frac{\partial^2 P}{\partial T^2}\right)_V \right]\left(\frac{\partial P}{\partial T}\right)_V^{3}\\ \left(\frac{\partial^2 V}{\partial T\partial P}\right) =  \left[\left(\frac{\partial^2 P}{\partial T \partial V}\right) \left(\frac{\partial P}{\partial V}\right)_T  \left(\frac{\partial P}{\partial T}\right)_V \left(\frac{\partial^2 P}{\partial V^2}\right)_T \right]\left(\frac{\partial P}{\partial V}\right)_T^{3}\end{aligned}\end{align} \]Excess properties
\[ \begin{align}\begin{aligned}H_{dep} = \int_{\infty}^V \left[T\frac{\partial P}{\partial T}_V  P\right]dV + PV  RT= P V  R T + \frac{2}{\sqrt{ \delta^{2}  4 \epsilon}} \left(T a \frac{d \alpha{\left (T \right )}}{d T}  a \alpha{\left (T \right )}\right) \operatorname{atanh} {\left (\frac{2 V + \delta}{\sqrt{\delta^{2}  4 \epsilon}} \right)}\\S_{dep} = \int_{\infty}^V\left[\frac{\partial P}{\partial T}  \frac{R}{V}\right] dV + R\log\frac{PV}{RT} =  R \log{\left (V \right )} + R \log{\left (\frac{P V}{R T} \right )} + R \log{\left (V  b \right )} + \frac{2 a \frac{d\alpha{\left (T \right )}}{d T} }{\sqrt{\delta^{2}  4 \epsilon}} \operatorname{atanh}{\left (\frac {2 V + \delta}{\sqrt{\delta^{2}  4 \epsilon}} \right )}\\V_{dep} = V  \frac{RT}{P}\\U_{dep} = H_{dep}  P V_{dep}\\G_{dep} = H_{dep}  T S_{dep}\\A_{dep} = U_{dep}  T S_{dep}\\\text{fugacity} = P\exp\left(\frac{G_{dep}}{RT}\right)\\\phi = \frac{\text{fugacity}}{P}\\C_{v, dep} = T\int_\infty^V \left(\frac{\partial^2 P}{\partial T^2}\right) dV =  T a \left(\sqrt{\frac{1}{\delta^{2}  4 \epsilon}} \log{\left (V  \frac{\delta^{2}}{2} \sqrt{\frac{1}{ \delta^{2}  4 \epsilon}} + \frac{\delta}{2} + 2 \epsilon \sqrt{ \frac{1}{\delta^{2}  4 \epsilon}} \right )}  \sqrt{\frac{1}{ \delta^{2}  4 \epsilon}} \log{\left (V + \frac{\delta^{2}}{2} \sqrt{\frac{1}{\delta^{2}  4 \epsilon}} + \frac{\delta}{2}  2 \epsilon \sqrt{\frac{1}{\delta^{2}  4 \epsilon}} \right )} \right) \frac{d^{2} \alpha{\left (T \right )} }{d T^{2}} \\C_{p, dep} = (C_pC_v)_{\text{from EOS}} + C_{v, dep}  R\end{aligned}\end{align} \]References
[R118] (1, 2, 3) Thorade, Matthis, and Ali Saadat. “Partial Derivatives of Thermodynamic State Properties for Dynamic Simulation.” Environmental Earth Sciences 70, no. 8 (April 10, 2013): 34973503. doi:10.1007/s126650132394z. [R119] (1, 2) Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. [R120] (1, 2) Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985.

solve
()[source]¶ First EOSgeneric method; should be called by all specific EOSs. For solving for T, the EOS must provide the method solve_T. For all cases, the EOS must provide a_alpha_and_derivatives. Calls set_from_PT once done.

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
Whether to use a SymPy csederived expression (3x faster) or individual formulas  not applicable where a numerical solver is used.
Returns: T : float
Temperature, [K]

static
volume_solutions
(T, P, b, delta, epsilon, a_alpha, quick=True)[source]¶ Solution of this form of the cubic EOS in terms of volumes. Returns three values, all with some complex part.
Parameters: T : float
Temperature, [K]
P : float
Pressure, [Pa]
b : float
Coefficient calculated by EOSspecific method, [m^3/mol]
delta : float
Coefficient calculated by EOSspecific method, [m^3/mol]
epsilon : float
Coefficient calculated by EOSspecific method, [m^6/mol^2]
a_alpha : float
Coefficient calculated by EOSspecific method, [J^2/mol^2/Pa]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: Vs : list[float]
Three possible molar volumes, [m^3/mol]
Notes
Using explicit formulas, as can be derived in the following example, is faster than most numeric root finding techniques, and finds all values explicitly. It takes several seconds.
>>> from sympy import * >>> P, T, V, R, b, a, delta, epsilon, alpha = symbols('P, T, V, R, b, a, delta, epsilon, alpha') >>> Tc, Pc, omega = symbols('Tc, Pc, omega') >>> CUBIC = R*T/(Vb)  a*alpha/(V*V + delta*V + epsilon)  P >>> #solve(CUBIC, V)


class
thermo.eos.
PR
(Tc, Pc, omega, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos.GCEOS
Class for solving the PengRobinson cubic equation of state for a pure compound. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which calculates a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T.
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=0.45724\frac{R^2T_c^2}{P_c}\\ b=0.07780\frac{RT_c}{P_c}\\\alpha(T)=[1+\kappa(1\sqrt{T_r})]^2\\\kappa=0.37464+1.54226\omega0.26992\omega^2\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
The constants in the expresions for a and b are given to full precision in the actual code, as derived in [R123].
References
[R121] 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. [R122] 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. [R123] (1, 2) Privat, R., and J.N. Jaubert. “PPR78, a Thermodynamic Model for the Prediction of Petroleum FluidPhase Behaviour,” 11. EDP Sciences, 2011. doi:10.1051/jeep/201100011. Examples
TP initialization, and exploring each phase’s properties:
>>> eos = PR(Tc=507.6, Pc=3025000, omega=0.2975, T=400., P=1E6) >>> eos.V_l, eos.V_g (0.000156073131885293, 0.0021418760907613724) >>> eos.phase 'l/g' >>> eos.H_dep_l, eos.H_dep_g (26111.868721160834, 3549.2993749373945) >>> eos.S_dep_l, eos.S_dep_g (58.0984281510609, 6.439449710478305) >>> eos.U_dep_l, eos.U_dep_g (22942.157933046128, 2365.391545698767) >>> eos.G_dep_l, eos.G_dep_g (2872.4974607364747, 973.5194907460723) >>> eos.A_dep_l, eos.A_dep_g (297.21332737823104, 210.38833849255525) >>> eos.beta_l, eos.beta_g (0.002693370917783791, 0.01012322391117497) >>> eos.kappa_l, eos.kappa_g (9.335721543829537e09, 1.9710669809793307e06) >>> eos.Cp_minus_Cv_l, eos.Cp_minus_Cv_g (48.51014580740853, 44.54414603000345) >>> eos.Cv_dep_l, eos.Cp_dep_l (18.89210627002109, 59.08779227742962)
PT initialization, liquid phase, and round robin trip:
>>> eos = PR(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00013022208100139953, 31134.740290463407, 72.47559475426013)
TV initialization, liquid phase:
>>> eos = PR(Tc=507.6, Pc=3025000, omega=0.2975, T=299., V=0.00013022208100139953) >>> eos.P, eos.phase (1000000.0000020266, 'l')
PV initialization at same state:
>>> eos = PR(Tc=507.6, Pc=3025000, omega=0.2975, V=0.00013022208100139953, P=1E6) >>> eos.T, eos.phase (298.99999999999926, 'l')
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the PR EOS. to_TP
(T, P)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Psat_coeffs
= [9.689234781518378e06, 0.0002443582031145319, 0.0026885427128470565, 0.017049496987961255, 0.06971001627679084, 0.19625435197107072, 0.39857709528021257, 0.5870213533216718, 0.5163461910213303, 3.3504109815148495, 0.0001335877045451046]¶

Psat_coeffs_limiting
= [3.4758880164801873, 0.7675486448347723]¶

Zc
= 0.30740130869870386¶

a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives for this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, kappa, and a.
For use in solve_T, returns only a_alpha if full is False.
\[ \begin{align}\begin{aligned}a\alpha = a \left(\kappa \left( \frac{T^{0.5}}{Tc^{0.5}} + 1\right) + 1\right)^{2}\\\frac{d a\alpha}{dT} =  \frac{1.0 a \kappa}{T^{0.5} Tc^{0.5}} \left(\kappa \left( \frac{T^{0.5}}{Tc^{0.5}} + 1\right) + 1\right)\\\frac{d^2 a\alpha}{dT^2} = 0.5 a \kappa \left( \frac{1}{T^{1.5} Tc^{0.5}} \left(\kappa \left(\frac{T^{0.5}}{Tc^{0.5}}  1\right)  1\right) + \frac{\kappa}{T^{1.0} Tc^{1.0}}\right)\end{aligned}\end{align} \]

c1
= 0.4572355289213822¶

c2
= 0.07779607390388846¶

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the PR EOS. Uses Tc, a, b, and kappa as well, obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: T : float
Temperature, [K]
Notes
The exact solution can be derived as follows, and is excluded for breviety.
>>> from sympy import * >>> P, T, V = symbols('P, T, V') >>> Tc, Pc, omega = symbols('Tc, Pc, omega') >>> R, a, b, kappa = symbols('R, a, b, kappa')
>>> a_alpha = a*(1 + kappa*(1sqrt(T/Tc)))**2 >>> PR_formula = R*T/(Vb)  a_alpha/(V*(V+b)+b*(Vb))  P >>> #solve(PR_formula, T)


class
thermo.eos.
SRK
(Tc, Pc, omega, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos.GCEOS
Class for solving the SoaveRedlichKwong cubic equation of state for a pure compound. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T.
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=\left(\frac{R^2(T_c)^{2}}{9(\sqrt[3]{2}1)P_c} \right) =\frac{0.42748\cdot R^2(T_c)^{2}}{P_c}\\b=\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_c}{P_c} =\frac{0.08664\cdot R T_c}{P_c}\\\alpha(T) = \left[1 + m\left(1  \sqrt{\frac{T}{T_c}}\right)\right]^2\\m = 0.480 + 1.574\omega  0.176\omega^2\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
References
[R124] 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. [R125] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. [R126] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985. Examples
>>> eos = SRK(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00014682102759032, 31754.65309653571, 74.3732468359525)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the SRK EOS. to_TP
(T, P)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Psat_coeffs
= [3.2606704044732426e06, 8.494828412561618e05, 0.0009661948864683891, 0.006368516279504884, 0.027478137804348456, 0.08418797719898592, 0.19421926832038514, 0.3331822830694727, 0.3209627416366067, 3.0522790305186756, 3.689527930660367e05]¶

Psat_coeffs_limiting
= [3.2308843103522107, 0.7210534170705403]¶

Zc
= 0.3333333333333333¶

a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives for this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, m, and a.
\[ \begin{align}\begin{aligned}a\alpha = a \left(m \left( \sqrt{\frac{T}{Tc}} + 1\right) + 1\right)^{2}\\\frac{d a\alpha}{dT} = \frac{a m}{T} \sqrt{\frac{T}{Tc}} \left(m \left(\sqrt{\frac{T}{Tc}}  1\right)  1\right)\\\frac{d^2 a\alpha}{dT^2} = \frac{a m \sqrt{\frac{T}{Tc}}}{2 T^{2}} \left(m + 1\right)\end{aligned}\end{align} \]

c1
= 0.4274802335403414¶

c2
= 0.08664034996495772¶

epsilon
= 0¶

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the SRK EOS. Uses a, b, and Tc obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: T : float
Temperature, [K]
Notes
The exact solution can be derived as follows; it is excluded for breviety.
>>> from sympy import * >>> P, T, V, R, a, b, m = symbols('P, T, V, R, a, b, m') >>> Tc, Pc, omega = symbols('Tc, Pc, omega') >>> a_alpha = a*(1 + m*(1sqrt(T/Tc)))**2 >>> SRK = R*T/(Vb)  a_alpha/(V*(V+b))  P >>> # solve(SRK, T)


class
thermo.eos.
PR78
(Tc, Pc, omega, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos.PR
Class for solving the PengRobinson cubic equation of state for a pure compound according to the 1978 variant. Subclasses PR, which provides everything except the variable kappa. Solves the EOS on initialization. See PR for further documentation.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a=0.45724\frac{R^2T_c^2}{P_c}\\ b=0.07780\frac{RT_c}{P_c}\\\alpha(T)=[1+\kappa(1\sqrt{T_r})]^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: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
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
[R127] Robinson, Donald B, and DingYu Peng. The Characterization of the Heptanes and Heavier Fractions for the GPA PengRobinson Programs. Tulsa, Okla.: Gas Processors Association, 1978. [R128] 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
PT initialization (furfuryl alcohol), liquid phase:
>>> eos = PR78(Tc=632, Pc=5350000, omega=0.734, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 8.351960066075009e05, 63764.649480508735, 130.73710891262687)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the PR EOS. to_TP
(T, P)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes.

class
thermo.eos.
PRSV
(Tc, Pc, omega, T=None, P=None, V=None, kappa1=0)[source]¶ Bases:
thermo.eos.PR
Class for solving the PengRobinsonStryjekVera equations of state for a pure compound as given in [R129]. The same as the PengRobinson EOS, except with a different kappa formula and with an optional fit parameter. Subclasses PR, which provides only several constants. See PR for further documentation and examples.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a=0.45724\frac{R^2T_c^2}{P_c}\\ b=0.07780\frac{RT_c}{P_c}\\\alpha(T)=[1+\kappa(1\sqrt{T_r})]^2\\\kappa = \kappa_0 + \kappa_1(1 + T_r^{0.5})(0.7  T_r)\\\kappa_0 = 0.378893 + 1.4897153\omega  0.17131848\omega^2 + 0.0196554\omega^3\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
kappa1 : float, optional
Fit parameter; available in [R129] for over 90 compounds, []
Notes
[R129] 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.
Solutions for PV solve for T with SciPy’s newton solver, as there is no analytical solution for T
[R130] and [R131] are two more resources documenting the PRSV EOS. [R132] 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 [R129] and [R132] only considered vapor pressure in fitting the parameter.
References
[R129] (1, 2, 3, 4, 5, 6) 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. [R130] (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. [R131] (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. [R132] (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 (hexane, with fit parameter in [R129]), liquid phase:
>>> eos = PRSV(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6, kappa1=0.05104) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00013012686944840622, 31698.916002476657, 74.16749024350403)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the PRSV EOS. to_TP
(T, P)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 this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, kappa0, kappa1, and a.
For use in rootfinding, returns only a_alpha if full is False.
The a_alpha function is shown below; its first and second derivatives are long available through the SymPy expression under it.
\[a\alpha = a \left(\left(\kappa_{0} + \kappa_{1} \left(\sqrt{\frac{ T}{Tc}} + 1\right) \left( \frac{T}{Tc} + \frac{7}{10}\right) \right) \left( \sqrt{\frac{T}{Tc}} + 1\right) + 1\right)^{2}\]>>> from sympy import * >>> P, T, V = symbols('P, T, V') >>> Tc, Pc, omega = symbols('Tc, Pc, omega') >>> R, a, b, kappa0, kappa1 = symbols('R, a, b, kappa0, kappa1') >>> kappa = kappa0 + kappa1*(1 + sqrt(T/Tc))*(Rational(7, 10)T/Tc) >>> a_alpha = a*(1 + kappa*(1sqrt(T/Tc)))**2 >>> # diff(a_alpha, T) >>> # diff(a_alpha, T, 2)

kappa1_Tr_limit
= False¶

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the PRSV EOS. Uses Tc, a, b, kappa0 and kappa as well, obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (somewhat faster) or individual formulas.
Returns: T : float
Temperature, [K]
Notes
Not guaranteed to produce a solution. There are actually two solution, one much higher than normally desired; it is possible the solver could converge on this.


class
thermo.eos.
PRSV2
(Tc, Pc, omega, T=None, P=None, V=None, kappa1=0, kappa2=0, kappa3=0)[source]¶ Bases:
thermo.eos.PR
Class for solving the PengRobinsonStryjekVera 2 equations of state for a pure compound as given in [R133]. The same as the PengRobinson EOS, except with a different kappa formula and with three fit parameters. Subclasses PR, which provides only several constants. See PR for further documentation and examples. PRSV provides only one constant.
\[ \begin{align}\begin{aligned}P = \frac{RT}{vb}\frac{a\alpha(T)}{v(v+b)+b(vb)}\\a=0.45724\frac{R^2T_c^2}{P_c}\\ b=0.07780\frac{RT_c}{P_c}\\\alpha(T)=[1+\kappa(1\sqrt{T_r})]^2\\\kappa = \kappa_0 + [\kappa_1 + \kappa_2(\kappa_3  T_r)(1T_r^{0.5})] (1 + T_r^{0.5})(0.7  T_r)\\\kappa_0 = 0.378893 + 1.4897153\omega  0.17131848\omega^2 + 0.0196554\omega^3\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
kappa1 : float, optional
Fit parameter; available in [R133] for over 90 compounds, []
kappa2 : float, optional
Fit parameter; available in [R133] for over 90 compounds, []
kappa : float, optional
Fit parameter; available in [R133] for over 90 compounds, []
Notes
Solutions for PV solve for T with SciPy’s newton solver, as there is no analytical solution for T
Note that tabulated kappa values should be used with the critical parameters used in their fits. [R133] considered only vapor pressure in fitting the parameter.
References
[R133] (1, 2, 3, 4, 5, 6, 7) 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
PT initialization (hexane, with fit parameter in [R133]), liquid phase:
>>> eos = PRSV2(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6, kappa1=0.05104, kappa2=0.8634, kappa3=0.460) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00013018821346475243, 31496.173493225775, 73.61525801151417)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the PRSV2 EOS. to_TP
(T, P)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 this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, kappa0, kappa1, kappa2, kappa3, and a.
For use in solve_T, returns only a_alpha if full is False.
The first and second derivatives of a_alpha are available through the following SymPy expression.
>>> from sympy import * >>> P, T, V = symbols('P, T, V') >>> Tc, Pc, omega = symbols('Tc, Pc, omega') >>> R, a, b, kappa0, kappa1, kappa2, kappa3 = symbols('R, a, b, kappa0, kappa1, kappa2, kappa3') >>> Tr = T/Tc >>> kappa = kappa0 + (kappa1 + kappa2*(kappa3Tr)*(1sqrt(Tr)))*(1+sqrt(Tr))*(Rational('0.7')Tr) >>> a_alpha = a*(1 + kappa*(1sqrt(T/Tc)))**2 >>> # diff(a_alpha, T) >>> # diff(a_alpha, T, 2)

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the PRSV2 EOS. Uses Tc, a, b, kappa0, kappa1, kappa2, and kappa3 as well, obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (somewhat faster) or individual formulas.
Returns: T : float
Temperature, [K]
Notes
Not guaranteed to produce a solution. There are actually 8 solutions, six with an imaginary component at a tested point. The two temperature solutions are quite far apart, with one much higher than the other; it is possible the solver could converge on the higher solution, so use T inputs with care. This extra solution is a perfectly valid one however.


class
thermo.eos.
VDW
(Tc, Pc, T=None, P=None, V=None, omega=None)[source]¶ Bases:
thermo.eos.GCEOS
Class for solving the Van der Waals cubic equation of state for a pure compound. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T. main_derivatives_and_departures is a reimplementation with VDW specific methods, as the general solution has ZeroDivisionError errors.
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=\frac{27}{64}\frac{(RT_c)^2}{P_c}\\b=\frac{RT_c}{8P_c}\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
omega is allowed as an input for compatibility with the other EOS forms, but is not used.
References
[R134] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. [R135] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985. Examples
>>> eos = VDW(Tc=507.6, Pc=3025000, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00022332978038490077, 13385.722837649315, 32.65922018109096)
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 this EOS. 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, ...)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. solve
()First EOSgeneric method; should be called by all specific EOSs. solve_T
(P, V)Method to calculate T from a specified P and V for the VDW EOS. to_TP
(T, P)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Psat_coeffs
= [0.00016085874036294383, 0.002014769498637164, 0.011302214511559567, 0.037903025677446814, 0.0867354062418565, 0.15182421588718523, 0.23310737420980204, 0.32912533484896433, 0.29955810023815194, 2.9999750707517197, 3.623599198764848e07]¶

Psat_coeffs_limiting
= [3.0232164484175756, 0.20980668241160666]¶

Zc
= 0.375¶

a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives for this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of a.
\[ \begin{align}\begin{aligned}a\alpha = a\\\frac{d a\alpha}{dT} = 0\\\frac{d^2 a\alpha}{dT^2} = 0\end{aligned}\end{align} \]

delta
= 0¶

epsilon
= 0¶

static
main_derivatives_and_departures
(T, P, V, b, delta, epsilon, a_alpha, da_alpha_dT, d2a_alpha_dT2, quick=True)[source]¶ Reimplementation of derivatives and excess property calculations, as ZeroDivisionError errors occur with the general solution. The following derivation is the source of these formulas.
>>> from sympy import * >>> P, T, V, R, b, a = symbols('P, T, V, R, b, a') >>> P_vdw = R*T/(Vb)  a/(V*V) >>> vdw = P_vdw  P >>> >>> dP_dT = diff(vdw, T) >>> dP_dV = diff(vdw, V) >>> d2P_dT2 = diff(vdw, T, 2) >>> d2P_dV2 = diff(vdw, V, 2) >>> d2P_dTdV = diff(vdw, T, V) >>> H_dep = integrate(T*dP_dT  P_vdw, (V, oo, V)) >>> H_dep += P*V  R*T >>> S_dep = integrate(dP_dT  R/V, (V,oo,V)) >>> S_dep += R*log(P*V/(R*T)) >>> Cv_dep = T*integrate(d2P_dT2, (V,oo,V)) >>> >>> dP_dT, dP_dV, d2P_dT2, d2P_dV2, d2P_dTdV, H_dep, S_dep, Cv_dep (R/(V  b), R*T/(V  b)**2 + 2*a/V**3, 0, 2*(R*T/(V  b)**3  3*a/V**4), R/(V  b)**2, P*V  R*T  a/V, R*(log(V) + log(V  b)) + R*log(P*V/(R*T)), 0)

omega
= None¶

solve_T
(P, V)[source]¶ Method to calculate T from a specified P and V for the VDW EOS. Uses a, and b, obtained from the class’s namespace.
\[T = \frac{1}{R V^{2}} \left(P V^{2} \left(V  b\right) + V a  a b\right)\]Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
Returns: T : float
Temperature, [K]


class
thermo.eos.
RK
(Tc, Pc, T=None, P=None, V=None, omega=None)[source]¶ Bases:
thermo.eos.GCEOS
Class for solving the RedlichKwong cubic equation of state for a pure compound. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T.
Two of T, P, and V are needed to solve the EOS.
\[ \begin{align}\begin{aligned}P =\frac{RT}{Vb}\frac{a}{V\sqrt{T}(V+b)}\\a=\left(\frac{R^2(T_c)^{2.5}}{9(\sqrt[3]{2}1)P_c} \right) =\frac{0.42748\cdot R^2(T_c)^{2.5}}{P_c}\\b=\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_c}{P_c} =\frac{0.08664\cdot R T_c}{P_c}\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
omega is allowed as an input for compatibility with the other EOS forms, but is not used.
References
[R136] Redlich, Otto., and J. N. S. Kwong. “On the Thermodynamics of Solutions. V. An Equation of State. Fugacities of Gaseous Solutions.” Chemical Reviews 44, no. 1 (February 1, 1949): 23344. doi:10.1021/cr60137a013. [R137] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition. New York: McGrawHill Professional, 2000. [R138] Walas, Stanley M. Phase Equilibria in Chemical Engineering. ButterworthHeinemann, 1985. Examples
>>> eos = RK(Tc=507.6, Pc=3025000, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00015189341729751854, 26160.8336206741, 63.01311649400547)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the RK EOS. to_TP
(T, P)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Psat_coeffs
= [704544.2441281658, 3561602.0999577316, 6656106.824621978, 4335693.453896916, 2349194.303374687, 4335442.825124258, 326862.94121967856, 4024294.3438453656, 3188268.8928488772, 1083057.9018650202, 142620.2120065352]¶

Psat_coeffs_limiting
= [72.70028836951158, 68.76714163049]¶

Zc
= 0.3333333333333333¶

a_alpha_and_derivatives
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives for this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of a.
\[ \begin{align}\begin{aligned}a\alpha = \frac{a}{\sqrt{T}}\\\frac{d a\alpha}{dT} =  \frac{a}{2 T^{\frac{3}{2}}}\\\frac{d^2 a\alpha}{dT^2} = \frac{3 a}{4 T^{\frac{5}{2}}}\end{aligned}\end{align} \]

c1
= 0.4274802335403414¶

c2
= 0.08664034996495772¶

epsilon
= 0¶

omega
= None¶

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the RK EOS. Uses a, and b, obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: T : float
Temperature, [K]
Notes
The exact solution can be derived as follows; it is excluded for breviety.
>>> from sympy import * >>> P, T, V, R = symbols('P, T, V, R') >>> Tc, Pc = symbols('Tc, Pc') >>> a, b = symbols('a, b')
>>> RK = Eq(P, R*T/(Vb)  a/sqrt(T)/(V*V + b*V)) >>> # solve(RK, T)


class
thermo.eos.
APISRK
(Tc, Pc, omega=None, T=None, P=None, V=None, S1=None, S2=0)[source]¶ Bases:
thermo.eos.SRK
Class for solving the Refinery SoaveRedlichKwong cubic equation of state for a pure compound shown in the API Databook [R139]. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T. Two fit constants are used in this expresion, with an estimation scheme for the first if unavailable and the second may be set to zero.
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=\left(\frac{R^2(T_c)^{2}}{9(\sqrt[3]{2}1)P_c} \right) =\frac{0.42748\cdot R^2(T_c)^{2}}{P_c}\\b=\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_c}{P_c} =\frac{0.08664\cdot R T_c}{P_c}\\\alpha(T) = \left[1 + S_1\left(1\sqrt{T_r}\right) + S_2\frac{1  \sqrt{T_r}}{\sqrt{T_r}}\right]^2\\S_1 = 0.48508 + 1.55171\omega  0.15613\omega^2 \text{ if S1 is not tabulated }\end{aligned}\end{align} \]Parameters: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float, optional
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
S1 : float, optional
Fit constant or estimated from acentric factor if not provided []
S2 : float, optional
Fit constant or 0 if not provided []
References
[R139] (1, 2) API Technical Data Book: General Properties & Characterization. American Petroleum Institute, 7E, 2005. Examples
>>> eos = APISRK(Tc=514.0, Pc=6137000.0, S1=1.678665, S2=0.216396, P=1E6, T=299) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 7.045692682173252e05, 42826.2716306387, 103.6269439137981)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the API SRK EOS. to_TP
(T, P)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 this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, a, S1, and S2.
\[ \begin{align}\begin{aligned}a\alpha(T) = a\left[1 + S_1\left(1\sqrt{T_r}\right) + S_2\frac{1  \sqrt{T_r}}{\sqrt{T_r}}\right]^2\\\frac{d a\alpha}{dT} = a\frac{Tc}{T^{2}} \left( S_{2} \left(\sqrt{ \frac{T}{Tc}}  1\right) + \sqrt{\frac{T}{Tc}} \left(S_{1} \sqrt{ \frac{T}{Tc}} + S_{2}\right)\right) \left(S_{2} \left(\sqrt{\frac{ T}{Tc}}  1\right) + \sqrt{\frac{T}{Tc}} \left(S_{1} \left(\sqrt{ \frac{T}{Tc}}  1\right)  1\right)\right)\\\frac{d^2 a\alpha}{dT^2} = a\frac{1}{2 T^{3}} \left(S_{1}^{2} T \sqrt{\frac{T}{Tc}}  S_{1} S_{2} T \sqrt{\frac{T}{Tc}} + 3 S_{1} S_{2} Tc \sqrt{\frac{T}{Tc}} + S_{1} T \sqrt{\frac{T}{Tc}}  3 S_{2}^{2} Tc \sqrt{\frac{T}{Tc}} + 4 S_{2}^{2} Tc + 3 S_{2} Tc \sqrt{\frac{T}{Tc}}\right)\end{aligned}\end{align} \]

solve_T
(P, V, quick=True)[source]¶ Method to calculate T from a specified P and V for the API SRK EOS. Uses a, b, and Tc obtained from the class’s namespace.
Parameters: P : float
Pressure, [Pa]
V : float
Molar volume, [m^3/mol]
quick : bool, optional
Whether to use a SymPy csederived expression (3x faster) or individual formulas
Returns: T : float
Temperature, [K]
Notes
If S2 is set to 0, the solution is the same as in the SRK EOS, and that is used. Otherwise, newton’s method must be used to solve for T. There are 8 roots of T in that case, six of them real. No guarantee can be made regarding which root will be obtained.


class
thermo.eos.
TWUPR
(Tc, Pc, omega, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos.PR
Class for solving the Twu [R140] variant of the PengRobinson cubic equation of state for a pure compound. Subclasses PR, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T.
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=0.45724\frac{R^2T_c^2}{P_c}\\ b=0.07780\frac{RT_c}{P_c}\\\alpha = \alpha^{(0)} + \omega(\alpha^{(1)}\alpha^{(0)})\\\alpha^{(i)} = T_r^{N(M1)}\exp[L(1T_r^{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: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
Claimed to be more accurate than the PR, PR78 and PRSV equations.
There is no analytical solution for T. There are multiple possible solutions for T under certain conditions; no guaranteed are provided regarding which solution is obtained.
References
[R140] (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
>>> eos = TWUPR(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.V_l, eos.H_dep_l, eos.S_dep_l (0.0001301754975832377, 31652.726391608117, 74.1128253091799)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the PR EOS. to_TP
(T, P)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 this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, omega, and a.
Because of its similarity for the TWUSRK EOS, this has been moved to an external TWU_a_alpha_common function. See it for further documentation.


class
thermo.eos.
TWUSRK
(Tc, Pc, omega, T=None, P=None, V=None)[source]¶ Bases:
thermo.eos.SRK
Class for solving the SoaveRedlichKwong cubic equation of state for a pure compound. Subclasses CUBIC_EOS, which provides the methods for solving the EOS and calculating its assorted relevant thermodynamic properties. Solves the EOS on initialization.
Implemented methods here are a_alpha_and_derivatives, which sets a_alpha and its first and second derivatives, and solve_T, which from a specified P and V obtains T.
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=\left(\frac{R^2(T_c)^{2}}{9(\sqrt[3]{2}1)P_c} \right) =\frac{0.42748\cdot R^2(T_c)^{2}}{P_c}\\b=\left( \frac{(\sqrt[3]{2}1)}{3}\right)\frac{RT_c}{P_c} =\frac{0.08664\cdot R T_c}{P_c}\\\alpha = \alpha^{(0)} + \omega(\alpha^{(1)}\alpha^{(0)})\\\alpha^{(i)} = T_r^{N(M1)}\exp[L(1T_r^{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: Tc : float
Critical temperature, [K]
Pc : float
Critical pressure, [Pa]
omega : float
Acentric factor, []
T : float, optional
Temperature, [K]
P : float, optional
Pressure, [Pa]
V : float, optional
Molar volume, [m^3/mol]
Notes
There is no analytical solution for T. There are multiple possible solutions for T under certain conditions; no guaranteed are provided regarding which solution is obtained.
References
[R141] 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
>>> eos = TWUSRK(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.phase, eos.V_l, eos.H_dep_l, eos.S_dep_l ('l', 0.00014689217317770398, 31612.591872087483, 74.02294100343829)
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 this EOS. 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, ...)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])Method to calculate T from a specified P and V for the SRK EOS. to_TP
(T, P)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 this EOS. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Uses the set values of Tc, omega, and a.
Because of its similarity for the TWUPR EOS, this has been moved to an external TWU_a_alpha_common function. See it for further documentation.


class
thermo.eos.
ALPHA_FUNCTIONS
[source]¶ Bases:
thermo.eos.GCEOS
Basic class with a number of attached alpha functions for different applications, all of which have no parameters attached. These alpha functions should be used for fitting purposes; new EOSs should have their alpha functions added here. The first and second derivatives should also be implemented. Efficient implementations are discouraged but possible.
All parameters should be in self.alpha_function_coeffs. This object is inspired by the work of [R142], where most of the alpha functions have been found.
References
[R142] (1, 2) Young, André F., Fernando L. P. Pessoa, and Victor R. R. Ahón. “Comparison of 20 Alpha Functions Applied in the Peng–Robinson Equation of State for Vapor Pressure Estimation.” Industrial & Engineering Chemistry Research 55, no. 22 (June 8, 2016): 650616. doi:10.1021/acs.iecr.6b00721. Examples
Swap out the default alpha function from the SRK EOS, replace it the same, a new method that takes a manually specified coefficient.
>>> eos = SRK(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> [eos.m, eos.a_alpha_and_derivatives(299)] [0.9326878999999999, (3.7271789178606376, 0.007332989159328508, 1.947612023379061e05)]
>>> a = SRK >>> a.a_alpha_and_derivatives = ALPHA_FUNCTIONS.Soave_1972 >>> a.alpha_function_coeffs = [0.9326878999999999] >>> a = a(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> a.a_alpha_and_derivatives(299) (3.7271789178606376, 0.007332989159328508, 1.947612023379061e05)
Methods
Almeida
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Almeida et al. Androulakis
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Androulakis et al. Coquelet
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Coquelet et al. Gasem
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Gasem (2001) [R220]. Gibbons_Laughton
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Gibbons and Laughton (1984) [R221]. Haghtalab
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Haghtalab et al. Harmens_Knapp
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Harmens and Knapp (1980) [R223]. Heyen
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Heyen (1980) [R224]. Hvap
(T)Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration. Mathias
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Mathias (1983) [R226]. Mathias_Copeman
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Mathias and Copeman (1983) [R227]. Melhem
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Melhem et al. Psat
(T[, polish])Generic method to calculate vapor pressure for a specified T. Saffari
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Saffari and Zahedi (2013) [R230]. Schwartzentruber
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Schwartzentruber et al. Soave_1972
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Soave (1972) [R232]. Soave_1984
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Soave (1984) [R233]. Soave_1993
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Soave (1983) [R234]. Trebble_Bishnoi
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Trebble and Bishnoi (1987) [R235]. Twu
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Twu et al. 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. Yu_Lu
(T[, full, quick])Method to calculate a_alpha and its first and second derivatives according to Yu and Lu (1987) [R237]. a_alpha_and_derivatives
(T[, full, quick])Dummy method to calculate a_alpha and its first and second derivatives. 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, ...)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)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
static
Almeida
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Almeida et al. (1991) [R143]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = e^{c_{1} \left( \frac{T}{Tc} + 1\right) \left{ \frac{T}{Tc}  1}\right^{c_{2}  1} + c_{3} \left(1 + \frac{Tc}{T}\right)}\]References
[R143] (1, 2) Almeida, G. S., M. Aznar, and A. S. Telles. “Uma Nova Forma de Dependência Com a Temperatura Do Termo Atrativo de Equações de Estado Cúbicas.” RBE, Rev. Bras. Eng., Cad. Eng. Quim 8 (1991): 95.

static
Androulakis
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Androulakis et al. (1989) [R144]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = c_{1} \left( \left(\frac{T}{Tc}\right)^{\frac{2}{3}} + 1\right) + c_{2} \left( \left(\frac{T}{Tc}\right)^{\frac{2}{3}} + 1\right)^{2} + c_{3} \left( \left(\frac{T}{Tc}\right)^{ \frac{2}{3}} + 1\right)^{3} + 1\]References
[R144] (1, 2) Androulakis, I. P., N. S. Kalospiros, and D. P. Tassios. “Thermophysical Properties of Pure Polar and Nonpolar Compounds with a Modified VdW711 Equation of State.” Fluid Phase Equilibria 45, no. 2 (April 1, 1989): 13563. doi:10.1016/03783812(89)802547.

static
Coquelet
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Coquelet et al. (2004) [R145]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = e^{c_{1} \left( \frac{T}{Tc} + 1\right) \left(c_{2} \left( \sqrt{\frac{T}{Tc}} + 1\right)^{2} + c_{3} \left( \sqrt{\frac{T}{Tc}} + 1\right)^{3} + 1\right)^{2}}\]References
[R145] (1, 2) Coquelet, C., A. Chapoy, and D. Richon. “Development of a New Alpha Function for the Peng–Robinson Equation of State: Comparative Study of Alpha Function Models for Pure Gases (Natural Gas Components) and WaterGas Systems.” International Journal of Thermophysics 25, no. 1 (January 1, 2004): 13358. doi:10.1023/B:IJOT.0000022331.46865.2f.

static
Gasem
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Gasem (2001) [R146]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = e^{\left( \left(\frac{T}{Tc}\right)^{c_{3}} + 1\right) \left(\frac{T c_{2}}{Tc} + c_{1}\right)}\]References
[R146] (1, 2) Gasem, K. A. M, W Gao, Z Pan, and R. L Robinson Jr. “A Modified Temperature Dependence for the PengRobinson Equation of State.” Fluid Phase Equilibria 181, no. 1–2 (May 25, 2001): 11325. doi:10.1016/S03783812(01)004885.

static
Gibbons_Laughton
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Gibbons and Laughton (1984) [R147]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = c_{1} \left(\frac{T}{Tc}  1\right) + c_{2} \left(\sqrt{\frac{T}{Tc}}  1\right) + 1\]References
[R147] (1, 2) Gibbons, Richard M., and Andrew P. Laughton. “An Equation of State for Polar and NonPolar Substances and Mixtures” 80, no. 9 (January 1, 1984): 101938. doi:10.1039/F29848001019.

static
Haghtalab
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Haghtalab et al. (2010) [R148]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = e^{\left( c_{3}^{\log{\left (\frac{T}{Tc} \right )}} + 1\right) \left( \frac{T c_{2}}{Tc} + c_{1}\right)}\]References
[R148] (1, 2) Haghtalab, A., M. J. Kamali, S. H. Mazloumi, and P. Mahmoodi. “A New ThreeParameter Cubic Equation of State for Calculation Physical Properties and Vaporliquid Equilibria.” Fluid Phase Equilibria 293, no. 2 (June 25, 2010): 20918. doi:10.1016/j.fluid.2010.03.029.

static
Harmens_Knapp
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Harmens and Knapp (1980) [R149]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = \left(c_{1} \left( \sqrt{\frac{T}{Tc}} + 1\right)  c_{2} \left(1  \frac{Tc}{T}\right) + 1\right)^{2}\]References
[R149] (1, 2) Harmens, A., and H. Knapp. “ThreeParameter Cubic Equation of State for Normal Substances.” Industrial & Engineering Chemistry Fundamentals 19, no. 3 (August 1, 1980): 29194. doi:10.1021/i160075a010.

static
Heyen
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Heyen (1980) [R150]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = e^{c_{1} \left( \left(\frac{T}{Tc}\right)^{c_{2}} + 1\right)}\]References
[R150] (1, 2) Heyen, G. Liquid and Vapor Properties from a Cubic Equation of State. In “Proceedings of the 2nd International Conference on Phase Equilibria and Fluid Properties in the Chemical Industry”. DECHEMA: Frankfurt, 1980; p 913.

static
Mathias
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Mathias (1983) [R151]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = \left(c_{1} \left( \sqrt{\frac{T}{Tc}} + 1\right)  c_{2} \left( \frac{T}{Tc} + 0.7\right) \left( \frac{T}{Tc} + 1\right) + 1\right)^{2}\]References
[R151] (1, 2) Mathias, Paul M. “A Versatile Phase Equilibrium Equation of State.” Industrial & Engineering Chemistry Process Design and Development 22, no. 3 (July 1, 1983): 38591. doi:10.1021/i200022a008.

static
Mathias_Copeman
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Mathias and Copeman (1983) [R152]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = \left(c_{1} \left( \sqrt{\frac{T}{Tc}} + 1\right) + c_{2} \left( \sqrt{\frac{T}{Tc}} + 1\right)^{2} + c_{3} \left(  \sqrt{\frac{T}{Tc}} + 1\right)^{3} + 1\right)^{2}\]References
[R152] (1, 2) Mathias, Paul M., and Thomas W. Copeman. “Extension of the PengRobinson Equation of State to Complex Mixtures: Evaluation of the Various Forms of the Local Composition Concept.” Fluid Phase Equilibria 13 (January 1, 1983): 91108. doi:10.1016/03783812(83)800843.

static
Melhem
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Melhem et al. (1989) [R153]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = e^{c_{1} \left( \frac{T}{Tc} + 1\right) + c_{2} \left( \sqrt{\frac{T}{Tc}} + 1\right)^{2}}\]References
[R153] (1, 2) Melhem, Georges A., Riju Saini, and Bernard M. Goodwin. “A Modified PengRobinson Equation of State.” Fluid Phase Equilibria 47, no. 2 (August 1, 1989): 189237. doi:10.1016/03783812(89)801761.

static
Saffari
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Saffari and Zahedi (2013) [R154]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = e^{\frac{T c_{1}}{Tc} + c_{2} \log{\left (\frac{T}{Tc} \right )} + c_{3} \left( \sqrt{\frac{T}{Tc}} + 1\right)}\]References
[R154] (1, 2) Saffari, Hamid, and Alireza Zahedi. “A New AlphaFunction for the PengRobinson Equation of State: Application to Natural Gas.” Chinese Journal of Chemical Engineering 21, no. 10 (October 1, 2013): 115561. doi:10.1016/S10049541(13)605819.

static
Schwartzentruber
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Schwartzentruber et al. (1990) [R155]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = \left(c_{4} \left( \sqrt{\frac{T}{Tc}} + 1\right)  \left( \sqrt{\frac{T}{Tc}} + 1\right) \left(\frac{T^{2} c_{3}} {Tc^{2}} + \frac{T c_{2}}{Tc} + c_{1}\right) + 1\right)^{2}\]References
[R155] (1, 2) J. Schwartzentruber, H. Renon, and S. Watanasiri, “Kvalues for NonIdeal Systems:An Easier Way,” Chem. Eng., March 1990, 118124.

static
Soave_1972
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Soave (1972) [R156]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Same as SRK.a_alpha_and_derivatives but slower and requiring alpha_function_coeffs to be set. One coefficient needed.
\[\alpha = \left(c_{1} \left( \sqrt{\frac{T}{Tc}} + 1\right) + 1\right)^{2}\]References
[R156] (1, 2) Soave, Giorgio. “Equilibrium Constants from a Modified Redlich Kwong Equation of State.” Chemical Engineering Science 27, no. 6 (June 1972): 11971203. doi:10.1016/00092509(72)800964.

static
Soave_1984
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Soave (1984) [R157]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficients needed.
\[\alpha = c_{1} \left( \frac{T}{Tc} + 1\right) + c_{2} \left(1 + \frac{Tc}{T}\right) + 1\]References
[R157] (1, 2) Soave, G. “Improvement of the Van Der Waals Equation of State.” Chemical Engineering Science 39, no. 2 (January 1, 1984): 35769. doi:10.1016/00092509(84)800342.

static
Soave_1993
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Soave (1983) [R158]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Two coefficient needed.
\[\alpha = c_{1} \left( \frac{T}{Tc} + 1\right) + c_{2} \left( \sqrt{\frac{T}{Tc}} + 1\right)^{2} + 1\]References
[R158] (1, 2) Soave, G. “Improving the Treatment of Heavy Hydrocarbons by the SRK EOS.” Fluid Phase Equilibria 84 (April 1, 1993): 33942. doi:10.1016/03783812(93)851315.

static
Trebble_Bishnoi
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Trebble and Bishnoi (1987) [R159]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. One coefficient needed.
\[\alpha = e^{c_{1} \left( \frac{T}{Tc} + 1\right)}\]References
[R159] (1, 2) Trebble, M. A., and P. R. Bishnoi. “Development of a New Four Parameter Cubic Equation of State.” Fluid Phase Equilibria 35, no. 1 (September 1, 1987): 118. doi:10.1016/03783812(87)800018.

static
Twu
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Twu et al. (1991) [R160]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Three coefficients needed.
\[\alpha = \left(\frac{T}{Tc}\right)^{c_{3} \left(c_{2}  1\right)} e^{c_{1} \left( \left(\frac{T}{Tc} \right)^{c_{2} c_{3}} + 1\right)}\]References
[R160] (1, 2) Twu, Chorng H., David Bluck, John R. Cunningham, and John E. Coon. “A Cubic Equation of State with a New Alpha Function and a New Mixing Rule.” Fluid Phase Equilibria 69 (December 10, 1991): 3350. doi:10.1016/03783812(91)900242.

static
Yu_Lu
(T, full=True, quick=True)[source]¶ Method to calculate a_alpha and its first and second derivatives according to Yu and Lu (1987) [R161]. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2. See GCEOS.a_alpha_and_derivatives for more documentation. Four coefficients needed.
\[\alpha = 10^{c_{4} \left( \frac{T}{Tc} + 1\right) \left( \frac{T^{2} c_{3}}{Tc^{2}} + \frac{T c_{2}}{Tc} + c_{1}\right)}\]References
[R161] (1, 2) Yu, JinMin, and Benjamin C. Y. Lu. “A ThreeParameter Cubic Equation of State for Asymmetric Mixture Density Calculations.” Fluid Phase Equilibria 34, no. 1 (January 1, 1987): 119. doi:10.1016/03783812(87)850471.

static

class
thermo.eos.
GCEOS_DUMMY
(T=None, P=None, **kwargs)[source]¶ Bases:
thermo.eos.GCEOS
Attributes
Pc Tc 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])Dummy method to calculate a_alpha and its first and second derivatives. 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, ...)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)volume_solutions
(T, P, b, delta, epsilon, ...)Solution of this form of the cubic EOS in terms of volumes. 
Pc
= None¶

Tc
= None¶

omega
= None¶
