0% found this document useful (0 votes)
5 views34 pages

Numerical Solutions to PDE

The document discusses numerical solutions of partial differential equations (PDEs), focusing on the finite-difference method for solving elliptic, parabolic, and hyperbolic equations. It covers the classification of second-order PDEs, finite difference approximations for derivatives, and methods for solving heat and wave equations. Additionally, it introduces explicit and implicit methods, including the Crank-Nicolson method, for solving parabolic equations with boundary and initial conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views34 pages

Numerical Solutions to PDE

The document discusses numerical solutions of partial differential equations (PDEs), focusing on the finite-difference method for solving elliptic, parabolic, and hyperbolic equations. It covers the classification of second-order PDEs, finite difference approximations for derivatives, and methods for solving heat and wave equations. Additionally, it introduces explicit and implicit methods, including the Crank-Nicolson method, for solving parabolic equations with boundary and initial conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Numerical solutions of PDE: Classification of second order

equations, finite difference approximation to derivatives,


solution of heat equations, solution of wave equations and
solution of Laplace equation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Introduction:
The partial differential equation (PDE) is one of the most important and useful
topics of mathematics, physics and different branches of engineering. But, finding of
solution of PDEs is a very difficult task. Several analytical methods are available to
solve PDEs, but, all these methods need in depth mathematical knowledge. On the
other hand numerical methods are simple, but generate erroneous result. Most widely
used numerical method is finite-difference method due to its simplicity. In this module,
only finite-difference method is discussed to solve PDEs.

1.1 Classification of partial differential equations

The general second order PDE is of the following form:


∂2u ∂2u ∂2u ∂u ∂u
A + B + C +D +E + Fu = G (1.1)
∂x2 ∂x∂y ∂y 2 ∂x ∂y
i.e., Auxx + Buxy + Cuyy + Dux + Euy + F u = G, (1.2)

where A, B, C, D, E, F, G are functions of x and y.


The second order PDEs are of three types, viz. elliptic, hyperbolic and parabolic.
The type of a PDE can be determined by finding the discriminant

∆ = B 2 − 4AC.

The PDE of equation (1.2) is called elliptic, parabolic and hyperbolic according as
the value of ∆ at any point (x, y) is < 0, = 0 or > 0.
Elliptic equation

The most simple examples of this type of PDEs are Poisson’s equation
∂2u ∂2u
+ 2 = g(x, y) (1.3)
∂x2 ∂y
and Laplace equation
∂2u ∂2u
+ 2 =0 or ∇2 u = 0. (1.4)
∂x2 ∂y
The analytic solution of an elliptic equation is a function of x and y which satisfies
the PDE at every point of the region S which is bounded by a plane closed curve C
and satisfies some conditions at every point on C. The condition that the dependent
variable satisfies along the boundary curve C is known as boundary condition.
1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Parabolic

Parabolic equation

The simplest example of parabolic equation is the heat conduction equation


∂u ∂2u
= α 2. (1.5)
∂t ∂x
In parabolic PDE, time t is involved as an independent variable.
The solution u represents the temperature at a distance x units from one end of
a thermally insulated bar after t seconds of heat conduction. In this problem, the
temperature at the ends of a bar are known for all time, i.e. the boundary conditions
are known.

Hyperbolic equation

The third type PDE is hyperbolic. Also, in this equation time t is taken as an indepen-
dent variable.
The simplest example of hyperbolic equation is the one-dimensional wave equation
∂2u 2
2∂ u
= c . (1.6)
∂t2 ∂x2

Here, u is the transverse displacement of a vibrating string of length l at a distance


x from one end after a time t.
Hyperbolic equations generally originate from vibration problems.
The values of u at the ends of the string are generally known for all time (i.e. boundary
conditions are known) and the shape and velocity of the string are given at initial time
(i.e. initial conditions are known).

1.2 Finite-difference approximation to partial derivatives

Let x and y be two independent variables and u be the dependent variable of the
given PDE. Now, we divide the xy-plane into set of equal rectangles of lengths ∆x = h
and ∆y = k by drawing the equally spaced grid lines parallel to the coordinates axes.
That is,

xi = ih, i = 0, ±1, ±2, . . .


yj = jk, j = 0, ±1, ±2, . . . .
2
......................................................................................

The intersection of horizontal and vertical lines is called mesh point and the ijth
mesh point is denoted by P (xi , yj ) or P (ih, jk). The value of u at this mesh point is
denoted by ui,j , i.e. ui,j = u(xi , yj ) = u(ih, jk).
The first order partial derivatives at this mesh point are approximated as follows:
ui+1,j − ui,j
ux (ih, jk) = + O(h) (1.7)
h
(forward difference approximation)
ui,j − ui−1,j
= + O(h) (1.8)
h
(backward difference approximation)
ui+1,j − ui−1,j
= + O(h2 ) (1.9)
2h
(central difference approximation)

Similarly, ui,j+1 − ui,j


uy (ih, jk) = + O(k) (1.10)
k
(forward difference approximation)
ui,j − ui,j−1
= + O(k) (1.11)
k
(backward difference approximation)
ui,j+1 − ui,j−1
= + O(k2 ) (1.12)
2k
(central difference approximation)

The second order partial derivatives are approximated as follows:


ui−1,j − 2ui,j + ui+1,j
uxx (ih, jk) = + O(h2 ). (1.13)
h2
ui,j−1 − 2ui,j + ui,j+1
uyy (ih, jk) = + O(k2 ). (1.14)
k2
The above equations are used to approximate a PDE to a system of difference equa-
tions.

1.3 Parabolic equations

Here, two methods are described to solve a parabolic PDE.


Let us consider the following parabolic equation known as heat conduction equation
∂u ∂2u
=α 2 (1.15)
∂t ∂x
3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Parabolic

with the initial condition u(x, 0) = f (x) and the boundary conditions u(0, t) = φ(t), u(1, t) =
ψ(t).

1.3.1 An explicit method

We approximate the given PDE by using the finite-difference approximation for ut


and uxx defined in (1.10) and (1.13). Then the equation (1.15) reduces to

ui,j+1 − ui,j ui−1,j − 2ui,j + ui+1,j


≃α , (1.16)
k h2

where xi = ih and tj = jk; i, j = 0, 1, 2, . . ..


After simplification the above equation becomes

ui,j+1 = rui−1,j + (1 − 2r)ui,j + rui+1,j , (1.17)

where r = αk/h2 .
From this formula one can compute the value of ui,j+1 at the mesh point (i, j + 1)
when the values of ui−1,j , ui,j and ui+1,j are known. So this method is called the explicit
method. By stability analysis, it can be shown that the formula is stable, if 0 < r ≤ 1/2.
The grids and mesh points are shown in Figure 1.1. For this problem, the initial and
boundary values are given. These values are shown in the figure by filled circles. That
is, the values of u are known along x-axis and two vertical lines (t = 0 and t = 1). Also,
it is mentioned in the figure that if the values at the meshes (i − 1, j), (i, j) and (i + 1, j)
are known (shown by filled circles) then one can determine the value of u for the mesh
(i, j + 1) (shown by circle).

Example 1.1 Solve the following heat equation


∂u ∂2u
=
∂t ∂x2

