Wilson Gibbs Excess Model (thermo.wilson)

This module contains a class Wilson for performing activity coefficient calculations with the Wilson model. An older, functional calculation for activity coefficients only is also present, Wilson_gammas.

For reporting bugs, adding feature requests, or submitting pull requests, please use the GitHub issue tracker.

Wilson Class

class thermo.wilson.Wilson(T, xs, lambda_coeffs=None, ABCDEF=None, lambda_as=None, lambda_bs=None, lambda_cs=None, lambda_ds=None, lambda_es=None, lambda_fs=None)[source]

Bases: thermo.activity.GibbsExcess

Class for representing an a liquid with excess gibbs energy represented by the Wilson equation. This model is capable of representing most nonideal liquids for vapor-liquid equilibria, but is not recommended for liquid-liquid equilibria.

The two basic equations are as follows; all other properties are derived from these.

\[g^E = -RT\sum_i x_i \ln\left(\sum_j x_j \lambda_{i,j} \right) \]
\[\Lambda_{ij} = \exp\left[a_{ij}+\frac{b_{ij}}{T}+c_{ij}\ln T + d_{ij}T + \frac{e_{ij}}{T^2} + f_{ij}{T^2}\right] \]
Parameters
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

lambda_coeffslist[list[list[float]]], optional

Wilson parameters, indexed by [i][j] and then each value is a 6 element list with parameters (a, b, c, d, e, f); either lambda_coeffs or the lambda parameters are required, [various]

ABCDEFtuple(list[list[float]], 6), optional

The lamba parameters can be provided as a tuple, [various]

lambda_aslist[list[float]], optional

a parameters used in calculating Wilson.lambdas, [-]

lambda_bslist[list[float]], optional

b parameters used in calculating Wilson.lambdas, [K]

lambda_cslist[list[float]], optional

c parameters used in calculating Wilson.lambdas, [-]

lambda_dslist[list[float]], optional

d paraemeters used in calculating Wilson.lambdas, [1/K]

lambda_eslist[list[float]], optional

e parameters used in calculating Wilson.lambdas, [K^2]

lambda_fslist[list[float]], optional

f parameters used in calculating Wilson.lambdas, [1/K^2]

Notes

In addition to the methods presented here, the methods of its base class thermo.activity.GibbsExcess are available as well.

Warning

If parameters are ommited for all interactions, this model reverts to thermo.activity.IdealSolution. In large systems it is common to only regress parameters for the most important components; set lambda parameters for other components to 0 to “ignore” them and treat them as ideal components.

This class works with python lists, numpy arrays, and can be accelerated with Numba or PyPy quite effectively.

References

1(1,2)

Smith, H. C. Van Ness Joseph M. Introduction to Chemical Engineering Thermodynamics 4th Edition, Joseph M. Smith, H. C. Van Ness, 1987.

2

Kooijman, Harry A., and Ross Taylor. The ChemSep Book. Books on Demand Norderstedt, Germany, 2000.

3

Gmehling, Jürgen, Michael Kleiber, Bärbel Kolbe, and Jürgen Rarey. Chemical Thermodynamics for Process Simulation. John Wiley & Sons, 2019.

Examples

Example 1

This object-oriented class provides access to many more thermodynamic properties than Wilson_gammas, but it can also be used like that function. In the following example, gammas are calculated with both functions. The lambdas cannot be specified in this class; but fixed values can be converted with the log function so that fixed values will be obtained.

>>> Wilson_gammas([0.252, 0.748], [[1, 0.154], [0.888, 1]])
[1.881492608717, 1.165577493112]
>>> GE = Wilson(T=300.0, xs=[0.252, 0.748], lambda_as=[[0, log(0.154)], [log(0.888), 0]])
>>> GE.gammas()
[1.881492608717, 1.165577493112]

We can check that the same lambda values were computed as well, and that there is no temperature dependency:

>>> GE.lambdas()
[[1.0, 0.154], [0.888, 1.0]]
>>> GE.dlambdas_dT()
[[0.0, 0.0], [0.0, 0.0]]

In this case, there is no temperature dependency in the Wilson model as the lambda values are fixed, so the excess enthalpy is always zero. Other properties are not always zero.

