Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

NUMERICAL ME'TI-IODS IN ENGINEERING 'l

308 ~b S
~l~
f
,:ill
I

Similarly we have the approximations for the de:rh,ativ


y : ~~¼
·t '
- Ui,j+ l - u.,:,j + O(h) .
~- k ~

= Ui,j -kUi,j-1 + O(k)

_ Ui,j+l - Ui,j-1 + O(k2)


- 2k
_ ui,,i-1 - 2ui,j + Ui,j+l + O(k2)
and Uyy - k2
'• .(~,
Replacing the derivatives in any partial differential e
their corresponding difference approximations (1) to (8), We q~at~o%y
0
finite-difference analogues of the given equation. lain the
11.4. Elliptic equations. The Laplace equation
a
2
2
u a2u
Vu=- + - =0
ax 2 ay2
and the Poisson's equation
a2u a 2u
- 2 + - 2 =f(x,y)
ax ay
y

o._________________
·x
Fig. 11.2
are examples of elliptic partial differential equations. Laplace equat!on
arises in steady-state flow and potential problems. Poisson's equa~~::
arises in fluid mechanics, electricity and magnetism and tor~i
problems. . h~$
The solution of these equations is a function u(x, y) whi~ar.i·
satisfied at every point of a region R subject to certain boun ·
conditions specified on the closed curve C (Fig. 11.2). .~
. ui1ibr1ll
In general, problems concerning steady viscous flow, eq t'1oJlS·
stresses in elastic structures etc ., lead to elliptic type of equa
)
,;.', 7 501,V1'JON OF p ARTIAL DIFFERENTI .
11fl< CJII, AL EQUA110NS 3
1
i· • Solution of Laplace equat· 09
11.v• 2 Ion
au a2u
-2+-=0
ax ay2
.. C nsider a rectangular region R for h' .. .(1)
o . h. . . w Ich u( ).
I Jar)'· Div1~e t is region u~to a network of x,y is known at the
~oP in Fig. 11.3 (assummg that square m.esh of "d
shown . th d . . an exact s b d' s1 eh
J ,s-'ble), R,eplacmg e er1vabves in (1) b th . . u - 1vision of R . '
"'~' Y e1r differe 1s
'· we have nee approxun·
I 1,os, a-
Y·•
b2,s b3,s b4, s ~,5
,5

4 U2, 4 U3, 4
- bs, 4
U4 , 4

3 bs, 3
U2, 3 U3, 3 U4, 3

bs,2
U2, 2 U3, 2 U4, 2

' -
b1, 1 b3, 1 bs, 1 X
Fig. 11.3
1
2 [ui-1 ' J· - 2u i,• J. + Ui+ 1, ·] + -h12 [U.i, 1·- 1 - 2u z,· J· + u z.· J+
· 1l -- 0
h 1
It
U· . _
i, J - 41 [Ui-l, j + Ui+l, j + Ui, j+l + ll-i, j-1] ... (2)

Th·ls sht1w th
I:.
.iverage fitsv
0
Is at the value of u at any interior mesh point is the
t
below. ( _u es at four neighbouring pointsto the left, right, above
[ ih1ted in p·2 is called the standard 5-point formula which is
lg. 11.4.
j
. Sotn.et·llnes a formula similar to (2) is used which is given by

~'fl ~" 1'his hui, J-:.: 1-(u


4 •-1- , j+I + u;+l, j-1 + U;+I, j+I + u,_1,
. .,...1)
.. ... (3)
~'P<f0llr lle1ghb
•t . 8 0 Ws th at the value of u •
· the average of its
• 1s · va1ues a t,
'' \l.rln.tr
our· z, J
i-lllhl ing d;agonal mesh points. (3) is called the d1agona • I
0
~ a.te th an. '-I.
( a) wh 1·~lds represented in Fig. 11.5. Althoug_l1 (3) _1s
· Iess
1 •~in
1
gthe 2 'Yet it serves as a reasonably good approximation for
~ start·o/g values at the mesh points-
NUMERICAL METIIODS IN ENGINEERING
310 AND~
~lb. ~l

· ·+1
U i,J
ui-1 ,J+ 1

''
~ Ir
~ /

'' /
/
> ' ,~:
...
~
. U· .
...
~

-
Ui+ l,j
',, ,u .
/

\ l,j
fl

u i-1, j i,J ,, /
\
fl
,, > .__
\

,, / \
\

U l·- 1,J-
.1
ui,J-1 ui,1
Fig. 11.4 Fig. 11.5 ,,.
Now to find the initial values of u at the interior mesh p;i·
we first use the diagonal five point formula (3) and compute u3,31 ~~lt1,
u 4 .4, u 4 ,2 and u 2 ,2 , in this order. Thus we get,

u3,3 =¾(b1,s + bs,1 + bs,5 + b1,1) ; u2,4 = ~ (b1,5 + u3,3 + b3,5 +bi.a)
u4,4 = ¾(ba,s + bs,a + ba,5 + ua,a) ; u4,2 = ~ (ua,a -i- b5,1 + b3,1 +b5,3)
1
u2,2 = 4 (b1,a + ba,1 + ua,3 + b1,1)
The values at the remaining interior points i.e. u2,3, ua,4, u4,1aI1
ua,2 are computed by the standard five-point formula (2). Thuv
obtain
u2,3 = ¼<b1,a + ua,a + u2,4 + u2,2), ua,4 = ~(u2,4 + u4,4 + b3,5 + u3,3)
u4,3 = ¼<ua,a + bs,a + u4,4 + u4,2), ua,2 = ~(u2,2 + u4,2 + ua,3 + u 3,i) ;
Having found all the nine values of ui j once, their accuracr~
improved by either of the following iterative ~ethods. In ea~h c~s\~'.
method is repeated till the difference between two consecutive iter
becomes negligible. Ofu \
(i) Jacobi's method. Denoting the nth iterative value ·
by u<n>i, j, the iterative formula to solve (2) is
1) 1 ( ) (11) , , 11 I I
(
Un+ . · =-[u(n) . · + (n). · +Un . ·+i+ U 1,;-
u
i, J 4 l-1,J i+l,J i, J . tS~I
. . , . sh polll
It gives improved values of u 1. . at the interior me 1

. ca11e d the point Jacobi's formula . ' 1


1s · u(; 1
.. 1· ~r~~
(ii) Gauss-Seidal method. In this method, the
mula is · 1
(Il l. rl'
u(n+l) . . = !.[u(n+l) . . + (n) . . + .,(n+U . ·+1 + ll i, ~\
i,J 4 i-1 , J u i+l,J rt i,J . the1ll"
5
It u t·1· ·
1 1ses the latest iterative value available and scall
. ts t . 11
pom symme r1ca Y from left to right along sn:ccessive
. roWS · IJt
0
d to c p' '
?bs. Gauss-Seidal method is simple and can '1e adaptehat [eilgt.
1 1t 1·
ca~ a ,one. ts convergence being slow, the working is oolll
e \V ~
J I
'
AL SOLUTION OF PARTIAL DIFFERENTIAL EQUATIONS 311
~£RIC . .
· er be shown that the Gauss-$e1dal scheme converges twice as fast as
howev '
cflll b'' scheme.
J11co isThe accuracy of cal:ula~1ons
.
depends on the mesh-size i.e. smaller the
t the accuracy. But if h 1s too small, it may increase rounding-off errors
• ~' betler 1·ncreases the labour of computation.
8
nda so
Example 11.2. Solve the elliptic equation uxx + uyy = 0 for the
allowing square mesh with boundary values as shown.
fl o 500 1000 · 500 o
C

U1 U2 U3
1000 1000

A U4 U5 u6 B
2000 2000

U7 Us U9
1000
,
1000

D
0 500 0
500 1000
Fig. 11.6
Let ui, u 2 , .. •. •. , u 9 be the values ofu at the interior mesh-points.
Since the boundary values ofu are symmetrical aboutAB,
= Ui, Us =u2, Ug =U3.
U7
Also the values of u being symmetrical about CD.
= u1, Us = U4, Ug = U7.
U3
Thus i:t is sufficient to find the values u1, u2, u4 and u5.
Now we find their initial values in the following order :

U5 = .!. (2000 + 2000 + 1000 + 1000) = 1500 (St.cl. formula)


4

U1 =.!.4 (0 + 1500 + 1000 + 2000) = 1125 (Diag. formula)

u2 = ¼(1125 + 1125 + 1000 + 1500) =1188 (St.cl. formula)

U4 = .!. (2000 + 1500 + 1125 + 1125) = 1438 (St.cl. formula)


4
We carry out the iteration process using the formulae :
u1(n+l) ~ .!. [1000 + uin) + 500 + uin>]
4
u2(n+l) = .!. [u/n+l) + u1 (n) + 1000 + U5(n)]
4

·~
NUMERICAL METI-10 DS IN E~ ~GINEERING AN \
312 D Seit:,'. !
(n.+1) - .!. [2000 + uin) + u l (n+ l) + U l (n)]
U4 - 4
(n+l) - .!. [u (n+l) + uin) + uin+l) + uin)]
U5 - 4 4
First iteration : (put n = O)
(1) = .!. (1000 + 1188 + 500 + 1438) == 1032
u.1 4

u
2
(1) - .!. (1032 + 1125 + 1000 + 1500) = 1164
-4
uil): ¼(2000 + 1500 + 1032 + 1125) = 1414