subject to the boundary conditions u(0, t) = 0, u(1, t) = 3t and initial condition u(x, 0) =
1.5x.

Solution. Let h = 0.2 and k = 0.01, so r = k/h2 = 0.25 < 1/2. The initial and
boundary values are shown in the following table.
4
......................................................................................

t 6
u u

u u
u known values
u e u
ui,j+1 ⊕ unknown value

u u u u u
ui−1,j ui,j ui+1,j
u u
6
k h-
u? u u u u u u- x
t = 0, u = f (x)

Figure 1.1: Known and unknown meshes of heat equation

j = 5, t = 0.05 0.0 0.15


j = 4, t = 0.04 0.0 0.12
j = 3, t = 0.03 0.0 0.09
j = 2, t = 0.02 0.0 0.06
j = 1, t = 0.01 0.0 0.03
j = 0, t = 0.00 0.0 0.3 0.6 0.9 1.2 0.00
x=0 x = 0.2 x = 0.4 x = 0.6 x = 0.8 x = 1.0
i=0 i=1 i=2 i=3 i=4 i=5
∂u ui,j+1 − ui,j
Using the finite difference approximations = and
∂t k
∂2u ui−1,j − 2ui,j + ui+1,j
= , the given PDE reduces to
∂x2 h2
1
ui,j+1 = (ui−1,j + 2ui,j + ui+1,j ).
4
From this equation, we get
1
u1,1 = (u0,0 + 2u1,0 + u2,0 ) = 0.3
4
1
u2,1 = (u1,0 + 2u2,0 + u3,0 ) = 0.6
4
and so on.
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Parabolic

The values of u for all meshes are shown in the following table.

j = 5, t = 0.05 0.0 0.28104 0.50125 0.56968 0.42396 0.15


j = 4, t = 0.04 0.0 0.29264 0.53888 0.63460 0.47062 0.12
j = 3, t = 0.03 0.0 0.30000 0.57656 0.71438 0.53906 0.09
j = 2, t = 0.02 0.0 0.30000 0.60000 0.80625 0.64500 0.06
j = 1, t = 0.01 0.0 0.30000 0.60000 0.90000 0.82500 0.03
j = 0, t = 0.00 0.0 0.30000 0.60000 0.90000 1.20000 0.00
x=0 x = 0.2 x = 0.4 x = 0.6 x = 0.8 x = 1.0
i=0 i=1 i=2 i=3 i=4 i=5

1.3.2 Crank-Nicolson implicit method

The above explicit method is very simple and it has limitation. This method is
stable if 0 < r ≤ 1/2, i.e. 0 < αk/h2 ≤ 1/2, or αk ≤ h2 /2. That is, the value of k
must be chosen very small, and it takes time to get the result at a particular mesh. In
1947, Crank and Nicolson have developed an implicit method which reduces the total
computation time. Also, the method is applicable for all finite values of r. In this
method, the given PDE is approximated by replacing both space and time derivatives
by their central difference approximations at the midpoint of the points (ih, jk) and
(ih, (j + 1)k), i.e. at the point (ih, (j + 1/2)k). To use approximation at this point, we
write the equation (1.15) in the following form
 2 
α ∂2u
     2  
∂u ∂ u ∂ u
=α = + . (1.18)
∂t i,j+1/2 ∂x2 i,j+1/2 2 ∂x2 i,j ∂x2 i,j+1

Then using central difference approximation the above equation reduces to


 
ui,j+1 − ui,j α ui+1,j − 2ui,j + ui−1,j ui+1,j+1 − 2ui,j+1 + ui−1,j+1
= + .
k 2 h2 h2
After simplification, we get the following equation

−rui−1,j+1 + (2 + 2r)ui,j+1 − rui+1,j+1 = rui−1,j + (2 − 2r)ui,j + rui+1,j , (1.19)

where r = αk/h2 and j = 0, 1, 2, . . ., i = 1, 2, . . . , (N − 1), N is the number of subdivi-


sions of x.
6
......................................................................................

In general, the left hand side of the above equation contains three unknowns values,
but the right hand side has three known values of u.

The known (circle) and unknown (filled circle) meshes are shown in Figure 1.2.

For j = 0 and i = 1, 2, . . . , N −1, equation (1.19) generates N simultaneous equations


for N − 1 unknown u1,1 , u2,1 , . . . , uN −1,1 (of first row) in terms of known initial values
u1,0 , u2,0 , . . . , uN −1,0 and boundary values u0,0 and uN,0 . Thus, for this problem initial
and boundary conditions are required.

Similarly, for j = 1 and i = 1, 2, . . . , N − 1 we obtain another system of equations


containing the unknowns u1,2 , u2,2 , . . . , uN −1,2 in terms of known values obtained in
previous step.

Thus for each value of j (j = 2, 3, . . .), there is a system of equations.

t
6
u u

u e e e u
j+1
u e
u u u u ⊕ unknown values
j u known values
u u

u u u u u u u- x
i=0 i−1 i i+1 i=N

Figure 1.2: Meshes of Crank-Nicolson implicit method

In this method, the value of ui,j+1 is not expressed directly in terms of known values
of u’s obtained in earlier step, it is written as unknown values, and hence the method
is implicit.

The system of equations (1.19) for a fixed j, can be expressed as the following matrix
notation.
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Parabolic

    
2+2r −r u1,j+1 d1,j
  u2,j+1   d2,j
    

 −r 2+2r −r   


 · · · · · · · · · · · · · · · · · · · · ·   u3,j+1  =  d3,j (1.20)
    

  ..   .. 

 −r 2+2r −r  

.
 
  .


−r 2+2r uN −1,j+1 dN −1,j

where

d1,j = ru0,j + (2 − 2r)u1,j + ru2,j + ru0,j+1


di,j = rui−1,j + (2 − 2r)ui,j + rui+1,j ; i = 2, 3, . . . , N − 2
dN −1,j = ruN −2,j + (2 − 2r)uN −1,j + ruN,j + ruN,j+1 .

Note that the right hand side of equation (1.20) is known.


This is a tri-diagonal system of linear equations and it can be solved by any method
discussed in Chapter 5 or the special method for tri-diagonal equations.

1
Example 1.2 Solve the following problem by Crank-Nicolson method by taking h =
4
1 1
and k = ,
8 16
∂u ∂2u
= , 0 < x < 1, t > 0
∂t ∂x2
where u(0, t) = u(1, t) = 0, t > 0, u(x, 0) = 3x, t = 0.

Solution. Case I.
1 1 k
Let h = and k = . Therefore, r = 2 = 2.
4 8 h
The Crank-Nicolson scheme is

−ui−1,j+1 + 3ui,j+1 − ui+1,j+1 = ui−1,j − ui,j + ui+1,j .

The initial and boundary conditions are shown in Figure 1.3.


The initial values are u0,0 = 0, u1,0 = 0.75, u2,0 = 1.5, u3,0 = 2.25, u4,0 = 3 and the
boundary values are u0,1 = 0, u4,1 = 0.
8
......................................................................................

t
6u0,1 u1,1 u2,1 u3,1 u4,1
j=1, t= 81 u e e e u
A B C
u0,0 u1,0 u2,0 u3,0 u
j=0, t=0 u u u u u-4,0x
i=0 i=1 i=2 i=3 i=4
x=0 x= 14 x= 12 x= 34 x=1