>>> GE.HE(), GE.CpE()
(0.0, 0.0)
>>> GE.GE(), GE.SE(), GE.dGE_dT()
(683.165839398, -2.277219464, 2.2772194646)

Example 2

ChemSep is a (partially) free program for modeling distillation. Besides being a wonderful program, it also ships with a permissive license several sets of binary interaction parameters. The Wilson parameters in it can be accessed from Thermo as follows. In the following case, we compute activity coefficients of the ethanol-water system at mole fractions of [.252, 0.748].

>>> from thermo.interaction_parameters import IPDB
>>> CAS1, CAS2 = '64-17-5', '7732-18-5'
>>> lambda_as = IPDB.get_ip_asymmetric_matrix(name='ChemSep Wilson', CASs=[CAS1, CAS2], ip='aij')
>>> lambda_bs = IPDB.get_ip_asymmetric_matrix(name='ChemSep Wilson', CASs=[CAS1, CAS2], ip='bij')
>>> GE = Wilson(T=273.15+70, xs=[.252, .748], lambda_as=lambda_as, lambda_bs=lambda_bs)
>>> GE.gammas()
[1.95733110, 1.1600677]

In ChemSep, the form of the Wilson lambda equation is

\[\Lambda_{ij} = \frac{V_j}{V_i}\exp\left( \frac{-A_{ij}}{RT}\right) \]

The parameters were converted to the form used by Thermo as follows:

\[a_{ij} = \log\left(\frac{V_j}{V_i}\right) \]
\[b_{ij} = \frac{-A_{ij}}{R}= \frac{-A_{ij}}{ 1.9872042586408316} \]

This system was chosen because there is also a sample problem for the same components from the DDBST which can be found here: http://chemthermo.ddbst.com/Problems_Solutions/Mathcad_Files/P05.01a%20VLE%20Behavior%20of%20Ethanol%20-%20Water%20Using%20Wilson.xps

In that example, with different data sets and parameters, they obtain at the same conditions activity coefficients of [1.881, 1.165]. Different sources of parameters for the same system will generally have similar behavior if regressed in the same temperature range. As higher order lambda parameters are added, models become more likely to behave differently. It is recommended in [3] to regress the minimum number of parameters required.

Example 3

The DDBST has published some sample problems which are fun to work with. Because the DDBST uses a different equation form for the coefficients than this model implements, we must initialize the Wilson object with a different method.

>>> T = 331.42
>>> N = 3
>>> Vs_ddbst = [74.04, 80.67, 40.73]
>>> as_ddbst = [[0, 375.2835, 31.1208], [-1722.58, 0, -1140.79], [747.217, 3596.17, 0.0]]
>>> bs_ddbst = [[0, -3.78434, -0.67704], [6.405502, 0, 2.59359], [-0.256645, -6.2234, 0]]
>>> cs_ddbst = [[0.0, 7.91073e-3, 8.68371e-4], [-7.47788e-3, 0.0, 3.1e-5], [-1.24796e-3, 3e-5, 0.0]]
>>> dis = eis = fis = [[0.0]*N for _ in range(N)]
>>> params = Wilson.from_DDBST_as_matrix(Vs=Vs_ddbst, ais=as_ddbst, bis=bs_ddbst, cis=cs_ddbst, dis=dis, eis=eis, fis=fis, unit_conversion=False)
>>> xs = [0.229, 0.175, 0.596]
>>> GE = Wilson(T=T, xs=xs, lambda_as=params[0], lambda_bs=params[1], lambda_cs=params[2], lambda_ds=params[3], lambda_es=params[4], lambda_fs=params[5])
>>> GE
Wilson(T=331.42, xs=[0.229, 0.175, 0.596], lambda_as=[[0.0, 3.870101271243586, 0.07939943395502425], [-6.491263271243587, 0.0, -3.276991837288562], [0.8542855660449756, 6.906801837288562, 0.0]], lambda_bs=[[0.0, -375.2835, -31.1208], [1722.58, 0.0, 1140.79], [-747.217, -3596.17, -0.0]], lambda_ds=[[-0.0, -0.00791073, -0.000868371], [0.00747788, -0.0, -3.1e-05], [0.00124796, -3e-05, -0.0]])
>>> GE.GE(), GE.dGE_dT(), GE.d2GE_dT2()
(480.2639266306882, 4.355962766232997, -0.029130384525017247)
>>> GE.HE(), GE.SE(), GE.dHE_dT(), GE.dSE_dT()
(-963.3892533542517, -4.355962766232997, 9.654392039281216, 0.029130384525017247)
>>> GE.gammas()
[1.2233934334, 1.100945902470, 1.205289928117]

