The code implements the UNIQUAC activity coefficient model for a five-component liquid-liquid equilibrium system consisting of Water, Methanol, Cyclohexane, n-Butanol, and Toluene at 25°C and atmospheric pressure. Pure component structural parameters r and q are taken from Sandler’s textbook, while the 10 asymmetric binary interaction parameters are sourced directly from the Aspen Plus UNIQ-1 databank and arranged into 5×5 A and B matrices.
The activity coefficients are computed via the standard UNIQUAC combinatorial and residual contributions, with the interaction energy expressed as τᵢⱼ = exp(Aᵢⱼ + Bᵢⱼ/T), where T is in Kelvin.
The equilibrium phase compositions were determined by applying the Common Tangent Hyperplane (CTH) Approach.
Mathematica results show excellent agreement with their counterparts obtained using Aspen-Plus.
The activity coefficients are computed via the standard UNIQUAC combinatorial and residual contributions, with the interaction energy expressed as τᵢⱼ = exp(Aᵢⱼ + Bᵢⱼ/T), where T is in Kelvin.
The equilibrium phase compositions were determined by applying the Common Tangent Hyperplane (CTH) Approach.
Mathematica results show excellent agreement with their counterparts obtained using Aspen-Plus.
Based on the converged LLE solution:
◼
Liquid Phase 1 (α — Aqueous-rich phase):
◼
The first liquid phase is predominantly aqueous, with Water as the dominant component at a mole fraction of 0.4612, followed by n-Butanol at 0.2649 and Methanol at 0.2184. Cyclohexane and Toluene are nearly immiscible in this phase, appearing at very low mole fractions of 0.0329 and 0.0226 respectively. The presence of Methanol and n-Butanol in this phase reflects their partial miscibility with water due to their hydroxyl groups.
◼
Liquid Phase 2 (β — Organic-rich phase):
◼
The second liquid phase is organic-rich, dominated by Cyclohexane at 0.6466 and Toluene at 0.2413, which together account for over 85% of the phase composition. n-Butanol appears at 0.0815, acting as a bridging component between the aqueous and organic phases due to its amphiphilic nature. Methanol and Water are largely expelled from this phase, present only at trace levels of 0.0251 and 0.0055 respectively, consistent with their strong affinity for the aqueous phase.
◼
Phase split fraction:
◼
The organic phase (β) constitutes 35.37% of the total mixture, while the aqueous phase (α) accounts for the remaining 64.63%, reflecting the water-rich nature of the overall feed composition z = {0.30, 0.15, 0.25, 0.20, 0.10}.
ClearAll["Global`*"];
Temperature
T=298.15;
1=Water, 2=Methanol, 3=Cyclohexane, 4=n-Butanol, 5=Toluene
UNIQUAC volume (r) and surface area (q) parameters
Source: Sandler “Chemical Engineering Thermodynamics”, App. D
r={0.9200,1.4311,4.0464,3.4543,3.9228};q={1.40002,1.43203,3.24004,3.04805,2.9700};
In[]:=
A={{0,0.6437,0,-4.9934,0},{-1.0662,0,-0.4168,-0.3136,0},{0,2.6608,0,0.3638,-0.0238},{3.7644,0.2267,0.0328,0,-1.6557},{0,0,0.1775,2.9509,0}};
In[]:=
Dimensions[A]
Out[]=
{5,5}
In[]:=
B={{0,-322.131,-540.36,1569.05,-350.21},{432.879,0,125.38,82.6364,27.8315},{-1247.3,-1572.84,0,-468.91,-30.4889},{-1446.61,-125.288,85.7643,0,628.409},{-950.6,-563.013,-54.6638,-1249.19,0}};
In[]:=
Dimensions[B]
Out[]=
{5,5}
In[]:=
nc=5;
In[]:=
Table[Exp[A[[i,j]]+B[[i,j]]/T],{i,1,nc},{j,1,nc}]//TableForm
Out[]//TableForm=
1. | 0.646144 | 0.163266 | 1.30894 | 0.308939 |
1.47062 | 1. | 1.00373 | 0.96422 | 1.09784 |
0.0152456 | 0.0732021 | 1. | 0.298516 | 0.881562 |
0.33704 | 0.824055 | 1.37775 | 1. | 1.57144 |
0.0412408 | 0.151321 | 0.994174 | 0.289702 | 1. |
UNIQUAC activity coefficient function
UNIQUACgamma[x_List]:=Module[{nc,phi,theta,tau,lnGammaComb,lnGammaRes,lnGamma,z0=10,l,S,sumXL},nc=Length[x];(*Coordinationnumberz0=10*)l=Table[(z0/2)(r[[i]]-q[[i]])-(r[[i]]-1),{i,1,nc}];(*Segment&surfacefractions*)phi=(r*x)/(r.x);theta=(q*x)/(q.x);(*UNIQUACtaumatrix*)tau=Table[Exp[A[[i,j]]+B[[i,j]]/T],{i,1,nc},{j,1,nc}];(*---Combinatorialpart---*)sumXL=Sum[x[[i]]l[[i]],{i,1,nc}];lnGammaComb=Table[Log[phi[[i]]/x[[i]]]+(z0/2)q[[i]]Log[theta[[i]]/phi[[i]]]+l[[i]]-(phi[[i]]/x[[i]])sumXL,{i,1,nc}];(*---Residualpart---*)S=Table[Sum[theta[[j]]tau[[j,i]],{j,1,nc}],{i,1,nc}];lnGammaRes=Table[q[[i]](1-Log[S[[i]]]-Sum[theta[[k]]tau[[i,k]]/S[[k]],{k,1,nc}]),{i,1,nc}];lnGamma=lnGammaComb+lnGammaRes;Exp[lnGamma]];
UNIQUAC GE/RT
gEUNIQUAC[x_List]:=Module[{phi,theta,l,geC,geR,tau,z0},z0=10;phi=Table[r[[i]]x[[i]]/Sum[r[[j]]x[[j]],{j,5}],{i,5}];theta=Table[q[[i]]x[[i]]/Sum[q[[j]]x[[j]],{j,5}],{i,5}];l=Table[(z0/2)(r[[i]]-q[[i]])-(r[[i]]-1),{i,5}];(*UNIQUACtaumatrix*)tau=Table[Exp[A[[i,j]]+B[[i,j]]/T],{i,1,nc},{j,1,nc}];geC=Sum[x[[i]]Log[phi[[i]]/x[[i]]]+(z0/2)q[[i]]x[[i]]Log[theta[[i]]/phi[[i]]],{i,5}];geR=-Sum[q[[i]]x[[i]]Log[Sum[theta[[j]]tau[[j,i]],{j,5}]],{i,5}]+Sum[q[[i]]x[[i]](1-Sum[theta[[j]]tau[[i,j]]/Sum[theta[[k]]tau[[k,j]],{k,5}],{j,5}]),{i,5}];geC+geR];
Total G/RT
gMix[x1_,x2_,x3_,x4_]:=Module[{x5,x},x5=1-x1-x2-x3-x4;x={x1,x2,x3,x4,x5};Sum[x[[i]]Log[x[[i]]],{i,5}]+gEUNIQUAC[x]];
Gradient
grad=Table[D[gMix[x1,x2,x3,x4],var],{var,{x1,x2,x3,x4}}];
Unknowns
xa={xa1,xa2,xa3,xa4};xb={xb1,xb2,xb3,xb4};
Gibbs energies
gA=gMix[xa1,xa2,xa3,xa4];gB=gMix[xb1,xb2,xb3,xb4];
Gradients
gradA=grad/.{x1->xa1,x2->xa2,x3->xa3,x4->xa4};gradB=grad/.{x1->xb1,x2->xb2,x3->xb3,x4->xb4};
Common tangent hyperplane
eqSlope=Thread[gradA==gradB];eqIntercept=gA-xa.gradA==gB-xb.gradB;
Feed
z={0.30,0.15,0.25,0.20,0.10}
Out[]=
{0.3,0.15,0.25,0.2,0.1}
Mass balances
eqMB={z[[1]]==(1-beta)xa1+betaxb1,z[[2]]==(1-beta)xa2+betaxb2,z[[3]]==(1-beta)xa3+betaxb3,z[[4]]==(1-beta)xa4+betaxb4};
Complete system
eqns=Join[eqSlope,{eqIntercept},eqMB];
Solution
sol=FindRoot[eqns,{{xa1,0.46},{xa2,0.22},{xa3,0.03},{xa4,0.26},{xb1,0.0056},{xb2,0.025},{xb3,0.64},{xb4,0.081},{beta,0.34}},MaxIterations->1000]
Out[]=
{xa10.461159,xa20.218378,xa30.0329319,xa40.264862,xb10.00553134,xb20.0250595,xb30.646625,xb40.0814854,beta0.353708}
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Phase splitting in a pentanary system by the common tangent hyperplane approach
by Siwar Labidi, Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, June 13, 2026
https://community.wolfram.com/groups/-/m/t/3732715
by Siwar Labidi, Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, June 13, 2026
https://community.wolfram.com/groups/-/m/t/3732715