Regular Solution Gibbs Excess Model (thermo.regular_solution)

This module contains a class RegularSolution for performing activity coefficient calculations with the regular solution model.

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

Regular Solution Class

class thermo.regular_solution.RegularSolution(T, xs, Vs, SPs, lambda_coeffs=None)[source]

Bases: thermo.activity.GibbsExcess

Class for representing an a liquid with excess gibbs energy represented by the Regular Solution model. This model is not temperature dependent and has limited predictive ability, but can be used without interaction parameters. This model is described in [1].

\[G^E = \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m} \]
\[A_{mn} = 0.5(\delta_m - \delta_n)^2 - \delta_m \delta_n k_{mn} \]

In the above equation, \(\delta\) represents the solubility parameters, and \(k_{mn}\) is the interaction coefficient between m and n. The model makes no assumption about the symmetry of this parameter.

Parameters
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Vslist[float]

Molar volumes of each compond at a reference temperature (often 298.15 K), [m^3/mol]

SPslist[float]

Solubility parameters of each compound; normally at a reference temperature of 298.15 K, [Pa^0.5]

lambda_coeffslist[list[float]], optional

Optional interaction parameters, [-]

Notes

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

Additional equations of note are as follows.

\[G^E = H^E \]
\[S^E = 0 \]
\[\delta = \sqrt{\frac{\Delta H_{vap} - RT}{V_m}} \]

References

1

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

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

3

Elliott, J., and Carl Lira. Introductory Chemical Engineering Thermodynamics. 2nd edition. Upper Saddle River, NJ: Prentice Hall, 2012.

4

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

Examples

Example 1

From [2], calculate the activity coefficients at infinite dilution for the system benzene-cyclohexane at 253.15 K using the regular solution model (example 5.20, with unit conversion in-line):

>>> from scipy.constants import calorie
>>> GE = RegularSolution(T=353.15, xs=[.5, .5], Vs=[89E-6, 109E-6], SPs=[9.2*(calorie*1e6)**0.5, 8.2*(calorie*1e6)**0.5])
>>> GE.gammas_infinite_dilution()
[1.1352128394, 1.16803058378]

This matches the solution given of [1.135, 1.168].

Example 2

Benzene and cyclohexane calculation from [3], without interaction parameters.

>>> GE = RegularSolution(T=353, xs=[0.01, 0.99], Vs=[8.90e-05, 1.09e-04], SPs=[9.2*(calorie/1e-6)**0.5, 8.2*(calorie/1e-6)**0.5])
>>> GE.gammas()
[1.1329295, 1.00001039]

Example 3

Another common model is the Flory-Huggins model. This isn’t implemented as a separate model, but it is possible to modify the activity coefficient results of RegularSolution to obtain the activity coefficients from the Flory-Huggins model anyway. ChemSep [4] implements the Flory-Huggins model and calls it the regular solution model, so results can’t be compared with ChemSep except when making the following manual solution. The example below uses parameters from ChemSep for ethanol and water.

>>> GE = RegularSolution(T=298.15, xs=[0.5, 0.5], Vs=[0.05868e-3, 0.01807e-3], SPs=[26140.0, 47860.0])
>>> GE.gammas() # Regular solution activity coefficients
[1.8570955489, 7.464567232]
>>> lngammass = [log(g) for g in GE.gammas()]
>>> thetas = [GE.Vs[i]/sum(GE.xs[i]*GE.Vs[i] for i in range(GE.N)) for i in range(GE.N)]
>>> gammas_flory_huggins = [exp(lngammass[i] + log(thetas[i]) + 1 - thetas[i]) for i in range(GE.N)]
>>> gammas_flory_huggins
[1.672945693, 5.9663471]

This matches the values calculated from ChemSep exactly.

Attributes
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Vslist[float]

Molar volumes of each compond at a reference temperature (often 298.15 K), [K]

SPslist[float]

Solubility parameters of each compound; normally at a reference temperature of 298.15 K, [Pa^0.5]

lambda_coeffslist[list[float]]

Interaction parameters, [-]

Methods

GE()

Calculate and return the excess Gibbs energy of a liquid phase using the regular solution model.

d2GE_dT2()

Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phas.

d2GE_dTdxs()

Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy.

d2GE_dxixjs()

Calculate and return the second mole fraction derivatives of excess Gibbs energy of a liquid phase using the regular solution model.

d3GE_dT3()

Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase.

d3GE_dxixjxks()

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

dGE_dT()

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

dGE_dxs()

