3. Virial Equation of State¶
-
class
scithermo.eos.virial.
Virial
(pow: callable = <ufunc 'power'>, exp: callable = <ufunc 'exp'>)[source]¶ - Parameters
R (float, hard-coded) – gas constant, set to SI units
pow (callable, optional) – function for computing power, defaults to numpy.power
exp (callable, optional) – function for computing logarithm, defaults to numpy.exp
-
class
scithermo.eos.virial.
SecondVirial
(dippr_no: str = None, compound_name: str = None, cas_number: str = None, pow: callable = <ufunc 'power'>, **kwargs)[source]¶ Virial equation of state for one component. See [GP07][SVanNessA05]
-
G_R_RT_expr
(P, T)[source]¶ Dimensionless residual gibbs
\[\frac{G^\mathrm{R}}{RT} = (B^0 + \omega B^1)\frac{P_\mathrm{r}}{T_\mathrm{r}}\]- Returns
Expression for residual gibbs free (divided by RT) – dimensionless
-
H_R_RT_expr
(P, T)[source]¶ Dimensionless residual enthalpy
\[\frac{H^\mathrm{R}}{RT} = P_\mathrm{r}\left[ \frac{B^0}{T_\mathrm{r}} - \frac{\mathrm{d} B^0}{\mathrm{d}T_\mathrm{r}} + \omega\left(\frac{B^1}{T_\mathrm{r}} - \frac{\mathrm{d}B^1}{\mathrm{d}T_\mathrm{r}}\right) \right]\]- Returns
Expression for residual enthalpy (divided by RT) – dimensionless
-
S_R_R_expr
(P, T)[source]¶ Dimensionless residual entropy
\[\frac{S^\mathrm{R}}{R} = -P_\mathrm{r}\left( \frac{\mathrm{d} B^0}{\mathrm{d}T_\mathrm{r}} + \omega\frac{\mathrm{d}B^1}{\mathrm{d}T_\mathrm{r}} \right)\]- Returns
Expression for residual entropy (divided by R) – dimensionless
-
ln_hat_phi_i_expr
(P, T)[source]¶ logarithm of fugacity coefficient
Note
single-component version
\[\ln\hat{\phi}_i = \frac{PB}{RT}\]- Parameters
P (float) – pressure in Pa
T (float) – temperature in K
-
plot_Z_vs_P
(T, P_min, P_max, symbol='o', ax=None, **kwargs)[source]¶ Plot compressibility as a function of pressure
- Parameters
T (float) – temperature [K]
P_min (float) – minimum pressure for plotting [Pa]
P_max (float) – maximum pressure for plotting [Pa]
phase (str) – phase type (liquid or vapor), defaults to vapor
symbol (str) – marker symbol, defaults to ‘o’
ax (plt.axis) – matplotlib axes for plotting, defaults to None
kwargs – keyword arguments for plotting
-
-
class
scithermo.eos.virial.
BinarySecondVirial
(i_kwargs=None, j_kwargs=None, k_ij=0.0, pow: callable = <ufunc 'power'>, exp: callable = <ufunc 'exp'>)[source]¶ Second virial with combining rules from [PLdeAzevedo86]
\[\begin{split}\begin{align} w_{ij} &= \frac{w_i + w_j}{2} \\ T_{\mathrm{c},ij} &= \sqrt{T_{\mathrm{c},i}T_{\mathrm{c},j}}(1-k_{ij}) :label:eq_Tcij\\ P_{\mathrm{c},ij} &= \frac{Z_{\mathrm{c},ij}RT_{\mathrm{c},ij}}{V_{\mathrm{c},ij}} \\ \end{align}\end{split}\]where
\[\begin{split}\begin{align} Z_{\mathrm{c},ij} &= \frac{Z_{\mathrm{c},i} + Z_{\mathrm{c},j}}{2} \\\ V_{\mathrm{c},ij} &= \left(\frac{V_{\mathrm{c},i}^{1/3} + V_{\mathrm{c},j}^{1/3}}{2}\right)^{3} \end{align}\end{split}\]- Parameters
k_ij (float) – equation of state mixing rule in calculation of critical temperautre, see Equation
eq_Tcij
. When \(i=j\) and for chemical similar species, \(k_{ij}=0\). Otherwise, it is a small (usually) positive number evaluated from minimal \(PVT\) data or, in the absence of data, set equal to zero.cas_pairs (list(tuple(str))) – pairs of cas registry numbers, derived from cas_numbers calculated
other_cas (dict) – map from one cas number to other
-
B_ij_expr
(cas_1, cas_2, T)[source]¶ Returns \(B_{ij}\) considering that
i=j
ori!=j
If
i=j
, find the component \(k\) for whichk=i=j
(all cas no’s equal). Then return \(B_{kk}\) where\[B_{kk}=\frac{RT_{\mathrm{c},k}}{P_{\mathrm{c},k}}\left[ B^0\left(\frac{T}{T_{\mathrm{c},k}}\right) + \omega_k\left(\frac{T}{T_{\mathrm{c},k}}\right) \right]\]Otherwise, if
i!=j
, return \(B_{ij}\), where\[B_{ij}=\frac{RT_{\mathrm{c},ij}}{P_{\mathrm{c},ij}}\left[ B^0\left(\frac{T}{T_{\mathrm{c},ij}}\right) + \omega_{ij}\left(\frac{T}{T_{\mathrm{c},ij}}\right) \right]\]This is implemented in a simplified fashion usintg
BinarySecondVirial.get_w_Tc_Pc()
and then calling the generic expression for \(B\)- Parameters
cas_1 (str) – cas number of first component
cas_2 (str) – cas number of second component
T – temperature [K]
-
B_mix_expr
(y_k, T)[source]¶ - Parameters
y_k (dict[
cas_numbers
, float]) – mole fractions of each component \(k\)T – temperature in K
- Returns
\(B\) [m^3/mol], where \(Z = 1 + BP/R/T\)
-
Tstar_d_lnphi_dTstar
(cas_i, y_i, P, T)[source]¶ Returns
\[\begin{split}\begin{align} T^\star \frac{\partial \ln{\hat{\phi}_i}}{\partial T^\star} &= \frac{T T_\text{ref}}{T_\text{ref}}\frac{\partial \ln{\hat{\phi}_i}}{\partial T} = \frac{T}{T_\text{c}}\frac{\partial \ln{\hat{\phi}_i}}{\partial T_\text{r}} \\ &= \frac{T}{T_\text{c}}\left[ \frac{P}{RT}\left( \frac{\partial B_{ii}}{\partial T_r} + (1-y_i)^2\frac{\partial \delta_{ij}}{\partial T_r} \right) - \frac{T_c\ln\hat{\phi}_i}{T} \right] \\ &= \frac{P}{R T_\text{c}}\left( \frac{\partial B_{ii}}{\partial T_r} + (1-y_i)^2\frac{\partial \delta_{ij}}{\partial T_r} \right) - \ln\hat{\phi}_i \\ &= -\frac{\bar{H}_i^\text{R}}{RT} \end{align}\end{split}\]where \(\frac{\partial \delta_{ij}}{\partial T_r}\) is given by (3)
- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
-
X_R_dimensionless
(method: callable, cas_i: str, y_i: float, P: float, T: float)[source]¶ Residual property of \(X\) for mixture.
- Parameters
method (callable) – function to compute partial molar property of compound
-
bar_GiR_RT
(*args)[source]¶ Dimensionless residual partial molar free energy of component \(i\)
(1)¶\[\frac{\bar{G}^\mathrm{R}_i}{RT} = \ln\hat{\phi}_i\]
-
bar_HiR_RT
(cas_i, y_i, P, T)[source]¶ Dimensionless residual partial molar enthalpy of component \(i\)
\[\begin{split}\begin{align} \frac{\bar{H}^\mathrm{R}_i}{RT} &= -T \left(\frac{\partial \ln\hat{\phi}_i}{\partial T}\right)_{P,y} \\ &= - \frac{T}{T_c} \left(\frac{\partial \ln\hat{\phi}_i}{\partial T_r}\right)_{P,y} \\ &= - \frac{T}{T_c}\left( \frac{P}{RT}\left[ \frac{\partial B_{ii}}{\partial T_r} + (1-y_i)^2\frac{\partial \delta_{ij}}{\partial T_r} \right] - \frac{T_c\ln\hat{\phi}_i}{T} \right) \end{align}\end{split}\]where \(\frac{\partial \delta_{ij}}{\partial T_r}\) is given by (3) so that we obtain
(2)¶\[\frac{\bar{H}^\mathrm{R}_i}{RT} = -\frac{P}{RT_c}\left[ \frac{\partial B_{ii}}{\partial T_r} + (1-y_i)^2\frac{\partial \delta_{ij}}{\partial T_r} \right] + \ln\hat{\phi}_i\]- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
-
bar_SiR_R
(cas_i, y_i, P, T)[source]¶ Dimensionless residual partial molar entropy of component \(i\)
Since
\[G^\mathrm{R} = H^\mathrm{R} - T S^\mathrm{R}\]In terms of partial molar properties, then
\[\begin{split}\begin{align} \bar{S}_i^\mathrm{R} &= \frac{\bar{H}_i^\mathrm{R} - \bar{G}_i^\mathrm{R}}{T} \\ \frac{\bar{S}_i^\mathrm{R}}{R} &= \frac{\bar{H}_i^\mathrm{R}}{RT} - \frac{\bar{G}_i^\mathrm{R}}{RT} \\ \end{align}\end{split}\]By comparing Equation (1) and (2) it is observed that
\[\frac{\bar{S}_i^\mathrm{R}}{R} = -\frac{P}{RT_c}\left[ \frac{\partial B_{ii}}{\partial T_r} + (1-y_i)^2\frac{\partial \delta_{ij}}{\partial T_r} \right]\]where \(\frac{\partial \delta_{ij}}{\partial T_r}\) is given by (3)
- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
-
bar_ViR_RT
(cas_i, y_i, P, T)[source]¶ residual Partial molar volume for component i
\[\begin{split}\begin{align} \frac{\bar{V}_i^\mathrm{R}}{RT} &= \left(\frac{\partial \ln\hat{\phi}_i}{\partial P}\right)_{T,y}\\ &= \frac{B_{ii} + (1-y_i)^2\delta_{ij}}{RT} \end{align}\end{split}\]Note
This expression does not depend on \(P\)
- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
- Returns
\(\bar{V}_i^\mathrm{R}/R/T\)
-
calc_Z
(y_k, P, T)[source]¶ - Parameters
y_k (dict) – mole fractions of each component \(k\)
P – pressure in Pa
T – temperature in K
- Returns
\(Z\) [mol/m^3], where \(Z = 1 + BP/R/T\)
-
d_dij_d_Tr
(T)[source]¶ - (3)¶\[\frac{\partial \delta_{ij}}{\partial T_r} = 2\frac{\partial B_{ij}}{\partial T_r}-\frac{\partial B_{ii}}{\partial T_r}-\frac{\partial B_{jj}}{\partial T_r}\]
- Parameters
T – temperature [K]
-
d_ij_expr
(T)[source]¶ - (4)¶\[\delta_{ij} = 2B_{ij} - B_{ii} - B_{jj}\]
- Parameters
T – temperature [K]
- Returns
\(\delta_{ij}\) [m**3/mol]
-
fugacity_i_expr
(cas_i, y_i, P, T)[source]¶ Fugacity of component i in mixture \(f_i=\hat{\phi}_i y_i P\)
- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
-
get_w_Tc_Pc
(cas_i, cas_j=None)[source]¶ Returns critical constants for calculation based off of whetner i = j or not
- Returns
(\(w\), \(T_c\), \(P_c\))
- Return type
tuple
-
ln_hat_phi_i_expr
(cas_i, y_i, P, T)[source]¶ logarithm of fugacity coefficient
\[\ln\hat{\phi}_i = \frac{P}{RT}\left[B_{ii} + (1-y_i)^2\delta_{ij}\right]\]- Parameters
cas_i (str) – cas number for component of interest
y_i (float) – mole fraction of component of interest
P (float) – pressure in Pa
T (float) – temperature in K
where \(\delta_{ij}\) is given by Equation (4)