This notebook shows plots of the steady-state concentration distribution through a plane sheet, a cylindrical annulus, and a spherical shell, in which diffusion is assumed to be one-dimensional.The relevant equations are:For the plane sheet, D=0 for , where is the diffusion coefficient. Without loss of generality, one can choose the boundary conditions and . Different values of parameter can be chosen. Here, we take α = 10.For the cylindrical annulus, Dr=0 for =1⩽r⩽=2, where is the diffusion coefficient. Again, one can choose the boundary conditions and . Again, we set α = 10.For the spherical shell, D=0 for =1⩽r⩽=2, with the same and boundary conditions as for the cylindrical annulus.For the plane sheet, if , then is a constant and the concentration distribution is indicated by the green line. Fick's second law is recovered, as shown in the first snapshot.In all plots, the red dots correspond to the solution obtained using Chebyshev orthogonal collocation with collocation points (see Ref. 2). The blue curve is the analytical solution given by Crank[1]: , where with =0 (planar case) and =1 (cylindrical and spherical cases).For the plane sheet, , =I(x=0)=0, and =I(x=1).For the cylindrical annulus, , =I(r=1)=0, and =I(r=2).For the spherical shell, , =I(r=1)=0, and =I(r=2).As expected, the two solutions agree perfectly.References:[1] J. Crank, The Mathematics of Diffusion, 2nd ed., New York: Oxford University Press, 1975.[2] Binous H., Kaddeche S., Bellagi A., Solution of six chemical engineering problems using the Chebyshev orthogonal collocation technique, Comput Appl Eng Educ., 2017; 25:594–607. https://doi.org/10.1002/cae.21823
∂
∂x
∂c
∂x
0⩽x⩽1
D=1+αx
c(x=0)=1
c(x=1)=0
α
1
r
∂
∂r
∂c
∂r
r
1
r
2
D=1+αr
c(r=1)=1
c(r=2)=0
1
2
r
∂
∂r
2
r
∂c
∂r
r
1
r
2
D
α=0
D=1
N=16
1-c=-I-
I
1
I
1
I
2
I(x)=(1+αξ)dξ
x
∫
x
0
1
m
ξ
x
0
x
0
m=0
I
1
I
2
m=1
I
1
I
2
m=2
I
1
I
2
Np=15;Ds=Table[d[i,j],{i,0,Np},{j,0,Np}];d[0,0]=(2Np^2+1)/6//N;d[Np,Np]=-(2Np^2+1)/6//N;d[i_,i_]:=-y[i]/(2(1-y[i]^2));y[i_]:=Cos[iPi/Np]//N;d[j_,k_]:=If[j≠k,c[j](-1)^(j+k)/(c[k](y[j]-y[k]))];
c[i_]:=If[i0||iNp,2,1];
r1=1;r2=2;
In[]:=
alpha=10;
Plane sheet case
In[]:=
x1=Table[1/2(y[i]+1),{i,Np,0,-1}];Concp[i_]:=Ds[[i,j]]conc[j];U1=Table[(1+alphax1[[j]])Concp[j],{j,1,Np+1}];Eq[i_]:=Ds[[i]].U10;bc1=conc[1]1;bc2=conc[Np+1]0;initguess=Table[{conc[i],0.5},{i,1,Np+1}];sys=Flatten[{bc1,bc2,Table[Eq[i],{i,2,Np}]},1];sol=Quiet@FindRoot[sys,initguess,MaxIterations1000];p1=ListPlot[Table[{x1[[i]],conc[i]/.sol},{i,1,Np+1}],FrameTrue,AspectRatio1,PlotStyle{Darker@Red,PointSize[0.02]}];F[Xi_?NumericQ]:=Quiet@NIntegrate[1/(1+alphax),{x,0,Xi}];I2=F[1];I1=0;p2=ContourPlot[1-Cc(I1-F[x])/(I1-I2),{x,0,1},{Cc,0,1}];Show[p1,p2,Graphics[{Darker@Green,Thickness[0.007],Line[{{1,0},{0,1}}]}],ImageSize380{1,1},GridLinesAutomatic,FrameLabel{Style["x",Italic,18],Style["concentration",18]}]
Np+1
∑
j=1
Out[]=
Cylindrical annulus case
In[]:=
x1=Table[(r2-r1)/2(y[i]+1)+r1,{i,Np,0,-1}];F[Xi_?NumericQ]:=Quiet@NIntegrate[1/(x(1+alphax)),{x,1,Xi}];I2=F[2];I1=F[1];p2=ContourPlot[1-Cc(I1-F[x])/(I1-I2),{x,1,2},{Cc,0,1}];Concp[i_]:=Ds[[i,j]]conc[j];U1=Table[x1[[j]](1+alphax1[[j]])Concp[j],{j,1,Np+1}];Eq[i_]:=Ds[[i]].U10;bc1=conc[1]1;bc2=conc[Np+1]0;initguess=Table[{conc[i],0.5},{i,1,Np+1}];sys=Flatten[{bc1,bc2,Table[Eq[i],{i,2,Np}]},1];sol=Quiet@FindRoot[sys,initguess,MaxIterations1000];p1=ListPlot[Table[{x1[[i]],conc[i]/.sol},{i,1,Np+1}],FrameTrue,AspectRatio1,PlotStyle{Darker@Red,PointSize[0.02]}];Show[p1,p2,ImageSize380{1,1},GridLinesAutomatic,FrameLabel{Style["r",Italic,18],Style["concentration",18]}]
Np+1
∑
j=1
Out[]=
Spherical shell case
In[]:=
x1=Table[(r2-r1)/2(y[i]+1)+r1,{i,Np,0,-1}];F[Xi_?NumericQ]:=Quiet@NIntegrate[1/(x^2(1+alphax)),{x,1,Xi}];I2=F[2];I1=F[1];p2=ContourPlot[1-Cc(I1-F[x])/(I1-I2),{x,1,2},{Cc,0,1}];Concp[i_]:=Ds[[i,j]]conc[j];U1=Table[x1[[j]]^2(1+alphax1[[j]])Concp[j],{j,1,Np+1}];Eq[i_]:=Ds[[i]].U10;bc1=conc[1]1;bc2=conc[Np+1]0;initguess=Table[{conc[i],0.5},{i,1,Np+1}];sys=Flatten[{bc1,bc2,Table[Eq[i],{i,2,Np}]},1];sol=Quiet@FindRoot[sys,initguess,MaxIterations1000];p1=ListPlot[Table[{x1[[i]],conc[i]/.sol},{i,1,Np+1}],FrameTrue,AspectRatio1,PlotStyle{Darker@Red,PointSize[0.02]}];Show[p1,p2,ImageSize380{1,1},GridLinesAutomatic,FrameLabel{Style["r",Italic,18],Style["concentration",18]}]
Np+1
∑
j=1