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]  

Typesetting:-mrow(Typesetting:-mo(+Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mn(Typesetting:-mrow(Typesetting:-mi(                                       (3.2.52) 

with the boundary conditions: 

                                                              Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo(Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mn(                                                       (3.2.53) 

and  

 

                                                                Typesetting:-mrow(Typesetting:-mi(=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: 

                                                               Typesetting:-mrow(Typesetting:-mi(=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: 

> restart:
 

> with(plots):
 

> N:=6;
 

6 (1)
 

> L:=1;
 

1 (2)
 

> eq:=diff(y(x),x$2)+1/x*diff(y(x),x)+lambda^2*(1-x^2)*y(x);
 

`+`(diff(diff(y(x), x), x), `/`(`*`(diff(y(x), x)), `*`(x)), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(`^`(x, 2)))), `*`(y(x))))) (3)
 

 

> bc1:=diff(y(x),x);
 

diff(y(x), x) (4)
 

> bc2:=y(x)-0;
 

y(x) (5)
 

The additional boundary condition is entered here: 

> bc3:=y(x)-1;
 

`+`(y(x), `-`(1)) (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))) (7)
 

> dydx:=(y[m+1]-y[m-1])/2/h;
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(y[`+`(m, 1)], `-`(y[`+`(m, `-`(1))])))), `*`(h))) (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))) (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))) (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,... (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))) (12)
 

> Eq[N+1]:=subs(diff(y(x),x)=dydxb,y(x)=y[N+1],bc2);
 

y[7] (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;
 

 

 

 

 

 

`+`(`/`(`*`(`+`(y[2], `-`(`*`(2, `*`(y[1]))), y[0])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(y[2], `-`(y[0])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(`^`(h, 2)))), `*`(y[1]))))
`+`(`/`(`*`(`+`(y[3], `-`(`*`(2, `*`(y[2]))), y[1])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 4), `*`(`+`(y[3], `-`(y[1])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(4, `*`(`^`(h, 2))))), `*`(...
`+`(`/`(`*`(`+`(y[4], `-`(`*`(2, `*`(y[3]))), y[2])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 6), `*`(`+`(y[4], `-`(y[2])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(9, `*`(`^`(h, 2))))), `*`(...
`+`(`/`(`*`(`+`(y[5], `-`(`*`(2, `*`(y[4]))), y[3])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 8), `*`(`+`(y[5], `-`(y[3])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(16, `*`(`^`(h, 2))))), `*`...
`+`(`/`(`*`(`+`(y[6], `-`(`*`(2, `*`(y[5]))), y[4])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 10), `*`(`+`(y[6], `-`(y[4])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(25, `*`(`^`(h, 2))))), `*...
`+`(`/`(`*`(`+`(y[7], `-`(`*`(2, `*`(y[6]))), y[5])), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 12), `*`(`+`(y[7], `-`(y[5])))), `*`(`^`(h, 2))), `*`(`^`(lambda, 2), `*`(`+`(1, `-`(`*`(36, `*`(`^`(h, 2))))), `*... (14)
 

The additional equation for the eigenvalue is: 

> Eqeig:=subs(diff(y(x),x)=dydxf,y(x)=y[0],bc3);
 

`+`(y[0], `-`(1)) (15)
 

> h:=L/(N+1);
 

`/`(1, 7) (16)
 

The finite difference equations are stored in eqs: 

> eqs:=seq(eval(subs(Phi=1,Eq[i])),i=0..N+1),Eqeig;
 

`+`(`-`(`*`(`/`(7, 2), `*`(y[2]))), `*`(14, `*`(y[1])), `-`(`*`(`/`(21, 2), `*`(y[0])))), `+`(`*`(`/`(147, 2), `*`(y[2])), `-`(`*`(98, `*`(y[1]))), `*`(`/`(49, 2), `*`(y[0])), `*`(`/`(48, 49), `*`(`^`...
`+`(`-`(`*`(`/`(7, 2), `*`(y[2]))), `*`(14, `*`(y[1])), `-`(`*`(`/`(21, 2), `*`(y[0])))), `+`(`*`(`/`(147, 2), `*`(y[2])), `-`(`*`(98, `*`(y[1]))), `*`(`/`(49, 2), `*`(y[0])), `*`(`/`(48, 49), `*`(`^`...
`+`(`-`(`*`(`/`(7, 2), `*`(y[2]))), `*`(14, `*`(y[1])), `-`(`*`(`/`(21, 2), `*`(y[0])))), `+`(`*`(`/`(147, 2), `*`(y[2])), `-`(`*`(98, `*`(y[1]))), `*`(`/`(49, 2), `*`(y[0])), `*`(`/`(48, 49), `*`(`^`...
(17)
 

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 (18)
 

These variables are solved as: 

> fsolve({eqs},{vars});
 

{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}
{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}
(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 (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}
{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}
(21)
 

> assign(sol[1]):
 

The first eigenvalue is given by: 

> l[1]:=lambda;
 

2.687842398 (22)
 

The first eigenfunction is plotted here: 

> plot([seq([i*h,y[i]],i=0..N+1)],thickness=4,axes=boxed,labels=[x,y]);
 

Plot_2d
 

> 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:
 

> unassign('lambda'):
 

> M:=4;
 

4 (23)
 

The next three eigenvalues are found by changing the range in increments of 4: 

> for j from 2 to M do
 

> vars:=seq(y[i]=-1..1,i=0..N+1),lambda=l[j-1]+1..l[j-1]+4;
 

> sol[j]:=fsolve({eqs},{vars});
 

> assign(sol[j]):
 

> l[j]:=lambda;
 

> 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:
 

> unassign('lambda'):
 

> od:
 

The first four eigenvalues are: 

> print(seq(l[i],i=1..M));
 

2.687842398, 6.519412138, 10.06247204, 12.97831858 (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)});
 

Plot_2d
 

>