ui 1) = ¼(1414 + 1438 + 1164 + 1188) = 1301


Second iteration: (put n = 1)
2
u.1( ) = ¼(1000 + 1164 + 500 + 1414) = 1020

uz< 2) = ¼(1020 + 1032 + 1000 + 1301) = 1088


ui2> = ¼(2000 + 1301 + 1020 + 1032) = 1338
ui > = ¼(1338 + 1414 + 1088 + 1164) = 1251
2

Third iteration :
3
u1 ( ) = ¼(1000 + 1088 + 500 + 1338) = 982
ui3) = ¼(982 + 1020 + 1000 + 1251) = 1063
ui~) = ¼(2000 + 1251 + 982 + 1020) = 1313
3
= ¼(1313 + 1338 + 1063 + 1088) = 1201
U.5( )
Fourth iteration :
4
u.1( ) = ¼(1000 + 1063 + 500 + 1313) = 969
ui = ¼(969 + 982 + 1000 + 1201) = 1038
4
)
4
ui = ¼(2000 + 1201 + 969 + 982) = 1288
)
4
u5< ) = ¼(1288 + 1313 + 1038 + 1063) = 1176
Fifth iteration :
(5) 1
Ul = 4 (1000 + 1038 + 500 + 1288) = 957
(5) 1
u2 = 4 (957 + 969 + 1000 + 1176) ~ 1026
u (5) _ 1 ( _
4
- 4
20 00 + 1176 + 957 + 969) = 127 6
U 5{S)::: ¼(1276 + 1288 + 1026 + 1038) ::: ll 57
r cAL SOLUTION OF PARTIAL DIFFERENTJALEQUATIONs
ffi16Jtl 313
~[ (6 ) 951 (B) ·
Siwilarly' u 1 7 = , u2 7 = 1016, ui6) 1266, u5(G) = =1146
u/ ) = 946, u2< ) = 1011 u 4<7 ) - 1260 (7)
8 ==1138
u1( ) = 943, ui8)= 1007,' ui > =- 1257,,U5
u 8 (8) =
1134 5
u1(9) =941, ui9) =1005, ui9) = 1255, u5(9) = 1131
u1(lO) =940, > =1003, ui10
10> = 1253, ui
(10) = 1129 u
1
u 1(ll) = 939, uP >= 1002, uP 1>:: 1252, u:(11) = 1128
12 2
u1 < >-= 939, uP >-= 1001, uP
2>"' 1251, ui 12) = 1126

