Description
This notebook simulates the elution of a binary mixture through a packed chromatographic column. Band propagation is described by the equilibrium-dispersive (ED) model: the two solutes are carried along by convection, broadened by an apparent axial dispersion coefficient that lumps together all band-broadening effects, and are assumed to be in adsorption equilibrium with the stationary phase at every point of the column.
The solutes are assumed to follow a linear (Henry) adsorption isotherm, so they do not compete for adsorption sites and the two partial differential equations are uncoupled. The system is solved numerically with (1) NDSolve (method of lines) and (2) Chebyshev orthogonal collocation. The outlet chromatograms are compared.
Governing equations
Mass balance of solute
i
in the column (
i=1,2
):
∂
c
i
∂t
+F
∂
q
i
∂t
+u
∂
c
i
∂z
=
D
a
2
∂
c
i
∂
2
z
with the phase ratio
F=
1-ϵ
ϵ
and the linear (Henry) isotherm, in which each solute adsorbs independently of the other:
q
i
=
a
i
c
i
The time derivative of
q
i
is
∂
q
i
∂t
=
a
i
∂
c
i
∂t
Substituting into the mass balance gives an independent linear advection-dispersion equation for each solute:
(1+F
a
i
)
∂
c
i
∂t
+u
∂
c
i
∂z
=
D
a
2
∂
c
i
∂
2
z
Initial and boundary conditions
Initial condition (column nearly clean; the narrow Gaussian keeps the initial and inlet conditions consistent at the corner
t=0,z=0
):
c
i
(0,z)=
c
0,i
-10000
2
z
e
Inlet (rectangular pulse of duration
t
inj
):
c
i
(t,0)=
c
0,i
,t≤
t
inj
c
i
(t,0)=0,t>
t
inj
Outlet (no diffusive flux at the column end):
∂
c
i
∂z
z=L
=0
Parameters and symbols
◼
  • L
    – column length (cm);
    u
    – interstitial velocity (cm/s);
    D
    a
    – apparent axial dispersion coefficient (cm^2/s)
  • ◼
  • ϵ
    – total bed porosity;
    F
    – phase ratio
  • ◼
  • c
    i
    – mobile-phase concentration of solute
    i
    ;
    q
    i
    – stationary-phase concentration in equilibrium with
    c
    i
  • ◼
  • a
    i
    – Henry constant (slope of the linear isotherm)
  • ◼
  • c
    0,i
    – injected (feed) concentration;
    t
    inj
    – injection time;
    t
    end
    – simulated time
  • ◼
  • Values used:
    L
    = 5 cm;
    u
    = 0.1 cm/s;
    D
    a
    =
    2×
    -3
    10
    cm^2/s;
    ϵ
    = 0.4 (
    F
    = 1.5);
    a
    1
    = 1,
    a
    2
    = 2.5;
    c
    0,1
    = 0.5,
    c
    0,2
    = 0.25;
    t
    inj
    = 10 s;
    t
    end
    = 400 s
  • Workflow
    1
    .
    Define the parameters and the injection pulse.
    2
    .
    Define the linear isotherm and write the PDE system (one independent equation per solute).
    3
    .
    Set the initial and boundary conditions and solve with NDSolve.
    4
    .
    Plot the outlet chromatograms
    c
    i
    (t,L)
    obtained with NDSolve.
    5
    .
    Compute the solution based on the Chebyshev orthogonal Collocation technique and plot it.
    6
    .
    Overlay the NDSolve chromatograms (solid coloured lines) and the orthogonal collocation approximation (dashed black lines).
    ◼
  • Units: lengths in cm, time in s, concentrations in consistent arbitrary units.
  • In[]:=
    (*Two-ComponentEquilibrium-DispersiveChromatography​​linearisotherm,rectangularpulseinjection*)
    In[]:=
    c={c1[t,z],c2[t,z]};
    In[]:=
    (*Linear(Henry)isothermq_i=a_ic_i*)​​q[cc_List]:={aL1c1[t,z],aL2c2[t,z]};
    In[]:=
    q[c]
    Out[]=
    {aL1c1[t,z],aL2c2[t,z]}
    In[]:=
    pde={(FD[q[c][[1]],t])+D[c1[t,z],t]+uD[c1[t,z],z]==DaD[c1[t,z],{z,2}],(FD[q[c][[2]],t])+D[c2[t,z],t]+uD[c2[t,z],z]==DaD[c2[t,z],{z,2}]}
    Out[]=
    u
    (0,1)
    c1
    [t,z]+
    (1,0)
    c1
    [t,z]+aL1F
    (1,0)
    c1
    [t,z]Da
    (0,2)
    c1
    [t,z],u
    (0,1)
    c2
    [t,z]+
    (1,0)
    c2
    [t,z]+aL2F
    (1,0)
    c2
    [t,z]Da
    (0,2)
    c2
    [t,z]
    In[]:=
    pde//InputForm//Simplify
    Out[]//InputForm=
    {u*Derivative[0, 1][c1][t, z] + (1 + aL1*F)*Derivative[1, 0][c1][t, z] == Da*Derivative[0, 2][c1][t, z],
    u*Derivative[0, 1][c2][t, z] + (1 + aL2*F)*Derivative[1, 0][c2][t, z] == Da*Derivative[0, 2][c2][t, z]}
    In[]:=
    (*Parameters(cm,s)*)​​L=5;u=0.1;Da=2*^-3;(*columnlength,interstitialvelocity,dispersion*)​​eps=0.4;F=(1-eps)/eps;(*porosity,phaseratio*)​​nc=2;(*numberofcomponents*)​​{aL1,aL2}={1.0,2.5};(*Henry'sa_i*)​​c0=0.5{1,0.5};(*injectedconcentrations*)​​tinj=10;(*injectiontime*)​​tend=400;(*endtime;t_R,i~(L/u)(1+Fa_i)=125and237.5s(frontarrival;bandcentre=t_R+tinj/2)*)​​
    In[]:=
    (L/u)(1+FaL1)
    Out[]=
    125.
    In[]:=
    (L/u)(1+FaL2)
    Out[]=
    237.5
    In[]:=
    (*Injectionpulse(samedurationforbothcomponents)*)​​cin[i_,t_]:=If[t>tinj,0,If[i==1,c0[[1]],c0[[2]]]];
    In[]:=
    Plot[{cin[1,t],cin[2,t]},{t,0,100},Frame->True,GridLines->Automatic,AspectRatio->1,FrameLabel->{Style["t",14],Style["inlet concentrations",14]},PlotStyle->{{Darker@Blue},{Darker@Red,Dashed}},PlotLegends->{"c1 inlet","c2 inlet"}]
    Out[]=
    c1 inlet
    c2 inlet
    In[]:=
    (*GoverningPDEsystem*)
    In[]:=
    pde={(FD[q[c][[1]],t])+D[c1[t,z],t]+uD[c1[t,z],z]==DaD[c1[t,z],{z,2}],(FD[q[c][[2]],t])+D[c2[t,z],t]+uD[c2[t,z],z]==DaD[c2[t,z],{z,2}]}
    Out[]=
    0.1
    (0,1)
    c1
    [t,z]+2.5
    (1,0)
    c1
    [t,z]
    1
    500
    (0,2)
    c1
    [t,z],0.1
    (0,1)
    c2
    [t,z]+4.75
    (1,0)
    c2
    [t,z]
    1
    500
    (0,2)
    c2
    [t,z]
    In[]:=
    (*Initialandboundaryconditions*)​​ics=Table[(c[[i]]/.t->0)==c0[[i]]Exp[-10000z^2],{i,nc}];(*nearlycleancolumn;narrowGaussianmatchestheinletvalueatz=0*)​​bcIn=Table[(c[[i]]/.z->0)==If[i==1,If[t>tinj,0,c0[[1]]],If[t>tinj,0,c0[[2]]]],{i,nc}];(*inlet:rectangularpulseofdurationtinj*)​​bcOut=Table[(D[c[[i]],{z,1}]/.z->L)==0,{i,nc}];(*outlet:zeroconcentrationgradientatz=L*)​​
    In[]:=
    ics
    Out[]=
    c1[0,z]0.5
    -10000
    2
    z
    
    ,c2[0,z]0.25
    -10000
    2
    z
    
    
    In[]:=
    bcIn
    Out[]=
    {c1[t,0]If[t>10,0,c0〚1〛],c2[t,0]If[t>10,0,c0〚2〛]}
    In[]:=
    bcOut
    Out[]=
    
    (0,1)
    c1
    [t,5]0,
    (0,1)
    c2
    [t,5]0
    In[]:=
    (*SolvethePDEsystemnumerically(methodoflines)*)​​sol=Quiet@NDSolve[Join[pde,ics,bcIn,bcOut],c,{t,0,tend},{z,0,L},AccuracyGoal->7];
    In[]:=
    (*Chromatogramattheoutlet*)​​p1=Plot[Evaluate[c/.sol/.z->L],{t,0,tend},GridLines->Automatic,AspectRatio->1,PlotRange->All,Frame->True,FrameLabel->{Style["t (s)",14],Style["c1 and c2 @ (t, L)",14]},PlotLegends->{"Component 1","Component 2"},PlotLabel->"\nOutlet chromatogram (2 components)\n"]
    Out[]=
    Component 1
    Component 2
    Np = number of collocation intervals (Np = 40), giving Np+1 = 41 collocation points. The error decreases as Np increases; an independent check (Np = 20 to 80) is given in the discussion at the end.
    Corner entry D[0,0] of the differentiation matrix. The four corners, the diagonal, the edges and the interior each obey a different closed-form expression, so they are defined case by case below.
    Opposite corner entry D[Np,Np] = -D[0,0] (the matrix is centro-antisymmetric).
    Chebyshev-Gauss-Lobatto collocation points y_i = cos(i Pi/Np). These run from y = 1 (i = 0) down to y = -1 (i = Np) and cluster near the two ends, which is what suppresses the oscillations a uniform grid would produce.
    Diagonal entries for the interior nodes (0 < i < Np).
    Off-diagonal entries D[j,k] for interior rows and columns, j != k. The alternating sign (-1)^(j+k) and the node spacing y[j]-y[k] come from differentiating the Lagrange cardinal polynomials at the grid points.
    Remaining corner entry D[Np,0].
    Remaining corner entry D[0,Np].
    First column: interior rows j, column 0.
    Last column: interior rows j, column Np.
    First row: row 0, interior columns j. Note the factor 2 -- the boundary rows carry the Chebyshev weight c_0 = c_Np = 2 while interior nodes have c = 1.
    Last row: row Np, interior columns j.
    Assemble all of the above into Add, the (Np+1)x(Np+1) first-derivative operator. Multiplying a vector of nodal values by Add returns the vector of first derivatives at those nodes.
    The second-derivative operator is simply the first-derivative matrix applied twice: Bdd = Add . Add.
    Chebyshev collocation solution of the same two-component problem (method of lines). The first-derivative matrix Add and the second-derivative matrix Bdd defined above are mapped from y in [-1,1] to z in [0,L] and used to discretise dc/dz and d2c/dz2. The two end nodes carry the boundary conditions (Dirichlet at the inlet, zero gradient at the outlet) instead of the PDE, so the interior nodes give an index-1 DAE system. Np = 40 is sufficient here (peak heights and areas within 0.3 %, see discussion); the injected band is only about 1 cm long, so a much coarser grid is not advisable.
    Discussion
    Retention
    With a linear isotherm each band travels with the velocity u/(1+F a_i), independently of the other solute. The dead time is L/u = 50 s, so the fronts reach the outlet at 50(1+F a_i) = 125 s (solute 1) and 237.5 s (solute 2). Because the rectangular pulse lasts tinj = 10 s, the band centres are expected at about 130 s and 242.5 s.
    Separation
    ​The resolution Rs = (t2 - t1)/(2(sigma1 + sigma2)) is about 1.7, so the two bands are baseline-separated (Rs >= 1.5), with only a very small overlap in the valley near 160 to 190 s. Because the isotherm is linear there is no competition: the two chromatograms do not affect each other and could be simulated separately. The profile of each band is that of a plain advection-dispersion problem.
    Comparison of the methods
    ​The NDSolve (method of lines) and Chebyshev collocation curves overlay each other in the final plot. In the independent check, the maximum deviation of the Chebyshev solution from the fine reference was 1.9e-3 (Np = 20), 4.7e-4 (Np = 40), 3.0e-4 (Np = 50) and 1.2e-4 (Np = 80) for solute 1, against a peak height of 0.175. Np = 40 therefore reproduces height, area and width to within about 0.3 %. The error decreases only gradually with Np, probably because the inlet pulse is discontinuous in time, which limits the benefit of spectral accuracy. The closed-form differentiation matrix of the notebook agrees with the standard Chebyshev matrix to 3e-12 at Np = 40.
    Limitations of the model
    ​The inlet uses a Dirichlet condition c(t,0) = c_in(t). With axial dispersion, the Danckwerts condition u c_in = u c - Da dc/dz is the physically consistent choice and conserves mass exactly; the difference is small at this Peclet number (Pe = u L/Da = 250) but it explains the slight shift of the retention times. The initial Gaussian (width about 0.01 cm) adds about 1 % of the injected plug length. The equilibrium-dispersive model also lumps all mass-transfer resistances into Da, and a linear isotherm is only valid at low concentrations.
    Conclusion
    Both numerical approaches solve the two-component equilibrium-dispersive model with a linear isotherm and give the same chromatograms. The weakly retained solute elutes at about 130 s and the strongly retained one at about 242 s, in agreement with the analytical retention times t_R = (L/u)(1+F a_i) plus half the injection time. The peaks keep their injected areas (5 and 2.5), are broadened by dispersion to sigma_t = 11 s and 21 s (125 plates), and are resolved with Rs = 1.7. Chebyshev collocation with only 41 nodes reproduces the NDSolve solution and a fine finite-difference reference to within about 0.3 % of the peak height, with a much smaller system. For more demanding cases (higher injected concentrations, non-linear competitive isotherms) the same collocation framework can be reused by replacing the linear isotherm and coupling the two equations.
    Quantitative comparison: area, mean retention time, standard deviation, height and resolution from both solutions.