Module - 5.1
Module - 5.1
To find ℎ?
𝑏−𝑎 1−0 1
We know thatℎ = = = 4 = 0.25
𝑛 4
Solution:
d2 y
Given thatdx2 + 𝑥 2 𝑦 = 0 ⇒ 𝑦 ′′ = −𝑥 2 𝑦 ; 𝑦(0) = 0, 𝑦(1) = 1,
𝑎 = 0 & 𝑏 = 1 , ℎ = 0.25
Here,𝑥0 = 0; 𝑥1 = 0.25; 𝑥2 = 0.5; 𝑥3 = 0.75; 𝑥4 = 1
𝑦0 = 0; 𝑦1 =? ; 𝑦2 =? ; 𝑦3 =? ; 𝑦4 = 1;
d2 y
From given equationdx2 + 𝑥 2 𝑦 = 0
𝑦 ′′ = −𝑥 2 𝑦 … … … . . [𝟏]
Apply finite difference scheme to [1], we get
𝑦𝑖 ′′ = −𝑥𝑖 2 𝑦𝑖 where𝑖 = 1,2,3
Using 𝑦𝑖 ′′ formula in the above equation, we get
𝑦𝑖−1 − 2𝑦𝑖 + 𝑦𝑖+1
= −𝑥𝑖 2 𝑦𝑖 … … … . [𝟐], 𝑖 = 1,2,3
ℎ2
𝑎 = 1&𝑏 =2
We know that
Here,𝑥0 = 1; 𝑥1 = 1.25; 𝑥2 = 1.5; 𝑥3 = 1.75; 𝑥4 = 2
𝑦0 = 1; 𝑦1 =? ; 𝑦2 =? ; 𝑦3 =? ; 𝑦4 = 2;
′′
From given equationx𝑦 + 𝑦 = 0
𝑦
𝑦 ′′ = − … … … . . [1]
𝑥
Apply finite difference scheme to [1], we get
𝒚
𝒚𝒊 ′′ = − 𝒙𝒊 where𝑖 = 1,2,3
𝒊
′′
Using 𝑦𝑖 formula in the above equation, we get
𝑦𝑖−1 − 2𝑦𝑖 + 𝑦𝑖+1 𝑦𝑖
= − … … … . [𝟐], 𝑖 = 1,2,3
ℎ2 𝑥𝑖
Put 𝑖 = 1 in [2] we get
𝑦0 − 2𝑦1 + 𝑦2 𝑦1
=−
0.0625 𝑥1
𝑦1
⇒ (1 − 2𝑦1 + 𝑦2 ) = 0.0625 [− ]
1.25
i.e.,1 + 𝑦2 − 2𝑦1 = −0.05𝑦1
𝑦2 − 2𝑦1 + 0.05𝑦1 = −1
𝑦2 − 1.95𝑦1 = −1 … … … … … [𝟑]
In this chapter, we will discuss the finite difference solution of one dimensional heat flow equation by explicit and implicit methods.
Explicit Method (Bender-Schmidt Method):
𝝏𝒖 𝝏𝟐 𝒖 𝝏𝟐 𝒖 𝝏𝒖
Consider the one-dimensional heat equation 𝝏𝒕 = 𝜶𝟐 𝝏𝒙𝟐 . (Or) 𝝏𝒙𝟐 = 𝒂 𝝏𝒕
𝟏 𝒂𝒉𝟐 𝟏
In order to apply Bender-Schmidt recurrence relation, For 𝝀 = ,we must choose 𝒌 = for a given 𝒖𝒊,𝒋+𝟏 = [𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 ] ∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝟐 𝟐
Physical interpretation
As the B.C’S; 𝑢(0, 𝑡) = 𝑢(4, 𝑡) = 0, both the edges, temperature 𝑢(𝑥, 𝑡) = 0, if means both ends are cooled. The initial temperature 𝑢(𝑥, 0) = 𝑓(𝑥) = 𝑥(4 − 𝑥).
With respect to the central axis, the temperature symmetrically distributed.
Example 1:Solve𝒖𝒙𝒙 = 𝟐𝒖𝒕 when 𝒖(𝟎, 𝒕) = 𝟎, 𝒖(𝟒, 𝒕) = 𝟎 and with initial condition𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙) upto t = 5 sec, assuming∆𝒙 = 𝒉 = 𝟏.
Solution:Given 𝑢𝑥𝑥 = 2𝑢𝑡 and ∆𝑥 = ℎ = 1.
𝒂𝒉𝟐 2(12 )
Here a=2, h=1. Then choose 𝑘 = = ⇒ 𝑘 = 1.
𝟐 2
𝑲 𝟏
Put 𝑘 = 1in 𝜆 = 𝒂𝒉𝟐 , we get𝝀 = 𝟐
By initial condition
𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), we have
𝑢(1,0) = 1(4 − 1) = 3
𝑢(2,0) = 2(4 − 2) = 4
𝑢(3,0) = 3(4 − 3) = 3
By boundary condition 𝑢(0, 𝑡) = 0 and𝑢(4, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 𝑡 = 5 𝑠𝑒𝑐 are tabulated as follows:
𝒉=𝟏
i
0 1 2 3 4
j
𝒌=𝟏 0 0 3 4 3 0
1 0 2 3 2 0
2 0 1.5 2 1.5 0
3 0 1 1.5 1 0
4 0 1.75 1 0.75 0
5 0 0.5 0.75 0.5 0
𝝏𝒖 𝝏𝟐 𝒖 𝟏
Example2: Solve the equation = subject to the conditions𝒖(𝟎, 𝒕) = 𝒖(𝟓, 𝒕) = 𝟎and 𝒖(𝒙, 𝟎) = 𝒙𝟐 (𝟐𝟓 − 𝒙𝟐 ). Taking h=1 and k= , tabulate the values of uuptot=4sec.
𝝏𝒕 𝝏𝒙𝟐 𝟐
𝟏
Solution:Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, h=1& 𝑘 = 𝟐 .
𝟏
𝟏 𝑲 𝟐 𝟏
Put 𝑘 = 𝟐in 𝜆 = 𝒂𝒉𝟐 , we get𝝀 = =𝟐
𝟏
By initial condition
𝒖(𝒙, 𝟎) = 𝒙𝟐 (𝟐𝟓 − 𝒙𝟐 ),we have
𝑢(1,0) = 24; 𝑢(2,0) = 84; 𝑢(3,0) = 144; 𝑢(4,0) = 144
By boundary condition𝑢(0, 𝑡) = 0and 𝑢(5, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 𝑡 = 4𝑠𝑒𝑐 are tabulated as follows:
𝒉=𝟏
i
0 1 2 3 4 5
j
0 0 24 84 144 144 0
0.5 0 42 84 144 72 0
1 0 42 78 78 57 0
1.5 0 39 60 67.5 39 0
𝟏
𝒌= 2 0 30 53.25 49.5 33.75 0
𝟐
2.5 0 26.625 39.75 43.5 24.75 0
3 0 19.875 35.0625 32.25 21.75 0
3.5 0 17.5312 26.0625 28.4062 16.125 0
4 0 13.0312 22.9688 21.0938 14.2031 0
Example3:
𝝏𝒖 𝝏𝟐 𝒖
Solve the equation 𝝏𝒕 = 𝝏𝒙𝟐 ,𝟎 < 𝑥 < 1, 𝑡 > 0, 𝑢(𝒙, 𝟎) = 𝟏𝟎𝟎(𝒙 − 𝒙𝟐 ),
By initial condition
𝒖(𝒙, 𝟎) = 𝟏𝟎𝟎(𝒙 − 𝒙𝟐 ),we have
1 1 1 2 1 3
𝑢 ( , 0) = 100 ( − ( ) ) = 18.75; 𝑢 ( , 0) = 25; 𝑢 ( , 0) = 18.75
4 4 4 2 4
By boundary condition 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 0
By Bender-Schmidt recurrence relation
𝟏
𝒖𝒊,𝒋+𝟏 = [𝒖 + 𝒖𝒊+𝟏,𝒋 ]∀𝒋 = 𝟎, 𝟏, 𝟐 … ..
𝟐 𝒊−𝟏,𝒋
The values of u up to 4 time steps are tabulated as follows:
𝟏
𝒉=
𝟒
i 𝟏 𝟐 𝟑 𝟒
0 =𝟏
j 𝟒 𝟒 𝟒 𝟒
0 0 18.75 25 18.75 0
1 0 12.5 18.75 12.5 0
2 0 9.375 12.5 9.375 0
3 0 6.25 9.375 6.25 0
4 0 4.6875 6.25 4.6875 0
Formula :
𝟏
If 𝝀 ≠ 𝟐 , then Bender-Schmidt finite difference explicit scheme is given by
Solution:
𝟏
Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, h=1 &= 𝟒 .
𝟏
𝟏 𝟏
Put 𝑘 = in 𝜆 = 𝟒 , we get𝝀 =
𝟒 𝟏 𝟒
𝟏
Here,𝝀 ≠ 𝟐, we use following Bender-Schemidt relation
𝒉=𝟏
i 0 1 2 3 4
j
0 0 3 4 3 0
𝟏
𝒌= 𝟎. 𝟐𝟓 0 2.5 3.5 2.5 0
𝟒
𝟎. 𝟓 0 2.125 3 2.125 0
𝟎. 𝟕𝟓 0 1.8125 2.5625 1.8125 0
𝟏 0 1.5469 2.1875 1.5469 0
Example 2:
𝝏𝟐 𝒖 𝝏𝒖
Solve the equation 𝝏𝒙𝟐 = 𝝏𝒕
, 𝒖(𝟎, 𝒕) = 𝒖(𝟒, 𝒕) = 𝟎, 𝑢(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), assuming 𝒉 = 𝟏 and𝒌 = 𝟏. Find the values u upto 𝒕 = 𝟒sec by using
Bender-Schmidt formula.
Solution :
Given 𝑢𝑥𝑥 = 𝑢𝑡 Here a=1, ℎ = 1&𝑘 = 𝟏 .
𝒌
Put 𝑘 = 𝟏in 𝜆 = , we get𝝀 = 𝟏
𝒂𝒉𝟐
𝟏
Here, 𝝀 ≠ 𝟐, we use following Bender-Schemidt relation
Bender-Schmidt formula.
𝝏𝒖 𝝏𝟐 𝒖
CRANK - NICHOLSON (IMPLICIT) METHOD: (𝝏𝒕 = 𝒂𝟐 𝝏𝒙𝟐 )
E
D
Scheme
𝑢𝑖−1,𝑗 𝑢𝑖+1,𝑗
B A C
Problem : 1Using Crank-Nicholson’s method solve 𝒖𝒙𝒙 = 𝟏𝟔𝒖𝒕 𝟎 < 𝒙 < 1, 𝒕 > 0 given 𝒖(𝒙, 𝟎) = 𝟎, 𝒖(𝟎, 𝒕) = 𝟎 and 𝒖(𝟏, 𝒕) = 𝟏𝟎𝟎𝒕, Compute 𝒖 for one step in 𝒕 direction
𝟏𝑢 𝑢𝑖,𝑗+1 𝑢𝑖+1,𝑗+1
taking 𝒉 = 𝟒 𝑖−1,𝑗+1
x increasing
𝑖
0 0.25 0.5 0.75 1
𝑗
t
0 0 0 0 0 0
1 0 𝑢1 𝑢2 𝑢3 100
1 1
𝑢1 = (0 + 0 + 0 + 𝑢2 ) ∴ 𝑢1 = 𝑢2 … … … … … … (2)
4 4
1 1
𝑢2 = 4 (0 + 0 + 𝑢1 + 𝑢3 ) ∴ 𝑢2 = 4 (𝑢1 + 𝑢3 ) … … … (3)
1 1
𝑢3 = 4 (0 + 0 + 𝑢2 + 100) ∴ 𝑢3 = 4 (𝑢2 + 100) … … . . (4)
Using the value 𝑢2 = 7.1429 in (2) & (3) we get 𝑢1 = 1.7857, 𝑢3 = 26.7857
The values are
Problem : 2
x direction
i
0 0.25 0.5 0.75 1
j
0 0 0 0 0 0
t
1 1
0 𝑢1 𝑢2 𝑢3
16 16
2 2
0 𝑢4 𝑢5 𝑢6
16 16
Solving we get,
𝒖𝟒 = 𝟎. 𝟎𝟎𝟓𝟗𝟏𝟐𝟓 𝒖𝟓 = 𝟎. 𝟎𝟏𝟗𝟏𝟓
𝒖𝟔 = 𝟎. 𝟎𝟓𝟐𝟕𝟖𝟕𝟓
Problem for Practice:
1. Solve by Crank-Nicolson’s implicit method, 𝑢𝑡 = 𝑢𝑥𝑥 , 0 < 𝑥 < 1, 𝑡 > 0
𝑢(𝑥, 0) = 100(𝑥 − 𝑥 2 ), 𝑢(0, 𝑡) = 0and𝑢(1, 𝑡) = 0. Compute 𝑢 for one time step with ℎ = 0.25
ANS: 𝑢1 = 𝑢3 = 9.82, 𝑢2 = 14.29
2. Using Crank-Nicolson method, solve 𝑢𝑥𝑥 = 𝑢𝑡 subject 𝑡𝑜 𝑢(𝑥, 0) = 0,
1 1
𝑢(0, 𝑡) = 0 and (1, 𝑡) = 16𝑡 , taking ℎ = 4 and k= 8 for one time step.
ℎ
Equation (1) is called an Explicit scheme or Explicit formula to solve the wave equation.Choose𝑘 = 𝑎
Problem: 1
Solve numerically 𝟒𝒖𝒙𝒙 = 𝒖𝒕𝒕 with the boundary conditions 𝒖(𝟎, 𝒕) = 𝟎, 𝒖(𝟒, 𝒕) = 𝟎 and the initial conditions 𝒖𝒕 (𝒙, 𝟎) = 𝟎 𝒂𝒏𝒅 𝒖(𝒙, 𝟎) = 𝒙(𝟒 − 𝒙), 𝐭𝐚𝐤𝐢𝐧𝐠 𝐡 =
𝟏. 𝐂𝐨𝐦𝐩𝐮𝐭𝐞 𝐮 𝐮𝐩𝐭𝐨 𝟒 𝐬𝐞𝐜𝐬.
Solution :
h 1
Given h = 1, a2 = 4 a = 2, k = a = 2
𝒙
0 1 2 3 4
𝒕
0 0 3 4 3 0
0.5 0 2 3 2 0
1 0 0 0 0 0
1.5 0 -2 -3 -2 0
2 0 -3 -4 -3 0
2.5 0 -2 -3 -2 0
3 0 0 0 0 0
3.5 0 2 3 2 0
4 0 3 4 3 0
Problem: 2 Solve𝟐𝟓𝒖𝒙𝒙 − 𝒖𝒕𝒕 = 𝟎 for ‘u’ at the pivotal points, given 𝒖(𝟎, 𝒕) = 𝒖(𝟓, 𝒕) = 𝟎𝒖𝒕 (𝒙, 𝟎) = 𝟎 𝒂𝒏𝒅 𝒖(𝒙, 𝟎) = 𝒙 𝒇𝒐𝒓
𝟎 ≤ 𝒙 ≤ 𝟐. 𝟓; = 𝟏𝟎 − 𝟐𝒙 𝒇𝒐𝒓 𝟐. 𝟓 ≤ 𝒙 ≤ 𝟓for one half period of vibration.
ℎ 1
Solution :Given h = 1, 𝑎2 = 25 ∴ a = 5, 𝑘 = 𝑎 = 5
2𝑙 2×5
Period of vibration = 𝑎 = 5
= 2 𝑠𝑒𝑐𝑜𝑛𝑑𝑠. Half period =1 second
Solution :
Here, the two ends are not fixed.
∴ 𝑥 = 1is a free end with displacement not equal to zero.
ℎ 0.25
Given h = 0.25, 𝑎2 = 1 ∴ a = 1, 𝑘 = = = 0.25
𝑎 1
𝒙
0 0.25 0.5 0.75 1
𝒕
0 0 0 0 0 0
0.25 0 0 0 0 70.7106
0.5 0 0 0 70.7106 100
0.75 0 0 70.7106 100 70.7106
1.0 0 70.7106 100 70.7106 0
LAPLACE EQUATION
𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solution of Laplace equation 𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝟎[𝐄𝐥𝐥𝐢𝐩𝐭𝐢𝐜𝐭𝐲𝐩𝐞]
𝒖𝒊−𝟏,𝒋 𝒖𝒊,𝒋
𝒖𝒊+𝟏,𝒋
𝒖𝒊,𝒋−𝟏
𝒖𝒊−𝟏,𝒋+𝟏 𝒖𝒊+𝟏,𝒋+𝟏
𝒖𝒊,𝒋
𝒖𝒊−𝟏,𝒋−𝟏 𝒖𝒊+𝟏,𝒋−𝟏
𝝏𝟐 𝒖 𝝏𝟐 𝒖
Example 1: Solve𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝟎 by Liemann’s method, at the nine mesh points of the square given below. The values of u at the boundary are specified in the figure.
0 u4 u5 u6 21.0
0 u7 u8 u9 17.0
0 9.0
8.7 12.1 12.6
Solution:
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢
Using SFPF
1
𝑢5 = [21.0 + 17.0 + 0 + 12.1] = 12.5
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 12.5 + 0 + 17.0] = 7.4
4
1
𝑢3 = [12.5 + 18.6 + 17 + 21] = 17.3
4
1
𝑢7 = [0 + 12.5 + 0 + 12.1] = 6.2
4
1
𝑢9 = [12.5 + 9 + 12.1 + 21.0] = 13.7
4
We useSFPEto get the other values of 𝒖
1
𝑢2 = [17 + 12.5 + 7.4 + 17.3] = 13.6
4
1
𝑢4 = [7.4 + 6.2 + 0 + 12.5] = 6.5
4
1
𝑢6 = [12.5 + 17.3 + 21 + 13.7] = 16.1
4
1
𝑢8 = [12.5 + 12.1 + 6.2 + 13.7] = 11.1
4
Gauss-Seidal iterative scheme
1
𝑢1 = 4 [0 + 𝑢2 + 𝑢4 + 11.1];
1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 17.0]
4
1
𝑢3 = [𝑢2 + 𝑢6 + 21.9 + 19.7]
4
1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]
4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
1
𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 21.0]
4
1
𝑢7 = [0 + 𝑢4 + 𝑢8 + 8.7]
4
1
𝑢8 = [𝑢5 + 𝑢7 + 𝑢8 + 12.1]
4
1
𝑢9 = [𝑢6 + 𝑢8 + 17.0 + 12.8]
4
The iteration values are tabulated as follows:
Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 7.4 13.6 17.3 6.5 12.5 16.1 6.2 11.1 13.7
1 7.8 13.7 17.9 6.6 11.9 16.1 6.6 11.1 14.3
2 7.9 13.7 17.9 6.6 11.9 16.3 6.6 11.2 14.3
3 7.9 13.7 17.9 6.6 11.9 16.3 6.6 11.2 14.3
Hence the solution is
𝒖𝟏 = 𝟕. 𝟗, 𝒖𝟐 = 𝟏𝟑. 𝟕, 𝒖𝟑 = 𝟏𝟕. 𝟗, 𝒖𝟒 = 𝟔. 𝟔, 𝒖𝟓 = 𝟏𝟏. 𝟗, 𝒖𝟔 = 𝟏𝟔. 𝟑, 𝒖𝟕 = 𝟔. 𝟔,
, 𝒖𝟖 = 𝟏𝟏. 𝟐, 𝒂𝒏𝒅𝒖𝟗 = 𝟕. 𝟗
Example 2:
Solve 𝒖𝒙𝒙 + 𝒖𝒚𝒚 = 𝟎 over the square mesh of side 4 units satisfying the following boundary conditions
(𝒊)𝒖(𝟎, 𝒚) = 𝟎𝒇𝒐𝒓𝟎 ≤ 𝒚 ≤ 𝟒
(𝒊𝒊)𝒖(𝟒, 𝒚) = 𝟏𝟐 + 𝒚𝒇𝒐𝒓𝟎 ≤ 𝒚 ≤ 𝟒
(𝒊𝒊𝒊)𝒖(𝒙, 𝟎) = 𝟑𝒙𝒇𝒐𝒓𝟎 ≤ 𝒙 ≤ 𝟒
(𝒊𝒗)𝒖(𝒙, 𝟒) = 𝒙𝟐 𝒇𝒐𝒓𝟎 ≤ 𝒙 ≤ 𝟒
Solution:
We divide the square mesh into 16 sub-squares of side 1 unit
𝒖(𝒙, 𝟒) = 𝒙𝟐 𝒇𝒐𝒓 𝟎 ≤ 𝒙 ≤ 𝟒
𝒚=𝟒
y
1 4 9 16
0
𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒙=𝟒
0 15
𝒖𝟒 𝒖𝟓 𝒖𝟔
𝒙=𝟎 0 14 𝒖(𝟒, 𝒚) = 𝟏𝟐 + 𝒚
𝒖=𝟎
𝒖𝟕 𝒖𝟖 𝒖𝟗
0 13
x
Let 𝑢1 , 𝑢20 39 be the values
, 𝑢3 , … … … 𝑢 6 of 𝑢9at the nine
12interior mesh points of the region respectively.
First we find the rough values of 𝑢
UsingSFPF
𝒚=𝟎
1
𝑢5 = [4 + 6 + 0 + 14]𝒖(𝒙, = 6𝟎) = 𝟑𝒙 𝒇𝒐𝒓 𝟎 ≤ 𝒙 ≤ 𝟒
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 6 + 4 + 0] = 2.5
4
1
𝑢3 = [16 + 6 + 14 + 4] = 10
4
1
𝑢7 = [0 + 6 + 0 + 6] = 3
4
1
𝑢9 = [6 + 14 + 6 + 12] = 9.5
4
We use SFPF to get the other values of 𝑢
1
𝑢2 = [4 + 6 + 2.5 + 10] = 5.6
4
1
𝑢4 = [0 + 6 + 2.5 + 3] = 2.9
4
1
𝑢6 = [6 + 14 + 10 + 9.5] = 9.9
4
1
𝑢8 = [6 + 6 + 3 + 9.5] = 6.1
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 1 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 14]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 4] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 3]
4 4
1 1
𝑢3 = [𝑢2 + 𝑢6 + 9 + 15] ;𝑢8 = [𝑢5 + 𝑢7 + 𝑢8 + 6]
4 4
1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 13 + 9]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:
Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 2.5 5.6 10 2.9 6 9.9 3 6.1 9.5
1 2.38 5.61 9.87 2.86 6.12 9.87 2.99 6.15 9.51
2 2.37 5.59 9.87 2.87 6.2 9.87 3.01 6.16 9.51
3 2.37 5.59 9.87 2.88 6.13 9.88 3.01 6.16 9.51
4 2.37 5.59 9.87 2.88 6.13 9.88 3.01 6.16 9.51
Hence the solution is
𝒖𝟏 = 𝟐. 𝟑𝟕, 𝒖𝟐 = 𝟓. 𝟓𝟗, 𝒖𝟑 = 𝟗. 𝟖𝟕, 𝒖𝟒 = 𝟐. 𝟖𝟖, 𝒖𝟓 = 𝟔. 𝟏𝟑, 𝒖𝟔 = 𝟗. 𝟖𝟖, 𝒖𝟕 = 𝟑. 𝟎𝟏
, 𝒖𝟖 = 𝟔. 𝟏𝟔, 𝒂𝒏𝒅 𝒖𝟗 = 𝟗. 𝟓𝟏
Example 3 : Write down the finite difference analogue of the equation 𝒖𝒙𝒙 + 𝒖𝒚𝒚 = 𝟎 and solve for the system bounded by the square 𝟎 ≤ 𝒙 ≤ 𝟒, 𝟎 ≤ 𝒚 ≤ 𝟒 and the boundary
conditions being given as 𝒖 = 𝟎 at 𝒙 = 𝟎;
𝒙𝟐
𝒖 = 𝟖 + 𝟐𝒚 𝒂𝒕 𝒙 = 𝟒; 𝒖 = 𝒂𝒕𝒚 = 𝟎; 𝒖 = 𝒙𝟐 𝒂𝒕𝒚 = 𝟒𝒘𝒊𝒕𝒉 𝒉 = 𝒌 = 𝟏. Use Gauss seidal methodto compute the values at the internal mesh points.
𝟐
Solution :
We divide the square mesh into 16 sub-squares of side 1 unit
𝒖 = 𝒙𝟐 𝒇𝒐𝒓 𝒚 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒
𝒚=𝟒
y
1 4 9 16
0
𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒙=𝟒
0 14
𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖 = 𝟖 + 𝟐𝒚
0 12
𝒙=𝟎
𝒖𝟕 𝒖𝟖 𝒖𝟗
𝒖=𝟎
10
0
x
𝟏 𝟗
0 2 88
𝟐 𝟐
𝒚=𝟎
𝒙𝟐
𝒖= 𝒇𝒐𝒓𝒙 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒
𝟐
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢
Using SFPF
1
𝑢5 = [0 + 12 + 4 + 2] = 4.5
4
Next to find 𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗using DFPF
1
𝑢1 = [0 + 4.5 + 0 + 4] = 2.1
4
1
𝑢3 = [4 + 12 + 16 + 4.5] = 9.1
4
1
𝑢7 = [0 + 2 + 0 + 4.5] = 1.6
4
1
𝑢9 = [8 + 4.5 + 2 + 12] = 6.6
4
We use SFPF to get the other values of 𝒖
1
𝑢2 = [4 + 4.5 + 2.1 + 9.1] = 4.9
4
1
𝑢4 = [0 + 4.5 + 2.1 + 1.6] = 2.1
4
1
𝑢6 = [4.5 + 12 + 9.1 + 6.6] = 8.1
4
1
𝑢8 = [1.6 + 6.6 + 2 + 4.5] = 3.7
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 1 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 12]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 4] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 0.5]
4 4
1 1
𝑢3 = 4 [𝑢2 + 𝑢6 + 9 + 14] ;𝑢8 = 4 [𝑢5 + 𝑢7 + 𝑢8 + 2]
1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 10 + 4.5]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:
Iteration 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 2.13 4.94
4.91
9.13 2.06 4.5 8.06 1.62 3.69 6.63
1 2.00 8.99 2.03 4.67 8.07 1.56 3.72 6.57
2 1.99 4.91 9.00 2.06 4.69 8.07 1.57 3.71 6.57
3 1.99 4.92 9.00 2.06 4.69 8.07 1.57 3.71 6.57
4 2.00 4.92 9.00 2.07 4.69 8.07 1.57 3.71 6.57
5 2.00 4.92 9.00 2.07 4.69 8.07 1.57 3.71 6.57
Hence the solution is𝒖𝟏 = 𝟐, 𝒖𝟐 = 𝟒. 𝟗𝟐, 𝒖𝟑 = 𝟗, 𝒖𝟒 = 𝟐. 𝟎𝟕, 𝒖𝟓 = 𝟒. 𝟔𝟗,
𝒖𝟔 = 𝟖. 𝟎𝟕, 𝒖𝟕 = 𝟏. 𝟓𝟕, 𝒖𝟖 = 𝟑. 𝟕𝟏𝒂𝒏𝒅𝒖𝟗 = 𝟔. 𝟓𝟕
Example 4 : Solve the Laplace equation 𝛁𝟐 𝒖 = 𝟎 inside the square the region bounded by the lines 𝒙 = 𝟎, 𝒙 = 𝟒, 𝒚 = 𝟎𝒂𝒏𝒅𝒚 = 𝟒 given that 𝒖 = 𝒙𝟐 𝒚𝟐 on the boundary.
Solution: Taking ℎ = 𝑘 = 1,The given region is divided into 16 sub-squares and the boundary values are specified below :
𝒖 = 𝒙𝟐 𝒚𝟐 𝒇𝒐𝒓 𝒚 = 𝟎, 𝟏, 𝟐, 𝟑, 𝟒
𝒚=𝟒
y 144
256
16 64
0
144
𝒖𝟏 𝒖𝟐 𝒖𝟑
4
𝒙=𝟎 0
𝒖=𝟎 𝒖𝟒 𝒖𝟓 𝒖𝟔
0 64 𝒙=𝟒
𝒖 = 𝒙𝟐 𝒚𝟐
𝒖𝟕 𝒖𝟖 𝒖𝟗
0 16
0 0 0 0 0
x 𝒚=𝟎
𝒖=𝟎
Let 𝑢1 , 𝑢2 , 𝑢3 , … … … 𝑢9 be the values of 𝑢 at the nine interior mesh points of the region respectively.
First we find the rough values of 𝑢
Using SFPF
1
𝑢5 = [0 + 64 + 0 + 64] = 32
4
Next to find𝒖𝟏 , 𝒖𝟑 , 𝒖𝟕, 𝒖𝟗 usingDFPF
1
𝑢1 = [0 + 32 + 0 + 64] = 24
4
1
𝑢3 = [64 + 64 + 32 + 256] = 104
4
1
𝑢7 = [0 + 0 + 0 + 32] = 8
4
1
𝑢9 = [0 + 32 + 64 + 0] = 24
4
We use SFPF to get the other values of 𝒖
1
𝑢2 = [64 + 32 + 24 + 104] = 56
4
1
𝑢4 = [0 + 32 + 24 + 8] = 16
4
1
𝑢6 = [64 + 32 + 104 + 24] = 56
4
1
𝑢8 = [32 + 0 + 8 + 64] = 26
4
Gauss-Seidal iterative scheme
1 1
𝑢1 = [0 + 16 + 𝑢2 + 𝑢4 ] ; 𝑢6 = [𝑢3 + 𝑢5 + 𝑢9 + 64]
4 4
1 1
𝑢2 = [𝑢1 + 𝑢3 + 𝑢5 + 64] ; 𝑢7 = [0 + 𝑢4 + 𝑢8 + 0]
4 4
1 1
𝑢3 = [𝑢2 + 𝑢6 + 144 + 144] ; 𝑢8 = 4 [𝑢5 + 𝑢7 + 𝑢8 + 0]
4
1 1
𝑢4 = [0 + 𝑢1 + 𝑢5 + 𝑢7 ]; 𝑢9 = [𝑢6 + 𝑢8 + 16 + 0]
4 4
1
𝑢5 = [𝑢2 + 𝑢4 + 𝑢6 + 𝑢8 ]
4
Gauss seidal iteration values are tabulated as follows:
I 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
0 24 56 104 16 32 56 8 26 24
1 22 56 100 15.5 38.38 56.60 10.38 18.19 22.70
2 21.88 56.07 100.17 17.66 37.13 56 8.96 17.20 22.30
3 22.43 55.93 99.98 17.13 36.57 55.71 8.58 16.86 22.14
4 22.27 55.71 99.86 16.86 36.29 55.57 8.43 16.72 22.07
5 22.14 55.57 99.79 16.72 36.15 55.50 8.36 16.65 22.04
6 22.07 55.5 99.75 16.65 36.08 55.47 8.33 16.61 22.02
7 22.04 55.47 99.74 16.61 36.04 55.45 8.31 16.59 22.01 Hence the solution is𝒖𝟏 = 𝟐𝟐. 𝟎𝟏, 𝒖𝟐 = 𝟓𝟓. 𝟒𝟒, 𝒖𝟑 = 𝟗𝟕. 𝟕𝟐, 𝒖𝟒 = 𝟏𝟔. 𝟓𝟖,
8 22.02 55.45 99.73 16.59 36.04 55.44 8.30 16.58 22.01 𝒖𝟓 = 𝟑𝟔. 𝟎𝟏, 𝒖𝟔 = 𝟓𝟓. 𝟒𝟒, 𝒖𝟕 = 𝟖. 𝟐𝟗, 𝒖𝟖 = 𝟏𝟔. 𝟓𝟖𝒂𝒏𝒅𝒖𝟗 = 𝟐𝟐. 𝟎𝟏
9 22.01 55.44 99.72 16.59 36.01 55.44 8.29 16.58 22.01 POISSON EQUATION
10 22.01 55.44 99.72 16.58 36.01 55.44 8.29 16.58 22.01 𝝏𝟐 𝒖 𝝏𝟐 𝒖
Solution of Poisson equation𝝏𝒙𝟐 + 𝝏𝒚𝟐 = 𝒇(𝒙, 𝒚)[𝐄𝐥𝐥𝐢𝐩𝐭𝐢𝐜𝐭𝐲𝐩𝐞]
(or)𝛁𝟐 𝒖 = 𝒇(𝒙, 𝒚)
Where 𝑓(𝑥, 𝑦) is a function of 𝑥 and 𝑦.
Formula
𝒖𝒊−𝟏,𝒋 + 𝒖𝒊+𝟏,𝒋 + 𝒖𝒊,𝒋−𝟏 + 𝒖𝒊,𝒋+𝟏 − 𝟒𝒖𝒊,𝒋 = 𝒉𝟐 𝒇(𝒊𝒉, 𝒋𝒉) … … … … … … … (𝟏)
Applying this formula (1) at each internal mesh point, we get a system of linear equation in 𝑢𝑖 , where 𝑢𝑖 are the values of u at the internal mesh points. Solving the equation,
the values 𝑢𝑖 are known.
Example 1:
Solve the Poisson equation 𝛁𝟐 𝐮 = −𝟏𝟎(𝐱 𝟐 + 𝐲 𝟐 + 𝟏𝟎) over the square mesh with sides 𝒙 = 𝟎, 𝒚 = 𝟎, 𝒙 = 𝟑, 𝒚 = 𝟑 𝒂𝒏𝒅𝒖 = 𝟎 on the boundary. Assume mesh length 𝒉 = 𝟏 unit.
Solution:
0 0
0 0𝑗=3
A 𝒖𝟏 𝒖𝟐 B
0
0𝑗=2
𝑢=0
0 C 𝒖𝟑 𝒖𝟒 D
0𝑗=1
𝑦=1
𝑦 100 100
0 100
A 𝒖𝟏 𝒖𝟐 B
0
100
𝑥=0
𝑥=1
ℎ = 1/3
C 𝒖𝟑 𝒖𝟒 D
100
0
0 0 0 0 𝑥
𝑦 = 0 , ℎ = 1/3
0 0 0 0 0
u1 u2 u3 j=1
0 A B C 0
u4 u5 u6 j=0
X 0 D E F 0
u7 u8 u9
0 G H I 0 j=-1
0 0 0 0 0
i=-1 i=0 i=1
Let us assume 𝑢2 = 𝑢3 = 𝑢4 = 𝑢5 = 𝑢6 = 𝑢7 = 𝑢8 = 𝑢9 = 0
The iterated values are tabulated as follows:
I 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝒖𝟒 𝒖𝟓 𝒖𝟔 𝒖𝟕 𝒖𝟖 𝒖𝟗
1 -2 -0.5 -2.1 -0.5 -0.3 -0.6 -2.1 -0.6 -2.3
2 -2.3 -1.2 -2.5 -1.2 -0.9 -1.4 -2.5 -1.4 -2.7
3 -2.6 -1.5 -2.7 -1.5 -1.5 -1.7 -2.7 -1.7 -2.9
4 -2.8 -1.8 -2.9 -1.8 -1.8 -1.9 -2.9 -1.9 -3.0
5 -2.9 -1.9 -3.0 -1.9 -1.9 -2.0 -3.0 -2.0 -3.0
6 -3.0 -2.0 -3.0 -2.0 -2.0 -2.0 -3.0 -2.0 -3.0
7 -3.0 -2.0 -3.0 -2.0 -2.0 -2.0 -3.0 -2.0 -3.0
Hence the solution is𝒖𝟏 = −𝟑, 𝒖𝟐 = −𝟐, 𝒖𝟑 = −𝟑, 𝒖𝟒 = −𝟐,
𝒖𝟓 = −𝟐, 𝒖𝟔 = −𝟐, 𝒖𝟕 = −𝟑, 𝒖𝟖 = −𝟐𝒂𝒏𝒅𝒖𝟗 = −𝟑
Practice Problems:
𝜕2𝑢 𝜕2𝑢
1.Solve the Poisson equation + = 𝑒 𝑥𝑦 (𝑥 2 + 𝑦 2 ) , 0 < 𝑥 < 1 ; 0 < 𝑦 < 1
𝜕𝑥 2 𝜕𝑦2
𝑢(0, 𝑦) = 1; 𝑢(1, 𝑦) = 𝑒 𝑦 ; 0 ≤ 𝑦 ≤ 1 𝑎𝑛𝑑 𝑢(𝑥, 0) = 1, 𝑢(𝑥, 1) = 𝑒 𝑥 ;
0 ≤ 𝑥 ≤ 1usingℎ = 𝑘 = 1/3.
ANS: 𝒖𝟏 = 𝒖𝟒 = 𝟏. 𝟐𝟐𝟓𝟖, 𝒖𝟐 = 𝟏. 𝟒𝟕𝟖𝟓, 𝒖𝟑 = 𝟏. 𝟏𝟎𝟔𝟎
𝜕2𝑢 𝜕2𝑢
2. Solve the Poisson equation𝜕𝑥 2 + 𝜕𝑦2 = −36(x 2 + y 2 + 5)subject to the condition with sides𝑢 = 0 at𝑥 = 0 and𝑥 = 3 ; 𝑢 = 0 at 𝑦 = 0 𝑎𝑛𝑑
𝑢 = 1 at 𝑦 = 3 for 0 < 𝑥 < 3 Find the solution taking ℎ = 1 with a square mesh.
ANS:𝒖𝟏 = 𝟐𝟓𝟐. 𝟒, 𝒖𝟐 = 𝟑𝟏𝟓. 𝟒, 𝒖𝟑 = 𝟏𝟖𝟗. 𝟏; 𝒖𝟒 = 𝟐𝟓𝟐. 𝟏
PREVIOUS YEAR ANNA UNIVERSITY QUESTION PAPERS
(𝑖) 𝑢(0, 𝑦) = 0, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖) 𝑢(4, 𝑦) = 12 + 𝑦, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖𝑖) 𝑢(𝑥, 0) = 3𝑥, 0 ≤ 𝑥 ≤ 4
(𝑖𝑣)𝑢(𝑥, 4) = 𝑥 2 , 0 ≤ 𝑥 ≤ 4
By dividing the square into 16 square meshes of side 1 and always correcting the computed values to two places of decimals, obtain the values of 𝑢 at 9
interior pivotal points.
𝜕2𝑢 𝜕𝑢
(b)Solve by Crank-Nicolson’s method 𝜕𝑥 2 = 0 < 𝑥 < 1, 𝑡 > 0 satisfying the conditions 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0 𝑎𝑛𝑑 𝑢(𝑥, 0) = 100𝑥(1 − 𝑥).
𝜕𝑡
1 1
Compute 𝑢 for one time step with ℎ = 4 and 𝑘 = 64.
𝑢(1, 𝑡) = 0, 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥, 0 < 𝑥 < 1 and ℎ = 0.2. Find the values of
𝑢 upto 𝑡 = 0.1
(ii)(a)Solve 𝑦 ′′ − 𝑦 = 𝑥,𝑥 ∈ (0,1) given 𝑦(0) = 𝑦(1) = 0 using finite differences by dividing the interval into four equal parts.
(b)Solve the Poisson equation∇2 𝑢 = −10(𝑥 2 + 𝑦 2 + 10) 0 ≤ 𝑥 ≤ 3,
0 ≤ 𝑦 ≤ 3, 𝑢 = 0 on the boundary.
PART-A NOV/DEC 2013
𝑑 2𝑦
1. Solve the wave equation − 𝑥𝑦 = 0, , 𝑦(0) = −1, 𝑦(1) = 2 𝑏𝑦 finite difference method taking 𝑛 = 2
𝑑𝑥 2
2. Write down the Leibmann’s iteration process to solve the Laplace equation.
PART-B
𝜕2𝑢 𝜕𝑢 1
(a) Using Crank-Nicholson’s method, solve numerically = 16 with boundary conditions 𝑢(𝑥, 0) = 0, 𝑢(0, 𝑡) = 0 and 𝑢(1, 𝑡) = 50𝑡 taking ℎ =
𝜕𝑥 2 𝜕𝑡 4
𝜕2𝑢 𝜕2𝑢
(b) Solve the elliptic equation 𝜕𝑥 2 + 𝜕𝑦2 = 0 for the following square mesh with boundary values as given below:
1 4 9 16
0
0 14 u1 u2 u3
0 12 u4 u5 u6
0 10 u7 u8 u9
0 0.5 2 4.5 8
(b) Solve the Poisson equation ∇ 𝑢 = −10(𝑥 2 + 𝑦 2 + 10) over the square mesh
2
(𝑖) 𝑢(0, 𝑦 ) = 0, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖) 𝑢(4, 𝑦) = 12 + 𝑦, 0 ≤ 𝑦 ≤ 4
(𝑖𝑖𝑖) 𝑢(𝑥, 0) = 3𝑥, 0 ≤ 𝑥 ≤ 4
(𝑖𝑣)𝑢(𝑥, 4) = 𝑥 2 , 0 ≤ 𝑥 ≤ 4
𝑘𝑐 2
(b) Obtain the Crank-Nicholson finite difference by taking 𝜆 = = 1.
ℎ2
𝜕2𝑢 𝜕𝑢
Hence, find 𝑢(𝑥, 𝑡) in the rod for two times steps for the heat equation = , given 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥, 𝑢(0, 𝑡) = 0, 𝑢(1, 𝑡) = 0. Take ℎ = 0.2
𝜕𝑥 2 𝜕𝑡