. Thus there is negligible difference between the values obtained


,111 the 11th and 12th iterations.
Hence u 1 = 939, u2 = 1001, U4 = 1251 and u = 1126.
5
Example 11.3. Given the values of u(x, y) on the boundary of the
quare in the Fig. 211 . 7, evaluate the function u(x, y) satisfying the
~lace equation V u = 0 at the pivotal points of this figure by
(a) Jacobi's method. (Madras B.E., 1998)
(b) Gauss-Seidal method. . (/J,fadurai B.E., 1989 S)
To get the initial values of u1, u2, u3, u4, we assume that u4 = 0.
Then
U1 1
= (1000 + 0 + 1000 + 2000) = 1000 (Diag. formula)
U2 = !4 (1000 + 500 + 1000 + 0) = 625 (Std. formula)
U3 = !4 (2000 + 0 + 1000 + 500) = 875 (Std. formula)
U4 =! 4
(875 + 0 + 625 + 0) = 375 (Std. formula)

lOOQ 1000 1000 1000


UJ U2
2000 500

U3 U4
2000 0
"•
I I

( 0
1000 0
500
f
Fig. 11.7 . . g Jacobi's for-
tnhl ( ) We carr-u out the successive
. 1·t er at10ns, us1n
\{ a.e :ct J .

( (n)]
ul n+t) :::: ! [2000 + u2(n) + 1000 + U ;~
4
J
NUMERICAL METIIODS IN ENGINEERIN
G i\ND
314 Sc11, .

(n+l) _ 1 [u 1(n) + 500 + 1000 + uin)]


u2 - 4 '
(n+l) - ! [2000 + u4(n) + Ut(n) + 500]
U3 - 4
(n+l) - l [u3(n) + 0 + uin) + O]
U4 - 4
First iteration : (put n = O)
u (1) = ~ (2000 + 625 + 1000 + 875) = 1125
1