The solution given by the DDBST has the same values [1.223, 1.101, 1.205], and can be found here: http://chemthermo.ddbst.com/Problems_Solutions/Mathcad_Files/05.09%20Compare%20Experimental%20VLE%20to%20Wilson%20Equation%20Results.xps

Example 4

A simple example is given in [1]; other textbooks sample problems are normally in the same form as this - with only volumes and the a term specified. The system is 2-propanol/water at 353.15 K, and the mole fraction of 2-propanol is 0.25.

>>> T = 353.15
>>> N = 2
>>> Vs = [76.92, 18.07] # cm^3/mol
>>> ais = [[0.0, 437.98],[1238.0, 0.0]] # cal/mol
>>> bis = cis = dis = eis = fis = [[0.0]*N for _ in range(N)]
>>> params = Wilson.from_DDBST_as_matrix(Vs=Vs, ais=ais, bis=bis, cis=cis, dis=dis, eis=eis, fis=fis, unit_conversion=True)
>>> xs = [0.25, 0.75]
>>> GE = Wilson(T=T, xs=xs, lambda_as=params[0], lambda_bs=params[1], lambda_cs=params[2], lambda_ds=params[3], lambda_es=params[4], lambda_fs=params[5])
>>> GE.gammas()
[2.124064516, 1.1903745834]

The activity coefficients given in [1] are [2.1244, 1.1904]; matching ( with a slight deviation from their use of 1.987 as a gas constant).

Attributes
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

model_idint

Unique identifier for the Wilson activity model, [-]

Methods

GE()

Calculate and return the excess Gibbs energy of a liquid phase represented with the Wilson model.

d2GE_dT2()

Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phase using the Wilson activity coefficient model.

d2GE_dTdxs()

Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy of a liquid represented by the Wilson model.

d2GE_dxixjs()

Calculate and return the second mole fraction derivatives of excess Gibbs energy for the Wilson model.

d2lambdas_dT2()

Calculate and return the second temperature derivative of the lambda termsfor the Wilson model at the system temperature.

d3GE_dT3()

Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase using the Wilson activity coefficient model.

d3GE_dxixjxks()

Calculate and return the third mole fraction derivatives of excess Gibbs energy using the Wilson model.

d3lambdas_dT3()

Calculate and return the third temperature derivative of the lambda terms for the Wilson model at the system temperature.

dGE_dT()

Calculate and return the temperature derivative of excess Gibbs energy of a liquid phase represented by the Wilson model.

dGE_dxs()

Calculate and return the mole fraction derivatives of excess Gibbs energy for the Wilson model.

dlambdas_dT()

Calculate and return the temperature derivative of the lambda terms for the Wilson model at the system temperature.

from_DDBST(Vi, Vj, a, b, c[, d, e, f, ...])

Converts parameters for the wilson equation in the DDBST to the basis used in this implementation.

from_DDBST_as_matrix(Vs[, ais, bis, cis, ...])

Converts parameters for the wilson equation in the DDBST to the basis used in this implementation.

lambdas()

Calculate and return the lambda terms for the Wilson model for at system temperature.

to_T_xs(T, xs)

Method to construct a new Wilson instance at temperature T, and mole fractions xs with the same parameters as the existing object.

GE()[source]

Calculate and return the excess Gibbs energy of a liquid phase represented with the Wilson model.

\[g^E = -RT\sum_i x_i \ln\left(\sum_j x_j \lambda_{i,j} \right) \]
Returns
GEfloat

Excess Gibbs energy of an ideal liquid, [J/mol]

d2GE_dT2()[source]

Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phase using the Wilson activity coefficient model.

\[\frac{\partial^2 G^E}{\partial T^2} = -R\left[T\sum_i \left(\frac{x_i \sum_j (x_j \frac{\partial^2 \Lambda_{ij}}{\partial T^2} )}{\sum_j x_j \Lambda_{ij}} - \frac{x_i (\sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T} )^2}{(\sum_j x_j \Lambda_{ij})^2} \right) + 2\sum_i \left(\frac{x_i \sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T}}{\sum_j x_j \Lambda_{ij}} \right) \right] \]
Returns
d2GE_dT2float