Figure 1.3: Boundary and initial values when h = 1/4, k = 1/8.

The unknown meshes are A(i = 1, j = 1), B(i = 2, j = 1) and C(i = 3, j = 1). Hence
the system of equations is

−u0,1 + 3u1,1 − u2,1 = u0,0 − u1,0 + u2,0


−u1,1 + 3u2,1 − u3,1 = u1,0 − u2,0 + u3,0
−u2,1 + 3u3,1 − u4,1 = u2,0 − u3,0 + u4,0 .

Using initial and boundary values the above system of equations becomes

0 + 3u1,1 − u2,1 = 0 − 0.75 + 1.5 = 0.75


−u1,1 + 3u2,1 − u3,1 = 0.75 − 1.5 + 2.25 = 1.5
−u2,1 + 3u3,1 + 0 = 1.5 − 2.25 + 3.0 = 2.25.

This is a system of three linear equations with three unknowns. The solution of this
system is
u1,1 = u(0.25, 0.125) = 0.60714, u2,1 = u(0.50, 0.125) = 1.07143,
u3,1 = u(0.75, 0.125) = 1.10714.

Case II.
1 1 1
Let h = , k = . Therefore, r = 1. To find the value of u at t = , we have to solve
4 16 8
two systems of tri-diagonal equations in two steps.
The Crank-Nicolson scheme is

−ui−1,j+1 + 4ui,j+1 − ui+1,j+1 = ui−1,j + ui+1,j .

For this case, the initial and boundary conditions are shown in Figure 1.4.
9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Parabolic

t
6u0,2 u1,2 u2,2 u3,2 u4,2
j=2, t= 18 u e e e u
D E F
u0,1 u1,1 u2,1 u3,1 u4,1
1
j=1, t= 16 u e e e u
A B C
u0,0 u1,0 u2,0 u3,0 u
j=0, t=0 u u u u u-4,0x
i=0 i=1 i=2 i=3 i=4
x=0 x= 14 x= 12 x= 34 x=1

Figure 1.4: Boundary and initial values when h = 1/4, k = 1/16.

That is, the initial values are, u0,0 = 0, u1,0 = 0.75, u2,0 = 1.5, u3,0 = 2.25, u4,0 = 3
and the boundary values are u0,1 = 0, u4,1 = 0; u0,2 = 0, u4,2 = 0.
Here, r = 1, so the middle term of right hand side of Crank-Nicolson equation
vanishes. Thus the Crank-Nicolson equations for first step, i.e. for the mesh points
A(i = 1, j = 1), B(i = 2, j = 1) and C(i = 3, j = 1) are respectively
−u0,1 + 4u1,1 − u2,1 = u0,0 + u2,0
−u1,1 + 4u2,1 − u3,1 = u1,0 + u3,0
−u2,1 + 4u3,1 − u4,1 = u2,0 + u4,0 .

That is,
4u1,1 − u2,1 = 0 + 1.5 = 1.5
−u1,1 + 4u2,1 − u3,1 = 0.75 + 2.25 = 3.0
−u2,1 + 4u3,1 = 1.5 + 3 = 4.5.

The solution of this system of equations is


u1,1 = u(0.25, 0.0625) = 0.69643, u2,1 = u(0.50, 0.0625) = 1.28571,
u3,1 = u(0.75, 0.0625) = 1.44643.
Again, the Crank-Nicolson equations for the mesh points
D(i = 1, j = 2), E(i = 2, j = 2) and F (i = 3, j = 2) are respectively,

−u0,2 + 4u1,2 − u2,2 = u0,1 + u2,1


−u1,2 + 4u2,2 − u3,2 = u1,1 + u3,1
−u2,2 + 4u3,2 − u4,2 = u2,1 + u4,1 .
10
......................................................................................

Using boundary conditions and values of right hand side obtained in first step, the
above system becomes

4u1,2 − u2,2 = 0 + 1.28571 = 1.28571


−u1,2 + 4u2,2 − u3,2 = 0.69643 + 1.44643 = 2.14286
−u2,2 + 4u3,2 = 1.28571 + 0 = 1.28571.

The solution of this system is


u1,2 = u(0.25, 0.125) = 0.52041, u2,2 = u(0.50, 0.125) = 0.79592,
u3,2 = u(0.75, 0.125) = 0.52041.

11
......................................................................................

Practice Questions
1. Solve the heat equation
∂u ∂2u
=α 2
∂t ∂x
subject to the conditions u(x, 0) = 0, u(0, t) = 0 and u(1, t) = 2t, taking h =
1/2, k = 1/16.
∂2u ∂u
2. Given the differential equation 2
= and the boundary condition u(0, t) =
∂x ∂t
2 2
u(5, t) = 0 and u(x, 0) = x (30 − x ). Use the explicit method to obtain the
solution for xi = ih, yj = jk; i = 0, 1, . . . , 5 and j = 0, 1, 2, . . . , 6.

∂u ∂2u
3. Solve the differential equation = , 0 ≤ x ≤ 1/2, given that u = 0 when
∂t ∂x2
∂u ∂u
t = 0, 0 ≤ x ≤ 1/2 and with boundary conditions = 0 at x = 0 and = 1 at
∂x ∂x
x = 1/2 for t > 0, taking h = 0.1, k = 0.001.

4. Solve the following initial value problem ft = fxx , 0 ≤ x ≤ 1 subject to the initial
πx
condition f (x, 0) = cos and the boundary conditions f (0, t) = 1, f (1, t) = 0 for
2
t > 0, taking h = 1/3, k = 1/3.

5. Solve the parabolic differential equation ut = uxx , 0 ≤ x ≤ 1 subject to the


