Example 3.8 Cylindrical Catalyst Pellet
In the example discussed above, both the boundary conditions are of the Neumann type. However, many problems involve derivative boundary conditions. These problems can be handled by using the three point forward and backward differences at x = 0 and x = 1, respectively. This is illustrated by solving the cylindrical pellet problem solved in example 3.6 with a different boundary condition at the surface (x = 1):

(3.67)
The Maple program developed for the previous example can be modified to handle the derivative boundary conditions.
| > |
with(linalg):with(plots): |
 |
(1) |
 |
(2) |
| > |
eq:=diff(y(x),x$2)+1/x*diff(y(x),x)-phi^2*y(x); |
 |
(3) |
 |
(4) |
| > |
bc2:=diff(y(x),x)-1+y(x); |
 |
(5) |
The central difference expression for the second and first derivatives are
| > |
d2ydx2:=(y[m+1]-2*y[m]+y[m-1])/h^2; |
![`/`(`*`(`+`(y[`+`(m, 1)], `-`(`*`(2, `*`(y[m]))), y[`+`(m, `-`(1))])), `*`(`^`(h, 2)))](images/Example3.8 a Rev 1_8.gif) |
(6) |
| > |
dydx:=(y[m+1]-y[m-1])/2/h; |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[`+`(m, 1)], `-`(y[`+`(m, `-`(1))])))), `*`(h)))](images/Example3.8 a Rev 1_9.gif) |
(7) |
The three point forward and backward difference expressions for the derivative are:
| > |
dydxf:=(-y[2]+4*y[1]-3*y[0])/(2*h); |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(y[2]), `*`(4, `*`(y[1])), `-`(`*`(3, `*`(y[0])))))), `*`(h)))](images/Example3.8 a Rev 1_10.gif) |
(8) |
| > |
dydxb:=(y[N-1]-4*y[N]+3*y[N+1])/(2*h); |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[3], `-`(`*`(4, `*`(y[4]))), `*`(3, `*`(y[5]))))), `*`(h)))](images/Example3.8 a Rev 1_11.gif) |
(9) |
The governing equation in finite difference form is:
| > |
Eq[m]:=subs(diff(y(x),x$2)=d2ydx2,diff(y(x),x)=dydx,y(x)=y[m],x=m*h,eq); |
![`+`(`/`(`*`(`+`(y[`+`(m, 1)], `-`(`*`(2, `*`(y[m]))), y[`+`(m, `-`(1))])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(y[`+`(m, 1)], `-`(y[`+`(m, `-`(1))])))), `*`(m, `*`(`^`(h, 2)))), `-`(`*`(`^`(phi...](images/Example3.8 a Rev 1_12.gif) |
(10) |
The boundary conditions in finite difference form are:
| > |
Eq[0]:=subs(diff(y(x),x)=dydxf,y(x)=y[0],bc1); |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(y[2]), `*`(4, `*`(y[1])), `-`(`*`(3, `*`(y[0])))))), `*`(h)))](images/Example3.8 a Rev 1_13.gif) |
(11) |
| > |
Eq[N+1]:=subs(diff(y(x),x)=dydxb,y(x)=y[N+1],bc2); |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[3], `-`(`*`(4, `*`(y[4]))), `*`(3, `*`(y[5]))))), `*`(h)), `-`(1), y[5])](images/Example3.8 a Rev 1_14.gif) |
(12) |
A 'for loop' can be written for the interior node points as
| > |
for i to N do Eq[i]:=subs(m=i,Eq[m]);od; |
| > |
y[0]:=solve(Eq[0],y[0]); |
![`+`(`-`(`*`(`/`(1, 3), `*`(y[2]))), `*`(`/`(4, 3), `*`(y[1])))](images/Example3.8 a Rev 1_19.gif) |
(14) |
| > |
y[N+1]:=solve(Eq[N+1],y[N+1]); |
![`/`(`*`(`+`(`-`(y[3]), `*`(4, `*`(y[4])), `*`(2, `*`(h)))), `*`(`+`(3, `*`(2, `*`(h)))))](images/Example3.8 a Rev 1_20.gif) |
(15) |
 |
(16) |
| > |
for i to N do Eq[i]:=eval(Eq[i]);od; |
| > |
eqs:=[seq(Eq[i],i=1..N)]; |
![[`+`(`*`(`/`(100, 3), `*`(y[2])), `-`(`*`(`/`(100, 3), `*`(y[1]))), `-`(`*`(`^`(phi, 2), `*`(y[1])))), `+`(`*`(`/`(125, 4), `*`(y[3])), `-`(`*`(50, `*`(y[2]))), `*`(`/`(75, 4), `*`(y[1])), `-`(`*`(`^`...](images/Example3.8 a Rev 1_26.gif)
![[`+`(`*`(`/`(100, 3), `*`(y[2])), `-`(`*`(`/`(100, 3), `*`(y[1]))), `-`(`*`(`^`(phi, 2), `*`(y[1])))), `+`(`*`(`/`(125, 4), `*`(y[3])), `-`(`*`(50, `*`(y[2]))), `*`(`/`(75, 4), `*`(y[1])), `-`(`*`(`^`...](images/Example3.8 a Rev 1_27.gif) |
(18) |
| > |
vars:=[seq(y[i],i=1..N)]; |
![[y[1], y[2], y[3], y[4]]](images/Example3.8 a Rev 1_28.gif) |
(19) |
| > |
A:=genmatrix(eqs,vars,'B1'); |
 |
(20) |
 |
(21) |
Maple generates a row vector, which can be converted to a column vector as:
| > |
B:=matrix(N,1):for i to N do B[i,1]:=B1[i]:od:evalm(B); |
 |
(22) |
The solution is obtained as
| > |
X:=evalm(inverse(A)&*B); |
 |
(23) |
| > |
for i to N do y[i]:=X[i,1];od; |
| > |
y[0]:=eval(y[0]);y[N+1]:=eval(y[N+1]); |
Now the result obtained is plotted for different values of Thiele modulus Φ:
![[.1, .5, 1, 2, 5]](images/Example3.8 a Rev 1_41.gif) |
(26) |
| > |
clr:=[black,red,green,gold,blue]; |
![[black, red, green, gold, blue]](images/Example3.8 a Rev 1_42.gif) |
(27) |
| > |
for j from 1 to 5 do p[j]:=plot([seq([i*h,subs(phi=pars[j],y[i])],i=0..N+1)],thickness=3,title="Figure Exp 3.1.13.",axes=boxed,color=clr[j]):od:
|
| > |
display({seq(p[i],i=1..5)}); |