Second temperature derivative of excess Gibbs energy, [J/(mol*K^2)]

d2GE_dTdxs()[source]

Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy of a liquid represented by the Wilson model.

\[\frac{\partial^2 G^E}{\partial x_k \partial T} = -R\left[T\left( \sum_i \left(\frac{x_i \frac{\partial n_{ik}}{\partial T}}{\sum_j x_j \Lambda_{ij}} - \frac{x_i \Lambda_{ik} (\sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T} )}{(\partial_j x_j \Lambda_{ij})^2} \right) + \frac{\sum_i x_i \frac{\partial \Lambda_{ki}}{\partial T}}{\sum_j x_j \Lambda_{kj}} \right) + \ln\left(\sum_i x_i \Lambda_{ki}\right) + \sum_i \frac{x_i \Lambda_{ik}}{\sum_j x_j \Lambda_{ij}} \right] \]
Returns
d2GE_dTdxslist[float]

Temperature derivative of mole fraction derivatives of excess Gibbs energy, [J/mol/K]

d2GE_dxixjs()[source]

Calculate and return the second mole fraction derivatives of excess Gibbs energy for the Wilson model.

\[\frac{\partial^2 G^E}{\partial x_k \partial x_m} = RT\left( \sum_i \frac{x_i \Lambda_{ik} \Lambda_{im}}{(\sum_j x_j \Lambda_{ij})^2} -\frac{\Lambda_{km}}{\sum_j x_j \Lambda_{kj}} -\frac{\Lambda_{mk}}{\sum_j x_j \Lambda_{mj}} \right) \]
Returns
d2GE_dxixjslist[list[float]]

Second mole fraction derivatives of excess Gibbs energy, [J/mol]

d2lambdas_dT2()[source]

Calculate and return the second temperature derivative of the lambda termsfor the Wilson model at the system temperature.

\[\frac{\partial^2 \Lambda_{ij}}{\partial^2 T} = \left(2 f_{ij} + \left(2 T f_{ij} + d_{ij} + \frac{c_{ij}}{T} - \frac{b_{ij}}{T^{2}} - \frac{2 e_{ij}}{T^{3}}\right)^{2} - \frac{c_{ij}}{T^{2}} + \frac{2 b_{ij}}{T^{3}} + \frac{6 e_{ij}}{T^{4}}\right) e^{T^{2} f_{ij} + T d_{ij} + a_{ij} + c_{ij} \ln{\left(T \right)} + \frac{b_{ij}}{T} + \frac{e_{ij}}{T^{2}}} \]
Returns
d2lambdas_dT2list[list[float]]

Second temperature deriavtives of Lambda terms, asymmetric matrix, [1/K^2]

Notes

These Lambda ij values (and the coefficients) are NOT symmetric.

d3GE_dT3()[source]

Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase using the Wilson activity coefficient model.

\[\frac{\partial^3 G^E}{\partial T^3} = -R\left[3\left(\frac{x_i \sum_j (x_j \frac{\partial^2 \Lambda_{ij}}{\partial T^2} )}{\sum_j x_j \Lambda_{ij}} - \frac{x_i (\sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T} )^2}{(\sum_j x_j \Lambda_{ij})^2} \right) +T\left( \sum_i \frac{x_i (\sum_j x_j \frac{\partial^3 \Lambda _{ij}}{\partial T^3})}{\sum_j x_j \Lambda_{ij}} - \frac{3x_i (\sum_j x_j \frac{\partial \Lambda_{ij}^2}{\partial T^2}) (\sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T})}{(\sum_j x_j \Lambda_{ij})^2} + 2\frac{x_i(\sum_j x_j \frac{\partial \Lambda_{ij}}{\partial T})^3}{(\sum_j x_j \Lambda_{ij})^3} \right)\right] \]
Returns
d3GE_dT3float

Third temperature derivative of excess Gibbs energy, [J/(mol*K^3)]

d3GE_dxixjxks()[source]

Calculate and return the third mole fraction derivatives of excess Gibbs energy using the Wilson model.

