Example 2.3.14 Graetz Problem - Finite Difference Solution
The Graetz problem (heat or mass transfer) in cylindrical coordinates with parabolic velocity profile is solved here. The governing equation for the eigenfunction is[15] [8]
+
(3.2.52)
with the boundary conditions:

(3.2.53)
and
=0 (3.2.54)
Equation (3.2.52) is a second order equation with two boundary conditions (equations (3.2.53) and (3.2.54). In equation (3.2.52), λ is the eigenvalue. To solve for the eigenvalue an additional boundary condition has to be used. For this purpose, y at x = 0 is arbitrarily set to 1:
=1 (3.2.55)
Next, equation (3.2.52) is discretized using finite differences as in section 3.2.3. This yields N equations for the interior node points. The boundary conditions (equations (3.2.53) and (3.2.54) are converted to finite difference form. This yields two equations. There are a total of N+2 node points including the boundaries. There are N+2 dependent variables (yi,i = 0..N+1). There is an additional variable λ. The additional equation is (3.2.55). Hence, there are N+3 variables (yi,i = 0..N+1 and λ) to be solved from N+3 equations. There are infinite solutions for the differential equation (3.2.52). Hence, there are multiple solutions for the system of finite difference equations. This example is solved in Maple below:
 |
(1) |
 |
(2) |
| > |
eq:=diff(y(x),x$2)+1/x*diff(y(x),x)+lambda^2*(1-x^2)*y(x); |
 |
(3) |
 |
(4) |
 |
(5) |
The additional boundary condition is entered here:
 |
(6) |
The central difference expressions 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.2.14 Rev 1_14.gif) |
(7) |
| > |
dydx:=(y[m+1]-y[m-1])/2/h; |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[`+`(m, 1)], `-`(y[`+`(m, `-`(1))])))), `*`(h)))](images/Example3.2.14 Rev 1_15.gif) |
(8) |
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.2.14 Rev 1_16.gif) |
(9) |
| > |
dydxb:=(y[N-1]-4*y[N]+3*y[N+1])/(2*h); |
![`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[5], `-`(`*`(4, `*`(y[6]))), `*`(3, `*`(y[7]))))), `*`(h)))](images/Example3.2.14 Rev 1_17.gif) |
(10) |
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)))), `*`(`^`(lambda,...](images/Example3.2.14 Rev 1_18.gif) |
(11) |
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.2.14 Rev 1_19.gif) |
(12) |
| > |
Eq[N+1]:=subs(diff(y(x),x)=dydxb,y(x)=y[N+1],bc2); |
![y[7]](images/Example3.2.14 Rev 1_20.gif) |
(13) |
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; |
The additional equation for the eigenvalue is:
| > |
Eqeig:=subs(diff(y(x),x)=dydxf,y(x)=y[0],bc3); |
![`+`(y[0], `-`(1))](images/Example3.2.14 Rev 1_27.gif) |
(15) |
 |
(16) |
The finite difference equations are stored in eqs:
| > |
eqs:=seq(eval(subs(Phi=1,Eq[i])),i=0..N+1),Eqeig; |
The dependent variables are stored in vars:
| > |
vars:=seq(y[i],i=0..N+1),lambda; |
![y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], lambda](images/Example3.2.14 Rev 1_32.gif) |
(18) |
These variables are solved as:
![{y[7] = 0., y[0] = 1.000000000, lambda = -2.687842398, y[2] = .8606034948, y[1] = .9651508737, y[5] = .3314378546, y[6] = .1549393509, y[3] = .7046525028, y[4] = .5205640878}](images/Example3.2.14 Rev 1_33.gif)
![{y[7] = 0., y[0] = 1.000000000, lambda = -2.687842398, y[2] = .8606034948, y[1] = .9651508737, y[5] = .3314378546, y[6] = .1549393509, y[3] = .7046525028, y[4] = .5205640878}](images/Example3.2.14 Rev 1_34.gif) |
(19) |
Since there are multiple solutions, one has to provide the range for the dependent variables. The dependent variable y varies between 0 and 1 and the eigenvalue is solved in the range of 0.4.
| > |
vars:=seq(y[i]=-1..1,i=0..N+1),lambda=0..4; |
![y[0] = -1 .. 1, y[1] = -1 .. 1, y[2] = -1 .. 1, y[3] = -1 .. 1, y[4] = -1 .. 1, y[5] = -1 .. 1, y[6] = -1 .. 1, y[7] = -1 .. 1, lambda = 0 .. 4](images/Example3.2.14 Rev 1_35.gif) |
(20) |
The solution obtained in stored in sol[1] and plotted:
| > |
sol[1]:=fsolve({eqs},{vars}); |
![{y[7] = 0., y[0] = 1.000000000, y[2] = .8606034948, y[1] = .9651508737, y[5] = .3314378546, y[6] = .1549393509, y[3] = .7046525028, y[4] = .5205640878, lambda = 2.687842398}](images/Example3.2.14 Rev 1_36.gif)
![{y[7] = 0., y[0] = 1.000000000, y[2] = .8606034948, y[1] = .9651508737, y[5] = .3314378546, y[6] = .1549393509, y[3] = .7046525028, y[4] = .5205640878, lambda = 2.687842398}](images/Example3.2.14 Rev 1_37.gif) |
(21) |
The first eigenvalue is given by:
 |
(22) |
The first eigenfunction is plotted here:
| > |
plot([seq([i*h,y[i]],i=0..N+1)],thickness=4,axes=boxed,labels=[x,y]); |
| > |
p[1]:=plot([seq([i*h,y[i]],i=0..N+1)],thickness=4,axes=boxed,labels=[x,y]): |
| > |
for i from 0 to N+1 do unassign('y[i]'):od: |
 |
(23) |
The next three eigenvalues are found by changing the range in increments of 4:
| > |
vars:=seq(y[i]=-1..1,i=0..N+1),lambda=l[j-1]+1..l[j-1]+4; |
| > |
sol[j]:=fsolve({eqs},{vars}); |
| > |
p[j]:=plot([seq([i*h,y[i]],i=0..N+1)],thickness=4,title="Figure Exp. 3.2.30.",axes=boxed,labels=[x,y]): |
| > |
for i from 0 to N+1 do unassign('y[i]'):od: |
The first four eigenvalues are:
| > |
print(seq(l[i],i=1..M)); |
 |
(24) |
Even after using N = 30 interior node points we get only two digit accuracy with the exact solution. In addition, we observe more errors for higher eigenvalues than for the lower eigenvalues.
| > |
display({seq(p[i],i=1..M)}); |