u (1) = ¼(1000 + 500 + 1000 + 375) = 719


2

u (l) = ¼(2000 + 375 + 1000 + 500) = 969


3

ui1) = ¼(875 + 0 + 625 + 0) = 375


Second iteration : (put n = 1)
u (2) = !. (2000 + 719 + 1000 + 969) = 1172
1 4
u 2(2) =¼(1125 + 500 + 1000 + 375) = 750
U3( 2) = .!_ (2000 + 375 + 1125 + 500) = 1000
4

ui2) = ¼(969 + 0 + 719 + 0) = 422


Similarly
u1<3 )= 1188, ui3 ) = 774, u3(3 ) = 1024, ui3) = 438
u1(4) = 1200, u2( 4) = 782, u3(4 ) = 1032, ui ) = 450
4

u1 (5 ) = ui5) = 454
1204, u 2<5 ) = 788, u 3<5 ) = 1038,
u1 (6 ) = 1206.5, u2( 6 ) = 790, ui6 ) = 1040, ui ) = 456.5
6

u1< 7) = 1208, ui 7) = 791, u3(7) = 1041, ui7) = 458


8 58
and u1(S) = 1208, u 2(8 ) = 791.5, u 3 (8 ) = 1041.5, ui ) == 4 ·
th
Thus there is no significant difference between the seven ar
eighth iteration values.
Hence u1 = 1208, u 2 = 792, u 3 = 1042 and u4 = 458. .Seid: 1
(b) We carry out the successive iterations, using Gauss
formulae
Ut(n+l) = ¼[2000 + U2(n) + 1000 + U3(n)]

u2(n+l) = ¼lu1(n+l) + 500 + 1000 + uin)l


U3(n+l) = ¼[2000 + uin) + u. (n+l) + 500]
1
uin+l) = ¼[u3(n+l) + 0 + u2(n+l) + O]
soLUTION OF p ARTIAL DIFFERENTIAL EQU ,
coJCA-L A'I10NS
1
~U~di, ' 315
first iteration : (put n = 0)
u/1) = ¼(2000 + 625 + 1000 + 875) == 1125
u}l) = ¼(1125 + 500 + 1000 + 375)::: 750

US(l) = ¼(2000 + 375 + 1125 + 500) ::: 1000

uil) = ¼(1000 + 0 + 750 + 0) :::::438

Second iteration : (put n = 1)


2
zt1( ) = ¼(2000 + 750 + 1000 + 1000)::::: 1188

ui2) = ¼(1188 + 500 + 1000 + 438) == 782


2
U3( ) = ¼(2000 + 438 + 1188 + 500)::::: 1032