\[\frac{\partial^3 G^E}{\partial x_k \partial x_m \partial x_n} = -RT\left[ \sum_i \left(\frac{2x_i \Lambda_{ik}\Lambda_{im}\Lambda_{in}} {(\sum x_j \Lambda_{ij})^3}\right) - \frac{\Lambda_{km} \Lambda_{kn}}{(\sum_j x_j \Lambda_{kj})^2} - \frac{\Lambda_{mk} \Lambda_{mn}}{(\sum_j x_j \Lambda_{mj})^2} - \frac{\Lambda_{nk} \Lambda_{nm}}{(\sum_j x_j \Lambda_{nj})^2} \right] \]
Returns
d3GE_dxixjxkslist[list[list[float]]]

Third mole fraction derivatives of excess Gibbs energy, [J/mol]

d3lambdas_dT3()[source]

Calculate and return the third temperature derivative of the lambda terms for the Wilson model at the system temperature.

\[\frac{\partial^3 \Lambda_{ij}}{\partial^3 T} = \left(3 \left(2 f_{ij} - \frac{c_{ij}}{T^{2}} + \frac{2 b_{ij}}{T^{3}} + \frac{6 e_{ij}}{T^{4}}\right) \left(2 T f_{ij} + d_{ij} + \frac{c_{ij}}{T} - \frac{b_{ij}}{T^{2}} - \frac{2 e_{ij}}{T^{3}}\right) + \left(2 T f_{ij} + d_{ij} + \frac{c_{ij}}{T} - \frac{b_{ij}}{T^{2}} - \frac{2 e_{ij}}{T^{3}}\right)^{3} - \frac{2 \left(- c_{ij} + \frac{3 b_{ij}}{T} + \frac{12 e_{ij}}{T^{2}}\right)}{T^{3}}\right) e^{T^{2} f_{ij} + T d_{ij} + a_{ij} + c_{ij} \ln{\left(T \right)} + \frac{b_{ij}}{T} + \frac{e_{ij}}{T^{2}}} \]
Returns
d3lambdas_dT3list[list[float]]

Third temperature deriavtives of Lambda terms, asymmetric matrix, [1/K^3]

Notes

These Lambda ij values (and the coefficients) are NOT symmetric.

dGE_dT()[source]

Calculate and return the temperature derivative of excess Gibbs energy of a liquid phase represented by the Wilson model.

\[\frac{\partial G^E}{\partial T} = -R\sum_i x_i \ln\left(\sum_j x_i \Lambda_{ij}\right) -RT\sum_i \frac{x_i \sum_j x_j \frac{\Lambda _{ij}}{\partial T}}{\sum_j x_j \Lambda_{ij}} \]
Returns
dGE_dTfloat

First temperature derivative of excess Gibbs energy of a liquid phase represented by the Wilson model, [J/(mol*K)]

dGE_dxs()[source]

Calculate and return the mole fraction derivatives of excess Gibbs energy for the Wilson model.

\[\frac{\partial G^E}{\partial x_k} = -RT\left[ \sum_i \frac{x_i \Lambda_{ik}}{\sum_j \Lambda_{ij}x_j } + \ln\left(\sum_j x_j \Lambda_{kj}\right) \right] \]
Returns
dGE_dxslist[float]

Mole fraction derivatives of excess Gibbs energy, [J/mol]

dlambdas_dT()[source]

Calculate and return the temperature derivative of the lambda terms for the Wilson model at the system temperature.

\[\frac{\partial \Lambda_{ij}}{\partial T} = \left(2 T h_{ij} + d_{ij} + \frac{c_{ij}}{T} - \frac{b_{ij}}{T^{2}} - \frac{2 e_{ij}}{T^{3}}\right) e^{T^{2} h_{ij} + T d_{ij} + a_{ij} + c_{ij} \ln{\left(T \right)} + \frac{b_{ij}}{T} + \frac{e_{ij}}{T^{2}}} \]
Returns
dlambdas_dTlist[list[float]]

Temperature deriavtives of Lambda terms, asymmetric matrix [1/K]

Notes

These Lambda ij values (and the coefficients) are NOT symmetric.

static from_DDBST(Vi, Vj, a, b, c, d=0.0, e=0.0, f=0.0, unit_conversion=True)[source]

Converts parameters for the wilson equation in the DDBST to the basis used in this implementation.

