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(*, xs, Vs, SPs, T=298.15, lambda_coeffs=None)[source]

Bases: 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].

GE=mn(xmxnVmVnAmn)mxmVmG^E = \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m}
Amn=0.5(δmδn)2+δmδnkmnA_{mn} = 0.5(\delta_m - \delta_n)^2 + \delta_m \delta_n k_{mn}

In the above equation, δ\delta represents the solubility parameters, and kmnk_{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, [-]

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.

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.

GE=HEG^E = H^E
SE=0S^E = 0
δ=ΔHvapRTVm\delta = \sqrt{\frac{\Delta H_{vap} - RT}{V_m}}

Note that some sources use the convention of a negation for the calculation of A_{mn}.

Amn=0.5(δmδn)2δmδnkmnA_{mn} = 0.5(\delta_m - \delta_n)^2 - \delta_m \delta_n k_{mn}

Coefficients from models in that form can be used with this model simply by negating the k_{mn} parameters:

kmn=kmn other formk_{mn} = -k_{mn\text{ other form}}

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.

>>> from math import log
>>> 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.

GE()[source]

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

GE=mn(xmxnVmVnAmn)mxmVmG^E = \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m}
Amn=0.5(δmδn)2δmδnkmnA_{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.

2gET2=0\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.

2gExiT=0\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.

2GExixj=Vj(ViGEHij)(mVmxm)2ViGExjmVmxm+ViVj[δiδj(kji+kij)+(δiδj)2]mVmxm\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.

3gET3=0\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.

3GExixjxk=2ViVjVkGE+2VjVkHij(mVmxm)3+Vi(VjGExk+VkGExj)(mVmxm)2Vi2GExjxkmVmxmViVjVk[δi(δj(kij+kji)+δk(kik+kki))+(δiδj)2+(δiδk)2](mVmxm)2\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.

gET=0\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.

GExi=ViGE+mViVmxm[δiδm(kmi+kim)+(δiδm)2]mVmxm\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 [-]

Flory Huggins Class

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

Bases: GibbsExcess

Class for representing a liquid with excess Gibbs energy represented by the Flory-Huggins model. This model extends the Regular Solution model by adding entropic contributions from the different sizes of molecules.

GE=RTixiln(VijxjVj)+mn(xmxnVmVnAmn)mxmVmG^E = RT\sum_i x_i \ln\left(\frac{V_i}{\sum_j x_j V_j}\right) + \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m}
Amn=0.5(δmδn)2+δmδnkmnA_{mn} = 0.5(\delta_m - \delta_n)^2 + \delta_m \delta_n k_{mn}

The model can also be written as an addition to the Regular Solution model as follows:

GE=RTixiln(VijxjVj)+GRSEG^E = RT\sum_i x_i \ln\left(\frac{V_i}{\sum_j x_j V_j}\right) + G^E_{RS}
Parameters:
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Vslist[float]

Molar volumes of each component 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, [-]

Attributes:
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Vslist[float]

Molar volumes of each component 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 Flory-Huggins 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.

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]

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

Examples

The example below uses parameters from ChemSep for ethanol and water.

>>> GE = FloryHuggins(T=298.15, xs=[0.5, 0.5], Vs=[0.05868e-3, 0.01807e-3], SPs=[26140.0, 47860.0])
>>> GE.gammas()
[1.672945693, 5.9663471]

This matches the values calculated from ChemSep exactly.

GE()[source]

Calculate and return the excess Gibbs energy of a liquid phase using the Flory-Huggins model.

Returns:
GEfloat

Excess Gibbs energy, [J/mol]

d2GE_dT2()

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

2gET2=0\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.

2gExiT=R[ln(VijxjVj)VijxjVj]\frac{\partial^2 g^E}{\partial x_i \partial T} = R\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\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 of a liquid phase using the regular solution model.

For brevity, the equation is presented only as an addition to the regular solution equation:

2GExixj=RT[ViVj(mxmVm)2Vi+VjmxmVm]+2GExixjRS\frac{\partial^2 G^E}{\partial x_i \partial x_j} = RT\left[\frac{V_iV_j}{\left(\sum_m x_m V_m\right)^2} - \frac{V_i + V_j}{\sum_m x_m V_m}\right] + \frac{\partial^2 G^E}{\partial x_i \partial x_j}_{\text{RS}}
Returns:
d2GE_dxixjslist[list[float]]

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