ui 2
)= ¼(1032 + 0 + 782 + 0) ::::: 454
Similarly u1 (3 ) = 1204, ui3 ) ::::: 789, u3(3)::::: 1040, ui3 ) == 458
u1 (4 )::::; 1207, u2( 4 ) = 791, u3(4) == 1041, ui 4) = 458
and 5
u1 ( ) = 1208, ui5 ) = 791.5, u3(5)::::: 1041.5, ui5 ) == 458.25
Thus there is no significant difference between the fourth and
fifth iteration values.
Hence u1 = 1208, u 2 = 792, u 3 = 1042 and u4 = 458.
, 11.6. Solution of Poisson's equation
2
a2
a
-- +- u
u = f(x,y) ... (1)
2
ax 2 ay
Its method of solution is similar to that of the Laplace equation.
Here the standard 5-point formula for ( 1) takes the form
ui- I,J + ui+l,J + ui,j+I + Ui,J- 1 -4ui, J = h2f(ih, jh) .. .(2)
. By applying (2) at each interior niesh point, we arrive at linear
eGquations in the nodal values u· ·. These equations can be solved by
auss s •a l, j
- ei al method (p. ) .

of tl Ohs. The error in replacing u by the 11m e


·:ffierenc e approx~mation
c.: ·t d 1
. · . is
le ord O(h2 X\: • 1 · . by the d1fferen~e
a.ppr . er ) . Since k = h the error m rep acmg U yy . d
Po1s:'C1;riation is also of the orde~ O(h 2) . Hence the error in solvmg2 Laplace an
on s equ t· h d · f the order O(h ) ·
a ions by finite difference met O 15 0

the sc
E)(r .
aJnple 11.4 . Solve the equation \7 u - -
2 - 10(x2 +
~ l . .1
,l
+ 10) Ol'C'T
lUare · h • , · } - O on the bounc ary mu.
tn~,'> h l . ll..!lt sides x = O = y, x == 3 =-Y wlt t ll - E z997)
e1u:r1-J
6 (, i. :::: 1. lr:>E I997 ·S PatelB . J •, ~ -
(Ma.ngalore J . !.i. , ' ·
AL METHODS JN t NGlN EERING AND \
316
NUMERIC
. ~1~, ~.
Sc:1r:

Here h == 1. y
. The standard 5_-po~n t 0 0
. I ·for the given equ ation 1s
· 0
\i
formu a . + u. · ·- 1
. f U · 1 . + Ui,;+1 l, J
lli- 1,J I+ ,J ·2 ·2 + 10)
-
41,·z,•J. = - lO(i +J
l,
.
( ) UJ
... l OL - - - - - i t - - - -
For u1 (i = l,j ==2), (i) 0 I

o·ives O + u2 + 0 +u 3 - 4u 1
0
U3
= - 10(1 + 4 + 10) 0 L------+----f--U4
I •
0
i.e. u1 = .!.4(u2 + u3 + 150)
. .. (ii)
For u2 (i = 2,j = 2), (i) gives
0 0 0
u 2 = ¾(u 1 + u 4 + 180)
Fig. 11.8
.. .(iii)
For u 3(i = 1,j = 1), we have
U3 = .!_ (u1
4
+ U4 + 120) •.. (iv)
For u 4 (i = 2,j = 1), we have
u4 = ¾(u2 + u3 + 150) ... (u)
Equations(ii) and{v) showthatu 4 = u 1. Thus the above equations
reduce to
1
U1 = 4 (u2 + U3 + 150)
1
U2 = 2 (u2 + 90)
1
U3 = 2 (ul + 60)
Now let us solve these equations by Gauss-Seidal iteration
method.
st
Pir iteration : Starting from the approximations u2 = 0, u3 =O.
we obtain u (1) = _
1 37 5
Then u2(l) == ½(37.5 + 90) === 64
(1) 1
U2 :: 2 (37.5 + 60) :::= 49
Second iteration .
(2) 1
Ut ::: 4 (64 + 49 + 150) ::= 66
u (2) _ 1
2 - 2 (66 + 90) ::: 78
(2) . 1
U3 ::: 2 (66 + 60) ::: 63
I
I

)
, -, ., soi-imoN OF PARTIAL DIFFERENTIAL EOUAn
r ~lijJ)UCI"-' 0 NS
317