\[\Lambda_{ij} = \frac{V_j}{V_i}\exp\left(\frac{-\Delta \lambda_{ij}}{RT} \right) \]
\[\Delta \lambda_{ij} = a_{ij} + b_{ij}T + c T^2 + d_{ij}T\ln T + e_{ij}T^3 + f_{ij}/T \]
Parameters
Vifloat

Molar volume of component i; needs only to be in the same units as Vj, [cm^3/mol]

Vjfloat

Molar volume of component j; needs only to be in the same units as Vi, [cm^3/mol]

afloat

a parameter in DDBST form, [K]

bfloat

b parameter in DDBST form, [-]

cfloat

c parameter in DDBST form, [1/K]

dfloat, optional

d parameter in DDBST form, [-]

efloat, optional

e parameter in DDBST form, [1/K^2]

ffloat, optional

f parameter in DDBST form, [K^2]

unit_conversionbool

If True, the input coefficients are in units of cal/K/mol, and a R gas constant of 1.9872042… is used for the conversion; the DDBST uses this generally, [-]

Returns
afloat

a parameter in Wilson form, [-]

bfloat

b parameter in Wilson form, [K]

cfloat

c parameter in Wilson form, [-]

dfloat

d parameter in Wilson form, [1/K]

efloat

e parameter in Wilson form, [K^2]

ffloat

f parameter in Wilson form, [1/K^2]

Notes

The units show how the different variables are related to each other.

Examples

>>> Wilson.from_DDBST(Vi=74.04, Vj=80.67, a=375.2835, b=-3.78434, c=0.00791073, d=0.0, e=0.0, f=0.0, unit_conversion=False)
(3.8701012712, -375.2835, -0.0, -0.00791073, -0.0, -0.0)
static from_DDBST_as_matrix(Vs, ais=None, bis=None, cis=None, dis=None, eis=None, fis=None, unit_conversion=True)[source]

Converts parameters for the wilson equation in the DDBST to the basis used in this implementation. Matrix wrapper around Wilson.from_DDBST.

Parameters
Vslist[float]

Molar volume of component; needs only to be in consistent units, [cm^3/mol]

aislist[list[float]]

a parameters in DDBST form, [K]

bislist[list[float]]

b parameters in DDBST form, [-]

cislist[list[float]]

c parameters in DDBST form, [1/K]

dislist[list[float]], optional

d parameters in DDBST form, [-]

eislist[list[float]], optional

e parameters in DDBST form, [1/K^2]

fislist[list[float]], optional

f parameters in DDBST form, [K^2]

unit_conversionbool

If True, the input coefficients are in units of cal/K/mol, and a R gas constant of 1.9872042… is used for the conversion; the DDBST uses this generally, [-]

Returns
alist[list[float]]

a parameters in Wilson form, [-]

blist[list[float]]

b parameters in Wilson form, [K]

clist[list[float]]

c parameters in Wilson form, [-]

dlist[list[float]]

d paraemeters in Wilson form, [1/K]

elist[list[float]]

e parameters in Wilson form, [K^2]

flist[list[float]]

f parameters in Wilson form, [1/K^2]

lambdas()[source]

Calculate and return the lambda terms for the Wilson model for at system temperature.

\[\Lambda_{ij} = \exp\left[a_{ij}+\frac{b_{ij}}{T}+c_{ij}\ln T + d_{ij}T + \frac{e_{ij}}{T^2} + f_{ij}{T^2}\right] \]
Returns
lambdaslist[list[float]]

Lambda terms, asymmetric matrix [-]

Notes

These Lambda ij values (and the coefficients) are NOT symmetric.

to_T_xs(T, xs)[source]

Method to construct a new Wilson instance at temperature T, and mole fractions xs with the same parameters as the existing object.

Parameters
Tfloat

Temperature, [K]

xslist[float]

Mole fractions of each component, [-]

Returns
objWilson

New Wilson object at the specified conditions [-]

Notes

If the new temperature is the same temperature as the existing temperature, if the lambda terms or their derivatives have been calculated, they will be set to the new object as well.

Wilson Functional Calculations

thermo.wilson.Wilson_gammas(xs, params)[source]

Calculates the activity coefficients of each species in a mixture using the Wilson method, given their mole fractions, and dimensionless interaction parameters. Those are normally correlated with temperature, and need to be calculated separately.