d3GE_dT3()

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

3gET3=0\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.

For brevity, the equation is presented only as an addition to the regular solution equation:

3GExixjxk=RT[2ViVjVk(mxmVm)3+ViVj+ViVk+VjVk(mxmVm)2]+3GExixjxkRS\frac{\partial^3 G^E}{\partial x_i \partial x_j \partial x_k} = RT\left[-\frac{2V_iV_jV_k}{\left(\sum_m x_m V_m\right)^3} + \frac{V_iV_j + V_iV_k + V_jV_k}{\left(\sum_m x_m V_m\right)^2}\right] + \frac{\partial^3 G^E}{\partial x_i \partial x_j \partial x_k}_{\text{RS}}
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.

gET=Rixiln(VijxjVj)\frac{\partial g^E}{\partial T} = R\sum_i x_i \ln\left(\frac{V_i}{\sum_j x_j V_j}\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 of a liquid phase using the regular solution model.

GExi=RT[ln(VijxjVj)VijxjVj]+ViGE+mViVmxm[δiδm(kmi+kim)+(δiδm)2]mVmxm\frac{\partial G^E}{\partial x_i} = RT\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\right] + \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}

Or as an addition to the regular solution equation:

GExi=RT[ln(VijxjVj)VijxjVj]+GExiRS\frac{\partial G^E}{\partial x_i} = RT\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\right] + \frac{\partial G^E}{\partial x_i}_{\text{RS}}
Returns:
dGE_dxslist[float]

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

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.

Parameters:
Tfloat

Temperature, [K]

xslist[float]

Mole fractions of each component, [-]

Returns:
objRegularSolution

New RegularSolution object at the specified conditions [-]

Hansen Class

class thermo.regular_solution.Hansen(*, xs, Vs, delta_d, delta_p, delta_h, T=298.15, alpha=1.0)[source]

Bases: GibbsExcess

Class for representing a liquid with excess Gibbs energy represented by the Hansen model. This model extends the Flory-Huggins approach by considering three different types of molecular interactions: dispersive, polar, and hydrogen bonding.

The excess Gibbs energy is calculated using:

GE=RTixiln(VijxjVj)+mn(xmxnVmVnAmn)mxmVmG^E = RT\sum_i x_i \ln\left(\frac{V_i}{\sum_j x_j V_j}\right) + \frac{\sum_m \sum_n (x_m x_n V_m V_n A_{mn})}{\sum_m x_m V_m}

Where the interaction parameters A_{mn} are calculated using Hansen parameters:

Amn=α[(δd,mδd,n)2+0.25(δp,mδp,n)2+0.25(δh,mδh,n)2]A_{mn} = \alpha \left[ (\delta_{d,m} - \delta_{d,n})^2 + 0.25(\delta_{p,m} - \delta_{p,n})^2 + 0.25(\delta_{h,m} - \delta_{h,n})^2 \right]

The alpha term can be taken as 1, adjusted to fit a particular data set, or set to 0.6 as recommended in [1].

Parameters:
Tfloat

Temperature, [K]

xslist[float]

Mole fractions, [-]

Vslist[float]

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

delta_dlist[float]

Hansen dispersive parameters for each component, [Pa^0.5]

delta_plist[float]

Hansen polar parameters for each component, [Pa^0.5]

delta_hlist[float]

Hansen hydrogen bonding parameters for each component, [Pa^0.5]

alphafloat, optional

Optional scaling factor for the interaction terms, defaults to 1.0, [-]

Methods

GE()

Calculate and return the excess Gibbs energy of a liquid phase using the Flory-Huggins 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.

d3GE_dT3()

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

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 Hansen instance at temperature T, and mole fractions xs with the same parameters as the existing object.

d2GE_dxixjs

Notes

The Hansen model uses the same mathematical framework as the Flory-Huggins model but replaces the single solubility parameter with three Hansen parameters that better account for different types of molecular interactions. The excess Gibbs energy derivatives follow the same form as the Flory-Huggins model with the modified interaction parameters.

The delta and Vs terms can be specified in units of cm^3/mol and MPa^0.5 and the

References

[1]

