Solution of PDE's Using Finite Difference Method
Solution of PDE's Using Finite Difference Method
DIFFERENCE METHOD
In the present chapter, we discuss the numerical solutions of the partial differential
equations using finite difference method.
Most of the science and engineering problems are ending with the mathematical
equations like ordinary differential equations or partial differential equations. Some
of the differential equations are difficult to solve by analytical methods then we have
solve by numerical methods.
Numerical solution of the PDE’s using Finite difference method: In this
section, we are discuss the numerical solutions to solve partial differential equations
like one dimensional heat equation, one dimensional wave equation, two dimensional
Laplace equation and Poisson equation using finite difference method.
∂2z ∂ z 2
∂ z 2 2
+ 4 ∂x∂y + 4 ∂y 2 = 0, here A = 1, B = 4, C = 4 and B − 4AC = 16 − 16,
1
∂x2
2
B − 4AC = 0. Hence the given PDE is Parabolic form.
2 xyr − (x2 − y 2 )s − xyt + py − qx = 2(x2 − y 2 ), here, A = xy B = −x2 + y 2 ,
C = −xy, B 2 − 4AC = (−x2 + y 2 )2 − 4(xy)(−xy) = x4 + y 4 − 2x2 y 2 + 4x2 y 2 =
x4 + y 4 + 2x2 y 2 = (x + y)2 , B 2 − 4AC = (x + y)2 > 0 for all values of x and y.
Hence the given PDE is Hyperbolic form.
3 x2 (y − 1)r − x(y 2 − 1)s + y(y − 1)t + xyp − q = 0, here, A = x2 (y − 1),
B = −x(y 2 − 1), C = y(y − 1), B 2 − 4AC =
∂2u
4 + ∂u
∂x∂y ∂x
= 4, A = 0, B = 1, C = 0, B 2 − 4AC = 1 − 4(0)(0)1
2
B − 4AC = 1 > 0. Hence the given PDE is Hyperbolic form.
-hy) ) hg)
-)
\→ (x)
x0 = 0 x1 = 1 x2 = 2 ... xm =
\↓ (t)
t0 = 0 u(0,0) = u(x0 , t0 ) = 0 u(1,0) = u(x1 , t0 ) u(2,0) = u(x2 , t0 ) ... u(m,0)
t1 = 1 u(0,1) = u(x0 , t1 ) = 0 u(1,1) = u(x1 , t1 ) u(2,1) = u(x2 , t1 ) ... u(m,1)
t2 = 2 u(0,2) = u(x0 , t2 ) = 0 u(1,2) = u(x1 , t2 ) u(2,2) = u(x2 , t2 ) ... u(m,2)
... ... ... ... ... ...
tn = n u(0,n) = u(x0 , tn ) = 0 u(1,n) = u(x1 , tn ) u(2,n) = u(x2 , tn ) ... u(m,n)
Table 1: Basic information table
The first column and last column values are zero by the given boundary conditions.
Step - 03: Find the values of the first row OR first time level are obtained by using
the given initial condition u(x, 0) = f (x).
Step - 04: Find the values of the second row OR second time level are obtained, by
using Schmodt explict fromulae
I - row values: The values of the first row are computed by using the given initial
condition u(x, 0) = x(4 − x), substituting x = 0, 1, 2, 3, 4.
u(0,0) = 0, u(1,0) = (1)(4 − 1) = 3,u(2,0) = (2)(4 − 2) = 4, u(3,0) = (3)(4 − 3) = 3,
u(4,0) = (4)(4 − 4) = 0.
II - row values: The values of the second row are computed by Substitute j = 0 in
the above same formulae.
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
put, i = 1, u1,1 = 12 [u0,0 + u2,0 ] = 2, put, i = 2, u2,1 = 21 [u1,0 + u3,0 ] = 3,
put, i = 3, u3,1 = 21 [u2,0 + u4,0 ] = 2.
III - row values: The values of the third row are computed by Substitute j = 1 in
the above same formulae.
1
ui,2 = [ui−1,1 + ui+1,1 ]
2
put, i = 1, u1,2 = 12 [u0,1 + u2,1 ] = 1.5, put, i = 2, u2,2 = 12 [u1,1 + u3,1 ] = 2,
put, i = 3, u3,2 = 21 [u2,1 + u4,1 ] = 1.5.
IV - row values: The values of the fourth row are computed by Substitute j = 2 in
the above same formulae.
1
ui,3 = [ui−1,2 + ui+1,2 ]
2
put, i = 1, u1,3 = 12 [u0,2 + u2,2 ] = 1, put, i = 2, u2,3 = 21 [u1,2 + u3,2 ] = 1.5,
put, i = 3, u3,3 = 21 [u2,2 + u4,2 ] = 1.
V - row values: The values of the fifth row are computed by Substitute j = 3 in
the above same formulae
1
ui,4 = [ui−1,3 + ui+1,3 ]
2
put, i = 1, u1,4 = 12 [u0,3 + u2,3 ] = 0.75, put, i = 2, u2,4 = 12 [u1,3 + u3,3 ] = 1,
put, i = 3, u3,4 = 21 [u2,3 + u4,3 ] = 0.75.
VI - row values: The values of the sxith row are computed by Substitute j = 4 in
the above same formulae.
1
ui,5 = [ui−1,4 + ui+1,4 ]
2
put, i = 1, u1,5 = 12 [u0,4 + u2,4 ] = 0.5, put, i = 2, u2,5 = 12 [u1,4 + u3,4 ] = 0.75,
put, i = 3, u3,5 = 21 [u2,4 + u4,4 ] = 0.5.
2
Problem - 02: Solve ∂u ∂t
= ∂∂xu2 , subject to the conditionds u(0, t) = 0, u(1, t) = 0
and u(x, 0) = sin(πx), for 0 ≤ t ≤ 0.1 by taking h = 0.2. Write down the values of (1)
u(0.2, 0.04), (ii) u(0.4, 0.08) and u(0.6, 0.06).
2
Soltion: Given, ∂u ∂t
= ∂∂xu2 , B.C’s., u(0, t) = 0, u(1, t) = 0, I. C. u(x, 0) = sin(πx),
h = 0.2.
h2 (0.02)2
Here, c2 = 1, h = 0.2, k = 2c 2 = 2(1)
= 0.02.
The values of x in the range (0 ≤ x ≤ 1), with step length h = 0.2, are
x = 0, 0.2, 0.4, 0.6, 0.8, 1 and the values of t in the range (0 ≤ x ≤ 0.1), with step
length k = 0.02, are t = 0, 0.02, 0.04, 0.06, 0.08, 0.1.
\→ (x)
x0 = 0 x1 = 0.2 x2 = 0.4 x3 = 0.6 x4 =
\↓ (t)
t0 = 0 u(0,0) =0 u(1,0) = 0.5878 u(2,0) = 0.9511 u(3,0) = 0.9511 u(4,0) =0
t1 = 0.02 u(0,1) =0 u(1,1) = 0.4756 u(2,1) = 0.7695 u(3,1) = 0.7695 u(4,1) =0
t2 = 0.04 u(0,2) =0 u(1,2) = 0.3848 u(2,2) = 0.6226 u(3,2) = 0.6226 u(4,2) =0
t3 = 0.06 u(0,3) =0 u(1,3) = 0.3113 u(2,3) = 0.5037 u(3,3) = 0.5037 u(4,3) =0
t4 = 0.08 u(0,4) =0 u(1,4) = 0.2519 u(2,4) = 0.4075 u(3,4) = 0.4075 u(4,4) =0
t5 = 0.1 u(0,5) =0 u(1,5) = 0.2019 u(2,5) = 0.3278 u(3,5) = 0.3278 u(4,5) =0
Table 3: The value of u(x, t) in the above table
From the above table the value of the u(x, t) at the given points are
(i) u(0.2, 0.04) = 0.3848, (ii) u(0.4, 0.08) = 0.4075 and u(0.6, 0.06) = 0.5037.
I - row values: The values of the first row are estimated by using the given initial
condition u(x, 0) = sin(πx), substituting x = 0, 0.2, 0.4, 0.6, 0.8, 1.
u(0,0) = sin(0) = 0, u(1,0) = sin(0.2π) = 0.5878,u(2,0) = sin(0.4π) = 0.9511,
u(3,0) = sin(0.6π) = 0.9511, u(4,0) = sin(0.8π) = 0.5878, u(5,0) = sin(π) = 0.
II - row values: The values of the second row are estimated by Substitute j = 0 in
the above same formulae.
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
put, i = 1, u1,1 = 12 [u0,0 + u2,0 ] = 0.4756, put, i = 2, u2,1 = 21 [u1,0 + u3,0 ] = 0.7695,
put, i = 3, u3,1 = 21 [u2,0 + u4,0 ] = 0.7695, put, i = 4, u4,1 = 21 [u3,0 + u5,0 ] = 0.4756 .
III - row values: The values of the third row are computed by Substitute j = 1 in
the above same formulae
1
ui,2 = [ui−1,1 + ui+1,1 ]
2
put, i = 1, u1,2 = 12 [u0,1 + u2,1 ] = 0.3848, put, i = 2, u2,2 = 21 [u1,1 + u3,1 ] = 0.6226,
put, i = 3, u3,2 = 21 [u2,1 + u4,1 ] = 0.6226, put, i = 4, u4,2 = 21 [u3,1 + u5,1 ] = 0.3848.
IV - row values: The values of the fourth row are computed by Substitute j = 2 in
the above same formulae.
1
ui,3 = [ui−1,2 + ui+1,2 ]
2
put, i = 1, u1,3 = 12 [u0,2 + u2,2 ] = 0.3113, put, i = 2, u2,3 = 21 [u1,2 + u3,2 ] = 0.5037,
put, i = 3, u3,3 = 21 [u2,2 + u4,2 ] = 0.5037, put, i = 4, u4,3 = 21 [u3,2 + u5,2 ] = 0.3113.
V - row values: The values of the fifth row are computed by Substitute j = 3 in
the above same formulae
1
ui,4 = [ui−1,3 + ui+1,3 ]
2
put, i = 1, u1,4 = 12 [u0,3 + u2,3 ] = 0.2519, put, i = 2, u2,4 = 21 [u1,3 + u3,3 ] = 0.4075,
put, i = 3, u3,4 = 21 [u2,3 + u4,3 ] = 0.4075, put, i = 4, u4,4 = 21 [u3,3 + u5,3 ] = 0.2519 .
VI - row values: The values of the sixth row are computed by Substitute j = 4 in
the above same formulae.
1
ui,5 = [ui−1,4 + ui+1,4 ]
2
put, i = 1, u1,5 = 12 [u0,4 + u2,4 ] = 0.2019, put, i = 2, u2,5 = 21 [u1,4 + u3,4 ] = 0.3278,
put, i = 3, u3,5 = 21 [u2,4 + u4,4 ] = 0.3278,put, i = 4, u4,5 = 21 [u3,4 + u5,4 ] = 0.2019 .
h = 0.1, c2 = 1, k = 0.001.
The values of x in the range (0 < x < 1), with step length h = 0.1, are
x = 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 and the values of t at the two time levels
with step length k = 0.001, are t = 0, 0.001, 0.002.
\rightarrow (x)
x0 = 0 x1 = 0.1 x2 = 0.2 x3 = 0.3 x4 = 0.4 x5
\downarrow (t)
t=0 u0,0 = 0 u1,0 = 0.2 u2,0 = 0.4 u3,0 = 0.6 u4,0 = 0.8 u
t = 0.001 u0,1 = 0 u1,1 = 0.2 u2,1 = 0.4 u3,1 = 0.6 u4,1 = 0.8 u5
t = 0.002 u0,2 = 0 u1,2 = 0.2 u2,2 = 0.4 u3,2 = 0.6 u4,2 = 0.796 u5
kc2 (0.001)(1)
Here, the value of a = h2
= (0.1)2
= 0.1. We know that, by schmidt explicit
formulae
ui,j+1 = aui−1,j + (1 − 2a)ui,j + aui+1,j
Substitute the value of a = 0.1
I - row values: The values of the first row are estimated by using the given initial
condition (
2x, 0 ≤ x ≤ 12 ,
u(x, 0) =
2(1 − x), 21 ≤ x ≤ 1
substituting x = 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.
u(0,0) = 0, u(1,0) = 2(0.1) = 0.2,u(2,0) = 2(0.2) = 0.4,
u(3,0) = 2(0.3) = 0.6, u(4,0) = 2(0.4) = 0.8, u(5,0) = 2(0.5) = 1,
u(6,0) = 2(1 − 0.6) = 0.8, u(7,0) = 2(1 − 0.7) = 0.6, u(8,0) = 2(1 − 0.8) = 0.4,
u(9,0) = 2(1 − 0.9) = 0.2.
put, i = 1,
u1,1 = 0.1u0,0 + (0.8)u1,0 + 0.1u2,0 = 0.2
put, i = 2,
u2,1 = 0.1u1,0 + (0.8)u2,0 + 0.1u3,0 = 0.4
put, i = 3,
u3,1 = 0.1u2,0 + (0.8)u3,0 + 0.1u4,0 = 0.6
put, i = 4,
u4,1 = 0.1u3,0 + (0.8)u4,0 + 0.1u5,0 = 0.8
put, i = 5,
u5,1 = 0.1u4,0 + (0.8)u5,0 + 0.1u6,0 = 0.96
put, i = 6,
u6,1 = 0.1u5,0 + (0.8)u6,0 + 0.1u7,0 = 0.8
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 28 / 105
Continued Unit - III Problems on Numerical Solution of One
Dimensional Heat Equation ...
Similarly, put i = 7, u7,1 = 0.6, put i = 8, u8,1 = 0.4 and put i = 9, u9,1 = 0.2.
III - row values: The values of the third row are estimated by Substitute j = 1 in
the above same formulae
put, i = 1,
u1,2 = 0.1u0,1 + (0.8)u1,1 + 0.1u2,1 = 0.2
put, i = 2,
u2,2 = 0.1u1,1 + (0.8)u2,1 + 0.1u3,1 = 0.4
put, i = 3,
u3,2 = 0.1u2,1 + (0.8)u3,1 + 0.1u4,1 = 0.6
put, i = 4,
u4,2 = 0.1u3,1 + (0.8)u4,1 + 0.1u5,1 = 0.796
put, i = 5,
u5,2 = 0.1u4,1 + (0.8)u5,1 + 0.1u6,1 = 0.928
put, i = 6,
u6,2 = 0.1u5,1 + (0.8)u6,1 + 0.1u7,1 = 0.796
Similarly, put i = 7, u7,2 = 0.6, put i = 8, u8,2 = 0.4 and put i = 9, u9,2 = 0.2.
∂u ∂2u
= c2 2
∂t ∂x
By Crank - Nicholson method substituting the finite difference approximations to the
2
partial derivatives ∂u
∂t
and ∂∂xu2 is replaced with the average of its central difference
approximation on the j th and (j + 1)th time levels in the above equation and simplify
- a
C1ta)
-a)
Problem - 01: Solve the equation ut = uxx ,in the interval 0 < x < 5, t ≥ 0, with
the boundary conditions u(0, t) = 0, u(5, t) = 100 and initial condition u(x, 0) = 20.
Compute the values of u using Crank - Nicholson method with the step lenghts h = 1
and a = 1.
Solution: Given ut = uxx ,c2 = 1, B. C.,u(0, t) = 0, u(5, t) = 100 and I. C.,
2
u(x, 0) = 20,h = 1 and a = 1 we have a = kc h2
→ 1 = k(1)
(1)2
, k = 1. The value of the x
in (0, 5), with h = 1 are 0, 1, 2, 3, 4, 5.
\→ (x)
x0 = 0 x1 = 1 x2 = 2 x3 = 3 x4 = 4 x5 =
\↓ (t)
t0 = 0 u0,0 = 0 u1,0 = 20 u2,0 = 20 u3,0 = 20 u4,0 = 20 u5,0 =
t1 = 1 u0,1 = 0 u1,1 = 10.05 u2,1 = 20.2 u3,1 = 30.75 u4,1 = 62.69 u5,1 =
I - Row: Compute the values of the first row using the given initial condition
u(x, 0) = 20, substitute x = 0, 1, 2, 3, 4, 5, u(0, 0) = 0, u(1, 0) = 20, u(2, 0) = 20,
u(4, 0) = 20, u(5, 0) = 100.
put, i = 3,
4u3,1 = u2,0 + u4,0 + u3,1 + u4,1
4u3 = 20 + 20 + u2 + u4 , u2 − 4u3 + u4 = −40
put, i = 4,
4u4,1 = u3,0 + u5,0 + u4,1 + u5,1
4u4 = 20 + 100 + u3 + 100, 4u3 − u4 = −220
Now, solving the following system of equations using elimination method, we get
4u1 − u2 = 20
u1 − 4u2 + u3 = −40
u2 − 4u3 + u4 = −40
and
4u3 − u4 = −220
∴ u1 = 10.05, u2 = 20.2, u3 = 30.75 and u4 = 62.69
Problem - 02: Solve the equation ut = uxx , with the boundary conditions
u(0, t) = 0 = u(1, t) and initial condition u(x, 0) = sin(πx), using Crank - Nicholson
method. Assuming the step lenghts h = 0.25 and k = 0.01, compute the values of
u(x, t) for two time levels.
Solution: Given ut = uxx ,c2 = 1, B. C.,u(0, t) = 0 = u(1, t) and I. C.,
2
u(x, 0) = sin(πx),h = 0.25 and k = 0.01 we have the value of a = kc h2
= (0.01)(1)
(0.25)2
4
= 25 .
The value of x in the interval (0, 1) with h = 0.25 are 0, 0.25, 0.5, 0.75, 1 and the
values of t with k = 0.01 at two time levels are 0, 0.01, 0.02
\→ (x)
x0 = 0 x1 = 0.25 x2 = 0.5 x3 = 0.75 x4 = 1
\↓ (t)
t0 = 0 u0,0 = 0 u1,0 = 0.7071 u2,0 = 1 u3,0 = 0.7071 u4,0 = 0
t1 = 0.01 u0,1 = 0 u1,1 = 0.6437 u2,1 = 0.9104 u3,1 = 0.6437 u4,1 = 0
t1 = 0.02 u0,2 = 0 u1,2 = u2,2 = u3,2 = u4,2 = 0
I - Row: Compute the values of the first row using the given initial condition
u(x, 0) = sin(πx), substitute x = 0, 0.25, 0.5, 0.75, 1, u(0, 0) = 0,
u(1, 0) = sin(0.25π) = 0.7071, u(2, 0) = sin(0.5π) = 1, u(4, 0) = sin(0.75π) = 0.7071,
u(5, 0) = sin(π) = 0.
II - Row: Let the value of the second row are u1 = u1,1 , u2 = u2,1 , u3 = u3,1 and
u4 = u4,1 . Compute these values using the Crank - Nicholson method.
4 42 4 4 58 4
ui−1,j + ui,j + ui+1,j = − ui−1,j+1 + ui,j+1 − ui+1,j+1
25 25 25 25 25 25
Substitute j = 0
4 42 4 4 58 4
ui−1,0 + ui,0 + ui+1,0 = − ui−1,1 + ui,1 − ui+1,1
25 25 25 25 25 25
put i = 1, 2, 3 and solve the system of equations, we get, u1 = 0.6437, u2 = 0.9104
and u3 = 0.6437
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 37 / 105
Continued Unit - III Problems on Numerical Solution of One
Dimensional Heat Equation by Crank - Nicolson Method ...
III - Row: Let the value of the second row are u5 = u1,2 , u6 = u2,2 , u7 = u3,2 and
u8 = u4,2 . Compute these values using the Crank - Nicholson method.
4 42 4 4 58 4
ui−1,j + ui,j + ui+1,j = − ui−1,j+1 + ui,j+1 − ui+1,j+1
25 25 25 25 25 25
Substitute j = 1
4 42 4 4 58 4
ui−1,1 + ui,1 + ui+1,1 = − ui−1,2 + ui,2 − ui+1,2
25 25 25 25 25 25
put, i = 1, 2, 3 and solve the system of equations, we get, u5 , u6 and u7
k2 c2
ui,j−1 − 2ui,j + ui,j+1 = [ui−1,j − 2ui,j + ui+1,j ]
h2
k2
Taking a2 = h2
and the above equation becomes
\→ (x)
x0 = 0 x1 = 1 x2 = 2 ... xm =
\↓ (t)
t0 = 0 u(0,0) = u(x0 , t0 ) = 0 u(1,0) = u(x1 , t0 ) u(2,0) = u(x2 , t0 ) ... u(m,0)
t1 = 1 u(0,1) = u(x0 , t1 ) = 0 u(1,1) = u(x1 , t1 ) u(2,1) = u(x2 , t1 ) ... u(m,1)
t2 = 2 u(0,2) = u(x0 , t2 ) = 0 u(1,2) = u(x1 , t2 ) u(2,2) = u(x2 , t2 ) ... u(m,2)
... ... ... ... ... ...
tn = n u(0,n) = u(x0 , tn ) = 0 u(1,n) = u(x1 , tn ) u(2,n) = u(x2 , tn ) ... u(m,n)
Table 4: Basic information table
The first column and last column values are zero by the given boundary conditions.
Step - 03: Find the values of the first row OR first time level are obtained by using
the given initial condition u(x, 0) = f (x).
Step - 04: Find the values of the second row OR second time level values are
obtained by using fromulae
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
substitute i = 1, 2, 3, 4, ... Step - 05: Find the values of the third row OR third time
level values are obtained by using the explicit fromulae
2 2
Problem - 01: solve the one dimensional wave equation ∂∂t2u = 4 ∂∂xu2 , subject to
u(0, t) = 0 = u(4, t), ut (x, 0) = 0 and u(x, 0) = x(4 − x), by taking h = 1, k = 0.5
upto four steps.
2 2
Solution: Given ∂∂t2u = 4 ∂∂xu2 , c2 = 4, h = 1, k = 0.5, B.C.:u(0, t) = 0 = u(4, t) and I.
C. ut (x, 0) = 0 and u(x, 0) = x(4 − x). The values of the x in the range with step
length h = 1 are 0, 1, 2, 3, 4 and the values of t with step lenght k = 0.5 are
0, 0.5, 1, 1.5, 2.
\→ (x)
x0 = 0 x1 = 1 x2 = 2 x3 = 3 x4 = 4
\↓ (t)
t0 = 0 u0,0 =0 u1,0 = 3 u2,0 = 4 u3,0 = 3 u4,0 =0
t1 = 0.5 u0,1 =0 u1,1 = 2 u2,1 = 3 u3,1 = 2 u4,1 =0
t2 = 1 u0,2 =0 u1,2 = 0 u2,2 = 0 u3,2 = 0 u4,2 =0
t3 = 1.5 u0,3 =0 u1,3 = −2 u2,3 = −3 u3,3 = −2 u4,3 =0
t4 = 2 u0,4 =0 u1,4 = −3 u2,4 = −4 u3,4 = −3 u4,4 =0
I - row values: The values of the first row are calculated by using the given initial
condition
u(x, 0) = x(4 − x)
substituting x = 0, 1, 2, 3, 4, u(0,0) = 0, u(1,0) = 1(4 − 1) = 3, u(2,0) = 2(4 − 2) = 4,
u(3,0) = 3(4 − 3) = 3, u(4,0) = 4(4 − 4) = 0.
II - row values: The values of the second row are calculated by using the formulae.
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
put, i = 1,
1
u1,1 = [u0,0 + u2,0 ] = 2
2
put, i = 2,
1
u2,1 = [u1,0 + u3,0 ] = 3
2
put, i = 3,
1
u3,1 = [u2,0 + u4,0 ] = 2
2
III - row values: Find the values of the third row are calculate, by using the
explicit fromulae
ui,j+1 = ui−1,j + ui+1,j − ui,j−1
Substitute j = 1,
ui,2 = ui−1,1 + ui+1,1 − ui,0
put, i = 1,
u1,2 = u0,1 + u2,1 − u1,0 = 0
put, i = 2,
u2,2 = u1,1 + u3,1 − u2,0 = 0
put, i = 3,
u3,2 = u2,1 + u4,1 − u3,0 = 0
IV - row values: Find the values of the fourth row are calculate, by Substitute
j = 2 in the above equation
put, i = 1,
u1,3 = u0,2 + u2,2 − u1,1 = −2
put, i = 2,
u2,3 = u1,2 + u3,2 − u2,1 = −3
put, i = 3,
u3,3 = u2,2 + u4,2 − u3,1 = −2
V - row values: Find the values of the fifth row are calculate, by Substitute j = 3
in the above equation
ui,4 = ui−1,3 + ui+1,3 − ui,2
put, i = 1,
u1,4 = u0,3 + u2,3 − u1,2 = −3
put, i = 2,
u2,4 = u1,3 + u3,3 − u2,2 = −4
put, i = 3,
u3,4 = u2,3 + u4,3 − u3,2 = −3
Problem - 02: solve the one dimensional wave equation uxx = 0.0625utt , subject to
the conditions u(0, t) = 0 = u(5, t), ut (x, 0) = 0 and u(x, 0) = x2 (x − 5), by taking
h = 1, for 0 ≤ t ≤ 1.
Solution: Given uxx = 0.0625utt , utt = 0.0625 1
uxx , c2 = 0.0625
1
= 16, h = 1,we have,
h 1
k = c = 4 = 0.25, B.C.:u(0, t) = 0 = u(4, t) and I. C. ut (x, 0) = 0 and
u(x, 0) = x2 (x − 5). The values of the x in the range 0 ≤ x ≤ 5 with step length
h = 1 are 0, 1, 2, 3, 4, 5 and the values of t in the range 0 ≤ t ≤ 1 with step lenght
k = 0.25 are 0, 0.25, 0.5, 0.75, 1.
\→ (x)
x0 = 0 x1 = 1 x2 = 2 x3 = 3 x4 = 4 x5 = 5
\↓ (t)
t0 = 0 u0,0 =0 u1,0 = −4 u2,0 = −12 u3,0 = −18 u4,0 = −16 u5,0 =0
t1 = 0.25 u0,1 =0 u1,1 = −6 u2,1 = −11 u3,1 = −14 u4,1 = −9 u5,1 =0
t2 = 0.5 u0,2 =0 u1,2 = −7 u2,2 = −8 u3,2 = −2 u4,2 = 2 u5,2 =0
t3 = 0.75 u0,3 =0 u1,3 = −2 u2,3 = 2 u3,3 = 8 u4,3 = 7 u5,3 =0
t4 = 1 u0,4 =0 u1,4 = 9 u2,4 = 14 u3,4 = 11 u4,4 = 6 u5,4 =0
I - row values: The values of the first row are calculated by using the given initial
condition
u(x, 0) = x2 (x − 5)
substituting x = 0, 1, 2, 3, 4, u(0,0) = 0, u(1,0) = (1)2 (1 − 5) = −4,
u(2,0) = (2)2 (2 − 5) = −12, u(3,0) = (3)2 (3 − 5) = −18, u(4,0) = (4)2 (4 − 5) = −16.
II - row values: The values of the second row are calculated by using the formulae.
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
put, i = 1,
1
u1,1 = [u0,0 + u2,0 ] = −6
2
put, i = 2,
1
u2,1 = [u1,0 + u3,0 ] = −11
2
put, i = 3,
1
u3,1 = [u2,0 + u4,0 ] = −14
2
put, i = 4,
1
[u3,0 + u4,0 ] = −9
u4,1 =
2
III - row values: Find the values of the third row are obtained, by using the
explicit fromulae
ui,j+1 = ui−1,j + ui+1,j − ui,j−1
Substitute j = 1,
ui,2 = ui−1,1 + ui+1,1 − ui,0
put, i = 1,
u1,2 = u0,1 + u2,1 − u1,0 = −7
put, i = 2,
u2,2 = u1,1 + u3,1 − u2,0 = −8
put, i = 3,
u3,2 = u2,1 + u4,1 − u3,0 = −2
put, i = 4,
u4,21 = u3,1 + u5,1 − u4,0 = 2
IV - row values: Find the values of the fourth row are calculate, by Substitute
j = 2 in the above equation
put, i = 1,
u1,3 = u0,2 + u2,2 − u1,1 = −2
put, i = 2,
u2,3 = u1,2 + u3,2 − u2,1 = 2
put, i = 3,
u3,3 = u2,2 + u4,2 − u3,1 = 8
put, i = 4,
u4,3 = u3,2 + u5,2 − u4,1 = 7
V - row values: Find the values of the fifth row are calculate, by Substitute j = 3
in the above equation
ui,4 = ui−1,3 + ui+1,3 − ui,2
\→ (x)
x0 = 0 x1 = 1 x2 = 2 x3 = 3 x4 = 4 x5 = 5
\↓ (t)
t0 = 0 u0,0 =0 u1,0 = 20 u2,0 = 15 u3,0 = 10 u4,0 = 5 u5,0 =0
t1 = 0.2 u0,1 =0 u1,1 = 7.5 u2,1 = 15 u3,1 = 10 u4,1 = 5 u5,1 =0
t2 = 0.4 u0,2 =0 u1,2 = −5 u2,2 = 2.5 u3,2 = 10 u4,2 = 5 u5,2 =0
t3 = 0.6 u0,3 =0 u1,3 = −5 u2,3 = 10 u3,3 = −2.5 u4,3 = 5 u5,3 =0
t4 = 0.8 u0,4 =0 u1,4 = −5 u2,4 = −10 u3,4 = −15 u4,4 = −7.5 u5,4 =0
t5 = 1 u0,5 =0 u1,5 = −5 u2,5 = −10 u3,5 = −15 u4,5 = −20 u5,5 =0
I - row values: The values of the first row are calculated by using the given initial
condition (
20x, 0 ≤ x ≤ 1
u(x, 0) =
5(5 − x), 1 ≤ x ≤ 5
substituting x = 0, 1, 2, 3, 4, u(0,0) = 0, u(1,0) = 20(1) = 20, u(2,0) = 5(5 − 2) = 15,
u(3,0) = 5(5 − 3) = 10, u(4,0) = 5(5 − 4) = 5.
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 54 / 105
Continued Unit - III Problems on Numerical Solution of One
Dimensional Wave Equation ...
II - row values: The values of the second row are calculated by using the formulae.
1
ui,1 = [ui−1,0 + ui+1,0 ]
2
put, i = 1,
1
u1,1 = [u0,0 + u2,0 ] = 7.5
2
put, i = 2,
1
u2,1 = [u1,0 + u3,0 ] = 15
2
put, i = 3,
1
u3,1 = [u2,0 + u4,0 ] = 10
2
put, i = 4,
1
u4,1 = [u3,0 + u4,0 ] = 5
2
III - row values: Find the values of the third row are calculate, by using the
explicit fromulae
ui,j+1 = ui−1,j + ui+1,j − ui,j−1
Substitute j = 1,
ui,2 = ui−1,1 + ui+1,1 − ui,0
put, i = 1,
u1,2 = u0,1 + u2,1 − u1,0 = −5
put, i = 2,
u2,2 = u1,1 + u3,1 − u2,0 = 2.5
put, i = 3,
u3,2 = u2,1 + u4,1 − u3,0 = 10
put, i = 4,
u4,21 = u3,1 + u5,1 − u4,0 = 5
IV - row values: Find the values of the fourth row are estimate, by Substitute
j = 2 in the above equation
put, i = 1,
u1,3 = u0,2 + u2,2 − u1,1 = −5
put, i = 2,
u2,3 = u1,2 + u3,2 − u2,1 = −10
put, i = 3,
u3,3 = u2,2 + u4,2 − u3,1 = −2.5
put, i = 4,
u4,3 = u3,2 + u5,2 − u4,1 = 5
V - row values: Find the values of the fifth row are estmate, by Substitute j = 3 in
the above equation
ui,4 = ui−1,3 + ui+1,3 − ui,2
put, i = 1,
u1,4 = u0,3 + u2,3 − u1,2 = −5
put, i = 2,
u2,4 = u1,3 + u3,3 − u2,2 = −10
put, i = 3,
u3,4 = u2,3 + u4,3 − u3,2 = −15
put, i = 4,
u4,4 = u3,3 + u5,3 − u4,2 = −7.5
VI - row values: Find the values of the sixth row are estmate, by Substitute j = 4
in the above equation
ui,5 = ui−1,4 + ui+1,4 − ui,3
put, i = 1,
u1,5 = u0,4 + u2,4 − u1,3 = −5
put, i = 2,
u2,5 = u1,4 + u3,4 − u2,3 = −10
put, i = 3,
u3,5 = u2,4 + u4,4 − u3,3 = −15
put, i = 4,
u4,5 = u3,4 + u5,4 − u4,3 = −20
∂2u ∂2u
2
+ =0 (12)
∂x ∂y 2
OR
uxx + uyy = 0
is known as a two dimensional Laplace equation. To solve a two dimensional Laplace
equation subjected to the given boundary conditions. Solving the a two dimensional
Laplace equation numerically is nothing but to finding an approximate values of the
dependent variable u at the given boumdary conditions. Substituting the partial
derivatives in terms of finite difference approximations in the Eqn. (12) and simplify
1 1
[ui−1,j − 2ui,j + ui+1,j ] + 2 [ui,j−1 − 2ui,j + ui,j+1 ] = 0
h2 k
By choosing the step lengths h = k, we get
1
ui,j =
[ui−1,j + ui+1,j + ui,j−1 + ui,j+1 ]
4
This is known as the Standard five point formulae.
Since the two dimensional Laplace equation remains same when the co - ordinates
are rotated through an angle 450 we can have formulae of the form
1
ui,j = [ui−1,j−1 + ui−1,j+1 + ui+1,j+1 + ui+1,j−1 ]
4
This is known as the Diagonal five point formulae.
i,j+1
1i-1.j i+1,j
i,j
i,j-1
1a
-1.j+l 4,+1.J+1
14.3
4-1.-1 4,+1.j-1
Note - 03: Solving the two dimensional Laplace numerically is nothing but to
finding an approximate values of the interoir mesh point values by using the given
boundary conditions.
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 63 / 105
Continued Unit - III on Numerical Solution of Two Dimensional Laplace
Equation ...
500 S0
20
O
30
5CC
20
30
Applying the standard five point formulae, we get the following system of equations
(n+1) 1 (n) (n)
u1 = [20 + u2 + 100 + u3 ]
4
(n+1) 1 (n+1) (n)
u2 [u
= + 100 + u4 ]
4 1
(n+1) 1 (n) (n+1)
u3 = [30 + u4 + u1 ]
4
(n+1) 1 (n+1) (n+1)
u4 = [u3 + u2 ]
4
1 (2)
(2) (2) 1
u4 =
[u + u2 ] = [24.4141 + 41.9141] = 16.5821
4 3 4
III - iteration: Put n = 2
1 4 9
0
1 2 4
O
4
ol
0 0
Solution: By data the boundary conditions in the following figure, Identify the
interiror points by u1 , u2 , u3 and u4 .
1 4 9
0
1 2 4
O
4
ol
0 0
By applying the standard five point formulae, we get, the following system of
equations.
(n+1) 1 (n) (n)
u1 = [u2 + 1 + u3 ]
4
(n+1) 1 (n+1) (n)
u2 = [u1 + 8 + u4 ]
4
(n+1) 1 (n) (n+1)
u3 = [u4 + u1 ]
4
(n+1) 1 (n+1) (n+1)
u4 = [u3 + 1 + u2 ]
4
1 (2)
(2) (2) 1
u4 =[u + 1 + u2 ] = [0.4844 + 1 + 2.4844] = 0.9922
4 3 4
III - iteration: Put n = 2
1 (2)
(3) (2)
u1 =
[u + 1 + u3 ] = 0.9922
4 2
(3) 1 (3)
u2 = [u1 + 8 + u24 ] = 2.4961
4
(3) 1 (2) (3)
u3 = [u4 + u1 ] = 0.4961
4
(3) 1 (3) (3)
u4 = [u3 + 1 + u2 ] = 0.9980
4
∴ u1 = 0.9922, u2 = 2.4961, u3 = 0.4921, u4 = 0.9980, are the interior points.
2000 500
2000 0
1000 500 0 0
Solution: Let u1 , u2 , u3 and u4 are thw interior points and find the initial
approximation values using standard five point formulae and diagonal five point
formulae.
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 77 / 105
Continued Unit - III Problems on Numerical Solution of Two
Dimensional Laplace Equation ...
Find the approximate value of u01 using diagonal five point formulae taking u4 = 0,
(0) 1
u1 = [1000 + 0 + 2000 + 1000] = 1000
4
Now, compute the rest of the approximate values u02 , u03 and u04 , using standard five
point formulae
(0) 1
u2 = [1000 + 500 + 0 + 1000] = 625
4
(0) 1
u3 = [2000 + 0 + 1000 + 500] = 875
4
(0) 1
u4 = [875 + 0 + 625 + 0] = 375
4
By applying the standard five point formulae, we get, the following system of
equations.
(n+1) 1 (n) (n)
u1 = [2000 + u2 + 1000 + u3 ]
4
(n+1) 1 (n) (n)
u2 = [u1 + 500 + 1000 + u4 ]
4
(n+1) 1 (n) (n)
u3 = [2000 + u4 + u1 + 500]
4
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 78 / 105
Continued Unit - III Problems on Numerical Solution of Two
Dimensional Laplace Equation ...
II - iteration: Put n = 1
(2) 1 (1) (1)
u1 = [2000 + u2 + 1000 + u3 ] = 1171.8750
4
1 (1)
(2) (1)
[u + 500 + 1000 + u4 ] = 525
u2 =
4 1
(2) 1 (1) (1)
u3 = [2000 + u4 + u1 + 500] = 1000
4
(2) 1 (1) (1)
u4 = [u3 + u2 ] = 343.75
4
∴ u1 = 1171.8750, u2 = 525, u3 = 1000 and u4 = 343.75
Problem - 01: Solve the Laplace’s equation uxx + uyy = 0, following square mesh
with boundary values as shown in the following figure.
O0 11.1 17 19.718.6
0 41 143 21.9
4A 621 21
149 17
0
8.7 12.1 12.8 9
Solution: Given the boundary conditions in the following figure and let us identify
the interior mesh points by u1 , u2 , u3 , u4 , u5 , u6 , u7 , u8 and u9 .
O0 11.1 17 19.718.6
0 41 143 21.9
4A 621 21
149 17
0
8.7 12.1 12.8 9
Dividing the given square region into four sub square regions and estimate an initial
approximations. The mesh point u5 be the centre mesh point and compute this value
of the mesh point u5 using standard five point formulae
(0) 1
u5 = [0 + 21 + 12.1 + 17] = 12.525
4
Here, the mesh points u1 , u3 , u7 and u9 are the centre mesh points of the squares
1, 2, 3, 4, compute these values using diagonal five point formulae
(0) 1
u1 = [0 + 12.525 + 0 + 17] = 7.38125
4
(0) 1
u3 = [12.525 + 18.6 + 17 + 21] = 17.28125
4
(0) 1
u7 = [0 + 12.1 + 0 + 12525] = 6.15625
4
(0) 1
u9 = [12.525 + 9 + 12.1 + 21] = 13.65625
4
(n+1) 1 n
u4 = [u5 + un+1
1 + un
7]
4
(n+1)1 n+1
u5 [u =+ un6 + u2
n+1
+ un
8]
4 4
(n+1) 1
u6 = [un+1 + 21 + un+1 + un
9]
4 5 3
(n+1) 1
u7 = [un 8 + u4
n+1
+ 8.7]
4
1 n+1
(n+1)
u8 [u + un n+1
9 + u5
= + 12.1]
4 7
(n+1) 1
u9 = [un+1 + 17 + un+1 + 12.8]
4 8 6
Problem - 02: Solve the Laplace’s equation ∇2 u = 0, in the square region bounded
by the co ordinate axes and the lines x = 4, y = 4 with the boundary conditions
given by the following analytical expressions. (a) u(0, y) = 0, for 0 ≤ y ≤ 4,
(b) u(4, y) = 12 + y, for 0 ≤ y ≤ 4,
(c) u(x, 0) = 3x, for 0 ≤ x ≤ 4,
(d) u(x, 4) = x2 , for 0 ≤ x ≤ 4.
Solution: Given the boundary conditions
(a) u(0, y) = 0, for 0 ≤ y ≤ 4,
u(0, y) = 0, → u(0, 0) = 0, u(0, 1) = 0, u(0, 2) = 0, u(0, 3) = 0 and u(0, 4) = 0
(b) u(4, y) = 12 + y, for 0 ≤ y ≤ 4,
u(4, y) = 12 + y, → u(4, 0) = 12, u(4, 1) = 13, u(4, 2) = 14, u(4, 3) = 15 and
u(4, 4) = 16,
(c) u(x, 0) = 3x, for 0 ≤ x ≤ 4,
u(x, 0) = 3x, → u(0, 0) = 0, u(1, 0) = 3, u(2, 0) = 6, u(3, 0) = 9 and u(4, 0) = 12
(d) u(x, 4) = x2 , for 0 ≤ x ≤ 4.
u(x, 4) = x2 , → u(0, 4) = 0, u(1, 4) = 1, u(2, 4) = 4, u(3, 4) = 9 and u(4, 4) = 16.
These boundary conditions were showned in the following figure and identify the
interior points by u1 , u2 , u3 , u4 , u5 , u6 , u7 , u8 and u9 .
4 9
16
0
2 15
4 45 6 14
0 |7 1g 13
3 9 12
Dividing the given square region into four sub square regions and estimate an initial
approximations. The mesh point u5 be the centre mesh point and compute this value
of the mesh point u5 using standard five point formulae
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 89 / 105
Continued Unit - III Problems on Numerical Solution of Two
Dimensional Laplace Equation ...
1
(0)
u5 =[0 + 14 + 4 + 6] = 6
4
Here, the mesh points u1 , u3 , u7 and u9 are the centre mesh points of the squares
1, 2, 3, 4, compute these values using diagonal five point formulae
(0) 1
u1 = [0 + 4 + 0 + 6] = 2.5
4
(0) 1
u3 = [6 + 16 + 4 + 14] = 10
4
(0) 1
u7 = [0 + 6 + 0 + 6] = 3
4
(0) 1
u9 = [6 + 14 + 6 + 12] = 9.5
4
Again, estimate the remaining mesh points u2 , u4 , u6 and u8 using standard five
point formulae
(0) 1
u2 = [2.5 + 10 + 4 + 6] = 5.625
4
(0) 1
u4 = [0 + 6 + 2.5 + 3] = 2.875
4
(0) 1
u6 = [6 + 14 + 10 + 9.5] = 9.875
4
(0) 1
u8 = [3 + 9.5 + 6 + 6] = 6.125
4
Applying, the standard five point formulae, we get, the following system of equations.
(n+1) 1 n
u1 = [u2 + 1 + un
4]
4
(n+1) 1 n+1
u2 = [u + un n
3 + 4 + u5 ]
4 1
(n+1) 1
u3 = [un+1 + 15 + 9 + un
6]
4 2
Dr. Vijaya kumar, MSRIT, Bengaluru - 560
Engineering
054 Mathematics - IV - ME 41 June 1, 2021 91 / 105
Continued Unit - III Problems on Numerical Solution of Two
Dimensional Laplace Equation ...
(n+1) 1 n
u4 = [u5 + un+1
1 + un
7]
4
(n+1)1 n+1
u5 [u = + un n+1
6 + u2 + un
8]
4 4
(n+1) 1
u6 = [un+1 + 14 + un+1 + un
9]
4 5 3
(n+1) 1
u7 = [un n+1
8 + u4 + 3]
4
(n+1) 1 n+1
u8 = [u + un n+1
9 + u5 + 6]
4 7
(n+1) 1
u9 = [un+1 + 13 + un+1 + 9]
4 8 6
∂2u ∂2u
+ = f (x, y) (13)
∂x2 ∂y 2
OR
uxx + uyy = f (x, y)
is known as a two dimensional Poisson’s equation. To solve a two dimensional
Poisson’s equation subjected to the given boundary conditions. Solving the a two
dimensional Poisson’s equation numerically is nothing but to finding an approximate
values of the dependent variable u at the given boumdary conditions. Substituting
the partial derivatives in terms of finite difference approximations in the Eqn. (13)
and simplify
1 1
[ui−1,j − 2ui,j + ui+1,j ] + 2 [ui,j−1 − 2ui,j + ui,j+1 ] = f (x, y)
h2 k
This is called as a standard five point formulae to solve two dimensional Poisson’s
equation numerically. Estimate the interiror mesh points using standard five point
formulae for the given boundary conditions in the given problem.
Problem - 01: Solve the Poisson’s equation uxx + uyy = −81xy, 0 < x < 1,
0 < y < 1, given that, u(0, y) = 0, u(x, 0) = 0, u(1, y) = 100, u(x, 1) = 100 and h = 13 .
Solution: Given the boundary conditions u(0, y) = 0, u(x, 0) = 0, u(1, y) = 100,
u(x, 1) = 100, h = 13 and f (x, y) = −81xy, f (ih, jk) = −81(ih)(jh) = −h2 81(i)(j).
We know that, the standard five point formulae
100u= 100
100
100
100
0 u=0 0
Fig. 33.9
Fa
X
Fig. 33.10o
u3 + 0 + u2 − 4u4 = −150
1
u4 = (u2 + u3 + 150) (21)
4
We can observe the equations (18) and (21) are same u1 = u4 and the above four
equations are reduces to
1
u1 = (u2 + u3 + 150)
4
1
u2 = (u1 + 90)
2
1
u2 = (u1 + 60)
2
Now, solving these three equations by using Gauss - elimination iterative method
(0) (0)
taking the initial approximations u2 = 0 and u3 = 0
I - iteration:
(1) 1 (0) (0) (1) 1 (1) (1) 1 (1)
u1 = (u + u3 + 150) = 37.5, u2 = (u1 + 90) = 64, u2 = (u1 + 60) = 49.
4 2 2 2
II - iteration:
(2) 1 (1) (1) (2) 1 (2) (2) 1 (2)
u1 = (u + u3 + 150) = 66, u2 = (u1 + 90) = 78, u2 = (u1 + 60) = 63.
4 2 2 2
III - iteration:
(3) 1 (2) (2) (3) 1 (3) (3) 1 (3)
u1 = (u + u3 + 150) = 73, u2 = (u1 + 90) = 82, u2 = (u1 + 60) = 67.
4 2 2 2
IV - iteration:
(4) 1 (3) (3) (4) 1 (4) (4) 1 (4)
u1 = (u + u3 + 150) = 75, u2 = (u1 + 90) = 82.5, u2 = (u1 + 60) = 67.5.
4 2 2 2
V - iteration:
(5) 1 (4) (4) (5) 1 (5) (5) 1 (5)
u1 = (u + u3 + 150) = 75, u2 = (u1 + 90) = 82.5, u2 = (u1 + 60) = 67.5.
4 2 2 2
Hence, the fourth and fifth iterations are same. therefore, the approximate values of
the interior mesh points are u1 = 75, u2 = 82.5, u3 = 67.5 and u1 = 75.