boundary conditions u = 0 at x = 0 and x = 1 for t > 0 and the initial conditions
(
2x for 0 ≤ x ≤ 1/2
u(x, 0) =
2(1 − x) for 1/2 ≤ x ≤ 1,

using explicit method.

15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Hyperbolic

In this module, two other types of partial differential equations are considered. These
are hyperbolic and elliptic PDEs. Finite difference method is also used to solve these
problems. First we consider hyperbolic equation.

2.1 Hyperbolic equations

The simplest problem of this class is one dimensional wave equation. This problem
may occurs in many real life situations. For example, the transverse vibration of a
stretched string, propagation of light and sound, propagation of water wave, etc. It
arises in different fields such as acoustics, electromagnetics, fluid dynamics, etc.
The simplest form of the wave equation is given below:
Let u = u(r, t), r ∈ Rn be a scalar function which satisfies
∂2u
= c2 ∇2 u, (2.1)
∂t2
where ∇2 is the Laplacian in Rn and c is a constant speed of the wave propagation.
This equation can also be written as
1 ∂2
2 u = 0, where 2 = ∇2 − . (2.2)
c2 ∂t2
The operator 2 is called d’Alembertian.
In case of one dimension, the above equation is
∂2u 2
2∂ u
= c , t > 0, 0 < x < 1. (2.3)
∂t2 ∂x2
The initial conditions are u(x, 0) = f (x) and
 
∂u
= g(x), 0 < x < 1 (2.4)
∂t (x,0)
and the boundary conditions are

u(0, t) = φ(t) and u(1, t) = ψ(t), t ≥ 0. (2.5)

In finite difference method, the partial derivatives uxx and utt are approximated by
the following central-difference schema at the mesh points (xi , tj ) = (ih, jk) are
1
uxx = (ui−1,j − 2ui,j + ui+1,j ) + O(h2 )
h2
1
and utt = 2 (ui,j−1 − 2ui,j + ui,j+1 ) + O(k2 ),
k
2
......................................................................................

where i, j = 0, 1, 2, . . ..
Using this approximation, the equation (2.3) reduces to

1 c2
2
(ui,j−1 − 2ui,j + ui,j+1 ) = 2 (ui−1,j − 2ui,j + ui+1,j ).
k h
That is,
ui,j+1 = r 2 ui−1,j + 2(1 − r 2 )ui,j + r 2 ui+1,j − ui,j−1 , (2.6)

where r = ck/h.
Note that the value of ui,j+1 depends on the values of u at two time-levels (j − 1), j
and the value of ui,j+1 can be determined if the four values ui−1,j , ui,j , ui+1,j , ui,j−1 are
known.
The known (filled circle) and unknown (circle) values of u are shown in Figure 2.1.
t
6
j+1 e
⊕ unknown values
j u u u u known values

j−1 u

- x
i−1 i i+1

Figure 2.1: Known and unknown meshes for hyperbolic equations.

When j = 0, then from the equation (2.6) we get

ui,1 = r 2 ui−1,0 + 2(1 − r 2 )ui,0 + r 2 ui+1,0 − ui,−1 .

Since, u(x, 0) = f (x), ui,0 = f (xi ) = fi . Using this notation, the above equation
reduces to

ui,1 = r 2 fi−1 + 2(1 − r 2 )fi + r 2 fi+1 − ui,−1 . (2.7)

Now, by central difference approximation, the initial condition (2.4), becomes


1
(ui,1 − ui,−1 ) = gi .
2k
3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Hyperbolic

Substituting the value of ui,−1 to the equation (2.7), we get


1 2
r fi−1 + 2(1 − r 2 )fi + r 2 fi+1 + 2kgi .

ui,1 = (2.8)
2
Thus, from equation (2.8) we obtain the values of ui,1 for all values of i.
The truncation error of this method is O(h2 + k2 ) and the formula (2.6) is convergent
for 0 < r ≤ 1.

Example 2.1 Consider the following wave equation


∂2u 2
2∂ u
= c .
∂t2 ∂x2
The boundaryconditions
 u(0, t) = 0, u(1, t) = 0, t > 0 and the initial conditions
∂u
u(x, 0) = 4x2 , = 0, 0 ≤ x ≤ 1. Find the value of u for x = 0, 0.2, 0.4, . . . , 1.0
∂t (x,0)
and t = 0, 0.1, 0.2, . . . , 0.5, when c = 1.
Solution. Using central-difference approximation, the explicit formula for the given
equation is

ui,j+1 = r 2 ui−1,j + 2(1 − r 2 )ui,j + r 2 ui+1,j − ui,j−1 . (2.9)

Let h = 0.2 and k = 0.1, so r = ck/h = 0.5 < 1.


The boundary conditions transferred to u0,j = 0, u5,j = 0. The initial conditions
ui,1 − ui,−1
reduce to ui,0 = 4x2i , i = 1, 2, 3, 4, 5 and = 0, therefore ui,−1 = ui,1 .
2k
Since r = 0.5, the difference equation (2.9) becomes

ui,j+1 = 0.25ui−1,j + 1.5ui,j + 0.25ui+1,j − ui,j−1 . (2.10)

When j = 0, then

ui,1 = 0.25ui−1,0 + 1.5ui,0 + 0.25ui+1,0 − ui,−1


i.e. ui,1 = 0.125ui−1,0 + 0.75ui,0 + 0.125ui+1,0 , [using ui,−1 = ui,1 ]
= 0.125(ui−1,0 + ui+1,0 ) + 0.75ui,0 .

This formula gives the values of u for j = 1. For other values of j (j = 2, 3, . . .) the
values of u are calculated from the formula (2.10).
The initial and boundary values are shown in the following table.
4
......................................................................................

j = 5, t = 0.5 0 0
j = 4, t = 0.4 0 0
j = 3, t = 0.3 0 0
j = 2, t = 0.2 0 0
j = 1, t = 0.1 0 0
j = 0, t = 0.0 0 0.16 0.64 1.44 2.56 0
x=0 x = 0.2 x = 0.4 x = 0.6 x = 0.8 x = 1.0
i=0 i=1 i=2 i=3 i=4 i=5

The values of first row, i.e. ui,1 , i = 1, 2, 3, 4 are calculated as follows:

u1,1 = 0.125(u0,0 + u2,0 ) + 0.75u1,0 = 0.20


u2,1 = 0.125(u1,0 + u3,0 ) + 0.75u2,0 = 0.68
u3,1 = 0.125(u2,0 + u4,0 ) + 0.75u3,0 = 1.48
u4,1 = 0.125(u3,0 + u5,0 ) + 0.75u4,0 = 2.10.

Other values are written in the following table.

j = 5, t = 0.5 0 0.74328 0.89226 −0.50500 −1.25125 0


j = 4, t = 0.4 0 0.62906 1.05875 0.45250 −1.10375 0
j = 3, t = 0.3 0 0.46500 0.96625 1.17250 −0.29125 0
j = 2, t = 0.2 0 0.31000 0.80000 1.47500 0.96000 0
j = 1, t = 0.1 0 0.20000 0.68000 1.48000 2.10000 0
j = 0, t = 0.0 0 0.16000 0.64000 1.44000 2.56000 0
x=0 x = 0.2 x = 0.4 x = 0.6 x = 0.8 x = 1.0
i=0 i=1 i=2 i=3 i=4 i=5

2.1.1 Implicit difference methods

Generally, implicit methods generate a tri-diagonal system of algebraic equations.


Thus, it is suggested that the implicit methods should not be used without simplifying
assumption to solve pure BVPs, because these methods generate large number of equa-
tions for small h and k. But, these methods may be used for initial-boundary value
problems. Two such implicit methods are described below.
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Hyperbolic

Implicit Method-I

The right hand side of the equation (2.3) is divided into two parts. Now, by central-
difference approximation at the mesh point (ih, jk) the given equation reduces to
 2  " #
c2 ∂2u
  2 
∂ u ∂ u
= + .
∂t2 i,j 2 ∂x2 i,j+1 ∂x2 i,j−1

That is,
1
[ui,j+1 − 2ui,j + ui,j−1 ] (2.11)
k2
c2
= 2 [(ui+1,j+1 − 2ui,j+1 + ui−1,j+1 ) + (ui+1,j−1 − 2ui,j−1 + ui−1,j−1 )].
2h

Implicit Method-II

Again, we divide the right hand side of the given equation into three parts as
" #
∂2u c2 ∂2u
    2   2 
∂ u ∂ u
= +2 + .
∂t2 i,j 4 ∂x2 i,j+1 ∂x2 i,j ∂x2 i,j−1
By central-difference approximation the given equation reduces to
1
[ui,j+1 − 2ui,j + ui,j−1 ]
k2
c2
= 2 [(ui+1,j+1 − 2ui,j+1 + ui−1,j+1 ) (2.12)
4h
+2(ui+1,j − 2ui,j + ui−1,j ) + (ui+1,j−1 − 2ui,j−1 + ui−1,j−1 )].

The above equation can be written as


 2
−ui−1,j+1 + 2 1 + 2 ui,j+1 − ui+1,j+1
r
h  2 i
= 2 ui−1,j − 2 1 − 2 ui,j + ui+1,j
r
h  2 i
+ ui−1,j−1 − 2 1 + 2 ui,j−1 + ui+1,j−1 (2.13)
r
where r = ck/h.
This is a system of linear tri-diagonal equations and it can be solved by any method.
The above system of equations can also be written as
6
......................................................................................

    
2s −1 0 0 0 ··· 0 0 u1,j+1 d1,j+1
 −1 2s −1 0 0 · · · 0 0   u2,j+1   d2,j+1 
    
    
 0 −1 2s −1 0 · · · 0 0   u   d 
  3,j+1   3,j+1 
=

  
 0 0 −1 2s −1 · · · 0 0    u4,j+1   d4,j+1 
   

··· ··· ··· ··· ··· ··· ··· ··· ···   ··· 
    

0 0 0 0 0 · · · −1 2s uN −1,j+1 dN −1,j+1

where s = 1 + 2/r 2 and

d1,j = u0,j+1 + 2[u0,j − 2(1 − 2/r 2 )u1,j + u2,j ] + [u0,j−1 − 2(1 + 2/r 2 )u1,j−1 + u2,j−1 ]
di,j = 2[ui−1,j − 2(1 − 2/r 2 )ui,j + ui+1,j ]
+[ui−1,j−1 − 2(1 + 2/r 2 )ui,j−1 + ui+1,j−1 ]
i = 2, 3, . . . , N − 2
dN −1,j = uN,j+1 + 2[uN −2,j − 2(1 − 2/r 2 )uN −1,j + uN,j ]
+[uN −2,j−1 − 2(1 + 2/r 2 )uN −1,j−1 + uN,j−1 ]

For a particular value of j = k, k = 1, 2, . . ., one can find all values of ui,k , for
i = 1, 2, . . . , N − 1.
Both the formulae are valid for all values of r = ck/h > 0.

7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Hyperbolic

Practice Questions
1. The differential equation utt = uxx , 0 ≤ x ≤ 1 satisfies the boundary conditions
πx
u = 0 at x = 0 and x = 1 for t > 0, and the initial conditions u(x, 0) = sin ,
  4
∂u
= 0. Compute the values of u for x = 0, 0.1, 0.2, . . . , 0.5 and t =
∂t (x,0)
0, 0.1, 0.2, . . . , 0.5.

2. Solve the hyperbolic partial differential equation utt = uxx , 0 ≤ x ≤ 2, t ≥ 0,


subject to the boundary conditions u(0, t) = u(2, t) = 0, t ≥ 0 and the initial
πx
conditions u(x, 0) = 5 sin , 0 ≤ x ≤ 2, ut (x, 0) = 0, taking h = 1/8 and k = 1/8.
2

10
......................................................................................

Elliptic PDE is one of the widely used PDEs. In this module, the finite difference
method is described to solve the elliptic PDEs.

3.1 Elliptic equations

The elliptic PDEs occur in many practical situations. The most simple elliptic PDEs
are Laplace and Poisson equations. The Laplace equation is ∇n u = 0 and Poisson
equation is ∇n u = g(r).
One physical example of such equations is stated below.
Let the function ρ represent the electric charge density in some open bounded set
Ω ⊂ Rd . If the permittivity ε is constant in Ω the distribution of the electric potential
ϕ in Ω is governed by the Poisson equation

−ε∆ϕ = ρ.

This equation does not have a unique solution, because if φ is a solution of this
equation, then the function φ + c, is also a solution, where c is any constant. To get a
solution, every elliptic equation should have a suitable boundary conditions.
Let us consider the two-dimensional Laplace equation
∂2u ∂2u
+ 2 = 0 within the region R (3.1)
∂x2 ∂y
and u = f (x, y) on the boundary C.

In this problem, both are space variables. Now, we approximate this PDE by the
central difference approximation. Then the finite difference approximation of the above
equation is
ui−1,j − 2ui,j + ui+1,j ui,j−1 − 2ui,j + ui,j+1
+ = 0. (3.2)
h2 k2
It is assumed that the length of the subintervals along x and y directions are equal,
i.e. h = k. Then the above equation becomes,
1
ui,j = [ui+1,j + ui−1,j + ui,j+1 + ui,j−1 ]. (3.3)
4
From this expression, it is seen that the value of ui,j is the average of the values of u
at the four meshes – north (i, j + 1), east (i + 1, j), south (i, j − 1) and west (i − 1, j).
1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

y
6(i, j+1)
u

u e u
(i-1,j) (i,j) (i+1,j)
u - x
(i,j-1)

Figure 3.1: Known and unknown meshes in standard five-point formula

The known values (filled circles) and unknown (circle) are shown in Figure 3.1. This
formula is known as standard five-point formula.
It can be proved that the Laplace equation remains invariant when the coordinates
axes are rotated at an angle 450 .
Under this rotation, the equation (3.3) becomes
1
ui,j = [ui−1,j−1 + ui+1,j−1 + ui+1,j+1 + ui−1,j+1 ]. (3.4)
4
This is another formula to calculate ui,j and it is known as diagonal five-point
formula. The known and unknown meshes for this formula are shown in Figure 3.2.
y
6
u
(i-1,j+1)
u (i+1,j+1)

e
(i,j)
u u- x
(i-1,j-1) (i+1,j-1)

Figure 3.2: Known and unknown meshes in diagonal five-point formula

When the right hand side of the Laplace equation is nonzero, then this equation
is known as Poisson’s equation. The Poisson’s equation in two-dimension is in the
following form

uxx + uyy = g(x, y), (3.5)

with the boundary condition u = f (x, y) along the boundary C.


2
......................................................................................

Here, we also assumed that the mesh points in both x and y directions are uniform.
Using this assumption the central difference approximation of the equation (3.5) is
reduced to
1
ui,j = [ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j ] where gi,j = g(xi , yj ). (3.6)
4
Let u = 0 along the boundary C and i, j = 0, 1, 2, 3, 4. Then u0,j = 0, u4,j = 0 for
j = 0, 1, 2, 3, 4 and ui,0 = 0, ui,4 = 0 for i = 0, 1, 2, 3, 4. The boundary values (filled
circles) are shown in Figure 3.3.
y
6 u=0
j=4 u u u u u

j=3 u e e e u
u1,3 u2,3 u3,3
u=0, j=2 u e e e u u=0
u1,2 u2,2 u3,2
j=1 u e e e u
u1,1 u2,1 u3,1

j=0 u u u u u- x
i=0 i=1 i=2 i=3 i=4
u=0

Figure 3.3: The 5 × 5 meshes for elliptic equation

For a particular case, i.e. for i, j = 1, 2, 3 the equation (3.6) becomes a system of nine
equations with nine unknowns. These equations are written in matrix notation as
    
4 −1 0 −1 0 0 0 0 0 u1,1 −h2 g1,1
 −1 4 −1 0 −1 0 0 0 0   u1,2   −h2 g1,2 
    
    

0 −1 4 0 0 −1 0 0 0

u
 
−h 2g 
   1,3   1,3 
 −1 0 0 4 −1 0 −1 0 0   u2,1   −h2 g2,1 
    
    
 0 −1 0 −1 4 −1 0 −1 0   u2,2  =  −h2 g2,2  (3.7)
    
    
 0 0 −1 0 −1 4 0 0 −1   u   −h2 g 
   2,3   2,3 
 0 0 0 −1 0 0 4 −1 0   u3,1   −h2 g3,1 
    
    
 0 0 0 0 −1 0 −1 4 −1   u   −h2 g 
   3,2   3,2 
0 0 0 0 0 −1 0 −1 4 u3,3 −h2 g3,3
3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

This indicates that the equation (3.6) is a system of N (where N is the number of
subintervals along x and y directions) equations. Note that the coefficient matrix is
symmetric, positive definite and sparse (many elements are 0). Since, the coefficient
matrix is sparse, so it is suggested to use iterative method rather than direct method
to solve the above system of equations. Commonly used iterative methods are Jacobi’s
method, Gauss-Seidel’s method, successive overrelaxation method, alternate direction
implicit method, etc.

3.1.1 Method to find first approximate value of Laplace’s equation

Let us consider the Laplace’s equation uxx + uyy = 0. Let the region R be square
and it is divided into N × N small squares each of side h. The boundary values are
u0,j , uN,j , ui,0 , ui,N where i, j = 0, 1, 2, . . . , N , shown in Figure 3.4.
y
u1,4 u2,4 u3,4 u4,4
u0,4 6 u u u u u

u0,3 u e e e u u4,3
u1,3 u2,3 u3,3
u0,2 u e e e u u4,2
u1,2 u2,2 u3,2
u0,1 u e e e u u4,1
u1,1 u2,1 u3,1
u u u u u- x
u0,0 u1,0 u2,0 u3,0 u4,0

Figure 3.4: Known and unknown meshes for Laplace equation. Red meshes are cal-
culated by diagonal five-point formula and blue meshes are determined by standard
five-point formula

At first the diagonal five-point formula is used to compute the values of u according
to the order u2,2 , u1,3 , u3,3 , u1,1 and u3,1 (red meshes in the figure). That is,

1
u2,2 = (u0,0 + u4,4 + u0,4 + u4,0 )
4
1
u1,3 = (u0,2 + u2,4 + u0,4 + u2,2 )
4
4
......................................................................................

1
u3,3 = (u2,2 + u4,4 + u2,4 + u4,2 )
4
1
u1,1 = (u0,0 + u2,2 + u0,2 + u2,0 )
4
1
u3,1 = (u2,0 + u4,2 + u2,2 + u4,0 ).
4
In the second step, the remaining values, viz., u2,3 , u1,2 , u3,2 and u2,1 are evaluated
using standard five-point (blue meshes in the figure). Thus,
1
u2,3 = (u1,3 + u3,3 + u2,2 + u2,4 )
4
1
u1,2 = (u0,2 + u2,2 + u1,1 + u1,3 )
4
1
u3,2 = (u2,2 + u4,2 + u3,1 + u3,3 )
4
1
u2,1 = (u1,1 + u3,1 + u2,0 + u2,2 ).
4
Note that these are the first approximate values of u at different meshes. These values
can be updated by using any iterative methods mentioned earlier.

Example 3.1 Let us consider the following Dirichlet’s problem

uxx + uyy = 0,
u(x, 0) = 0, u(0, y) = 0,
u(x, 1) = 5x, u(1, y) = 5y.

Find the first approximate values at the interior meshes by dividing the square region
into 4 × 4 squares.
Solution. For this problem, the region R is 0 ≤ x, y ≤ 1. Let h = k = 0.25 and
xi = ih, yj = jk, i, j = 0, 1, 2, 3, 4. The meshes are shown in Figure 3.5.
The values of u are calculated in two steps. In first step, the diagonal five-point
formula is used to find the values of u2,2 , u1,3 , u3,3 , u1,1 , u3,1 and in second step the
standard five-point formula is used to find the values of u2,3 , u1,2 , u3,2 , u2,1 .
The diagonal five-point formula is
1
ui,j = [ui−1,j−1 + ui+1,j−1 + ui+1,j+1 + ui−1,j+1 ]
4
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

y
u1,4 u2,4 u3,4 u4,4
6 1.25
u 2.50
u 2.75 5.0
y=1.00, u0,4 =0 u u u u4,4 =5.0

y =0.75, u0,3 =0 u e e e u u4,3 =3.75


u1,3 u2,3 u3,3
y=0.50, u0,2 =0 u e e e u u4,2 =2.5
u1,2 u2,2 u3,2
y=0.25, u0,1 =0 u e e e u u4,1 =1.25
u1,1 u2,1 u3,1

y=0.00, u0,0 =0 u u u u u- x
0 0 0 0
u1,0 u2,0 u3,0 u4,0
x=0 x= 41 x= 12 x= 34 x=1
Figure 3.5: Meshes for Dirichlet’s problem

and standard five-point formula is


1
ui,j = [ui+1,j + ui−1,j + ui,j+1 + ui,j−1 ].
4
Therefore,
1 1
u2,2 = (u0,0 + u4,4 + u0,4 + u4,0 ) = (0 + 5.0 + 0 + 0) = 1.25
4 4
1 1
u1,3 = (u0,2 + u2,4 + u0,4 + u2,2 ) = (0 + 2.5 + 0 + 1.25) = 0.9375
4 4
1 1
u3,3 = (u2,2 + u4,4 + u2,4 + u4,2 ) = (1.25 + 5 + 2.5 + 2.5) = 2.8125
4 4
1 1
u1,1 = (u0,0 + u2,2 + u0,2 + u2,0 ) = (0 + 1.25 + 0 + 0) = 0.3125
4 4
1 1
u3,1 = (u2,0 + u4,2 + u2,2 + u4,0 ) = (0 + 2.5 + 1.25 + 0) = 0.9375.
4 4
The values of u2,3 , u1,2 , u3,2 and u2,1 are obtained by using standard five-point formula.

1 1
u2,3 = (u1,3 + u3,3 + u2,2 + u2,4 ) = (0.9375 + 2.8125 + 1.25 + 2.5) = 1.875
4 4
1 1
u1,2 = (u0,2 + u2,2 + u1,1 + u1,3 ) = (0 + 1.25 + 0.3125 + 0.9375) = 0.625
4 4
1 1
u3,2 = (u2,2 + u4,2 + u3,1 + u3,3 ) = (1.25 + 2.5 + 0.9375 + 2.8125) = 1.875
4 4
1 1
u2,1 = (u1,1 + u3,1 + u2,0 + u2,2 ) = (0.3125 + 0.9375 + 0 + 1.25) = 0.625.
4 4
6
......................................................................................

These are the first approximate values of u at the interior meshes.

3.2 Iterative methods

If the first approximate values of u are known, then these values can be updated by
applying any well known iterative method. Several iterative methods are available with
different rates of convergence, some of them are discussed below.
The standard five-point finite-difference formula for the Poisson’s equation (3.5) is

1
ui,j = (ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j ). (3.8)
4
(r)
Let ui,j be the rth iterative value of ui,j , r = 1, 2, . . ..
Jacobi’s method

The Jacobi’s iterative scheme to solve the system of equations (3.8) for the interior
meshes is

(r+1) 1 (r) (r) (r) (r)


ui,j = [u + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j ]. (3.9)
4 i−1,j
This formula evaluates the (r + 1)th iterated value of ui,j , when the rth iterated
values of u are known at the meshes (i − 1, j), (i + 1, j), (i, j − 1), (i, j + 1).

Gauss-Seidel’s method

In it well known (discussed in Chapter 5) that the latest updated values are used in
Gauss-Seidel’s method. The values of u along each row are computed systematically
from left to right. The iterative formula is

(r+1) 1 (r+1) (r) (r+1) (r)


ui,j = [ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j ]. (3.10)
4
The rate of convergence of this method is twice as fast as the Jacobi’s method.

Successive Over-Relaxation (SOR) method

In this method, the iteration scheme is accelerated by introducing a scalar, called re-
(r+1) (r)
laxation factor. This acceleration is made by making corrections on [ui,j − ui,j ].
(r+1)
Suppose ui,j is the value obtained from any iteration method, such as Jacobi’s or
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

Gauss-Seidel’s method. Then the updated value of ui,j at the (r + 1)th iteration is given
by
(r+1) (r+1) (r)
ui,j = wui,j + (1 − w)ui,j , (3.11)

where w is called relaxation factor.


If w > 1 then the method is called over-relaxation method. If w = 1 then the method
is nothing but the Gauss-Seidal iteration method.
Thus, for the Poisson’s equation, the Jacobi’s over-relaxation scheme is

(r+1) 1 h (r) (r) (r) (r)


i
(r)
ui,j = w ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j + (1 − w)ui,j (3.12)
4
and the Gauss-Seidel’s over-relaxation scheme is

(r+1) 1 h (r+1) (r) (r+1) (r)


i
(r)
ui,j = w ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 gi,j + (1 − w)ui,j . (3.13)
4
The rate of convergence of the above schema depends on the value of w and its value
lies between 1 and 2. But, the choice of suitable w is a difficult task.

Example 3.2 Solve the Laplace’s equation uxx + uyy = 0 defined within the square
region 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1 shown in Figure 3.6, by (a) Jacobi’s method, (b)
Gauss-Seidel’s method, and (c) Gauss-Seidel’s successive over-relaxation method.

u
12.4
e
u
12.4
e
u e
u

0 u e
u1,2
e
u2,2
u0
e

0 u e e e0
u
u1,1 u2,1
u u u u
0 0

Figure 3.6: Boundary conditions of Laplace equation

Solution.
(a) Jacobi’s method
Let the initial values be u2,1 = u1,2 = u2,2 = u1,1 = 0 and h = k = 1/3.
The Jacobi’s iteration scheme is
8
......................................................................................

(r+1) 1  (r) (r)  1  (r) (r) 


u1,1 = u2,1 + u1,2 + 0 + 0 = u2,1 + u1,2
4 4
(r+1) 1  (r) (r)  1  (r) (r) 
u2,1 = u1,1 + u2,2 + 0 + 0 = u1,1 + u2,2
4 4
(r+1) 1  (r) (r)  1  (r) (r) 
u1,2 = u1,1 + u2,2 + 0 + 12.4 = u1,1 + u2,2 + 12.4
4 4
(r+1) 1  (r) (r)  1  (r) (r) 
u2,2 = u1,2 + u2,1 + 12.4 + 0 = u1,2 + u2,1 + 12.4 .
4 4
(1) (1) (1) (1)
The first iterated values are, u1,1 = 0, u2,1 = 0, u1,2 = 3.1, u2,2 = 3.1.
The all other iterated values are given below.

r u1,1 u2,1 u1,2 u2,2


0 0.00000 0.00000 0.00000 0.00000
1 0.00000 0.00000 3.10000 3.10000
2 0.77500 0.77500 3.87500 3.87500
3 1.16250 1.16250 4.26250 4.26250
4 1.35625 1.35625 4.45625 4.45625
5 1.45312 1.45312 4.55312 4.55312
6 1.50156 1.50156 4.60156 4.60156
7 1.52578 1.52578 4.62578 4.62578
8 1.53789 1.53789 4.63789 4.63789
9 1.54395 1.54395 4.64395 4.64395
10 1.54697 1.54697 4.64697 4.64697
11 1.54849 1.54849 4.64849 4.64849
12 1.54924 1.54924 4.64924 4.64924
13 1.54962 1.54962 4.64962 4.64962
14 1.54981 1.54981 4.64981 4.64981
15 1.54991 1.54991 4.64991 4.64991
16 1.54995 1.54995 4.64995 4.64995

Therefore, u1,1 = 1.5500, u2,1 = 1.5500, u1,2 = 4.6500, u2,2 = 4.6500, correct up to
four decimal places.
(b) Gauss-Seidel’s method
Let u2,1 = u1,2 = u2,2 = u1,1 = 0 be the initial values. Also, h = k = 1/3.
9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

The Gauss-Seidel’s iteration scheme is


(r+1) 1  (r) (r) 
u1,1 = u2,1 + u1,2
4
(r+1) 1  (r+1) (r) 
u2,1 = u1,1 + u2,2
4
(r+1) 1  (r+1) (r) 
u1,2 = u1,1 + u2,2 + 12.4
4
(r+1) 1  (r+1) (r+1) 
u2,2 = u1,2 + u2,1 + 12.4 .
4
When r = 0 then
(1) 1 
u1,1 = 0+0 =0
4
(1) 1 
u2,1 = 0+0 =0
4
(1) 1 
u1,2 = 0 + 0 + 12.4 = 3.1
4
(1) 1 
u2,2 = 3.1 + 0 + 12.4 = 3.857.
4
These are the first iterated values. The results in all other iterations are shown below.

r u1,1 u2,1 u1,2 u2,2


0 0.00000 0.00000 0.00000 0.00000
1 0.00000 0.00000 3.10000 3.87500
2 0.77500 1.16250 4.26250 4.45625
3 1.35625 1.45312 4.55312 4.60156
4 1.50156 1.52578 4.62578 4.63789
5 1.53789 1.54395 4.64395 4.64697
6 1.54697 1.54849 4.64849 4.64924
7 1.54924 1.54962 4.64962 4.64981
8 1.54981 1.54991 4.64991 4.64995
9 1.54995 1.54998 4.64998 4.64999
10 1.54999 1.54999 4.64999 4.65000
11 1.55000 1.55000 4.65000 4.65000

Hence, u1,1 = 1.55000, u2,1 = 1.55000, u1,2 = 4.65000, u2,2 = 4.65000, correct up to
five decimal places.
10
......................................................................................

(c) Gauss-Seidel’s successive over-relaxation method


Let the intial value be u2,1 = u1,2 = u2,2 = u1,1 = 0.
The SOR scheme for interior meshes are
(r+1) w  (r+1) (r) (r+1) (r)  (r)
ui,j = ui−1,j + ui+1,j + ui,j−1 + ui,j+1 + (1 − w)ui,j .
4
For j = 1, 2, i = 1, 2, the formulae are
(r+1) w (r) (r) (r)
u1,1 = [u2,1 + u1,2 ] + (1 − w)u1,1
4
(r+1) w (r+1) (r) (r)
u2,1 = [u1,1 + u2,2 ] + (1 − w)u2,1
4
(r+1) w (r) (r+1) (r)
u1,2 = [u2,2 + u1,1 + 12.4] + (1 − w)u1,2
4
(r+1) w (r+1) (r) (r+1) (r)
u2,2 = [u1,2 + u3,2 + u2,1 + 12.4] + (1 − w)u2,2 .
4
Let w = 1.1. Then the values of u’s are listed below.
r u1,1 u2,1 u1,2 u2,2
1 0.00000 0.00000 3.41000 4.34775
2 0.93775 1.45351 4.52251 4.61863
3 1.54963 1.55092 4.65402 4.65450
4 1.55140 1.55153 4.65122 4.65031
5 1.55062 1.55010 4.65013 4.65003
6 1.55000 1.55000 4.65000 4.65000
7 1.55000 1.55000 4.65000 4.65000
Hence, solution is u1,1 = 1.55000, u2,1 = 1.55000, u1,2 = 4.65000, u2,2 = 4.65000,
correct up to five decimal places.
The SOR iteration scheme gives the result in 6th iterations for w = 1.1. While
Gauss-Seidal and Jacob’s iteration schema take 11 and 16 iterations respectively.
For SOR method the number of iterations depends on the value of w.

Example 3.3 Solve the Poisson’s equation uxx + uyy = 5x2 y for the square region
0 ≤ x ≤ 1, 0 ≤ y ≤ 1 with h = 1/3 and the values of u on the boundary are every where
zero. Use (a) Gauss-Seidel’s method, and (b) Gauss-Seidel’s SOR method.

Solution. In this problem, g(x, y) = 5x2 y, h = k = 1/3 and the boundary conditions
are u0,0 = u1,0 = u2,0 = u3,0 = 0, u0,1 = u0,2 = u0,3 = 0,
u1,3 = u2,3 = u3,3 = 0, u3,1 = u3,2 = 0.
11
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

(a) The Gauss-Seidel’s iteration scheme is


(r+1) 1  (r+1) (r) (r+1) (r)
ui,j = ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 g(ih, jk) .

4
5 2
Now, g(ih, jk) = 5h3 i2 j = 27 i j. Thus
 
(r+1) 1 (r+1) (r) (r+1) (r) 1 5 2
u1,1 = u + u2,1 + u1,0 + u1,2 − . .1 .1
4 0,1 9 27
   
1 (r) (r) 5 1 (r) (r) 5
= 0 + u2,1 + 0 + u1,2 − = u + u1,2 −
4 243 4 2,1 243
 
(r+1) 1 (r+1) (r) (r+1) (r) 1 5
u2,1 = u + u3,1 + u2,0 + u2,2 − . .22 .1
4 1,1 9 27
 
1 (r+1) (r) 20
= u1,1 + u2,2 −
4 243
 
(r+1) 1 (r+1) (r) (r+1) (r) 1 5
u1,2 = u0,2 + u2,2 + u1,1 + u1,3 − . .12 .2
4 9 27
 
1 (r) (r+1) 10
= u2,2 + u1,1 −
4 243
 
(r+1) 1 (r+1) (r) (r+1) (r) 1 5 2
u2,2 = u + u3,2 + u2,1 + u2,3 − . .2 .2
4 1,2 9 27
 
1 (r+1) (r+1) 40
= u1,2 + u2,1 − .
4 243

(0) (0) (0)


Let u2,1 = u2,2 = u1,2 = 0.
All the values are shown in the following table.

r u1,1 u2,1 u1,2 u2,2


1 −0.00514 −0.02186 −0.01157 −0.04951
2 −0.01350 −0.03633 −0.02604 −0.05675
3 −0.02074 −0.03995 −0.02966 −0.05855
4 −0.02255 −0.04085 −0.03056 −0.05901
5 −0.02300 −0.04108 −0.03079 −0.05912
6 −0.02311 −0.04113 −0.03085 −0.05915
7 −0.02314 −0.04115 −0.03086 −0.05915

Hence, the solution correct up to five decimal places is


u1,1 = −0.02314, u2,1 = −0.04115, u1,2 = −0.03086, u2,2 = −0.05915.
12
......................................................................................

(b) The SOR scheme is

(r+1) w  (r+1) (r) (r+1) (r) (r)


ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 g(ih, jh) + (1 − w)ui,j

ui,j =
4 
w (r+1) (r) (r+1) (r) 5 2 (r)
= ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − i j + (1 − w)ui,j .
4 243
(0) (0) (0)
Let the initial values be u2,1 = u1,2 = u2,2 = 0.
Let the relaxation factor be w = 1.1. Then, the values of u1,1 , u2,1 , u1,2 and u2,2 are
computed below.

r u1,1 u2,1 u1,2 u2,2


1 −0.00566 −0.02419 −0.01287 −0.05546
2 −0.01528 −0.03967 −0.02948 −0.05874
3 −0.02315 −0.04119 −0.03089 −0.05921
4 −0.02316 −0.04117 −0.03088 −0.05916
5 −0.02316 −0.04115 −0.03087 −0.05916
6 −0.02315 −0.04115 −0.03086 −0.05916

The solution obtained by SOR method is u1,1 = −0.02315, u2,1 = −0.04115, u1,2 =
−0.03086, u2,2 = −0.05916, correct up to five decimal places.
Note that the Gauss-Seidel’s iteration method needs 7 iterations whereas SOR method
takes only 6 iteration for w = 1.1.

13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Partial Differential Equation: Elliptic

Practice Questions
1. Solve the Poisson’s equation uxx + uyy = −2x2 + y 2 over the region 0 ≤ x ≤ 2, 0 ≤
y ≤ 2 taking the boundary condition u = 0 on all the boundary sides with h = 0.5.
Use Gauss-Seidel’s method to improve the solution.

2. Solve the Laplace equation uxx + uyy = 0 taking h = 1, with boundary values as
shown below.
8u 10u 12u
0 u u16

0 u e e e u28
u1,3 u2,3 u3,3

0 u e e e u24
u1,2 u2,2 u3,2
0 u e e e
u2,1 u3,1
u22
u1,1

0 u u u u u20
10 15 18

3. Solve the elliptic differential equation uxx + uyy = 0 and for the region bounded
by 0 ≤ x ≤ 5, 0 ≤ y ≤ 5, the boundary conditions being
u = 0 at x = 0 and u = 2 + y at x = 5,
u = x2 at y = 0 and u = 2x at y = 5.
Take h = k = 1. Use
(a) Jacobi’s method, (b) Gauss-Seidel’s method, and (c) Gauss-Seidel’s S.O.R.
method.

16

** ALL THE BEST **

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy