4. Equations of State

4.1. Single Component

4.1.1. Virial

Todo

merge docs with those in gasthermo.partial_molar_properties. There, the definitions of residual properties are displayed and here wee need only write simplified forms for the specific equation of state.

4.1.1.1. Theory

The second order virial equation of state is [GP07]

(1)\[Z = 1 + B\rho = 1 + \frac{BP}{RT}\]

Where the composition dependency of \(B\) is given by the exact mixing rule

(2)\[B = \sum_i \sum_j y_i y_j B_{ij}\]

where \(B_{ij}=B_{ji}\), and \(B_{ii}\) and \(B_{jj}\) are virial coefficients for the pure species

In this package, the useful correlation

\[\frac{BP_\text{c}}{RT_\text{c}} = B^0 + \omega B^1\]

or

(3)\[B = \frac{RT_\text{c}}{P_\text{c}}\left(B^0 + \omega B^1\right)\]

So that, combining Equations (1) and (3), the compressibility can be calculated from dimensionless quantities as

(4)\[Z = 1 + \left(B^0 + \omega B^1\right)\frac{P_\text{r}}{T_\text{r}}\]

where [SVanNessA05]

(5)\[B^0 = 0.083 - \frac{0.422}{T_\text{r}^{1.6}}\]
(6)\[B^1 = 0.139 - \frac{0.172}{T_\text{r}^{4.2}}\]

so that

so that the following derivatives can be computed as

(7)\[\frac{dB^0}{dT_\text{r}} = \frac{0.675}{T_\text{r}^{2.6}}\]
(8)\[\frac{dB^1}{dT_\text{r}} = \frac{0.722}{T_\text{r}^{5.2}}\]

Which allow the \(H^\text{R}\), \(S^\text{R}\), and \(G^\text{R}\) to be readily computed as follows [GP07]

(9)\[\frac{G^\text{R}}{RT} = \left(B^0 + \omega B^1\right)\frac{P_\text{r}}{T_\text{r}}\]
(10)\[\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]\]
(11)\[\frac{S^\text{R}}{R} = -P_\text{r}\left(\frac{d B^0}{d T_\text{r}} - \omega\frac{d B^1}{d T_\text{r}}\right)\]

The cross coefficients are calculated as

(12)\[B_{ij} = \frac{RT_{\text{c}ij}}{P_{\text{c}ij}}\left(B^0 + \omega_{ij}B^1\right)\]

so that the cross derivatives can be computed as

\[ \begin{align}\begin{aligned}\frac{dB_{ij}}{dT} = \frac{RT_{\text{c}ij}}{P_{\text{c}ij}}\left(\frac{dB^0}{d T} + \omega_{ij}\frac{dB^1}{dT}\right)\\\frac{dB_{ij}}{dT} = \frac{R}{P_{\text{c}ij}}\left(\frac{dB^0}{d T_{\text{r}ij}} + \omega_{ij}\frac{dB^1}{dT_{\text{r}ij}}\right)\end{aligned}\end{align} \]

or, equivalently,

(13)\[\frac{dB_{ij}}{dT_{\text{r}ij}} = \frac{RT_{\text{c}ij}}{P_{\text{c}ij}}\left(\frac{dB^0}{d T_{\text{r}ij}} + \omega_{ij}\frac{dB^1}{dT_{\text{r}ij}}\right)\]

4.1.1.2. Fugacity Coefficients

The Fugacity coefficients are calculated as

\[\ln\hat{\phi}_i=\left(\frac{\partial (nG^\text{R}/R/T)}{\partial n_i}\right)_{P,T,n_j}\]

For the virial equation of state, this becomes [VanNessA82]

(14)\[\ln\hat{\phi}_k = \frac{P}{RT}\left[B_{kk} + \frac{1}{2}\sum_i\sum_jy_iy_j\left(2\delta_{ik} - \delta_{ij}\right)\right]\]

where both \(i\) and \(j\) indices run over all species

(15)\[\delta_{ik} = 2B_{ik} - B_{ii} - B_{kk} = \delta_{ki}\]

and

\[\delta_{ii} = 0\]

4.1.1.3. Residual Partial Molar Properties

The partial molar residual free energy of component k is

(16)\[\frac{\bar{G}^\text{R}_k}{RT} = \ln{\hat{\phi}_k} = \frac{P}{RT}\left[B_{kk} + \frac{1}{2}\sum_i\sum_jy_iy_j\left(2\delta_{ik} - \delta_{ij}\right)\right]\]

The partial molar residual enthalpy of component k is

\[\begin{split}\begin{align} \frac{\bar{H}^\mathrm{R}_k}{RT} &= -T \left(\frac{\partial \ln\hat{\phi}_k}{\partial T}\right)_{P,y} \\ &= - \frac{T}{T_c} \left(\frac{\partial \ln\hat{\phi}_k}{\partial T_r}\right)_{P,y} \\ &= - \frac{T}{T_c}\left\{ \frac{P}{RT}\left[ \frac{\partial B_{kk}}{\partial T_r} + \frac{1}{2}\sum_i\sum_j y_iy_j\left( 2\frac{\partial \delta_{ik}}{\partial T_r} - \frac{\partial \delta_{ij}}{\partial T_r} \right) \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 (39) so that we obtain

(17)\[\frac{\bar{H}^\mathrm{R}_k}{RT} = - \frac{P}{RT_\text{c}}\left[ \frac{\partial B_{kk}}{\partial T_r} + \frac{1}{2}\sum_i\sum_j y_iy_j\left( 2\frac{\partial \delta_{ik}}{\partial T_r} - \frac{\partial \delta_{ij}}{\partial T_r} \right) \right] + \ln\hat{\phi}_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 (16) and (17) it is observed that

(18)\[\frac{\bar{S}_k^\mathrm{R}}{R} = - \frac{P}{RT_\text{c}}\left[ \frac{\partial B_{kk}}{\partial T_r} + \frac{1}{2}\sum_i\sum_j y_iy_j\left( 2\frac{\partial \delta_{ik}}{\partial T_r} - \frac{\partial \delta_{ij}}{\partial T_r} \right) \right]\]

where \(\frac{\partial \delta_{ij}}{\partial T_r}\) is given by (39)

The partial molar residual volume of component i is calculated as

\[\begin{split}\begin{align} \frac{\bar{V}_k^\mathrm{R}}{RT} &= \left(\frac{\partial \ln\hat{\phi}_i}{\partial P}\right)_{T,y}\\ &= \frac{\partial}{\partial P}\left\{\frac{P}{RT}\left[B_{kk} + \frac{1}{2}\sum_i\sum_jy_iy_j\left(2\delta_{ik} - \delta_{ij}\right)\right]\right\} \end{align}\end{split}\]

which simplifies to

(19)\[\frac{\bar{V}_k^\mathrm{R}}{RT} = \frac{1}{RT}\left[B_{kk} + \frac{1}{2}\sum_i\sum_jy_iy_j\left(2\delta_{ik} - \delta_{ij}\right)\right]\]

from which we obtain the intuitive result of

\[\bar{V}_k^\mathrm{R} = B_{kk} + \frac{1}{2}\sum_i\sum_jy_iy_j\left(2\delta_{ik} - \delta_{ij}\right)\]
class gasthermo.eos.virial.Virial(pow: callable = <ufunc 'power'>, exp: callable = <ufunc 'exp'>)[source]
Parameters
  • pow (callable, optional) – function for computing power, defaults to numpy.power

  • exp (callable, optional) – function for computing logarithm, defaults to numpy.exp

B0_expr(T_r)[source]
Parameters

T_r – Reduced temperature

Returns

Equation (5)

B1_expr(T_r)[source]
Parameters

T_r – reduced temperature

Returns

Equation eq:B1_expr

B_expr(T_r, w, T_c, P_c)[source]
Parameters
  • T_r – reduced temperature

  • w – accentric factor

  • T_c – critical temperautre [K]

  • P_c – critical pressure [Pa]

Returns

Equation (3)

d_B0_d_Tr_expr(T_r)[source]
Parameters

T_r – reduced temperature

Returns

Equation (7)

d_B1_d_Tr_expr(T_r)[source]
Parameters

T_r – reduced temperature

Returns

Equation (8)

hat_phi_i_expr(*args)[source]

expression for fugacity coefficient :returns: \(\exp\left({\ln{\hat{\phi}_i}}\right)\)

class gasthermo.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]
Parameters
  • P – pressure in Pa

  • T – Temperautre in K

Returns

Equation (9)

H_R_RT_expr(P, T)[source]
Parameters
  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (10)

S_R_R_expr(P, T)[source]
Parameters
  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (11)

calc_Z_from_dimensionless(P_r, T_r)[source]
Parameters
  • P_r – reduced pressure, dimensionless

  • T_r – reduced temperature, dimensionless

Returns

Equation (4)

calc_Z_from_units(P, T)[source]
Parameters
  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (1)

ln_hat_phi_k_expr(P, T)[source]

logarithm of fugacity coefficient

Note

single-component version

In this case, Equation (14) simplifies to

\[\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

4.1.2. Cubic

4.1.2.1. Theory

The generic cubic equation of state is [GP07]

\[P = \frac{RT}{V - b} - \frac{a(T)}{(V + \epsilon b)(V + \sigma b)}\]

where \(\epsilon\) and \(\sigma\) are pure numbers (the same for all substances), and \(a(T)\) and \(b\) are given by the following equations

(20)\[a(T) = \Psi \frac{\alpha(T_r)R^2T_{\text{c}}^2}{P_{\text{c}}}\]
\[b = \Omega\frac{RT_\text{c}}{P_\text{c}}\]

The compressibility factor can be calculated by solving the following equation

(21)\[Z - \left(1 + \beta - \frac{q\beta (Z - \beta)}{(Z + \epsilon\beta)(Z + \sigma\beta)}\right) = 0\]

where

(22)\[\beta = \Omega\frac{P_\text{r}}{T_\text{r}}\]

and

(23)\[q = \frac{\Psi \alpha(T_\text{r})}{\Omega T_\text{r}}\]

An iterative routine to calculate \(Z\) using Equation (21) is implemented, following [GP07], where

(24)\[Z^\text{new} = 1 + \beta - \frac{q\beta (Z^\text{old} - \beta)}{(Z^\text{old} + \epsilon\beta)(Z^\text{old} + \sigma\beta)}\]

that is continued until the following is true

(25)\[\|\frac{Z^\text{new} - Z^\text{old}}{Z^\text{new} + Z^\text{old}}\times 200\| < \text{tol}\]

4.1.2.2. Residual Molar Properties

(26)\[\frac{H^\text{R}}{RT} = Z - 1 + \left[\frac{\text{d} \ln \alpha(T_\text{r})}{\text{d} \ln T_\text{r}} - 1\right]qI\]
(27)\[\frac{G^\text{R}}{RT} = Z - 1 + \ln(Z-\beta) - qI\]
(28)\[\frac{S^\text{R}}{R} = \ln(Z-\beta) + \frac{\text{d} \ln \alpha(T_\text{r})}{\text{d} \ln T_\text{r}} qI\]

where the following functions have been defined

(29)\[I = \frac{1}{\sigma - \epsilon}\ln{\left( \frac{Z + \sigma \beta}{Z + \epsilon \beta} \right)}\]
(30)\[1 + \beta - \frac{q\beta (Z - \beta)}{(Z + \epsilon\beta)(Z + \sigma\beta)}\]

4.1.2.3. Fugacity Coefficients

The pure-component fugacity coefficient is defined as

\[\frac{G_i^\text{R}}{RT} = \ln\hat{\phi}_i\]

So that, from Equation (27),

(31)\[\ln\hat{\phi}_i = Z_i - 1 + \ln(Z_i-\beta_i) - q_iI_i\]

4.1.2.4. Mixtures

Warning

Not implemented yet!

Todo

Implement mixtures with cubic equations of state

class gasthermo.eos.cubic.Cubic(sigma: float, epsilon: float, Omega: float, Psi: float, dippr_no: str = None, compound_name: str = None, cas_number: str = None, log: callable = <ufunc 'log'>, exp: callable = <ufunc 'exp'>, name: str = 'cubic', **kwargs)[source]

Generic Cubic Equation of State

Parameters
  • sigma – Parameter defined by specific equation of state, \(\sigma\)

  • epsilon – Parameter defined by specific equation of state, \(\epsilon\)

  • Omega – Parameter defined by specific equation of state, \(\Omega\)

  • Psi – Parameter defined by specific equation of state, \(\Psi\)

  • tol – tolerance for iteration (see Equation (25)), set to 0.01

  • log – function for computing natural log, defaults to numpy.log

  • exp – function for computing exponential, defaults to numpy.exp

G_R_RT_expr(P, V, T)[source]

Dimensionless residual gibbs

Parameters
  • P – pressure in Pa

  • V – molar volume in m**3/mol

  • T – temperature in K

Returns

\(\frac{G^\text{R}}{RT}\), see Equation (27)

H_R_RT_expr(P, V, T)[source]

Dimensionless residual enthalpy

Parameters
  • P – pressure in Pa

  • V – molar volume in m**3/mol

  • T – temperature in K

Returns

\(\frac{H^\text{R}}{RT}\), see Equation (26)

I_expr(P, V, T)[source]
Parameters
  • P – pressure in Pa

  • V – molar volume in m**3/mol

  • T – temperature in K

Returns

\(I\) (see Equation (29))

S_R_R_expr(P, V, T)[source]

Dimensionless residual entropy

Parameters
  • P – pressure in Pa

  • V – molar volume in m**3/mol

  • T – temperature in K

Returns

\(\frac{S^\text{R}}{R}\), see Equation (28)

Z_right_hand_side(Z, beta, q)[source]

Estimate of compressibility of vapor [GP07], used for iterative methods

Returns

RHS of residual, see Equation (30)

a_expr(T)[source]
Parameters

T – temperautre in K

Returns

\(a(T)\) (see Equation (20))

alpha_expr(T_r)[source]

An empirical expression, specific to a particular form of the equation of state

Parameters

T_r – reduced temperature (T/Tc), dimensionless

Returns

\(\alpha (T_r)\) see Table ??

beta_expr(T, P)[source]
Parameters
  • T – temperature in K

  • P – pressure in Pa

Returns

\(\beta\) (see Equation (22))

cardano_constants(T, P)[source]
Parameters
  • T – temperature [T]

  • P – pressure [Pa]

Returns

cardano constants p, q

Return type

tuple

coefficients(T, P)[source]

Polynomial oefficients for cubic equation of state

\[Z^3 c_0 + Z^2c_1 + Z*c_2 + c_3 = 0\]
Returns

(c_0, c_1, c_2, c_3)

d_ln_alpha_d_ln_Tr(T_r)[source]
Parameters

T_r – reduced temperature [dimensionless]

Returns

Expression for \(\frac{\mathrm{d} \ln \alpha(T_\mathrm{r})}{\mathrm{d} \ln T_\mathrm{r}}\)

hat_phi_i_expr(*args)[source]

expression for fugacity coefficient :returns: \(\exp\left({\ln{\hat{\phi}_i}}\right)\)

iterate_to_solve_Z(T, P) → float[source]

Iterate to compute \(Z\) using Equation (24) util termination condition (Equation (25) is met)

Parameters
  • T – temperature in K

  • P – pressure in Pa

Returns

compressibility factor

ln_hat_phi_k_expr(P, V, T)[source]
Parameters
  • P – pressure in Pa

  • T – temperature in K

  • V – molar volume in m**3/mol

Returns

\(\ln{\hat{\phi}_k\), see Equation \(ln_hat_phi_i\)

num_roots(T, P)[source]

Find number of roots

See [ML12][Dei02]

Parameters
  • T – temperature in K

  • P – pressure in Pa

Returns

number of roots

plot_Z_vs_P(T: float, P_min: float, P_max: float, symbol='o', ax: matplotlib.pyplot.axis = None, fig: matplotlib.pyplot.figure = None, **kwargs)[source]

Plot compressibility as a function of pressure

Parameters
  • T – temperature [K]

  • P_min – minimum pressure for plotting [Pa]

  • P_max – maximum pressure for plotting [Pa]

  • symbol – marker symbol, defaults to ‘o’

  • ax – matplotlib axes for plotting, defaults to None

  • kwargs – keyword arguments for plotting

print_roots(T, P)[source]

Check to see if all conditions have one root

q_expr(T)[source]
Parameters

T – temperautre in K

Returns

\(q\) (see Equation (23))

residual(P, V, T)[source]
Parameters
  • P – pressure in Pa

  • V – volume in [mol/m**3]

  • T – temperature in K

Returns

residual for cubic equation of state (Equation (21))

class gasthermo.eos.cubic.RedlichKwong(**kwargs)[source]

Redlich-Kwong Equation of State [RK49]

This Equation of state has the following parameters [SVanNessA05]

Symbol

Value

\(\alpha(T_\text{r})\)

\(1/\sqrt{T_\text{r}}\)

\(\sigma\)

1

\(\epsilon\)

0

\(\Omega\)

0.08664

\(\Psi\)

0.42748

>>> from gasthermo.eos.cubic import RedlichKwong
>>> model = RedlichKwong(compound_name='Propane')
>>> model.sigma
1
>>> model.epsilon
0
>>> model.Omega
0.08664
>>> model.Psi
0.42748
alpha_expr(T_r)[source]

An empirical expression, specific to a particular form of the equation of state

Parameters

T_r – reduced temperature (T/Tc), dimensionless

Returns

\(\alpha (T_r)\) see Table ??

d_ln_alpha_d_ln_Tr(T_r)[source]
Parameters

T_r – reduced temperature [dimensionless]

Returns

Expression for \(\frac{\mathrm{d} \ln \alpha(T_\mathrm{r})}{\mathrm{d} \ln T_\mathrm{r}}\)

class gasthermo.eos.cubic.SoaveRedlichKwong(**kwargs)[source]

Soave Redlich-Kwong Equation of State [Soa72]

This equation of state has the following parameters

Symbol

Value

\(\alpha(T_\text{r})\)

\(\left[1 + f_w(1-\sqrt{T_\text{r}})\right]^2\)

\(\sigma\)

\(1\)

\(\epsilon\)

\(0\)

\(\Omega\)

\(0.08664\)

\(\Psi\)

\(0.42748\)

where

(32)\[f_w = 0.480 + 1.574\omega - 0.176\omega^2\]
>>> from gasthermo.eos.cubic import SoaveRedlichKwong
>>> model = SoaveRedlichKwong(compound_name='Water')
>>> model.Omega
0.08664
>>> model.sigma
1
>>> model.epsilon
0
>>> model.Psi
0.42748
>>> model.f_w_rule(0.)
0.48
>>> model.f_w_rule(1.)
1.878
Parameters

f_w (float, derived) – empirical expression used in \(\\alpha\) [dimensionless], see Equation (32)

alpha_expr(T_r)[source]

An empirical expression, specific to a particular form of the equation of state

Parameters

T_r – reduced temperature (T/Tc), dimensionless

Returns

\(\alpha (T_r)\) see Table ??

d_ln_alpha_d_ln_Tr(T_r)[source]
Parameters

T_r – reduced temperature [dimensionless]

Returns

Expression for \(\frac{\mathrm{d} \ln \alpha(T_\mathrm{r})}{\mathrm{d} \ln T_\mathrm{r}}\)

f_w_rule(w)[source]
Parameters

w – accentric factor

Returns

\(f_w\), see Equation (32)

class gasthermo.eos.cubic.PengRobinson(**kwargs)[source]

Peng-Robinson Equation of State [PR76]

This equation of state has the following parameters

Symbol

Value

\(\alpha(T_\text{r})\)

\(\left[1 + f_w(1-\sqrt{T_\text{r}})\right]^2\)

\(\sigma\)

\(1 + \sqrt{2}\)

\(\epsilon\)

\(1 - \sqrt{2}\)

\(\Omega\)

\(0.07780\)

\(\Psi\)

\(0.45724\)

where

(33)\[f_w = 0.480 + 1.574\omega - 0.176\omega^2\]
>>> from gasthermo.eos.cubic import PengRobinson
>>> model = PengRobinson(compound_name='Water')
>>> model.Omega
0.0778
>>> model.sigma
2.4142135
>>> model.epsilon
-0.414213
>>> model.Psi
0.45724
>>> model.f_w_rule(0.)
0.37464
>>> model.f_w_rule(1.)
1.64698
Parameters

f_w (float, derived) – empirical expression used in \(\\alpha\) [dimensionless?]

f_w_rule(w)[source]
Parameters

w – accentric factor

Returns

\(f_w\), see Equation (33)

4.2. Multicomponent

4.2.1. Virial

class gasthermo.eos.virial.MixingRule(pow: callable = <ufunc 'power'>, exp: callable = <ufunc 'exp'>)[source]

Van der Walls mixing rule

combining rules from [PLdeAzevedo86]

(34)\[\omega_{ij} = \frac{\omega_i + \omega_j}{2}\]
(35)\[T_{\text{c}ij} = \sqrt{T_{\text{c}i}T_{\text{c}j}}(1-k_{ij})\]
(36)\[P_{\text{c}ij} = \frac{Z_{\text{c}ij}RT_{\text{c}ij}}{V_{\text{c}ij}}\]
(37)\[Z_{\text{c}ij} = \frac{Z_{\text{c}i} + Z_{\text{c}j}}{2}\]
(38)\[V_{\text{c}ij} = \left(\frac{V_{\text{c}i}^{1/3} + V_{\text{c}j}^{1/3}}{2}\right)^3\]
P_cij_rule(Z_ci, V_ci, T_ci, Z_cj, V_cj, T_cj, k_ij)[source]
Returns

Equation (36)

T_cij_rule(T_ci, T_cj, k_ij)[source]
Parameters
  • T_ci – critical temperature of component i [K]

  • T_cj – ** j [K]

  • k_ij – k_ij parameter

Returns

Equation (35)

V_cij_rule(V_ci, V_cj)[source]
Parameters
  • V_ci – critical molar volume of component i [m**3/mol]

  • V_cj – critical molar volume of component j [m**3/mol]

Returns

Equation eq:Vc_combine

Z_cij_rule(Z_ci, Z_cj)[source]
Parameters
  • Z_ci – critical compressibility factor of component i

  • Z_cj – critical compressibility factor of component j

Returns

Equation (37)

w_ij_rule(w_i, w_j)[source]
Parameters
  • w_i – accentric factor of component i

  • w_j – accentric factor of component j

Returns

Equation (34)

class gasthermo.eos.virial.SecondVirialMixture(pow: callable = <ufunc 'power'>, exp: callable = <ufunc 'exp'>, **kwargs)[source]

Second virial with mixing rule from MixingRule

Note

can only input both custom critical properties or both from DIPPR–cant have mixed at the moment

Parameters
  • pow – function to calculate power, defaults to numpy.power

  • exp – function to calculate exponential,d efaults to numpy.exp

  • kwargs – key-word arguments to pass to RealMixture

B_ij_expr(i: int, j: int, T)[source]
Parameters
  • i – index of first component

  • j – index of second component

  • T – temperature [K]

Returns

Equation (12)

B_mix_expr(y_k: List[Union[float, Any]], T)[source]
Parameters
  • y_k – mole fractions of each component \(k\)

  • T – temperature in K

Returns

Equation (2)

G_R_RT(*args)[source]

Residual free energy of mixture \(G^\mathrm{R}/R/T\)

H_R_RT(*args)[source]

Residual enthalpy of mixture \(H^\mathrm{R}/R/T\)

M_R_dimensionless(method: callable, ys: List[Union[float, Any]], P: float, T: float)[source]

Residual property of \(X\) for mixture.

Similar to Equation (3) but in dimensionless form

Parameters

method (callable) – function to compute partial molar property of compound

S_R_R(*args)[source]

Residual entropy of mixture \(S^\mathrm{R}/R\)

bar_GiR_RT(cas_k: str, ys: List[Union[float, Any]], P, T)[source]

Dimensionless residual partial molar free energy of component \(i\)

Parameters
  • cas_k – cas number of component k

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (16)

bar_HiR_RT(cas_k: str, ys: List[Union[float, Any]], P, T)[source]

Dimensionless residual partial molar enthalpy of component \(i\)

Parameters
  • cas_k – cas number for component of interest

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

bar_HiR_star(T_star, cas_k: str, ys: List[Union[float, Any]], P, T)[source]

Returns the scaled entropy useful for computations \(\bar{H}_i^{\text{R},\star}\), as defined in Equation (10)

Parameters
  • cas_k – cas number of component k

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

bar_SiR_R(cas_k: str, ys: List[Union[float, Any]], P, T)[source]

Dimensionless residual partial molar entropy of component \(i\)

Parameters
  • cas_k – cas number for component of interest

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (18)

bar_ViR_RT(cas_k: str, ys: List[Union[float, Any]], P, T)[source]

residual Partial molar volume for component i

Note

This expression does not depend on \(P\)

Parameters
  • cas_k – cas number for component of interest

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (19)

calc_Z_from_units(y_k: List, P, T)[source]
Parameters
  • y_k – mole fractions of each component \(k\)

  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (1)

d_Bij_d_Trij(i: int, j: int, T)[source]
Parameters
  • i – index for component i

  • j – index for componen t j

  • T – temperature in K

Returns

Equation (13)

d_dij_d_Tr(i, j, T)[source]
(39)\[\frac{\partial \delta_{ij}}{\partial T_{\text{r}ij}} = 2\frac{\partial B_{ij}}{\partial T_{\text{r}ij}}-\frac{\partial B_{ii}}{\partial T_{\text{r}ij}}-\frac{\partial B_{jj}}{\partial T_{\text{r}ij}}\]

Todo

test this with symbolic differentiation of d_ik expression

Parameters
  • i – index for component i

  • j – index for componen t j

  • T – temperature [K]

d_ik_expr(i: int, k: int, T)[source]
Parameters
  • i – index of component i

  • k – index of component k

  • T – temperature [K]

Returns

Equation (15)

fugacity_i_expr(cas_i: str, ys: List[Union[float, Any]], P, T)[source]

Fugacity of component i in mixture \(f_i=\hat{\phi}_i y_i P\)

Parameters
  • cas_i – cas number for component of interest

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

get_w_Tc_Pc(i: int, 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_k_expr(k: int, ys: List[Union[float, Any]], P, T)[source]

logarithm of fugacity coefficient

Parameters
  • k – index of component k

  • ys – mole fractions

  • P – pressure in Pa

  • T – temperature in K

Returns

Equation (14)

plot_residual_HSG(P, T, ax=None, fig=None) → Tuple[matplotlib.pyplot.figure, matplotlib.pyplot.subplot][source]

Plot dimensionless residual properties as a function of mole fraction

Parameters
  • P – pressure in Pa

  • T – Temperature in K

  • ax – matplotlib ax, defaults to None

  • fig – matplotlib figure, defautls to None