\[\ln \gamma_i = 1 - \ln \left(\sum_j^N \Lambda_{ij} x_j\right) -\sum_j^N \frac{\Lambda_{ji}x_j}{\displaystyle\sum_k^N \Lambda_{jk}x_k} \]
Parameters
xslist[float]

Liquid mole fractions of each species, [-]

paramslist[list[float]]

Dimensionless interaction parameters of each compound with each other, [-]

Returns
gammaslist[float]

Activity coefficient for each species in the liquid mixture, [-]

Notes

This model needs N^2 parameters.

The original model correlated the interaction parameters using the standard pure-component molar volumes of each species at 25°C, in the following form:

\[\Lambda_{ij} = \frac{V_j}{V_i} \exp\left(\frac{-\lambda_{i,j}}{RT}\right) \]

If a compound is not liquid at that temperature, the liquid volume is taken at the saturated pressure; and if the component is supercritical, its liquid molar volume should be extrapolated to 25°C.

However, that form has less flexibility and offered no advantage over using only regressed parameters.

Most correlations for the interaction parameters include some of the terms shown in the following form:

\[\ln \Lambda_{ij} =a_{ij}+\frac{b_{ij}}{T}+c_{ij}\ln T + d_{ij}T + \frac{e_{ij}}{T^2} + h_{ij}{T^2} \]

The Wilson model is not applicable to liquid-liquid systems.

For this model to produce ideal acitivty coefficients (gammas = 1), all interaction parameters should be 1.

The specific process simulator implementations are as follows:

References

1

Wilson, Grant M. “Vapor-Liquid Equilibrium. XI. A New Expression for the Excess Free Energy of Mixing.” Journal of the American Chemical Society 86, no. 2 (January 1, 1964): 127-130. doi:10.1021/ja01056a002.

2

Gmehling, Jurgen, Barbel Kolbe, Michael Kleiber, and Jurgen Rarey. Chemical Thermodynamics for Process Simulation. 1st edition. Weinheim: Wiley-VCH, 2012.

Examples

Ethanol-water example, at 343.15 K and 1 MPa, from [2] also posted online http://chemthermo.ddbst.com/Problems_Solutions/Mathcad_Files/P05.01a%20VLE%20Behavior%20of%20Ethanol%20-%20Water%20Using%20Wilson.xps :

>>> Wilson_gammas([0.252, 0.748], [[1, 0.154], [0.888, 1]])
[1.881492608717, 1.165577493112]

Wilson Regression Calculations

thermo.wilson.wilson_gammas_binaries(xs, lambda12, lambda21, calc=None)[source]

Calculates activity coefficients at fixed lambda values for a binary system at a series of mole fractions. This is used for regression of lambda parameters. This function is highly optimized, and operates on multiple points at a time.

\[\ln \gamma_1 = -\ln(x_1 + \Lambda_{12}x_2) + x_2\left( \frac{\Lambda_{12}}{x_1 + \Lambda_{12}x_2} - \frac{\Lambda_{21}}{x_2 + \Lambda_{21}x_1} \right) \]
\[\ln \gamma_2 = -\ln(x_2 + \Lambda_{21}x_1) - x_1\left( \frac{\Lambda_{12}}{x_1 + \Lambda_{12}x_2} - \frac{\Lambda_{21}}{x_2 + \Lambda_{21}x_1} \right) \]
Parameters
xslist[float]

Liquid mole fractions of each species in the format x0_0, x1_0, (component 1 point1, component 2 point 1), x0_1, x1_1, (component 1 point2, component 2 point 2), … [-]

lambda12float

lambda parameter for 12, [-]

lambda21float

lambda parameter for 21, [-]

gammaslist[float], optional

Array to store the activity coefficient for each species in the liquid mixture, indexed the same as xs; can be omitted or provided for slightly better performance [-]

Returns
gammaslist[float]

Activity coefficient for each species in the liquid mixture, indexed the same as xs, [-]

Notes

The lambda values are hard-coded to replace values under zero which are mathematically impossible, with a very small number. This is helpful for regression which might try to make those values negative.

Examples

>>> wilson_gammas_binaries([.1, .9, 0.3, 0.7, .85, .15], 0.1759, 0.7991)
[3.42989, 1.03432, 1.74338, 1.21234, 1.01766, 2.30656]