Calculate and return the mole fraction derivatives of excess Gibbs energy of a liquid phase using the regular solution model.

to_T_xs(T, xs)

Method to construct a new RegularSolution 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 regular solution model.

\[G^E = \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m} \]
\[A_{mn} = 0.5(\delta_m - \delta_n)^2 - \delta_m \delta_n k_{mn} \]
Returns
GEfloat

Excess Gibbs energy, [J/mol]

d2GE_dT2()[source]

Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phas.

\[\frac{\partial^2 g^E}{\partial T^2} = 0 \]
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.

\[\frac{\partial^2 g^E}{\partial x_i \partial T} = 0 \]
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 of a liquid phase using the regular solution model.

\[\frac{\partial^2 G^E}{\partial x_i \partial x_j} = \frac{V_j(V_i G^E - H_{ij})}{(\sum_m V_m x_m)^2} - \frac{V_i \frac{\partial G^E}{\partial x_j}}{\sum_m V_m x_m} + \frac{V_i V_j[\delta_i\delta_j(k_{ji} + k_{ij}) + (\delta_i - \delta_j)^2] }{\sum_m V_m x_m} \]
Returns
d2GE_dxixjslist[list[float]]

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

d3GE_dT3()[source]

Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase.

\[\frac{\partial^3 g^E}{\partial T^3} = 0 \]
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.

\[\frac{\partial^3 G^E}{\partial x_i \partial x_j \partial x_k} = \frac{-2V_iV_jV_k G^E + 2 V_j V_k H_{ij}} {(\sum_m V_m x_m)^3} + \frac{V_i\left(V_j\frac{\partial G^E}{\partial x_k} + V_k\frac{\partial G^E}{\partial x_j} \right)} {(\sum_m V_m x_m)^2} - \frac{V_i \frac{\partial^2 G^E}{\partial x_j \partial x_k}}{\sum_m V_m x_m} - \frac{V_iV_jV_k[\delta_i(\delta_j(k_{ij} + k_{ji}) + \delta_k(k_{ik} + k_{ki})) + (\delta_i - \delta_j)^2 + (\delta_i - \delta_k)^2 ]}{(\sum_m V_m x_m)^2} \]
Returns
d3GE_dxixjxkslist[list[list[float]]]

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

dGE_dT()[source]

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

\[\frac{\partial g^E}{\partial T} = 0 \]
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 of a liquid phase using the regular solution model.

\[\frac{\partial G^E}{\partial x_i} = \frac{-V_i G^E + \sum_m V_i V_m x_m[\delta_i\delta_m(k_{mi} + k_{im}) + (\delta_i - \delta_m)^2 ]} {\sum_m V_m x_m} \]
Returns
dGE_dxslist[float]

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

to_T_xs(T, xs)[source]

Method to construct a new RegularSolution 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
objRegularSolution

New RegularSolution object at the specified conditions [-]

Regular Solution Regression Calculations

thermo.regular_solution.regular_solution_gammas_binaries(xs, Vs, SPs, Ts, lambda12, lambda21, gammas=None)[source]

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

\[\ln \gamma_1 = \frac{V_1\phi_2^2}{RT}\left[ (\text{SP}_1-\text{SP}_2)^2 + \lambda_{12}\text{SP}_1\text{SP}_2 + \lambda_{21}\text{SP}_1\text{SP}_2 \right] \]
\[\ln \gamma_2 = \frac{V_2\phi_1^2}{RT}\left[ (\text{SP}_1-\text{SP}_2)^2 + \lambda_{12}\text{SP}_1\text{SP}_2 + \lambda_{21}\text{SP}_1\text{SP}_2 \right] \]
\[\phi_1 = \frac{x_1 V_1}{x_1 V_1 + x_2 V_2} \]
\[\phi_2 = \frac{x_2 V_2}{x_1 V_1 + x_2 V_2} \]
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), … size pts*2 [-]

Vslist[float]

Molar volumes of each of the two components, [m^3/mol]

SPslist[float]

Solubility parameters of each of the two components, [Pa^0.5]

Tsflist[float]

Temperatures of each composition point; half the length of xs, [K]

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, [-]

Examples

>>> regular_solution_gammas_binaries([.1, .9, 0.3, 0.7, .85, .15], Vs=[7.421e-05, 8.068e-05], SPs=[19570.2, 18864.7], Ts=[300.0, 400.0, 500.0], lambda12=0.1759, lambda21=0.7991)
[6818.90697, 1.105437, 62.6628, 2.01184, 1.181434, 137.6232]