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].
In the above equation, represents the solubility parameters, and is the interaction coefficient between m and n. The model makes no assumption about the symmetry of this parameter.
- Parameters
- T
float
Temperature, [K]
- xs
list
[float
] Mole fractions, [-]
- Vs
list
[float
] Molar volumes of each compond at a reference temperature (often 298.15 K), [m^3/mol]
- SPs
list
[float
] Solubility parameters of each compound; normally at a reference temperature of 298.15 K, [Pa^0.5]
- lambda_coeffs
list
[list
[float
]],optional
Optional interaction parameters, [-]
- T
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.
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.
- Attributes
- T
float
Temperature, [K]
- xs
list
[float
] Mole fractions, [-]
- Vs
list
[float
] Molar volumes of each compond at a reference temperature (often 298.15 K), [K]
- SPs
list
[float
] Solubility parameters of each compound; normally at a reference temperature of 298.15 K, [Pa^0.5]
- lambda_coeffs
list
[list
[float
]] Interaction parameters, [-]
- T
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.
Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy.
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.
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.
- Returns
- GE
float
Excess Gibbs energy, [J/mol]
- GE
- d2GE_dT2()[source]¶
Calculate and return the second temperature derivative of excess Gibbs energy of a liquid phas.
- Returns
- d2GE_dT2
float
Second temperature derivative of excess Gibbs energy, [J/(mol*K^2)]
- d2GE_dT2
- d2GE_dTdxs()[source]¶
Calculate and return the temperature derivative of mole fraction derivatives of excess Gibbs energy.
- d2GE_dxixjs()[source]¶
Calculate and return the second mole fraction derivatives of excess Gibbs energy of a liquid phase using the regular solution model.
- d3GE_dT3()[source]¶
Calculate and return the third temperature derivative of excess Gibbs energy of a liquid phase.
- Returns
- d3GE_dT3
float
Third temperature derivative of excess Gibbs energy, [J/(mol*K^3)]
- d3GE_dT3
- d3GE_dxixjxks()[source]¶
Calculate and return the third mole fraction derivatives of excess Gibbs energy.
- dGE_dT()[source]¶
Calculate and return the temperature derivative of excess Gibbs energy of a liquid phase.
- Returns
- dGE_dT
float
First temperature derivative of excess Gibbs energy, [J/(mol*K)]
- dGE_dT
- dGE_dxs()[source]¶
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)[source]¶
Method to construct a new
RegularSolution
instance at temperature T, and mole fractions xs with the same parameters as the existing object.- Parameters
- Returns
- obj
RegularSolution
New
RegularSolution
object at the specified conditions [-]
- obj
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.
- Parameters
- xs
list
[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 [-]
- Vs
list
[float
] Molar volumes of each of the two components, [m^3/mol]
- SPs
list
[float
] Solubility parameters of each of the two components, [Pa^0.5]
- Ts
flist
[float
] Temperatures of each composition point; half the length of xs, [K]
- lambda12
float
lambda parameter for 12, [-]
- lambda21
float
lambda parameter for 21, [-]
- gammas
list
[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 [-]
- xs
- Returns
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]