I
Third iteration :
! (78 + 63 + 150) ~ 73
u 1(3 ) =

~ ui = ! (73 + 90) ~ 82
3
)

( uP> = ½<1a + 60> "' 67


J Fourth iteration :
l u 1(4) = ! (82 + 67 + 150) ~ 75
ui 4) = ½(75 + 90) = 82 .5
4
ll3( ) = ~ (75 + 60) = 67.5
Fifth iteration :
u/ 5 ) = ¾(82 .5 + 67.5 + 150) = 75
5
u2( ) = ½(75 + 90) = 82 .5
U3(S) = ½(75 + 90) = 67.5

Since these values are the same as those of fourth iteration we


have u1 = 75, u2 = 82 .5, U3 = 67.5 and u 4 = 75. ~ '
Problems.
1 1. Solve the equation u= + Uyy = 0 for the square mesh with the
boundary values as sho-wn in Fig. 11.9. (Madras B.E., 1997 S)
1

1 2 0 11.1 17 19. 7 18,.6

1,~- - - - 4 - - - ~- - - ~ 4
oL--+--1-- 1 - -, 21

0 L--l---+- - t - ~ 17

0 12.1 12.8 9
/, 4 5 8.7
I

F' Fig. 11 .10


2 . ig. 11.9 the Laplace's equa tion
. .
v72u • Find the values of u(x, y) satisfying · 'tl b undary values
::: 0 t th . , ,
as h ' a ., e pivotal pomts of a square reb. '
cri on w1 1 o
S OWl) in .
Fig. 11.10 . I . ·e
3 . = 0 fo r t s qu a1
le
tr'tesh Wit Solve the e lliptic e qu a tion . fl :,._.-: _+_ "{1 .11 . Iter ate u nt il th e
h bou n dary values as s h own 111 Fig .
I
NUMERICAL METIIODS IN ENGINEER:INo AN
318 Dsc1t,k
. dif-r. ce between successive values at any point . r
maximum ieren ls le
83t~
0.005. i~

1 60 60
0 0

40 r-----t---_,

0 L----1----+---+---, 2

O...___--=1~0---2.1....
0_ _
0 0 1 30
Fig. 11.11 Fig. 11.12
4. Using central-difference approximation solve V 2u =Oat the
nodal points of the square grid of Fig. 11.12 using the boundary valuei
indicated. (Madras B.E., 1991 81
5. Solve llxx +llyy = 0 for the square mesh with boundaryvalue1
as shown in Fig. 11.13. Iterate till the mesh values are correct to two
decimal places. (Coimbatore B.E., 1985 Pn
1 2 2 2

1 1 -
Or-----+-----4--- ~2

0 u3
- 0
u4
Or----t------1---~ 2
0 UJ u2 - 0

0 0 0 0
1 0
Fig. 11.13 F'g
1 .
11 · 14 . f
Jll 0
F. 6. Solve the Laplace's equation u + u = 0 in the donlfl '
ig. ll.l4 by (a) Jacobi's method, (b) Gau;:-Seidal method. . ofthe
F" 7. Solve the Laplace's equation V2u = 0 in the dorna.E1Jl lg89i
1g. 11 .15. (S G ·arat B. :1 -, 85b
8 S l · ll} e J11 1
. . o v~ the Poisson's equation v2u = 8x2y2 for the squa.r_, .
0f Fig. 11.16 with u(x , y) = 0 on the boundary and mesh le~gt.i-~
.1989)
(Madurai B- l
soLUTION OF PARTIAL DIFFERENTIAL EQUA'TIONS 319
,.~6~1cAL
l ~l"
y ,~

1
1' 1 4 9 16
~

Ul U2 Ul
14
~
U7 ua llg

U2 U3 U2 -
12 .....
0- U4 U5 u6 X
U1 U2 U1
0 10
Uj U2 U3

0 0.5 4 .5 8
2

You might also like