# UNIQUAC Gibbs Excess Model (thermo.uniquac)¶

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

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

## UNIQUAC Class¶

class thermo.uniquac.UNIQUAC(T, xs, rs, qs, tau_coeffs=None, ABCDEF=None, tau_as=None, tau_bs=None, tau_cs=None, tau_ds=None, tau_es=None, tau_fs=None)[source]

Class for representing an a liquid with excess gibbs energy represented by the UNIQUAC equation. This model is capable of representing VL and LL behavior.

$\frac{G^E}{RT} = \sum_i x_i \ln\frac{\phi_i}{x_i} + \frac{z}{2}\sum_i q_i x_i \ln\frac{\theta_i}{\phi_i} - \sum_i q_i x_i \ln\left(\sum_j \theta_j \tau_{ji} \right)$
$\phi_i = \frac{r_i x_i}{\sum_j r_j x_j}$
$\theta_i = \frac{q_i x_i}{\sum_j q_j x_j}$
$\tau_{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, [-]

rslist[float]

r parameters $$r_i = \sum_{k=1}^{n} \nu_k R_k$$ if from UNIFAC, otherwise regressed, [-]

qslist[float]

q parameters $$q_i = \sum_{k=1}^{n}\nu_k Q_k$$ if from UNIFAC, otherwise regressed, [-]

tau_coeffslist[list[list[float]]], optional

UNIQUAC parameters, indexed by [i][j] and then each value is a 6 element list with parameters [a, b, c, d, e, f]; either tau_coeffs or ABCDEF are required, [-]

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

Contains the following. One of tau_coeffs or ABCDEF or some of the tau_as, etc parameters are required, [-]

tau_aslist[list[float]] or None, optional

a parameters used in calculating UNIQUAC.taus, [-]

tau_bslist[list[float]] or None, optional

b parameters used in calculating UNIQUAC.taus, [K]

tau_cslist[list[float]] or None, optional

c parameters used in calculating UNIQUAC.taus, [-]

tau_dslist[list[float]] or None, optional

d paraemeters used in calculating UNIQUAC.taus, [1/K]

tau_eslist[list[float]] or None, optional

e parameters used in calculating UNIQUAC.taus, [K^2]

tau_fslist[list[float]] or None, optional

f parameters used in calculating UNIQUAC.taus, [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

There is no such thing as a missing parameter in the UNIQUAC model. It is possible to find $$\tau_{ij}$$ and $$\tau_{ji}$$ which make $$\gamma_i = 1$$ and $$\gamma_j = 1$$, but those tau values depend on rs, qs, and xs - the composition, which obviously will change. It is therefore impossible to make an interaction parameter “missing”; whatever value it has will always impact the phase equilibria problem. At best, the tau values can produce close to ideal behavior.

References

1(1,2)

Poling, Bruce E., John M. Prausnitz, and John P. O’Connell. The Properties of Gases and Liquids. 5th edition. New York: McGraw-Hill Professional, 2000.

2(1,2)

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

Examples

Example 1

Example 5.19 in [2] includes the calculation of liquid-liquid activity coefficients for the water-ethanol-benzene system. Two calculations are reproduced accurately here. Note that the DDBST-style coefficients assume a negative sign; for compatibility, their coefficients need to have their sign flipped.

>>> N = 3
>>> T = 25.0 + 273.15
>>> xs = [0.7273, 0.0909, 0.1818]
>>> rs = [.92, 2.1055, 3.1878]
>>> qs = [1.4, 1.972, 2.4]
>>> tausA = tausC = tausD = tausE = tausF = [[0.0]*N for i in range(N)]
>>> tausB = [[0, 526.02, 309.64], [-318.06, 0, -91.532], [1325.1, 302.57, 0]]
>>> tausB = [[-v for v in r] for r in tausB] # Flip the sign to come into UNIQUAC convention
>>> ABCDEF = (tausA, tausB, tausC, tausD, tausE, tausF)
>>> GE = UNIQUAC(T=T, xs=xs, rs=rs, qs=qs, ABCDEF=ABCDEF)
>>> GE.gammas()
[1.570393328, 0.2948241614, 18.114329048]


The given values in [2] are [1.570, 0.2948, 18.11], matching exactly. The second phase has a different composition; the expected values are [8.856, 0.860, 1.425]. Once the UNIQUAC object has been constructed, it is very easy to obtain properties at different conditions:

>>> GE.to_T_xs(T=T, xs=[1/6., 1/6., 2/3.]).gammas()
[8.8559908058, 0.8595242462, 1.42546014081]


The string representation of the object presents enough information to reconstruct it as well.

>>> GE
UNIQUAC(T=298.15, xs=[0.7273, 0.0909, 0.1818], rs=[0.92, 2.1055, 3.1878], qs=[1.4, 1.972, 2.4], ABCDEF=([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], [[0, -526.02, -309.64], [318.06, 0, 91.532], [-1325.1, -302.57, 0]], [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]))


The phase exposes many properties and derivatives as well.

>>> GE.GE(), GE.dGE_dT(), GE.d2GE_dT2()
(1843.96486834, 6.69851118521, -0.015896025970)
>>> GE.HE(), GE.SE(), GE.dHE_dT(), GE.dSE_dT()
(-153.19624152, -6.69851118521, 4.7394001431, 0.0158960259705)


Example 2

Another problem is 8.32 in [1] - acetonitrile, benzene, n-heptane at 45 °C. The sign flip is needed here as well to convert their single temperature-dependent values into the correct form, but it has already been done to the coefficients:

>>> N = 3
>>> T = 45 + 273.15
>>> xs = [.1311, .0330, .8359]
>>> rs = [1.87, 3.19, 5.17]
>>> qs = [1.72, 2.4, 4.4]
>>> tausA = tausC = tausD = tausE = tausF = [[0.0]*N for i in range(N)]
>>> tausB = [[0.0, -60.28, -23.71], [-89.57, 0.0, 135.9], [-545.8, -245.4, 0.0]]
>>> ABCDEF = (tausA, tausB, tausC, tausD, tausE, tausF)
>>> GE = UNIQUAC(T=T, xs=xs, rs=rs, qs=qs, ABCDEF=ABCDEF)
>>> GE.gammas()
[7.1533533992, 1.25052436922, 1.060392792605]


The given values in [1] are [7.15, 1.25, 1.06].

Example 3

ChemSep is a program for modeling distillation. Chemsep ships with a permissive license several sets of binary interaction parameters. The UNIQUAC 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'
>>> xs = [0.252, 0.748]
>>> rs = [2.11, 0.92]
>>> qs = [1.97, 1.400]
>>> N = 2
>>> T = 343.15
>>> tau_bs = IPDB.get_ip_asymmetric_matrix(name='ChemSep UNIQUAC', CASs=['64-17-5', '7732-18-5'], ip='bij')
>>> GE = UNIQUAC(T=T, xs=xs, rs=rs, qs=qs, tau_bs=tau_bs)
>>> GE.gammas()
[1.977454, 1.1397696]


In ChemSep, the form of the UNIQUAC tau equation is

$\tau_{ij} = \exp\left( \frac{-A_{ij}}{RT}\right)$

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

$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.01c%20VLE%20Behavior%20of%20Ethanol%20-%20Water%20Using%20UNIQUAC.xps

In that example, with different data sets and parameters, they obtain at the same conditions activity coefficients of [2.359, 1.244].

Attributes
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Methods

 Calculate and return the excess Gibbs energy of a liquid phase using the UNIQUAC model. Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phase using the UNIQUAC model. Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy using the UNIQUAC model. Calculate and return the second mole fraction derivatives of excess Gibbs energy using the UNIQUAC model. Calculate and return the second temperature derivative of the tau Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase using the UNIQUAC model. Calculate and return the third temperature derivative of the tau terms for the UNIQUAC model for a specified temperature. Calculate and return the temperature derivative of excess Gibbs energy of a liquid phase using the UNIQUAC model. Calculate and return the mole fraction derivatives of excess Gibbs energy using the UNIQUAC model. Calculate and return the temperature derivative of the tau terms for the UNIQUAC model for a specified temperature. Calculate and return the phi parameters at the system composition and temperature. regress_binary_parameters(gammas, xs, rs, qs) Perform a basic regression to determine the values of the tau terms in the UNIQUAC model, given a series of known or predicted activity coefficients and mole fractions. Calculate and return the tau terms for the UNIQUAC model for the system temperature. Calculate and return the theta parameters at the system composition and temperature. to_T_xs(T, xs) Method to construct a new UNIQUAC 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 using the UNIQUAC model.

$\frac{G^E}{RT} = \sum_i x_i \ln\frac{\phi_i}{x_i} + \frac{z}{2}\sum_i q_i x_i \ln\frac{\theta_i}{\phi_i} - \sum_i q_i x_i \ln\left(\sum_j \theta_j \tau_{ji} \right)$
Returns
GEfloat

Excess Gibbs energy, [J/mol]

d2GE_dT2()[source]

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

$\frac{\partial G^E}{\partial T^2} = -R\left[T\sum_i\left( \frac{q_i x_i(\sum_j \theta_j \frac{\partial^2 \tau_{ji}}{\partial T^2})}{\sum_j \theta_j \tau_{ji}} - \frac{q_i x_i(\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T})^2}{(\sum_j \theta_j \tau_{ji})^2} \right) + 2\left(\sum_i \frac{q_i x_i(\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T} )}{\sum_j \theta_j \tau_{ji}}\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 using the UNIQUAC model.

$\frac{\partial G^E}{\partial x_i \partial T} = R\left[-T\left\{ \frac{q_i(\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T} )}{\sum_j \tau_{ki} \theta_k} + \sum_j \frac{q_j x_j(\sum_k \frac{\partial \tau_{kj}}{\partial T} \frac{\partial \theta_k}{\partial x_i} ) }{\sum_k \tau_{kj} \theta_k} - \sum_j \frac{q_j x_j (\sum_k \tau_{kj} \frac{\partial \theta_k}{\partial x_i}) (\sum_k \theta_k \frac{\partial \tau_{kj}}{\partial T})}{(\sum_k \tau_{kj} \theta_k)^2} \right\} + \sum_j \frac{q_j x_j z\left(\frac{\partial \theta_j}{\partial x_i} - \frac{\theta_j}{\phi_j}\frac{\partial \phi_j}{\partial x_i} \right)}{2 \theta_j} - \sum_j \frac{q_j x_j \sum_k \tau_{kj}\frac{\partial \theta_k}{\partial x_i}}{\sum_k \tau_{kj}\theta_k} + 0.5zq_i \ln\left(\frac{\theta_i}{\phi_i} \right) - q_i \ln\left(\sum_j \tau_{ji} \theta_j\right) + \ln\left(\frac{\phi_i}{x_i} \right) + \frac{x_i}{\phi_i}\left(\frac{\partial \phi_i}{\partial x_i} -\frac{\phi_i}{x_i} \right) + \sum_{j\ne i} \frac{x_j}{\phi_j}\frac{\partial \phi_j}{\partial x_i} \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 using the UNIQUAC model.

$\frac{\partial^2 g^E}{\partial x_i \partial x_j}$
Returns
d2GE_dxixjslist[list[float]]

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

Notes

The formula is extremely long and painful; see the source code for details.

d2taus_dT2()[source]
Calculate and return the second temperature derivative of the tau

terms for the UNIQUAC model for a specified temperature.

$\frac{\partial^2 \tau_{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
d2taus_dT2list[list[float]]

Second temperature derivatives of tau terms, asymmetric matrix [1/K^2]

Notes

These 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 UNIQUAC model.

$\frac{\partial^3 G^E}{\partial T^3} = -R\left[T\sum_i\left( \frac{q_i x_i(\sum_j \theta_j \frac{\partial^3 \tau_{ji}}{\partial T^3})}{(\sum_j \theta_j \tau_{ji})} - \frac{3q_i x_i(\sum_j \theta_j \frac{\partial^2 \tau_{ji}}{\partial T^2}) (\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T})}{(\sum_j \theta_j \tau_{ji})^2} + \frac{2q_i x_i(\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T})^3}{(\sum_j \theta_j \tau_{ji})^3} \right) + \sum_i \left(\frac{3q_i x_i(\sum_j x_j \frac{\partial^2 \tau_{ji}}{\partial T^2} ) }{\sum_j \theta_j \tau_{ji}} - \frac{3q_ix_i (\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T})^2}{(\sum_j \theta_j \tau_{ji})^2} \right)\right]$
Returns
d3GE_dT3float

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

d3taus_dT3()[source]

Calculate and return the third temperature derivative of the tau terms for the UNIQUAC model for a specified temperature.

$\frac{\partial^3 \tau_{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
d3taus_dT3list[list[float]]

Third temperature derivatives of tau terms, asymmetric matrix [1/K^3]

Notes

These values (and the coefficients) are NOT symmetric.

dGE_dT()[source]

Calculate and return the temperature derivative of excess Gibbs energy of a liquid phase using the UNIQUAC model.

$\frac{\partial G^E}{\partial T} = \frac{G^E}{T} - RT\left(\sum_i \frac{q_i x_i(\sum_j \theta_j \frac{\partial \tau_{ji}}{\partial T} )}{\sum_j \theta_j \tau_{ji}}\right)$
Returns
dGE_dTfloat

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

dGE_dxs()[source]

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

$\frac{\partial G^E}{\partial x_i} = RT\left[ \sum_j \frac{q_j x_j \phi_j z}{2\theta_j}\left(\frac{1}{\phi_j} \cdot \frac{\partial \theta_j}{\partial x_i} - \frac{\theta_j}{\phi_j^2}\cdot \frac{\partial \phi_j}{\partial x_i} \right) - \sum_j \left(\frac{q_j x_j(\sum_k \tau_{kj} \frac{\partial \theta_k}{\partial x_i} )}{\sum_k \tau_{kj} \theta_{k}}\right) + 0.5 z q_i\ln\left(\frac{\theta_i}{\phi_i}\right) - q_i\ln\left(\sum_j \tau_{ji}\theta_j \right) + \frac{x_i^2}{\phi_i}\left(\frac{\partial \phi_i}{\partial x_i}/x_i - \phi_i/x_i^2\right) + \sum_{j!= i} \frac{x_j}{\phi_j}\frac{\partial \phi_j}{\partial x_i} + \ln\left(\frac{\phi_i}{x_i} \right) \right]$
Returns
dGE_dxslist[float]

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

dtaus_dT()[source]

Calculate and return the temperature derivative of the tau terms for the UNIQUAC model for a specified temperature.

$\frac{\partial \tau_{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
dtaus_dTlist[list[float]]

First temperature derivatives of tau terms, asymmetric matrix [1/K]

Notes

These values (and the coefficients) are NOT symmetric.

phis()[source]

Calculate and return the phi parameters at the system composition and temperature.

$\phi_i = \frac{r_i x_i}{\sum_j r_j x_j}$
Returns
phislist[float]

phi parameters, [-]

classmethod regress_binary_parameters(gammas, xs, rs, qs, use_numba=False, do_statistics=True, **kwargs)[source]

Perform a basic regression to determine the values of the tau terms in the UNIQUAC model, given a series of known or predicted activity coefficients and mole fractions.

Parameters
gammaslist[list[float, 2]]

List of activity coefficient pairs, [-]

xslist[list[float, 2]]

List of binary mole fraction pairs, [-]

rslist[float]

Van der Waals volume parameters for each species, [-]

qslist[float]

Surface area parameters for each species, [-]

use_numbabool, optional

Whether or not to try to use numba to speed up the computation, [-]

do_statisticsbool, optional

Whether or not to compute statistical measures on the outputs, [-]

kwargsdict

Extra parameters to be passed to the fitting function (not yet documented), [-]

Returns
parametersdict[str, float]

Dimentionless interaction parameters of each compound with each other; these are the actual tau values. [-]

statisticsdict[str: float]

Statistics, calculated and returned only if do_statistics is True, [-]

Notes

Notes on getting fitting coefficients that yield gammas of 1:

• This is possible some of the time to a pretty high accuracy

• This is not possible whatsoever in some cases

• The values of rs, and qs determine how close the fitting can be

• If rs and qs are close to each other, it may well fit nicely

• If they are distant (1.2-1.5x) they usually will not fit

Examples

In the following example, the tau values required to zero-out the coefficients for the n-pentane and n-hexane system are calculated. The parameters are converted back into aij parameters as used by this activity coefficient object, and then the calculated values are verified to be fairly nearly one.

>>> from thermo import UNIQUAC
>>> import numpy as np
>>> pts = 30
>>> rs = [3.8254, 4.4998]
>>> qs = [3.316, 3.856]
>>> xs = [[xi, 1.0 - xi] for xi in np.linspace(1e-7, 1-1e-7, pts)]
>>> gammas = [[1, 1] for i in range(pts)]
>>> coeffs, stats = UNIQUAC.regress_binary_parameters(gammas, xs, rs, qs)
>>> coeffs
{'tau12': 1.04220685, 'tau21': 0.95538082}
>>> assert stats['MAE'] < 1e-6
>>> tausB = tausC = tausD = tausE = tausF = [[0.0]*2 for i in range(2)]
>>> tausA = [[0, np.log(coeffs['tau12'])], [np.log(coeffs['tau21']), 0]]
>>> ABCDEF = (tausA, tausB, tausC, tausD, tausE, tausF)
>>> GE = UNIQUAC(T=300, xs=[.5, .5], rs=rs, qs=qs, ABCDEF=ABCDEF)
>>> GE.gammas()
[1.000000466, 1.000000180]


Note how the tau coefficients need to be converted into the a parameters of the tau equation. They could also have been converted into any of the other parameters, but then the activity coefficients predicted would no longer be close to 1 at other temperatures.

$\tau_{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]$

The UNIQUAC model’s r and q parameters create their own biases in the model, based on the structure of each of the pure species. Water and n-pentane are not miscible liquids; they will form two liquid phases except when one component is present in trace amounts. No matter the values of tau, it is not possible to make the UNIQUAC equation predict activity coefficients very close to one for this system, as shown in the following sample.

>>> rs = [3.8254, 0.92]
>>> qs = [3.316, 1.4]
>>> pts = 6
>>> xs = [[xi, 1.0 - xi] for xi in np.linspace(1e-7, 1-1e-7, pts)]
>>> gammas = [[1, 1] for i in range(pts)]
>>> coeffs, stats = UNIQUAC.regress_binary_parameters(gammas, xs, rs, qs)
>>> stats['MAE']
0.0254

taus()[source]

Calculate and return the tau terms for the UNIQUAC model for the system temperature.

$\tau_{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
tauslist[list[float]]

tau terms, asymmetric matrix [-]

Notes

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

thetas()[source]

Calculate and return the theta parameters at the system composition and temperature.

$\theta_i = \frac{q_i x_i}{\sum_j q_j x_j}$
Returns
thetaslist[float]

theta parameters, [-]

to_T_xs(T, xs)[source]

Method to construct a new UNIQUAC 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
objUNIQUAC

New UNIQUAC object at the specified conditions [-]

Notes

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

## UNIQUAC Functional Calculations¶

thermo.uniquac.UNIQUAC_gammas(xs, rs, qs, taus)[source]

Calculates the activity coefficients of each species in a mixture using the Universal quasi-chemical (UNIQUAC) equation, given their mole fractions, rs, qs, and dimensionless interaction parameters. The interaction parameters are normally correlated with temperature, and need to be calculated separately.

$\ln \gamma_i = \ln \frac{\Phi_i}{x_i} + \frac{z}{2} q_i \ln \frac{\theta_i}{\Phi_i}+ l_i - \frac{\Phi_i}{x_i}\sum_j^N x_j l_j - q_i \ln\left( \sum_j^N \theta_j \tau_{ji}\right)+ q_i - q_i\sum_j^N \frac{\theta_j \tau_{ij}}{\sum_k^N \theta_k \tau_{kj}} \theta_i = \frac{x_i q_i}{\displaystyle\sum_{j=1}^{n} x_j q_j} \Phi_i = \frac{x_i r_i}{\displaystyle\sum_{j=1}^{n} x_j r_j} l_i = \frac{z}{2}(r_i - q_i) - (r_i - 1)$
Parameters
xslist[float]

Liquid mole fractions of each species, [-]

rslist[float]

Van der Waals volume parameters for each species, [-]

qslist[float]

Surface area parameters for each species, [-]

tauslist[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 expression for the interaction parameters is as follows:

$\tau_{ji} = \exp\left(\frac{-\Delta u_{ij}}{RT}\right)$

However, it is seldom used. Most correlations for the interaction parameters include some of the terms shown in the following form:

$\ln \tau_{ij} =a_{ij}+\frac{b_{ij}}{T}+c_{ij}\ln T + d_{ij}T + \frac{e_{ij}}{T^2}$

This model is recast in a slightly more computationally efficient way in [2], as shown below:

$\ln \gamma_i = \ln \gamma_i^{res} + \ln \gamma_i^{comb} \ln \gamma_i^{res} = q_i \left(1 - \ln\frac{\sum_j^N q_j x_j \tau_{ji}} {\sum_j^N q_j x_j}- \sum_j \frac{q_k x_j \tau_{ij}}{\sum_k q_k x_k \tau_{kj}}\right) \ln \gamma_i^{comb} = (1 - V_i + \ln V_i) - \frac{z}{2}q_i\left(1 - \frac{V_i}{F_i} + \ln \frac{V_i}{F_i}\right) V_i = \frac{r_i}{\sum_j^N r_j x_j} F_i = \frac{q_i}{\sum_j q_j x_j}$

There is no global set of parameters which will make this model yield ideal acitivty coefficients (gammas = 1) for this model.

References

1

Abrams, Denis S., and John M. Prausnitz. “Statistical Thermodynamics of Liquid Mixtures: A New Expression for the Excess Gibbs Energy of Partly or Completely Miscible Systems.” AIChE Journal 21, no. 1 (January 1, 1975): 116-28. doi:10.1002/aic.690210115.

2

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

3

Maurer, G., and J. M. Prausnitz. “On the Derivation and Extension of the Uniquac Equation.” Fluid Phase Equilibria 2, no. 2 (January 1, 1978): 91-99. doi:10.1016/0378-3812(78)85002-X.

Examples

Ethanol-water example, at 343.15 K and 1 MPa:

>>> UNIQUAC_gammas(xs=[0.252, 0.748], rs=[2.1055, 0.9200], qs=[1.972, 1.400],
... taus=[[1.0, 1.0919744384510301], [0.37452902779205477, 1.0]])
[2.35875137797083, 1.2442093415968987]