Lindvig, Thomas, Michael L Michelsen, and Georgios M Kontogeorgis. “A Flory-Huggins Model Based on the Hansen Solubility Parameters.” Fluid Phase Equilibria 203, no. 1 (December 1, 2002): 247-60. https://doi.org/10.1016/S0378-3812(02)00184-X.

[2] (1,2)

Brouwer, Thomas, and Boelo Schuur. “Model Performances Evaluated for Infinite Dilution Activity Coefficients Prediction at 298.15 K.” Industrial & Engineering Chemistry Research 58, no. 20 (May 22, 2019): 8903-14. https://doi.org/10.1021/acs.iecr.9b00727.

[3]

Hansen, Charles M. Hansen Solubility Parameters: A User’s Handbook. CRC press, 2007.

Examples

[2] presents a number of examplese in their supporting material. No specific concentration was specified for what mole fraction was used to evaluate infinite dilution coefficients, however 2-3% seems to fit the data points provided in many cases. The 0.6 alpha also seems to have been used in their paper.

1-nitropropane as solvent, 2-methylbutane as solute from [2] - expected infinite dilution activity coefficient of 3.5:

>>> xs = [.97, 0.03]
>>> Vs = [89, 115.2]
>>> Vs = [Vi*1e-6 for Vi in Vs]
>>> delta_d = [16.6, 14.5]
>>> delta_p = [12.3, 0.0]
>>> delta_h = [5.5, 0.0]
>>> delta_factor = 1000
>>> delta_d = [v*delta_factor for v in delta_d]
>>> delta_p = [v*delta_factor for v in delta_p]
>>> delta_h = [v*delta_factor for v in delta_h]
>>> GE = Hansen(T=298.15, xs=xs, Vs=Vs, delta_d=delta_d, delta_p=delta_p, delta_h=delta_h, alpha=0.6)
>>> GE.gammas()[1]
3.48957861
>>> GE.gammas_infinite_dilution()[1]
3.8654190
>>> GE.GE()
96.67

The conversion factors can also be omitted as they cancel out:

>>> GE = Hansen(T=298.15, xs=[.97, 0.03], Vs=[89, 115.2], delta_d=[16.6, 14.5], delta_p=[12.3, 0.0], delta_h=[5.5, 0.0], alpha=0.6)
>>> GE.GE()
96.67
GE()

Calculate and return the excess Gibbs energy of a liquid phase using the Flory-Huggins model.

Returns:
GEfloat

Excess Gibbs energy, [J/mol]

d2GE_dT2()

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

2gET2=0\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()

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

2gExiT=R[ln(VijxjVj)VijxjVj]\frac{\partial^2 g^E}{\partial x_i \partial T} = R\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\right]
Returns:
d2GE_dTdxslist[float]

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

d2GE_dxixjs(derive_attr='GE')
d3GE_dT3()

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

3gET3=0\frac{\partial^3 g^E}{\partial T^3} = 0
Returns:
d3GE_dT3float

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

dGE_dT()

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

gET=Rixiln(VijxjVj)\frac{\partial g^E}{\partial T} = R\sum_i x_i \ln\left(\frac{V_i}{\sum_j x_j V_j}\right)
Returns:
dGE_dTfloat

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

dGE_dxs()

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

GExi=RT[ln(VijxjVj)VijxjVj]+ViGE+mViVmxm[δiδm(kmi+kim)+(δiδm)2]mVmxm\frac{\partial G^E}{\partial x_i} = RT\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\right] + \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}

Or as an addition to the regular solution equation:

GExi=RT[ln(VijxjVj)VijxjVj]+GExiRS\frac{\partial G^E}{\partial x_i} = RT\left[\ln\left(\frac{V_i}{\sum_j x_j V_j}\right) - \frac{V_i}{\sum_j x_j V_j}\right] + \frac{\partial G^E}{\partial x_i}_{\text{RS}}
Returns:
dGE_dxslist[float]

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

to_T_xs(T, xs)[source]

Method to construct a new Hansen 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:
objHansen

New Hansen 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γ1=V1ϕ22RT[(SP1SP2)2+λ12SP1SP2+λ21SP1SP2]\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γ2=V2ϕ12RT[(SP1SP2)2+λ12SP1SP2+λ21SP1SP2]\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]
ϕ1=x1V1x1V1+x2V2\phi_1 = \frac{x_1 V_1}{x_1 V_1 + x_2 V_2}
ϕ2=x2V2x1V1+x2V2\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]