Problem description
Problem description
Steady laminar (Poiseuille) flow in a circular tube carries a reacting fluid. A first-order, irreversible, exothermic reaction A → B proceeds with Arrhenius temperature dependence. The unknowns are the dimensionless concentration c(z,r) and temperature T(z,r). r is the radius scaled by the tube radius (r = 0 axis, r = 1 wall), z is the scaled axial coordinate, and the velocity profile is u = 1 - . Axial diffusion and conduction are neglected, and heat and mass share the same radial transport coefficient (i.e., Lewis number equal 1).
2
r
Governing equations: (1 - ) dc/dz = (1/Pe) (c/d + (1/r) dc/dr) - Da c exp[γ (1 - 1/T)]
and (1 -) dT/dz = (1/Pe) (T/d + (1/r) dT/dr) + β Da c exp[γ (1 - 1/T)].
2
r
2
d
2
r
and (1 -
2
r
2
d
2
r
Boundary and initial conditions: symmetry dc/dr = dT/dr = 0 on the axis (r = 0); no mass flux dc/dr = 0 and fixed wall temperature T = 1 at the wall (r = 1); uniform inlet state c = 1, T = 1 at z = 0. The inlet and wall temperatures are the reference temperature, so the rate constant equals Da there.
Parameters: Pe = 100, Da = 2, γ = 15 (activation energy), β = 0.2 (adiabatic temperature rise), reactor length L = 2.
Outputs: the mixed-cup conversion X(z) = 1 - 4 Integral[c (1 -) r, {r, 0, 1}] (the weight (1 - r^2) r integrates to 1/4) and the temperature field.
Outputs: the mixed-cup conversion X(z) = 1 - 4 Integral[c (1 -
2
r
Method
Method
The radial direction is discretised by orthogonal collocation at the Chebyshev-Gauss-Lobatto nodes y_i = cos(i Pi/Np) on [-1, 1], mapped to r = (1 + y)/2. Derivatives are represented by the differentiation matrix D (d/dr = 2 D, d2/dr2 = 4 D.D). The equations are enforced at the Np - 1 interior nodes, multiplied by r to remove the 1/r singularity; the two end nodes carry the boundary conditions. This gives a differential-algebraic system in z (method of lines), solved with NDSolve. A second, independent finite-difference discretisation (n = 80 intervals) is solved at the end as a cross-check.
Chebyshev differentiation matrix
Chebyshev differentiation matrix
Np = number of collocation intervals (Np = 20), giving Np+1 = 21 collocation points. The error decreases as Np increases.
In[]:=
(*Np=numberofChebyshevintervals(Np+1nodes).Spectralconvergence:raiseNptorefine.*)Np=20;
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.
In[]:=
(*CornerentryD[0,0]=(2Np^2+1)/6ofthefirst-derivativematrix.*)d[0,0]=(2Np^2+1)/6//N;
Opposite corner entry D[Np,Np] = -D[0,0] (the matrix is centro-antisymmetric).
In[]:=
(*OppositecornerD[Np,Np]=-(2Np^2+1)/6.*)d[Np,Np]=-(2Np^2+1)/6//N;
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.
In[]:=
(*Chebyshev-Gauss-Lobattonodesy_i=Cos[iPi/Np];y_0=1,y_Np=-1.*)y[i_]:=Cos[iPi/Np]//N;
Diagonal entries for the interior nodes (0 < i < Np).
In[]:=
(*Diagonalentriesforinteriornodes:D[i,i]=-y_i/(2(1-y_i^2)).*)d[i_,i_]:=-y[i]/(2(1-y[i]^2))//N;
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.
In[]:=
(*Off-diagonalentriesbetweeninteriornodes:D[j,k]=(-1)^(j+k)/(y_j-y_k).*)(*Boundaryrows/columnsarecoveredbythemorespecificrulesbelow(Mathematicatriesspecificpatternsfirst).*)d[j_,k_]:=If[j≠k&&k≠0&&k≠Np&&j≠0&&j≠Np,(-1)^(j+k)/(y[j]-y[k])]//N;
Remaining corner entry D[Np,0].
In[]:=
(*CornerD[Np,0]=-(1/2)(-1)^Np.*)d[Np,0]=-1/2(-1)^Np;
Remaining corner entry D[0,Np].
In[]:=
(*CornerD[0,Np]=+(1/2)(-1)^Np.*)d[0,Np]=1/2(-1)^Np;
First column: interior rows j, column 0.
In[]:=
(*Firstcolumn(k=0):D[j,0]=-(1/2)(-1)^j/(1-y_j).*)d[j_,0]:=If[j≠Np&&j≠0,-1/2(-1)^j/(1-y[j])];
Last column: interior rows j, column Np.
In[]:=
(*Lastcolumn(k=Np):D[j,Np]=(1/2)(-1)^(j+Np)/(1+y_j).*)d[j_,Np]:=If[j≠Np&&j≠0,1/2(-1)^(j+Np)/(1+y[j])];
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.
In[]:=
(*Firstrow(j=0):D[0,k]=2(-1)^k/(1-y_k);thefactor2istheend-pointweightc_0.*)d[0,j_]:=If[j≠Np&&j≠0,2(-1)^j/(1-y[j])];
Last row: row Np, interior columns j.
In[]:=
(*Lastrow(j=Np):D[Np,k]=-2(-1)^(k+Np)/(1+y_k).*)d[Np,j_]:=If[j≠Np&&j≠0,-2(-1)^(j+Np)/(1+y[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.
In[]:=
(*Add=(Np+1)x(Np+1)matrixofd/dyonthenodes;index1<->y=1,indexNp+1<->y=-1.*)Add=Table[d[i,j]//N,{i,0,Np},{j,0,Np}];
The second-derivative operator is simply the first-derivative matrix applied twice: Bdd = Add . Add.
In[]:=
(*Bdd=d^2/dy^2asthesquareofthefirst-derivativematrix.*)Bdd=Add.Add;
Collocation model of the reactor
Collocation model of the reactor
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 r in [0,1] and used to discretise dc/dr and c/d.
2
d
2
r
In[]:=
(*Radialnodesr=(1+y)/2in[0,1]:rp[[1]]=1isthewall,rp[[Np+1]]=0istheaxis.*)(*Chainruleusedbelow:d/dr=2d/dyandd^2/dr^2=4d^2/dy^2.*)rp=Table[(1+y[j])/2,{j,0,Np}]
Out[]=
{1.,0.993844,0.975528,0.945503,0.904508,0.853553,0.793893,0.726995,0.654508,0.578217,0.5,0.421783,0.345492,0.273005,0.206107,0.146447,0.0954915,0.0544967,0.0244717,0.00615583,0.}
In[]:=
(*Clearrsoitisafreesymbolinc[z,r]andT[z,r]below.*)r=.
In[]:=
(*Pe:radialdiffusioncoefficientis1/Pe;Da:Damkohlernumber;gamma:activationenergy;*)(*beta:adiabatictemperaturerise;L:reactorlength.rate=DacExp[gamma(1-1/T)](=DacatT=1).*)(*rateiskeptsymbolicherebecauseeq1andeq2readitwhenSYSisbuilt(seeIn[32]furtherdown).*)Pe=100;Da=2;γ=15;β=0.2;L=2;rate=Dac[z,r]Exp[γ(1-1/T[z,r])];
In[]:=
(*Massbalanceatnodei:r(1-r^2)dc/dz=(1/Pe)(rc_rr+c_r)-rrate(u=1-r^2,axialdiffusionneglected).*)(*Multiplyingbyrremovesthe1/rsingularity.RadialderivativescomefromrowiofAdd(factor2)andBdd(factor4).*)eq1[i_]:=rp[[i]](1-rp[[i]]^2)D[c[z,r],z]==(1/Pe)(rp[[i]]D[c[z,r],{r,2}]+D[c[z,r],r])-rp[[i]]rate/.c[z,r]->c[i][z]/.T[z,r]->T[i][z]/.Derivative[0,1][c][z,r]->(2/1)Sum[Add[[i,j]]c[j][z],{j,1,Np+1}]/.Derivative[0,2][c][z,r]->(2/1)^2Sum[Bdd[[i,j]]c[j][z],{j,1,Np+1}]/.Derivative[1,0][c][z,r]->c[i]'[z]
In[]:=
(*Energybalance,samestructurewiththeheatsource:r(1-r^2)dT/dz=(1/Pe)(rT_rr+T_r)+betarrate.*)eq2[i_]:=rp[[i]](1-rp[[i]]^2)D[T[z,r],z]==(1/Pe)(rp[[i]]D[T[z,r],{r,2}]+D[T[z,r],r])+βrp[[i]]rate/.c[z,r]->c[i][z]/.T[z,r]->T[i][z]/.Derivative[0,1][T][z,r]->(2/1)Sum[Add[[i,j]]T[j][z],{j,1,Np+1}]/.Derivative[0,2][T][z,r]->(2/1)^2Sum[Bdd[[i,j]]T[j][z],{j,1,Np+1}]/.Derivative[1,0][T][z,r]->T[i]'[z]
In[]:=
(*BoundaryconstraintsthatreplacethePDEatthetwoendnodes(index1=wall,Np+1=axis):*)(*axisdT/dr=0,walldc/dr=0,axisdc/dr=0,wallT=1.*)bc={(2/1)Sum[Add[[Np+1,j]]T[j][z],{j,1,Np+1}]==0,(2/1)Sum[Add[[1,j]]c[j][z],{j,1,Np+1}]==0,(2/1)Sum[Add[[Np+1,j]]c[j][z],{j,1,Np+1}]==0,T[1][z]==1};
In[]:=
(*Initialconditionatz=0:uniformc=1andT=1(consistentwiththeboundaryconstraints).*)init=Flatten@Table[{c[i][0]==1,T[i][0]==1},{i,1,Np+1}]
Out[]=
{c[1][0]1,T[1][0]1,c[2][0]1,T[2][0]1,c[3][0]1,T[3][0]1,c[4][0]1,T[4][0]1,c[5][0]1,T[5][0]1,c[6][0]1,T[6][0]1,c[7][0]1,T[7][0]1,c[8][0]1,T[8][0]1,c[9][0]1,T[9][0]1,c[10][0]1,T[10][0]1,c[11][0]1,T[11][0]1,c[12][0]1,T[12][0]1,c[13][0]1,T[13][0]1,c[14][0]1,T[14][0]1,c[15][0]1,T[15][0]1,c[16][0]1,T[16][0]1,c[17][0]1,T[17][0]1,c[18][0]1,T[18][0]1,c[19][0]1,T[19][0]1,c[20][0]1,T[20][0]1,c[21][0]1,T[21][0]1}
In[]:=
(*System=2(Np-1)ODEsatinteriornodes+4algebraicconstraints+2(Np+1)initialconditions.*)SYS=Flatten[Join[Table[{eq1[i],eq2[i]},{i,2,Np}],{bc},init]];
In[]:=
(*Unknownfunctionsc[i][z],T[i][z],i=1..Np+1(42unknownsforNp=20).*)unk=Flatten@Table[{c[i],T[i]},{i,1,Np+1}]
Out[]=
{c[1],T[1],c[2],T[2],c[3],T[3],c[4],T[4],c[5],T[5],c[6],T[6],c[7],T[7],c[8],T[8],c[9],T[9],c[10],T[10],c[11],T[11],c[12],T[12],c[13],T[13],c[14],T[14],c[15],T[15],c[16],T[16],c[17],T[17],c[18],T[18],c[19],T[19],c[20],T[20],c[21],T[21]}
In[]:=
(*Methodoflinesinz.NDSolvetreatsthe4constraintsasalgebraicequations(DAE);defaulttolerancesareused.*)SOL=NDSolve[SYS,unk,{z,0,L}];
In[]:=
(*f[z][r]:interpolatingfunctionoftheradialc-profileataxialpositionz(defaultinterpolationorder3).*)f[z_]:=Interpolation[Table[{rp[[i]],First[(c[i][z]/.SOL)]},{i,1,Np+1}]]
Results: conversion profile from collocation
Results: conversion profile from collocation
In[]:=
(*Table{z,conversion},z=0..Linstepsof0.01.Theweightur=(1-r^2)rintegratesto1/4,hencethefactor4.*)(*mixed-cupconversion:1-4Integrate[c(1-r^2)r,{r,0,1}]*)tbl=Table[{z,1-4NIntegrate[f[z][r]r(1-r^2),{r,0,1}]},{z,0,L,0.01}]
Out[]=
{{0.,-3.9635×},{0.01,0.0419256},{0.02,0.0875345},{0.03,0.135813},{0.04,0.186066},{0.05,0.237523},{0.06,0.289427},{0.07,0.341108},{0.08,0.392074},{0.09,0.441964},{0.1,0.490492},{0.11,0.53743},{0.12,0.582577},{0.13,0.625737},{0.14,0.666727},{0.15,0.705386},{0.16,0.741568},{0.17,0.775152},{0.18,0.806042},{0.19,0.834177},{0.2,0.859531},{0.21,0.88212},{0.22,0.902007},{0.23,0.919295},{0.24,0.934134},{0.25,0.946707},{0.26,0.957227},{0.27,0.965922},{0.28,0.973027},{0.29,0.978773},{0.3,0.983377},{0.31,0.987035},{0.32,0.989923},{0.33,0.992189},{0.34,0.993958},{0.35,0.995335},{0.36,0.996402},{0.37,0.997228},{0.38,0.997866},{0.39,0.998358},{0.4,0.998737},{0.41,0.999028},{0.42,0.999253},{0.43,0.999425},{0.44,0.999558},{0.45,0.99966},{0.46,0.999738},{0.47,0.999799},{0.48,0.999845},{0.49,0.999881},{0.5,0.999908},{0.51,0.999929},{0.52,0.999946},{0.53,0.999958},{0.54,0.999968},{0.55,0.999975},{0.56,0.999981},{0.57,0.999985},{0.58,0.999989},{0.59,0.999991},{0.6,0.999993},{0.61,0.999995},{0.62,0.999996},{0.63,0.999997},{0.64,0.999998},{0.65,0.999998},{0.66,0.999999},{0.67,0.999999},{0.68,0.999999},{0.69,0.999999},{0.7,0.999999},{0.71,1.},{0.72,1.},{0.73,1.},{0.74,1.},{0.75,1.},{0.76,1.},{0.77,1.},{0.78,1.},{0.79,1.},{0.8,1.},{0.81,1.},{0.82,1.},{0.83,1.},{0.84,1.},{0.85,1.},{0.86,1.},{0.87,1.},{0.88,1.},{0.89,1.},{0.9,1.},{0.91,1.},{0.92,1.},{0.93,1.},{0.94,1.},{0.95,1.},{0.96,1.},{0.97,1.},{0.98,1.},{0.99,1.},{1.,1.},{1.01,1.},{1.02,1.},{1.03,1.},{1.04,1.},{1.05,1.},{1.06,1.},{1.07,1.},{1.08,1.},{1.09,1.},{1.1,1.},{1.11,1.},{1.12,1.},{1.13,1.},{1.14,1.},{1.15,1.},{1.16,1.},{1.17,1.},{1.18,1.},{1.19,1.},{1.2,1.},{1.21,1.},{1.22,1.},{1.23,1.},{1.24,1.},{1.25,1.},{1.26,1.},{1.27,1.},{1.28,1.},{1.29,1.},{1.3,1.},{1.31,1.},{1.32,1.},{1.33,1.},{1.34,1.},{1.35,1.},{1.36,1.},{1.37,1.},{1.38,1.},{1.39,1.},{1.4,1.},{1.41,1.},{1.42,1.},{1.43,1.},{1.44,1.},{1.45,1.},{1.46,1.},{1.47,1.},{1.48,1.},{1.49,1.},{1.5,1.},{1.51,1.},{1.52,1.},{1.53,1.},{1.54,1.},{1.55,1.},{1.56,1.},{1.57,1.},{1.58,1.},{1.59,1.},{1.6,1.},{1.61,1.},{1.62,1.},{1.63,1.},{1.64,1.},{1.65,1.},{1.66,1.},{1.67,1.},{1.68,1.},{1.69,1.},{1.7,1.},{1.71,1.},{1.72,1.},{1.73,1.},{1.74,1.},{1.75,1.},{1.76,1.},{1.77,1.},{1.78,1.},{1.79,1.},{1.8,1.},{1.81,1.},{1.82,1.},{1.83,1.},{1.84,1.},{1.85,1.},{1.86,1.},{1.87,1.},{1.88,1.},{1.89,1.},{1.9,1.},{1.91,1.},{1.92,1.},{1.93,1.},{1.94,1.},{1.95,1.},{1.96,1.},{1.97,1.},{1.98,1.},{1.99,1.},{2.,1.}}
-13
10
Independent check: finite differences in r
Independent check: finite differences in r
Second-order central differences on a uniform grid r_i = i h (n = 80), with the axis treated by the symmetry limit and the wall node eliminated analytically (c_r = 0 together with u = 0 gives c_n = c_(n-1)/(1 + h^2 Pe Da/2); T_n = 1). The code below uses the same physical parameters.
Temperature field
Temperature field
Discussion
Discussion
Conversion
Conversion
The reaction is fast on the scale of the plotted length: X = 0.042 at z = 0.01, 50 percent at z = 0.10, 90 percent at z = 0.22, 99 percent at z = 0.32 and 99.9 percent at z = 0.41. Beyond z of about 0.5 the conversion is 0.9999 or more, so most of the plotted range (z up to 2) is flat. Radially, slow fluid near the wall is consumed first (c at the wall is about 0.01 at z = 0.1 while c on the axis is still 0.75), and the heat released raises the core temperature, which switches on the exponential Arrhenius factor: at T = 1.2 the rate constant is exp(15 (1 - 1/1.2)), about 12 times its value at T = 1. The axis concentration drops from 0.75 (z = 0.1) to 0.38 (z = 0.2) and below 1e-3 at z = 0.5.
Temperature
Temperature
The temperature climbs from 1 toward the adiabatic limit 1 + β = 1.2: on the axis T = 1.12 at z = 0.2, 1.16 at z = 0.25 and 1.1999 from z of about 0.5 onward. Because heat and mass have the same transport coefficient, T + β c obeys the source-free equation, so with c ≳ 0 the temperature cannot exceed 1.2 (computed maximum 1.19999999, reached on the axis). For these parameters there is no hot spot above this bound and no runaway. Downstream of the reaction zone the hot core is cooled only slowly by the wall because radial conduction is slow for Pe = 100: at z = 2 the axis is still at 1.1999 and r = 0.5 at about 1.18.
Accuracy and convergence
Accuracy and convergence
Collocation converges spectrally in Np. Against an Np = 40 reference, the worst conversion error at z = 0.05, 0.1 and 0.25 is about 5e-4 for Np = 10, 4e-5 for Np = 16, 2e-5 for Np = 20 (the value used) and 6e-7 for Np = 30. The finite-difference scheme is second order: the error at z = 0.01 is about 5e-5, 1e-5 and below 5e-6 for n = 40, 80 and 160, and the n = 80 curve stays within 3e-5 of the converged reference over the whole range.
Assumptions and limits
Assumptions and limits
The model neglects axial diffusion, viscous heating and property variation, assumes Lewis number 1 and a wall held at the inlet temperature, and uses one parameter set (Pe = 100, Da = 2, γ = 15, β = 0.2). Sensitivity to γ, β and Pe is not explored. At the wall the collocation scheme imposes dc/dr = 0 instead of the PDE, whereas the finite-difference scheme uses both dc/dr = 0 and the wall limit of the PDE; here both give the same conversion to about 1e-4.
Conclusion
Conclusion
Chebyshev orthogonal collocation with Np = 20 (21 nodes) combined with NDSolve reproduces the laminar-flow reactor accurately: the differentiation matrix, boundary constraints and DAE setup are correct, and the result is confirmed by an independent finite-difference solution and by a refined collocation run. The reactor reaches 99 percent conversion at z = 0.32 and essentially complete conversion by z = 0.5; the temperature rises to the adiabatic limit 1 + β = 1.2 on the axis and stays below it. Collocation needs about 21 radial nodes where finite differences need roughly 160 for a comparable error (1e-5), which is the main practical advantage of the method for smooth problems like this one.