THE NUMERICAL SOLUTION OF ORDINARY AND PARTIAL
DIFFERENTIAL EQUATIONS USING THE KELLER BOX METHOD
D. Andrew S. Rees
Department of Mechanical Engineering, University of Bath,
Claverton Down, Bath BA2 7AY, U.K.
1. Introduction
In this paper we will introduce the so{called Keller{box method which is used for solving sets of parabolic partial dierential equations. First devised by Keller & Cebeci [1] and subsequently popularised by Cebeci & Bradshaw [2], it has become a frequently{used method for solving boundary layer equations in uid mechanics.
The main aim of this paper is pedagogical. To this end the full Keller box method is approached in stages beginning with the standard Newton{Raphson method solving the root of one algebraic equation. This is extended to two and more variables, and subsequently to ordinary dierential equations. Finally, as if an extra do loop were to be added in, we
obtain the Keller box method for solving parabolic systems of partial dierential equations. We also present brie y how the method may be extended to solve ordinary dierential eigenvalue problems.
2. The Newton{Raphson iteration scheme
This is a well-known and frequently{used method for solving nonlinear algebraic equations. Undergraduate study usually concentrates on how to nd the root of one algebraic equation, and, unfortunately, that is usually the furthest extent of knowledge of the method. The aim of this section is to present the method and its generalisation toN equations inN unknown
values.
The usual example used is to nd the square root of 2. If we denote dierent iterates by a numerical subscript where x1 is the rst iterate (i.e. the initial guess), then
p
2 may be found by applying the following formula to successive iterates:
x n+1= x2 n+ 2 2x n : (1)
In this particular example convergence to either p
2 occurs for all possible initial guesses, but this is not always true; see Burden & Faires [3] for proof that convergence is guaranteed only if the initial guess is suciently close to a solution.
In general, one would wish to solve an equation of the form,f(x) = 0. The Newton{Raphson
method may be derived by rst writingx=x n+
nwhere x
nis the current iterate and
n
Truncation of the series after two terms yields a linear equation for n may be solved to obtain, n ', f(x n) f 0( x n) : (3)
If f(x) = 0 were a linear equation then Eq. (3) would be exact, but truncation errors are
usually nonzero, and therefore we dene the next iterate according to
x n+1 = x n+ n = x n , f(x n) f 0( x n) : (4)
Settingf(x) =x2,2 (or evenf(x) = 100,50x2orf(x) = 2,x2) into Eq. (4) will recover
the formula given in Eq. (1). The following table shows how iterates progress when using
x1= 100 as the initial guess.
n x n n 1 100:000000 49:990000 2 50:010000 24:985000 3 25:025000 12:472539 4 12:552461 6:196565 5 6:355896 3:020614 6 3:335282 1:367816 7 1:967466 0:475465 8 1:492001 0:075760 9 1:416241 0:002026 10 1:414215 0:000001 11 1:414214 0:000000
Table 1. Successive iterations to solve x2,2 = 0 using (1) or (4)
Initially convergence is slow with
ndecreasing by a factor of 2 per iteration. This is linear
convergence with n+1
/
n. When
nis suciently small, convergence becomes quadratic
and n+1
/2
n. It is important to note that quadratic convergence is the rule when j
n jis
small and this occurs when the desired root is a single root. When the root is double, then convergence remains linear. However, for the type of problem forming the main topic of this paper, the desired solutions usually correspond to single roots. Convergence is deemed to have occurred whenj
n
jis suciently small.
Suppose that we have to nd the roots of two functions of two variables:
f(x;y) = 0; g(x;y) = 0: (5)
The same Taylor series approach may be used with x = x n+ n and y = y n+ n and therefore, 0 = f(x n+ n ;y n+ n) = f(x n ;y n) + @f @x (x n ;y n) n+ @f @y (x n ;y n) n+ :::; (6a) 0 = g(x n+ n ;y n+ n) = g(x n ;y n) + @g @x (x n ;y n) n+ @g @y (x n ;y n) n+ :::: (6b)
Truncation after two terms yields,
from which we can nd nand
n by Gaussian Elimination, and form x n+1= x n+ n ; y n+1= y n+ n : (8) When both j n j and j n
j are suciently small then convergence is declared. A frivolous
example is given by,
f(x;y) =y,6x(x
2
,1); g(x;y) =x,6y(y
2
,1); (9)
the roots of which are given by the followingtable and the intersections of the curves depicted in Figure 1. x y 0:000000 0:000000 1:080123 1:080123 ,1:080123 ,1:080123 0:912871 ,0:912871 ,0:912871 0:912871 0:985599 ,0:169102 ,0:985599 0:169102 0:169102 ,0:985599 ,0:169102 0:985599
Table 2. The solutions of Eqs. (9)
- 3 - 2 - 1 0 1 2 3 - 3 - 2 - 1 0 1 2 3 y x
Further development of this theory to an arbitrary number of equations requires a change of notation. Therefore we will solve,
f1(x1;x2;:::x N) = 0 ; f2(x1;x2;:::x N) = 0 ; ... f N( x1;x2;:::x N) = 0 : (10) If we denote thenth iterate of theith variable byx
(n)
i , and its associated error by
(n) i , then
the Newton{Raphson iteration scheme becomes
0 B B B B B B B @ @f1 @x1 @f1 @x2 @f1 @x N @f2 @x1 @f2 @x2 @f2 @x N ... ... ... ... @f N @x1 @f N @x2 @f N @x N 1 C C C C C C C A 0 B B B @ (n) 1 (n) 2 ... (n) N 1 C C C A =, 0 B B @ f1 f2 ... f N 1 C C A ; (11)
where the matrix and the right hand side vector are evaluated using the values ofx
(n) i for i= 1;:::;N.
A suitable computer program to solve Eqs. (10) has a very straightforward structure, given ready access to a Gaussian Elimination subroutine. It involves an iteration loop and a convergence test. There is, of course, no guarantee that every choice of initial guess will yield a convergent sequence of iterates, and it may not be easy to nd all the solutions of the equations.
A slightly less ecient code would attempt to evaluate all the derivatives in (11) using nite dierences, but an advantage is that such a method would avoid having to encode possibly complicated functions. In such a scheme a subroutine which evaluates all the functions given in Eq. (10) would be called N + 1 times; the rst would yield the right hand side vector,
while the rest would be used to evaluate the terms in the matrix via the formula,
@f i @x j ' f i( x (n) 1 ;:::;x (n) j,1 ;x (n) j + ;x (n) j+1 ;:::;x (n) N ) ,f i( x (n) 1 ;:::;x (n) j,1 ;x (n) j ;x (n) j+1 ;:::;x (n) N ) (12) where is a suitably small number (perhaps 10
,5) and is not necessarily positive.
In extreme cases it may be necessary to use a relaxation factor, !, to under{relax the
corrections and thereby to avoid possible iterative divergence. Such a formula would be (x1;:::;x N) (n+1)= ( x1;:::;x N) (n)+ !(1;:::; N) (n) : (13)
The Newton{Raphson method corresponds to ! = 1, but under{relaxation corresponds to
0<!<1. The Fortran program on the next but one page implements the above algorithm,
but note that the Gaussian Elimination subroutine has been omitted.
In this code, the notation used mirrors as much as possible the theory given above. The
rhs2array is used as a temporary array when implementing the numerical dierentiation
procedure given in Eq. (12). The code is general except that theparameterstatements and
thefunctionsubroutine would need to be changed to solve a dierent problem. A typical
Initial guesses.... ===> 20 -10 1 6.65647172 20.000000 -10.000000 2 4.43255371 13.343528 -6.681522 3 2.94739888 8.910975 -4.476681 4 1.95349277 5.963576 -3.018119 5 1.28523062 4.010083 -2.063116 6 0.83144471 2.724852 -1.453684 7 0.51747531 1.893408 -1.091518 8 0.29449165 1.375932 -0.921271 9 0.13349179 1.081441 -0.894826 10 0.03301886 0.947949 -0.909329 11 0.00205123 0.914930 -0.912662 12 0.00000782 0.912879 -0.912870 13 0.00000000 0.912871 -0.912871 0.912871 -0.912871
Here an initial guess of x1 = 20 and x2 = ,10 was given. The four columns printed
correspond, respectively, to the iteration number (n), max(
(n) 1 ; (n) 2 ), x (n) 1 and x (n) 2 .
3. Ordinary Dierential Equations arising in Boundary{Layer ows
In this section we shall apply the above method to the solution of ordinary dierential equations, and, in particular, those which arise in the study of boundary{layer ows. The Navier{Stokes equations are well{known and, for the ow of an isothermal, incompressible Newtonian uid, may be written in the form,
@u @x +@v @y +@w @z = 0; (14) @u @t +u @u @x +v @u @y +w @u @z =, 1 @p @x + @2u @x2 +@2u @y2 +@2u @z2 ; (15) @v @t +u @v @x +v @v @y +w @v @z =, 1 @p @y + @2v @x2 +@2v @y2 +@2v @z2 ; (16) @w @t +u @w @x +v @w @y +w @w @z =, 1 @p @z + @2w @x2 +@2w @y2 +@2w @z2 ; (17)
where all the terms have their usual meanings. We will consider the steady two{dimensional boundary{layer ow over a symmetrical wedge of semi-angle,, but rst we need to
nondi-mensionalise the equations. After setting w = 0 and all t and z{derivatives to zero, we
introduce the scalings, (u;v) =U0(u ;v ) ; (x;y) =d(x ;y ) ; p=U20p : (18)
The Navier{Stokes equations reduce to
implicit real*8(a-h,o-z) parameter(n=2)
real*8 a(n,n),error(n),rhs(n),x(n),rhs2(n) tol=1.d-8 ! RUNTIME PARAMETERS delta=1.d-5 ! ================== maxits=20
omega=1.d0
print*,'Initial guesses....' read*,(x(i),i=1,n)
do 10 its=1,maxits ! ITERATION LOOP ! ============== call function(x,rhs) do 20 j=1,n ! EVALUATES MATRIX x(j)=x(j)+delta ! ================ call function(x,rhs2) x(j)=x(j)-delta do 30 i=1,n a(i,j)=(rhs2(i)-rhs(i))/delta 30 continue 20 continue
call gausse(a,error,rhs) ! FINDS CORRECTION ! ================ errormax=0.d0 do 40 i=1,n if(dabs(error(i)).gt.errormax)errormax=dabs(error(i)) 40 continue write(6,100)its,errormax,(x(i),i=1,n)
do 50 i=1,n ! UPDATE x-VALUES
x(i)=x(i)-omega*error(i) ! =============== 50 continue ! CONVERGENCE TEST if(errormax.lt.tol)then ! ================ write(6,110)(x(i),i=1,n) stop end if 10 continue 100 format(1x,i3,1x,f12.8,3x,10(1x,f10.6)) 110 format(10(1x,f10.6)) print*,'Not converged!' stop end c================================================================= subroutine function(x,rhs) ! DEFINES EQUATIONS
implicit real*8(a-h,o-z) ! ================= parameter(n=2) real*8 x(n),rhs(n) rhs(1)=x(1)-6.d0*x(2)*(x(2)**2-1.d0) rhs(2)=x(2)-6.d0*x(1)*(x(1)**2-1.d0) return end c=================================================================
u @v @x +v @v @y +w @v @z =, @p @y +Re ,1 @2v @x2 +@2v @y2 ; (21)
where Re=U0d= is the Reynolds number,d is a suitable lengthscale and U0 is a typical
velocity scale. In Eqs. (19) to (21) we have omitted the asterisk superscripts which were introduced in Eq. (18).
As the ow is two{dimensional and steady we may introduce the streamfunction, , accord-ing to u= @ @y ; v=, @ @x ; (22)
into Eqs. (19) to (21) to obtain
Re ,1 r4 = @ @y @r2 @x , @ @x @r2 @y : (23)
We consider the steady ow at very high Reynolds numbers and therefore, initially, we may setRe
,1= 0 in Eq. (23). The equation which results is solved by the solutions of
r2 = 0
and therefore it is relatively straightforward to nd solutions. For a symmetrical wedge conguration it may be shown that the slip velocity along the wedge is proportional to
x
=( ,), where
xis the coordinate measured along the surface of the wedge beginning at
the apex. Clearly this inviscid solution doesn't satisfy the no{slip condition at the surface of the wedge, and, given that we have neglected the highest derivative terms in nding the inviscid solution, the mathematical problem forms a singular perturbation analysis with a thin layer placed between the inviscid solution and the wedge | a boundary layer.
From the point of view of the boundary layer, at large distances from the wedge surface the inviscid slip velocity is attained, i.e. that u!U(x) asy!1, whereU(x) denotes the slip
velocity. In this limit Eq. (21) reduces to
U @U @x ', @p @x
given thatReis asymptotically large. Therefore the external ow has an associated pressure
gradient (which, in fact, is entirely absent for ow over a at plate, for which U = 1). We
may rescale pusing
@p @x ! @p @x ,U @U @x ;
and therefore equ. (20) becomes
u @u @x ,U @U @x +v @u @y =, @p @x +Re ,1 @2u @x2 +@2u @y2 ; (24)
It is easy to show that both v and y have asymptotic magnitude O(Re
,1=2) when Re is
asymptotically large, and therefore we introduce the boundary{layer scalings,
u=u; v=Re ,1=2 v; p=Re ,1 p; x=x; y=Re ,1=2 y; (25)
into Eqs. (19), (24) and (21):
u @v @x +v @v @y =, @p @y +Re ,1 @2v @x2 +@2v @y2 ; (28)
where the overbars have been omitted for clarity. If we formally setRe!1we obtain the
boundary layer equations,
@u @x +@v @y = 0; (29) u @u @x ,U @U @x +v @u @y =@2u @y2 ; (30) u @v @x +v @v @y =, @p @y +@2v @y2 : (31)
In general we solve Eqs. (29) and (30) subject to the boundary conditions,
u=v= 0 on y= 0; and u!U(x) as y!1: (32)
Equation (31) may now be ignored since it serves only to determine the pressure eld in terms of the velocities.
On introduction of the streamfunction, , into Eqs. (29) and (30), we obtain
@3 @y3 =@ @y @2 @x@y , @ @x @2 @y2 ,U @U @x : (33)
Now we assume that the inviscid ow over the wedge has, for simplicity, the slip velocity
U =x
. The nonlinear partial dierential Eq. (33) admits what is known as a self{similar
solution: let =x(1+ )=2 f() where =y =x(1 ,)=2 ; (34)
in Eq. (33) and therefore f satises the equation f 000+1 2(1 +)ff 00+ (1,f 0 f 0) = 0 : (35)
When= 0 then= 0 and this yields the familiar Blasius ow over a at plate. Heimenz
ow, or stagnation point ow, is obtained when = =2, or = 1. We set = 0 in the
numerical analysis of the next section.
4. A direct method for solving nonlinear ODEs
We shall consider how to solve the following ODE,
f 000+1
2ff 00= 0
; (36a)
which is subject to the boundary conditions,
f(0) = 0; f
0(0) = 0 and f
0
!1 as !1: (36b)
The solution of Eq. (36) gives the streamfunction for self{similar Blasius boundary ow over a at plate. The method we shall use to solve (36) uses the following sequence of steps.
4.1. Reduce the governing equation to rst order form.
This we shall do by dening the three variables,a, bandc, as follows.
Let a=f; b=f
0 and
c=f 00
Hence Eq. (36a) and its boundary conditions (36b) reduce to a 0 ,b=0 b 0 ,c=0 c 0+1 2ac=0 a(0) =0 b(0) =0 b(1),1 =0 (37)
4.2. Dene a set of grid points.
Let the grid points be1,2, :::,
N, where
1= 0, N =
max<1, and the intermediate
steps do not necessarilyhave the same length.
4.3. Discretise the 1st order system using nite dierences
The nite dierence scheme we shall use will be centred exactly halfway between the grid points. Such a central dierence scheme gives us second order accuracy.
Let h i =
i+1
,
i dene the steplength corresponding to the
ith interval. Thus we have N,1 intervals, as shown in the following depiction:
h1 h2 h3 h N,3 h N,2 h N,1 1 2 3 4 N,3 N,2 N,1 N
Further, let us usea
ito denote the numerical approximation to a(
i). Therefore the central
dierence approximation toa 0( ) at = i+1=2= i+1+ i 2 is a 0 a i+1 ,a i h i :
Now a,b and c are dened atthe gridpoints rather than halfway between them; therefore
we shall use a i+1=2 a i+1+ a i 2 to represent aat=
i+1=2. Hence Eqs. (37) transform to
(a i+1 ,a i) h i , (b i+1+ b i) 2 =0 (b i+1 ,b i) h i , (c i+1+ c i) 2 =0 (c i+1 ,c i) h i +18(a i+1+ a i)( c i+1+ c i) = 0 : (38a;b;c)
These dierence equations apply fori= 1;2;:::;N,1 and hence we have (3N,3) equations.
But as we also have 3N unknown values the three boundary conditions are to be used to
make up the decit in the number of equations:
a1= 0; b1= 0; b N
,1 = 0:
(38d)
4.4. Solve Eqs. (38) using Newton{Raphson iteration.
To do this, leta i= a (n) i + aidene the latest guess (i.e. the
nth iterate) and its exact error.
Given similar expressions for bothbandc we can substitute for these into Eqs. (38). As in
the standard Newton{Raphson technique, we neglect all appearances of powers of greater
than the rst power, and hence Eqs. (38) become: (a i+1 ,a i) h i , (b i+1+ b i) 2 =, h( a i+1 ,a i) h i , (b i+1+ b i) 2 i(n) ; (39a) (b i+1 ,b i) h i , (c i+1+ c i) 2 =, h( b i+1 ,b i) h i , (c i+1+ c i) 2 i(n) ; (39b) (c i+1 ,c i) h i +18(a i+1+ a i)( c i+1+ c i) + 1 8(a i+1+ a i)( c i+1+ c i) = , h( c i+1 ,c i) h i +18(a i+1+ a i)( c i+1+ c i) i(n) : (39c)
The three boundary conditions, (38b), become
a1=,a (n) 1 ; b1=,b (n) 1 ; b N = 1 ,b (n) N : (39d)
4.5. Arrange the dierence equations in matrix/vector notation.
The above matrix now falls into a block tridiagonal structure where the individual submatrix blocks are 33 matrices; this may be seen more readily if the above system is rewritten for
an arbitrary number of gridpoints:
0 B B B B @ B1 C1 A2 B2 C2 ... ... ... A N,1 B N,1 C N,1 A N C N 1 C C C C A 0 B B B B @ 1 2 ... N,1 N 1 C C C C A =, 0 B B B B @ R1 R2 ... R N,1 R N 1 C C C C A (4:6) where B1= 0 @ 1 0 0 0 1 0 ,1 h1 ,1 2 0 1 A ; B N = 0 @ 0 1 h N ,12 1 8(c N + c N,1) 0 1 8(a N + a N,1) + 1 h N 0 1 0 1 A ; and A j= 0 @ 0 , 1 hj ,1 , 1 2 1 8(c j+ c j,1) 0 1 8(a j+ a j,1) , 1 hj ,1 0 0 0 1 A ; for j= 2;:::;N; B j = 0 B @ 0 1 hj ,1 ,1 2 1 8(c j+ c j,1) 0 1 8(a j+ a j,1) + 1 hj ,1 ,1 h j ,12 0 1 C A ; for j= 2;:::;N,1; C j= 0 @ 0 0 0 0 0 01 h j ,12 0 1 A ; for j= 1;:::;N,1:
The other terms in the iteration equations are
R1= 0 @ a1 b1 (a2,a1)=h1,(b2+b1)=2 1 A ; R N = 0 @ (b N ,b N,1) =h N,1 ,(c N+ c N,1) =2 (c N ,c N,1) =h N,1+ 1 8(a N + a N,1)( c N+ c N,1) b N ,1 1 A ; R j= 0 @ (b j ,b j,1) =h j,1 ,(c j+ c j,1) =2 (c j ,c j,1) =h j,1+ 1 8(a j+ a j,1)( c j+ c j,1) (a j+1 ,a j) =h j ,(b j+1+ b j) =2 1 A for j= 2;:::;N,1; and i= 0 @ a j b j c j 1 A for j= 1;:::;N:
In the above matrix the leading block on the diagonal,B1, is in fact singular, and hence the
Block Tridiagonal Matrix Algorithm will not work on the iteration scheme as it is written above. A simple way to avoid this diculty is to interchange all the rows representing the
aandc equations. If we do this, then we obtain the following to replace Eqs. (40):
0 B B B B B B @ BC1 1 0 0 BC2 0 1 0 c1 1 8(c2+c1) 0 1 8(a2+a1), 1 h1 1 8(c2+c1) 0 1 8(a2+a1) + 1 h1 b1 0 ,1 h 1 ,12 0 1 h 1 ,12 a1 ,1 h 1 ,12 0 1 h 1 ,12 0 BC3 0 1 0 1 C C C C C C A (n) 0 B B B B B B B B @ a1 b1 c1 a2 b2 c2 1 C C C C C C C C A =, 0 B B B B B B B B @ a1 b1 (c2,c1)=h1+1 8(a2+a1)(c2+c1) (b2,b1)=h1,(c2+c1)=2 (a2,a1)=h1,(b2+b1)=2 b3,1 1 C C C C C C C C A (n) :
Having rearranged these rows, the leading and nal diagonal blocks are now
B1 0 @ 1 0 0 0 1 0 1 8(c2+c1) 0 1 8(a2+a1), 1 h1 1 A ; B N = 0 @ 0 1 hN,1 ,12 1 hN,1 ,12 0 0 1 0 1 A ;
are both nonsingular. For this method, it is alwaysessential to check the diagonal matrix blocks and to rearrange the rows of the matrix until all the diagonal blocks are nonsingular. The only constraint in this process is that the iteration matrix must retain its block tridi-agonal structure. The following table shows how the unknown value of f
00(0) varies with dierent step{sizes: max h N f 00(0) 10 0:40 26 ,0:444469 10 0:20 51 ,0:444045 10 0:10 101 ,0:443939 10 0:05 201 ,0:443913 5 0:20 26 ,0:454049 10 0:20 51 ,0:444045 15 0:20 76 ,0:443894 20 0:20 101 ,0:443891 25 0:20 126 ,0:443891 20 0:05 401 ,0:443757
Table 3. Summary of the solutions tof 000+1
2ff 00= 0.
steplength. The values off
00(0) given conrm that the method is second order accurate, and
that when the steplength is less than approximately 0:05, then about 5 signicant gures
of accuracy are attained. The second set of data is an investigation of how largemaxmust
be in order to capture accurately the exponential decay of the solution asbecomes large.
This indicates thatmax= 20 is suciently large.
5. Parameter sweeps
The code just described may be extended very easily by the addition of an extra \do loop"
to obtain solutions with ease at dierent parameter values. This will be illustrated by solving Eq. (35) for a range of values of. Clearly it is necessary to provide an initial iterate for
the solution presented above, for which = 0, but when a parameter sweep is performed
one may use the previous solution as the initial guess for the next one; this involves only a small amount of encoding, and has the advantage that the initial guess is very accurate when changes in the governing parameter are small.
Such a parameter sweep was undertaken with Eq. (35) where was varied. In all cases max = 20 andN = 401 were taken. The numerical values off
00(0) rounded to 6 decimal
places (though not accurate to 6 decimal places) are given below. #=iterations f 00(0) 6 0:0 ,0:443757 4 0:1 ,0:523537 4 0:2 ,0:594000 4 0:3 ,0:657659 4 0:4 ,0:716097 4 0:5 ,0:770376 4 0:6 ,0:821250 4 0:7 ,0:869272 4 0:8 ,0:914864 4 0:9 ,0:958353 4 1:0 ,1:000000 Table 4. Values off 00(0) as a function of .
6. A nonsimilar boundary layer ow
Earlier, we found that the boundary layer equations for Blasius ow over a at plate are
u x+ v y =0 (41 a) uu x+ v u y = u y y (41 b)
after suitable nondimensionalisation and scaling. Recall that bothvandywere scaled using Re
,1=2. The standard at plate boundary layer solution is given by u= y ; v=, x where satises y y y= y xy , y y x :
Here has a solution of the form =x1
=2
andf() satises f 000+1 2ff 00 = 0 ; f(0) = 0; f 0(0) = 0 ; and f 0 !1 as !1:
Given this similarity solution we can show that
u=f 0( ) and v= 1 2x ,1=2 , f 0( ),f() :
We shall now introduce blowing/suction from the surface by modifying the boundary con-ditions. The usual no{slip condition is that u= 0 and v = 0 on an impermeable surface.
Here we shall takev=F(x) ony= 0 whereF(x) =A(x,1)(2,x) when 1<x<2 and is
zero otherwise, and Ais the blowing amplitude. U ,!
Blowing/suction
x
x= 0 x= 1 x= 2
u= 0 v=F(x)
Numerically we shall take a dierent approach from before by using what is called a \prim-itive variables" formulation. That is, we shall solve for u and v directly. It is important
to note that these solutions, though formally of second order accuracy, are usually more accurate than those obtained using the streamfunction formulation for a given steplength. However, streamline plots are very useful and therefore we will also compute these. Hence we will solve the following set of equations,
u x+ v y=0 (42 a) u y y ,uu x ,v u y=0 (42 b) y ,u=0: (42c)
The corresponding boundary conditions are
u= 0; v=F(x) and =, Z x 0 F()d=G(x) on y= 0; (43a) and u,!1 as y,!1: (43b)
Given the form ofv for the usual Blasius boundary layer, letv=x ,1=2
V in order to avoid
innite values atx= 0. It is also convenient to set =x1 =2
so thatis nonzero atx= 0.
Guided by the Blasius similarity solution we introduce the new independent variables,
@ @x = @ @x @ @ + @ @x @ @ =, 2 @ @ + @ @ :
Equations (42) now become,
V ,12 u + u = 0 ; (44a) u + 1 2 uu ,Vu ,uu = 0 ; (44b) ,u= 0: (44c)
As Eqs. (44) only involve single{derivatives, this system consitutes an initial value problem
and therefore it is necessary to specify initial conditions at = 0. This does not turn out
to be dicult because when we set = 0 in Eqs. (44) we are left with a set of ordinary
dierential equations in: V ,12 u = 0 ; (45a) u + 1 2 uu ,Vu ; (45b) ,u= 0; (45c)
these are solved by the Blasius solution,u=f 0(
),V = ( f 0
,f)=2 and=f().
Discretisation
At = 0 the system reduces to a set of ODEs whose numerical solution is obtained in the
same way as before.
When>0 we use a set of grid points in both the anddirections:
1 2 3 4 1 2 3 4 1 2 3 1 2 3
The Keller box method is used to solve Eqs. (44). It is very similar to the one we used for solving ODEs in that the equations are reduced to rst order form in, are discretised half{
way between thegrid points, and are linearised in order to use Newton{Raphson iteration.
Marching in the {direction is also similar to the parameter sweep described in section 5,
except that {derivatives now appear. It is also similar to the Crank{Nicholson method
in that discretisation is made half{way between the grid points. (Note that, although
Thus our discretisation is centred in the middle of a box:
Given a typical variable,a, say, the various quantities are approximated as follows, a i+1=2;j+1=2 ' 14(a ij+ a i;j+1+ a i+1:j+ a i+1:j+1) ; (46a) a j i+1=2;j+1=2 ' 1 2 j (a i;j+1 ,a ij+ a i+1:j+1 ,a i+1;j) ; (46b) a j i+1=2;j+1=2 ' 1 2 i (a i+1;j ,a ij+ a i+1:j+1 ,a i;j+1) : (46c)
Now reduce Eqs. (44) to rst order form in . Leta=u,b=u , c=V andd=. Hence we obtain a ,b= 0 (47a) b + 1 2 ab,cb,aa = 0 (47 b) c ,12 b+a = 0 (47 c) d ,a= 0 (47d)
The discretisation of such a set of equations is very lengthy if we write every thing down using expressions such as those given by (46). If it is understood that all terms are evaluated at i+ 1=2 and j+ 1=2 using (46), and thata,betc. are corrections toa, betc., then the
Newton{Raphson method to solve Eqs. (47) may be written as
a ,b=,[a ,b]( n) (48 a) b + 1 2(a( n) b+b( n) a),(c( n) b+b( n) c),(a( n) a + a (n) a) =,[b + 1 2 ab,cb,aa ] (n) (48 b) c ,1 2 b+a = ,[c ,1 2 b+a ] (n) (48 c) d ,a=,[d ,a]( n) (48 d)
Given that we know all the values at = i then a,a and a are equivalent to a' 14(a i+1:j+ a i+1:j+1) ; (49a) a ' 1 2 j (a i+1:j+1 ,a i+1;j) ; (49b) a ' 1 2 i (a i+1;j+ a i+1:j+1) : (49c)
a j1 ;j+1=2 ' 1 j (a1 ;j+1 ,a1 j) : (50b)
The Keller{box method involves the following steps. First dene a sutiable grid in both the and directions. Then provide the code with an adequate initial guess for the = 0
prole. Use the Newton{Raphson scheme to nd the= 0 prole. Then march on to larger
values of using Newton{Raphson, iterating to convergence at each step.
As a rst guess at ordering the equations for the present example we simply place them in the order of presentation. Hence the Newton{Raphson system becomes
0 B B B B B B B B B B B B B B B B B B B @ 1 C C C C C C C C C C C C C C C C C C C A 0 B B B B B B B B B B B B B B B B B B B B B B B @ a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 1 C C C C C C C C C C C C C C C C C C C C C C C A =, 0 B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B @ a1 i+1 c1 i+1 ,F( i+1) d1 i+1 ,G( i+1) (a ,b) 3=2 i+1=2 (b + 1 2 ab,cb,aa ) 3=2 i+1=2 (c ,12 b+a ) 3=2 i+1=2 (d ,a) 3=2 i+1=2 (a ,b) 5=2 i+1=2 (b + 1 2 ab,cb,aa ) 5=2 i+1=2 (c ,12 b+a ) 5=2 i+1=2 (d ,a) 5=2 i+1=2 a3 i+1 ,1 1 C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C A
wheredenotes an entry which is denitely nonzero andan entry which may be zero. In
this case the rst and last diagonal blocks are nonsingular and therefore we do not need to interchange rows.
In Figure 2 we see that when suction occurs (A<0), then the surface shear stress increases.
The reason is that suction causes the boundary layer to become thinner, and hence variations in the cross{stream direction take place more rapidly compared with when A= 0. When A>0 uid is ejected into the boundary{layer, which increases its thickness relatively, and
hence the shear stress decreases with increasingA.
WhenA takes values larger that a little more than 3, the solution procedure breaks down
for ow separation takes place. From my experience, it seems that separation caused by an external agency, such as surface blowing or a deccelerated main stream, is of a fundamentally dierent nature from that which arises naturally, such as free convection from a horizontal wavy surface. In the former cases no progress may be made into the reverse ow region, and the point of separation is approached with an innitely increasing slope. In the latter cases, small, relatively weak recirculating regions may be traversed with little or no diculty, although numerical conditioning is often poor; see Rees & Pop [4].
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 0.0 0.2 0.4 0.6 0.8 1.0
u ( = 0) A=,3 A=,1 A= 0 A= 1 A= 3
Figure 2. Variation of the shear stress for dierent values ofAas a function of.
this gure the gap between the streamlines disappearing into or emerging from the suc-tion/blowing strip are displayed at much closer intervals than are those corresponding to the rest of the oweld.
7. Final Comments
The Keller box method has been in existence for just over a quarter of a century and has been used in the form described above in hundreds of research papers. But it is capable of being generalised in many dierent ways. For example it is not necessary to insist that the governing equations are reduced to rst order form in. The use of second order form (again
with central dierences, but with a constant steplength to keep the tridiagonal structure of the iteration matrix unaltered) increases substantially the numerical conditioning of the method, although derived quantities such as shear stresses and rates of heat transfer may be less accurate.
Given the similaritybetween the Keller box and Crank{Nicolson methods, it is not surprising that the use of too large a streamwise steplength will cause pointwise oscillations in the ow. There is a wide variation in the susceptibility to this numerical diculty. It is remedied by using a Backward Dierence version of the Keller box method. Discretisation then takes place at
i+1, rather than at
i+1=2. The backward dierence version also has an improved
A= 3
A= 0
A=,3
Figure 3. Streamlines for the three cases,A= 3,A= 0 andA=,3.
column: 0 B B B B B B B @ N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 1 C C C C C C C A where N
denotes a submatrix block. A modied version of the block tridiagonal matrix algorithm must now be implemented. Similar iteration matrices were used by Hsu & Wilks [6] who considered a free surface boundary layer ow, and by Lewis et al. [7] who considered convection in a tall box. These two latter problems were equivalent to partial dierential eigenvalue problems. We note that, in practice, it is often better to keep the equations in second order form. It is also possible to avoid using the above structure by dening a variable (call it) which identical to the eigenvalue. Then the standard Keller box method
may be used using the extra equation = 0.
partial dierential equations were solved have used this technique; see Rees [5,8]. In these cases the sizes of the systems under consideration made it almost impossible to encode the iteration matrix either correctly or within a reasonable amount of time.
8. References
[1] Keller, H.B. & Cebeci, T. Accurate numerical methods for boundary layer ows 1. Two dimensional ows Proc. Int. Conf. Numerical Methods in Fluid Dynamics, Lecture Notes in Physics, Springer{New York (1971).
[2] Cebeci, T. and Bradshaw, P., Physical and Computational Aspects of Convective Heat Transfer, Springer, New York (1984).
[3] Burden, R.R. & Faires, J.D., Numerical Analysis (6th Edition), Brooks/Cole Publishing Company (1997).
[4] Rees, D.A.S. & Pop, I., Free convection induced by a horizontal wavy surface in a porous medium Fluid Dynamics Research
14
151{166 (1994).[5] Rees, D.A.S., Free convective boundary layer ow from a heated surface in a layered porous medium Toapp ear in Journal of Porous Media (1998).
[6] Hsu, J.J. & Wilks, G., Mixed{convection laminar{lm condensation on a semiinnite vertical plate J. Fluid Mechanics
300
207{229 (1995).[7] Lewis, S., Rees, D.A.S. & Bassom, A.P., High wavenumber convection in tall porous containers heated from below Quarterly Journal of Mechanics and Applied Mathematics