0% found this document useful (0 votes)
94 views123 pages

Mvse-101 Pde

The document discusses finite difference methods for solving linear boundary value problems with mixed boundary conditions. It describes discretizing the differential equation at interior grid points as well as at the boundary points where mixed boundary conditions are specified. This results in a system of N+1 algebraic equations to solve for the N+1 unknown function values at the grid points. Central difference approximations are used to discretize the mixed boundary conditions at the boundaries. Solving the resulting linear system provides a numerical solution to the boundary value problem.

Uploaded by

Shivam Sharma
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)
94 views123 pages

Mvse-101 Pde

The document discusses finite difference methods for solving linear boundary value problems with mixed boundary conditions. It describes discretizing the differential equation at interior grid points as well as at the boundary points where mixed boundary conditions are specified. This results in a system of N+1 algebraic equations to solve for the N+1 unknown function values at the grid points. Central difference approximations are used to discretize the mixed boundary conditions at the boundaries. Solving the resulting linear system provides a numerical solution to the boundary value problem.

Uploaded by

Shivam Sharma
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/ 123

Module 4

Linear Boundary value problems

Lecture Content Hours


1 Finite Difference Methods: Dirichlet type boundary 1
condition
2 Finite Difference Methods: Mixed boundary condition 1
3 Shooting Method 1
4 Shooting Method contd… 1
Module 4
Lecture 1

Finite Difference Methods: Dirichlet type boundary condition

keywords: Dirichlet type boundary conditions, discretize, finite differences


Linear Boundary Value Problems
An initial value problem consists of a differential equation and associated initial
conditions for finding the unique solution of the problem. All the initial conditions are
specified at one specified point called as initial point. Typical initial conditions for nth
order differential equation involve specification of y, y’,…,y(n-1) at some initial point, say
at t=0. For a boundary value problem boundary conditions are associated with the
differential equation. The boundary conditions are specified at different points of the
domain of independent variable t known as boundary points. For example, consider a
second order ordinary differential equation
y  f(y,y,x);a  x  b
1(x)y(x)  1(x)y(x)  1 at x  a (4.1)
2 (x)y(x)  2 (x)y(x)  2 at x  b
The Boundary value is called two-point linear boundary value problem when the
arbitrary function f is given as a linear combination of dependent variable and its
derivative as
f(y,y,x)  c(x)y(x)  d(x)y(x)  e(x) (4.2)
The boundary conditions are specified at the boundary points x=a and x=b as linear
combination of y and its derivative y’. This is Robin mixed boundary conditions. In
particular when i  0, i  0;i  1,2 then the boundary conditions are known as Dirichlet

boundary conditions. The conditions are Neumann’s boundary conditions when


i  0, i  0;i  1,2

Finite difference method for two point linear Boundary Value problem with Dirichlet type
conditions
y  c(x)y(x)  d(x)y(x)  e(x);a  x  b
(4.3)
y(a)  1; y(b)  2

To apply finite difference method first discretize the domain a  x  b into N-1
computational grid points xi;i  1,2...N  1 and two boundary points x0 and xN as

a  x0  x1  x 2 ...  xN1  xN  b
The grid points are equi-spaced and computed as
ba
xi  x0  ih;h 
N
The step size h is a critical parameter for stability and convergence of the numerical
scheme. The differential equation is now written at each internal grid point
xi;i  1,2...N  1 . For this, the derivatives are replaced by corresponding finite differences:

y  2yi  yi1
y  xi   i1  o(h2 )
2
h
y y
y  xi   i1 i1  o(h2 )
2h
that is
yi1  2yi  yi 1 y y
 c(xi ) i 1 i1  d(xi )yi  e(xi )
h2 2h
h h
or ( 1  c i )yi1  (2  h2di )yi  ( 1  c i )yi1  h2ei;i  1,2,N  1 (4.4)
2 2

The unknown yi’s are on the left side and known quantities are on right side of
the equation for i=2,3,…N-2. Using boundary conditions for i=1and i=N-1 give
h h
(2  h2d1)y1  ( 1  c1)y 2  h2e1  (1  c1)1 (4.6a)
2 2
h h
( 1  cN1)yN 2  (2  h2dN1)yN1  [h2eN1  (1  cN1)2 ] (4.6b)
2 2
This reduces the system of differential equations to linear system of N-1 algebraic
equations which can be written in the matrix form as AX=B where
 1 u1 
 
 2 2 u2 
 . ... . 
 
 . ... 
 N 2 N 2 uN 2 
 
 N1 N1 (N1)X(N1)
 2 h 
 h e1  (1  2 )1 
 x1   
i  2  h2di x   h2e2 
h  2   
i  1  ci X  .  B  ...  (4.7)
2    2 
h  xN 2   h eN 2 
ui  1  ci  xN1 
2  2 h 
 h eN1  (1  )2 
 2 
The system of equations must admit unique solution for which the sufficient condition is
the diagonal dominance of the matrix A. Suppose d(x) has positive values in the domain
and c(x) is continuous. Let L be upper bound of the function c(x) over the domain then
the step size h smaller than 2/L guarantees the uniqueness of the solution.
Example 4.1: Solve the boundary value problem using N=4
y  12y  16; y(0)  y(2)  5
Solution: It is observed that c(x)=0, d(x)=12>0, e(x)=-16. for N=4, the Bvp will
reduce to system of three algebraic equations with step size h=2/4=0.5 The equivalent
system given below:
5y1  y 2 1
 y1  5y 2  y3  4
 y 2  5y3  1

The system of algebraic equations corresponding to the BVP has unique solution
irrespective of step size h. The solution of the system is
1 18 1
y1  , y 2   , y3 
23 23 23
Example 4.1: Solve the boundary value problem using N=4

xy   (2x  1)y  (x  1)y; y(1)  2e, y(3)  10e3


Solution: For the given boundary value problem a=1, b=3, N=4 h=0.5
2x  1 x 1
c(x)  ,d(x)  ,e(x)  0
x x
It may be noted that d(x) is positive and c(x) is a decreasing function in (1, 3).
Therefore, L=C(1)=3. Accordingly, the condition for unique solution ( h<2/L) is satisfied
for h=0.5
The grid points are x 0  1.0, x1  1.5, x 2  2.0, x3  2.5, x 4  3.0

The coefficients of the matrix are computed from the expressions given below
x 1 2 2x  1 h 2x  1 h
di  2  i h , i  1  ( i ) ,ui  1  ( i ) ,
xi xi 2 xi 2
Applying finite differences gives the following system of equations:
2.41667y1-0.33333y 2 =9.060939
-1.625 y1+2.375 y 2 -0.375 y3 =0
-1.6 y 2 +2.35 y3 =80.34215

The coefficient matrix is diagonally dominant. The system of equations can be solved
using Gauss-Seidel iterative scheme with initial guess as (0,0,0).
For numeric computations refer to NPTEL-II\BVP-I.xls
The final solution is obtained as
y1=5.125596, y 2 =9.977751, y 3 =40.98151
Module 4
Linear Boundary value problems

Lecture 2
Finite Difference Methods: Mixed boundary condition

keywords: computational grid, finite differences, mixed boundary conditions

Finite Difference Methods: Mixed boundary condition


Consider the Boundary value problem with non dirichlet type boundary conditions
y  c(x)y(x)  d(x)y(x)  e(x);a  x  b
1(x)y(x)  1(x)y(x)  1 at x  a; 1  0 (4.8)
2 (x)y(x)  2 (x)y(x)  2 at x  b; 2  0
X-1 X0 X1 X2 Xi XN XN+1

Fig 4.1 Computational grid


Let the computational grid be a  x0  x1  x 2 ...  xN1  xN  b . In case of Dirichlet

boundary conditions the solution is known at the boundary points x0 and xN and the
solution is to be computed at internal N-1 grid points. In case of non-Dirichlet boundary
conditions the solution is also to be computed at two boundary points. The number of
unkowns is now N+1. The discretization of differential equation is obtained at
N+1points including boundary points i=0 and N as in (3.4):
h h
( 1  c i )yi1  (2  h2di )yi  ( 1  ci )yi 1  h2ei;i  0,1,2,N (4.9)
2 2
The boundary conditions are discretized using central differences at i=0 and i=N
corresponding to x0 and xN respectively:
y(x0  h)  y(x0  h)
1(x0 )y(x0 )  1(x0 )  1
2h
y(xN  h)  y(xN  h)
 2 (xN )y(xN )  2 (xN )  2
2h
2h10 y0  10  y1  y 1   2h1
Or
2h2NyN  2N  yN1  yN1   2h2

y 1  y1  2h(10 / 10 )y0  2h1 / 10


Or (4.10)
yN1  yN1  2h(2N / 2N )yN  2h2 / 2N
The values of dependent variable y-1 and yN+1 are obtained at x-1=x0-h and xN+1 =xN+h
are fictitious points outside the computational grid. The finite difference scheme (3.4)
corresponding to i=0 and N incorporate y-1 and yN+1 which can be replaced by (3.9). This
is how boundary conditions are incorporated with the solution.
h
i 0: [(2  h2d0 )  2h( 1  c 0 )( 10 / 10 )]y0  2y1
2 (4.11a)
h
 h2e0  2h( 1  c 0 )1 / 10
2
h
i  N:  2yN1  [(2  h2dN )  2h( 1  cN ) 2N / 2N ]yN
2 (4.11b)
2 h
 h eN  2h( 1  cN )2 / 2N
2
Accordingly, the bvp is reduced to linear algebraic equations in matrix form Ty=B
a01 a02 
 
 1 1 u1 
  2 2 u2 
T=   (4.12)
 . ... 
 N1 N1 uN1
 
 aN1,N aN,N 
(N1)X(N1)

 y0  b0 
y   2 
 1   h e1 
y  .  B  ... 
   
 yN1  h2e 
 N1
 yN 
bN 

h h
i  2  h2di , i  1  ci , ui  1  ci, bi  h2ei; i  2,3,...,N  1
2 2
a01  0  2h0 (10 / 10 ) , a02  2 ,
aN,N  N  2huN ( 2N / 2N ), aN1,N  2
b0  h2e0  2h01 / 10 bN  h2eN  2huN2 / 2N
The finite difference methods reduces the problem of solving linear boundary value
problem to solution of linear simultaneous algebraic equations and the approximate
solution is obtained at finitely many equi-spaced discrete points. If the the number of
equations n is small then Gauss elimination method is used. If n is large then iterative
method is used if the system is diagonally dominant which is required for convergence
of iterative method. Further, it may be observed that the system of equations forms a tri
diagonal system for which a special form of Gaussian elimination method may be used
even for large n. The elementary transformations are required to reduce the tri-diagonal
matrix T and B in the following form
a01 a02  b0 
0 1 u1  b 
   1 
 0 2 u2  b 
  b 2 
 . ...  . 
 0  
N1 uN1   b 
   N1
 0  
aN,N  
bN
(N1)X(N1)

Then back substitution gives yi, i=N,N-1,…,3,2,1


Due to rounding off errors the solution by elimination method may give approximate
solution.

Example 4.3: Solve second order differential equation with Dirichlet condition at one
end and mixed boundary condition at other end using N=4:
1
0
0
1

1
1

y  y  ,y( )  ,y( )  y( ) 


Solution: Consider the IVP
1
0
0
1

1
1

y  y  ,y( )  ,y( )  y( ) 


For N=4, h =0.25. The finite difference formula for the derivative in the differential
equation is used:

d2 y y  2yi  yi1
 i1 ,i  1,2,3,4;
2
dx i h2

The substitution at i=1,2…N grid points, where the solution is desired, yields:

yi1  ( 2  h2 )yi  yi1  h2;i  1,2,3,4; (A)

The Solution is already known at the boundary point i=0. Also, at the other boundary
point i=N=4, the central difference formula is used for the derivative:

d2 y y y
 N1 N1
dx 2 N 2h

This substitution gives


yN1  yN1  2hyN  2h (B)
Using y0=0 in (A) for i=1 gives

( 2  h2 )y1  y 2  h2; (C)


Substituting yN+1 from (B) in (A) for i=N gives

2yN1  ( 2  h2  2h)yN  yN1  h2  2h (D)

Using (C) for i=1, (A) for i=2,3 and (D) for i=4 gives the system of algebraic equations
written in the matrix form as
2

0 1

0 0 0 2
2

2
 h   y   h 

1
1 0 0

    
2

2
  h     h 

2
 y
1 0

2 (E)
2

2
  h  y   h 

3
2

2
    

2
  h  h  y   h  h

4

Substitution for h gives tridiagonal matrix Ty=B, where
2
0
6 1 0 0
2
5

1 6

0 1 0

0 0 0 5

0
0
6
2
5
 .    . 
2
0
2 1
5

0
0
6
2
5
     
T
.  ; B   . 
2
6 2
2
5

0
0
6
2
5
  .   . 
0

2
6
2
5

0
4
3
7
5
   
  .   . 
The system of equations is solved using Gauss-Seidel method to give

y1= -0.03622 y2= -0.01174 y3= 0.074974 y4= 0.229248

The convergence is not good. More iteration are required for better solution.
Using elimination gives the following solution:

y1= -0.0354 y2= -0.01051 y3= 0.076229 y4= 0.230227

The exact solution of the problem is given as

x 0.25 0.5 0.75 1


y -0.03534 -0.01007 0.077393 0.232544

For computational details see mixed bc-bvp.xls


.
Course: Numerical Solution of Ordinary Differential Equations

Module5: Non-linear Boundary value problems

Lecture Content Hours


1 Solution by Finite Difference Methods 1
2 Shooting Method 2

Lecture 1

Solution by Finite Difference Methods


Solution by Finite Difference Methods
Consider two point non-linear boundary value problem with Dirichlet’s boundary
conditions
y  f(y, y, x); axb
(5.1)
y(a)  , y(b)  
The function f is a non-linear function of dependent variable and its derivatives. The
finite differences as discussed for linear boundary value problem can be applied to
nonlinear differential equation also to reduce it to algebraic system of equations which
will no more be linear. Replacing the derivative with finite differences at N-1equispaced
internal grid points give
y y ba
(yi1  2yi  yi1)  h2 f(xi,yi, i1 i1 )  0; i  1,2,...,N  1,h 
2h N
Let the solution vector of the BVP at given N+1 grid points (N-1 internal and 2 boundary
points) be

Y  [y0 ,y1,y2,...,yN1,yN ]T
Due to Dirichlet boundary conditions
y 0  , yN  

Write the system of equations in the matrix form as

G[Y ]  [g0 (Y),g1(Y),...,gN1(Y),gN (Y)]T  0 (5.2)

Such that
g0(Y)  y0 ; gN(Y)  yN ;
2 yi1  yi1 b  a (5.3)
g(Y)
i  (yi1  2yi  yi1)  h f(x ,y
i i , ); i  1,2,...,N  1,h 
2h N
The system (5.2) is a nonlinear system of N+1equations in N+1 unknowns. The
Newton’s iterative method can be used to solve the system numerically. This method is
a generalization of Newton-Raphson iterative scheme for finding roots of nonlinear
equation g(x)=0, N=1. According to Newton’s method, the sequence of iterations are
given as:
1
g(y(n) )
y(n  )  y(n)   y(n)  v(n)
g(y )
(n)

0
1
2
3
v (n)g(y(n) )  g(y(n) ),n  , , , ,...
For the system of equations, the derivative is replaced by Jacobian:
0 0 1 0

0 1 1 1

0
 g g g 
 y .
y yN 
 

1
 g g g 
 . 
J(Y)=  y y yN 
 . . . . 
 
 gN gN
.
gN 
0

 y y yN 

According to Newton’s method for solving (5.2), the sequence of iterations are given by
1

Y(n  )  Y(n)  v (n) (5.4)

The update vector v (n) is given by

J(Y (n) )v (n)  G(Y (n) ) (5.5)


Since gi , i=1,2,…N-1 involves yi-1,yi and yi+1 only, various partial derivatives in the
Jacobian are computed as
1

1
1

gi h f y  yi 
(xi,yi, i 
2

  )
1

yi y h
2

1
2

gi f y  yi 
(xi,yi, i 
2

 h )
yi y h
12

1
1

gi h f y  yi 
(xi,yi, i
2

  )
1

yi y h
0 0

g gN
Also,  ; 
y yN
Since gi involves yi-1,yi and yi+1 only, the rows in J(Y) will have at the most three non-
zero entries except in the first and last row and the Jacobian J is tri-diagonal:
1
0
0

0
 . . 

0
l 

1
 d u . . 
. . . . . . 

0
J(Y)   
. li di ui . 
. 0 . . . . . 

0
0
1
 
 . . NXN
where
2

12

1
2

1
f y  yi 

0
di   h (xi,yi, i ),d 
y h
12

1
1

0
h f y  yi 

0
(xi,yi, i
2

ui    ),lN  u  (5.6)
y h
1

1
1

h f y  yi 
(xi,yi, i  1
2

li    ),dN 
y h
The initial guess for the solution is obtained using line passing through the point
(a,  )and(b, ) :
0

 ba
yi( )    (xi  a); xi  a  ih,h 
ba N
0

0
1
2


Or yi( )    i i  , , ,...,N (5.7)
N
The method is illustrated for Dirichlet boundary conditions in the example.

Example 5.1: Solve the second order ordinary differential equation with Dirichlet type
boundary conditions:

yy  y2  2  0;1  x  2; y(1)  0; y(2)  1

Solution: Consider the differential equation with Dirichlet boundary conditions

yy   y 2  2  0 , y 0    0, yN    1

Rewriting the equation as

y2  2
y    f(x,y,y)
y
 f   1  y2   f   2y 
or`    ;     
 y i  y 2 i  y i  y i

According to the problem y 0    0, yN    1 .


Let N=5;h=0.2. The Jacobian matrix J of order is obtained using (5.6) as

2
4
1 4

1
 h  (y  y ) 
2

1
0
di   i i  ,d 
 yi 
 
12

1
1

0
y  yi 
0
ui    i ,lN  u  (A)
hyi
12

1
1

1
y  yi 
li    i  ,dN 
hyi

The initial guess is obtained using (5.7):

y2  2
y    f(x,y,y)
y
y y ba
gi (Y)  (yi1  2yi  yi1)  h2 f(xi,yi, i 1 i1 ); i  1,2,...,N  1,h 
2h N
y y
G(Y)  [(yi1  2yi  yi1)  h2 (2  ( i1 i1 )2 / yi ]
2h
y y
G(Y)  [(  yi1  2yi  yi1)  (2h2  ( i1 i 1 )2 / yi ]
2

1 0 0 1
-0.83333 2.066667 -1.16667 -0.06667 The system
-0.83333 2.057143 -1.14286 -0.05714
of equations
-0.85714 2.05 -1.125 -0.05
-0.875 2.044444 -1.11111 -0.04444 is now
1 2
solved using
iterative method. The detailed solution is given in the excel file nonlinear
BVPnewton.xls . The final solution of nonlinear BVP is given in the table. The solution is
converging to the exact solution of the problem.

iteration x 1 1.2 1.4 1.6 1.8 2


initial y 1 1.2 1.4 1.6 1.8 2
1 y 1 1.313385 1.543711 1.726003 1.875667 2
2 1 1.323542 1.558232 1.740394 1.885025 2
3 1 1.324788 1.560191 1.742175 1.886067 2
4 1 1.32495 1.560447 1.742408 1.886201 2
5 1 1.324971 1.56048 1.742438 1.886218 2
exact 1 1.32665 1.56205 1.74356 1.886796 2

Table 5.1 Solution for example 5.1


Introduction to PDE
Designing any engineering system always requires mathematical models with their
numerical solutions. Such models in real life are usually governed by Partial Differential
equations, subject to appropriate boundary conditions. However second order PDE have
applications in almost many fields e.g. Fluid Mechanics, Physics, Mechanical Engineering,
Heat transfer, Analysis of torsion in Civil Engineering etc.

Over 2-dimensional Cartesian domain Ω, let ‘u’ be the dependent variable.


Then a general second order PDE may be written as:

 2u  2u  2u
A  B  C  F x, y, u, u x , u y   G  0 (1)
x 2 xy y 2

where A,B,C are functions of (x, y) and F may be non- linear function then

Equation (1) is called a Quasilinear PDE. If F is also a linear function then Equation(1) is

a Linear PDE. If G = 0 then equation (1) is Homogeneous otherwise Non-Homogeneous.

For solving Equation (1) numerically, it is necessary to classify the PDE, as it defines the

nature of conditions to be satisfied, in order that partial differential equation (1) posses a

unique solution.

Any problem defined by equation (1) in a domain is said to be well posed if

(i) There exists atleast one solution (Existence).


(ii) There exists almost one solution (uniqueness).
(iii) The solution is stable.

A benchmark problem of a ill posed problem is

u xx  u yy  0 , 0<y<∞, with u(x,0) = 0, uy(x,0) = (1/n )sin nx

The closed form solution of the above equation does not satisfy the conditions.
The classification of the equation (1) is based upon the possibility of reducing it by a

suitable coordinate transformation to canonical form.

Let    ( x, y )     ,    ( x, y )                                              (2) 

where Φ and Ψ are twice differentiable and the Jacobian J   x y  x  y


is non zero so that (x, y) can be determined uniquely.
Then rewriting equation (1) in the following form

Au xx  Bu xy  Cu yy  Du x  Eu y  Fu  G  0 (3) 

and using the transformation given by (2), Eqn.(3) is transformed to

Au  Bu  Cu  Du  Eu  F u  G  0 (4) 

The corresponding characteristics are distinct or single or not real, depends upon the value of
discriminent (B2-4AC).

Thus the equation (3) is said to be Elliptic, Parabolic or Hyperbolic depending on

B2-4AC <, =, > 0 at a point or in a domain.

The classical examples are :

utt – c2 uxx = 0 is Hyperbolic Equation called as Wave Equation.

ut – c2 uxx = 0 is Parabolic Equation called as Heat Conduction Equation.

uxx+uyy = 0 is Elliptic Equation called as Laplace Equation

uxx+x uyy = 0 Tricomi Equation which is Elliptic for x >o, Parabolic for x=0
and Hyperbolic for x<0. Usually
the Boundary Value Problems are associated with Elliptic PDE whereas Initial Value Problems
are associated with Hyperbolic and Parabolic PDE.
In contrast to the solution of ODE, the general solution of a linear PDE contains arbitrary
functions, which implies that there are infinitely many solutions only. By specifying
initial/boundary conditions, one can determine specific solution of interest. The conditions which
are specified at t = 0 or at a particular time t = t0, where t >t0 for the time domain, is called
Cauchy condition. The problems with prescribed Cauchy conditions are called IVP
(Initial Value Problem).

In some physical problems, when the governing PDE is to be solved over a given domain of
space, the problem are named as BVP (Boundary Value Problem). Thus there are three type
of conditions :

Drichlet conditions : when u is presented at each point of the boundary of the domain.
u
Neumann conditions: when the values of normal derivative on the boundary are
n
specified.
u
Robin conditions : when + au is specified at the boundary.
n
Every PDE needs to be governed by any of the above conditions, as per classification.

 
 

 
Finite Difference Representation
The ultimate goal for the solution of a PDE over a continuous domain is to reduce it to
discrete model which are suitable for high speed computers. One of the standard approach is
using Finite Difference Methods which are applicable to all type of second order PDE.The main
steps in this approach are as follows:

1. Discretization
2. Replacing the derivatives by FD representation
3. Solving the corresponding Difference equations to get the numerical values of ‘u’ at the
discretized nodes

The first and third point will be discussed later. Let us discuss the approximation of the partial
derivatives by corresponding Finite Differences.

Let u(x, y) be the dependent variable .The Taylor’s series expansion can be written as:

u ( x, y ) ( x ) 2  2u ( x, y )
u ( x  x, y )  u ( x, y )  x   (2.1) 
x 2 x 2
Retaining terms upto first order,we have,

u u ( x  x, y )  u ( x, y )
  O(x) (2.2)
x x

u
This is called as first order forward difference approximation for
x .

u u ( x, y  y )  u ( x, y )
Similarly,   O(y )
y y

If (x,y) are represented by dummy variables i,j such that xi = i∆x and yj = j∆y.

Then (xi, yj) = ( i∆x, j∆y) = (ih, jk).Here h=∆x and k=∆y. Thus ui,j = u(xi, yj).Hence

 u  1
 
   ui 1, j  ui , j  o( h) (2.3)
 x  i , j h
This formula (2.3) has a truncation error of order h i.e. o(h).
Similarly one can use Backward Difference Formula by using the expansion of u(x-∆x, y) and
write
 u 
1

   ui , j  ui 1, j  o(h). ( 2 .4 )
 x  i , j h

For obtaining higher order formula,one can use

u (x) 3  3u
u( x  x, y)  u( x  x, y)  2x  
x 3 x 3

u u ( x  x, y )  u ( x  x, y )
  o ( x ) 2
x 2 x
 
 u 
  
1
 
ui 1, j  ui 1, j  o( h) 2 (2.5)
 x  i , j 2h

This formula is called as Central Difference Formula.

To obtain finite difference approximation for second order derivatives,we can use

 2u
u ( x  x, y )  2u ( x, y )  u ( x  x, y )  (x) 2  o(x) 4
x 2

  2u  u ( x  x, y )  2u ( x, y )  u ( x  x, y )
 2    o(x) 2
 x  x , y (x) 2

 
  2u  u  2ui , j  ui 1, j
 2   i 1, j  o( h 2 ) (2.6)
 x i , j h 2

This is the best formula for second order derivative,known as Central difference formula.
 2u  2u
,
Similarly, one can have formula for  x  y  y etc.
2

 
 

The above formulae can also be represented in the form of computational molecule as follows:

u 1 +o(h2)
                                                                                           ‐‐‐ 
‐ 0 1
x 2h  
u i‐1, j  u i, j  u i+1, j 
 
                                                        
  1  
u i, j+1 

u
 (1 / 2k ) +o(k2)
y   0 u i , j   
 

 
‐ u i ,j‐1 
 

     

 2u 1 ‐ +o(h2) 
 2 1  1  
x 2
h     
                                                                                          
1 u i‐1, j
             u i , j  u i+1, j   
 
 

 
‐ 0  1
 2u 1  
 2 +o(h2)
xy 4h
1 0  ‐
 
u i, j 
 
1  0  ‐
 

The above approximations, when substituted in the PDE reduces it to the set of difference
equation which can be solved iteratively.However due to truncation error ,care has to be taken
for convergence and stability of the solution.

Example: Obtain the equivalent finite difference formulation of the given PDE

u u  2 u
a 
t x x 2

Write the truncation error also.

Solution:

Using formula (2.3),we have

ui , j 1  ui , j ui 1, j  ui , j ui 1, j  2ui , j  ui 1, j


a 
t x (x) 2

 r   2r   r 
u i , j 1  u i 1, j  ar    u i , j 1  ar    u i 1, j  
 x   x   x 

The truncation error is o(∆t) + o(∆x).

              

                                             

 
 

 
Explicit Method for Solving Parabolic PDE
One of the simplest second order Parabolic Differential Equation in one-dimension is the
Heat Conduction Equation, written as:

u  2u
 c2 2 where 0  x  L, t  0 (1.1) 
t x
which arises in many real problems.

The appropriate, but most simple conditions are:


Initial condition: u x,0  u0  x 
and two Boundary Conditions namely: u0, t   u1 t  and uL, t   u2 t  .
Note that the analytical solution of equation (1.1) is usually a trigonometric series, which may
create problem in convergence.

The first Finite Difference method is the Explicit Method.

For this, let us discuss first step, which is common to all methods i.e. discretization.

The domain of the solution is 0  x  L, t  0 , as shown in fig(1).

∆t 
x=L 
x=0  ∆x  x 

fig(1)
It is to be discretized by drawing vertical and horizontal lines at equal distance say x and t
respectively. Let i , j be
defined dummy variables along x & t axis so that;

xi  ix, t j  jt & u xi , t j   ui , j  ix, jt .


Let the domain from x = 0 to x = L be subdivided into N sub-parts so that x = 0 corresponds to i
= 0 and x = L corresponds to i = N with t = 0 corresponds to j = 0.

(1.2) 
The initial condition then can be written as: u x,0   u 0 x   u i , 0  u 0 ix 

u 0, t   u1 t   u 0, j  u1  jt 
The boundary condition will be converted to: (1.3) 
u L, t   u 2 t   u N , j  u 2  jt 

Step 2: Replacing the derivatives by corresponding Finite Difference representation in


equation (1.1) which reduces to:

ui , j 1  ui , j ui 1, j  2ui , j  ui 1, j


 c2 (1.4) 
t (x) 2

     The truncation error is: ot   ox 2


Equation (1.4) thus can be rewritten as:

ui , j 1  c 2 ru i 1, j  (1  2c 2 r )ui , j  c 2 ru i 1, j with, r  t ( x ) 2 (1.5)

Equation (1.5) is called the Explicit Scheme.


The computational molecule for scheme (1.5) can be shown as in fig (2)

u i,j+1 

1 (j+1)th level 

r  1‐ r jth level 

 u i‐1,j  u i, j  u i+1,j 

fig (2)

Equation (1.5) is now solved at first time level for j = 0; for all values of i =1,2,---,(N-1).
Similarly solution at second,third time level is obtained correspondingly for j =1, 2 ---. It
is very important to note that this scheme is not unconditionally stable.

The value of r has to be < 1/2 i.e. ∆t < (1/2)(∆x)2 which makes ∆t to be sufficiently small. Thus
it requires large no. of computations at intermediate time level ;even for a small time ,as ∆x is
itself very small (Since the Finite Difference Method for approximating the derivatives is based
on Taylor’s expansion hence both ∆t and ∆x are small) .This is one of the great drawback of this
method.

Though the truncation error tends to 0 as ∆t → 0 and ∆x → 0 but the detail discussion about it
will be discussed in module 3,lecture 1.The main advantage of this scheme is that it is
computationally simple as the computations proceed pointwise, thus even manually
manageable.

u  2 u
Example 1:- Solve the Heat Conduction Equation  0  x  1 ,t  0
t t 2

u
subject to B.C: u = 0 at x = 0 and  0 at x = 1 ,for all t
x

3x
and, I.C: u ( x,0)  sin
2

Using the Explicit Method ,choosing ∆x = 0.1 and ∆t = 0.0025 so that r = 1/4, obtain the solution
for one time level and compare with the exact solution.
9 2t
3x
The exact solution is u  x, t   e 4
sin
2

Solution-

At a general point (i,j) the given pde is -

 u    2u 
    2
 t i , j  x i , j

The Explicit Finite-Difference representation of this equation is:

ui , j 1  ui , j ui 1, j  2ui , j  ui 1, j



t  x 
2

ui , j 1  rui 1, j  (1  2r )ui , j  rui 1. j (1) 


or

t
where, r 
 x 
2

(2) 
3x
Initial condition is: u ( x,0)  sin
2

 u 
Boundary conditions are: u0, j  0 and    0 ; N  10
 x  N , j

Replacing L.H.S of the above boundary condition by Backward Difference,

u N 1, j  u N , j
 0  u N 1, j  u N , j  u10 j  u9, j (3)
x

Substituting r = 1/4 and j = 0 in equation (1)

ui ,1 
1
4
 ui1,0  2ui,0  ui1,0  (4) 

Substituting i =1,2------,9 in equation (4) ,we get values at the first time level .These values are
used for the solution at the second time level for j=1.These values are shown below:

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i = 10

X= 0. X=0.1 X=0.2 X=0.3 X=0.4 X=0.5 X=0.6 X=0.7 X=0.8 X=0.9 X=1.0

j=0 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0657 .0740 .0740

j=1 0 .0082 .0164 .0247 .0329 .0411 .0493 .0574 .0656 .0739 .0739

The Exact solution is :

9 2t
3x
u  x, t   e 4
sin
2 (here t=0.0025)

Comparison between Explicit and Exact solution:

X 0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Explicit 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0656 .0739 .0739

Exact 0 .0078 .0156 .0233 .0311 .0389 .0467 .0543 .0622 .0699 .0777
0.08

0.07 Explicit
Exact
0.06

0.05
u(x,t)

0.04

0.03

0.02

0.01

0
0 0.2 0.4 0.6 0.8 1
x

u 2u
Example 2 : Consider the PDE :  x 2 ;0  x  1, t  0 (1)
t x
u 1
B.Cs (i) u=0 at x=0, t>0 (ii)  u; x  1, t  0
x 2

I.C is u = x(1-x) when t=0 & 0  x  1

Solve this equation by an explicit method , employing central-difference for the boundary
conditions. Take x  h  0.1 & r =0.25 and 0.7 and compare the result.

Solution:

The explicit approximation is

ui , j 1  ui , j ih  ui 1, j  2ui , j  ui 1, j 



k h2
 ui , j 1  irhui 1, j  1  2irh  ui , j  irhui 1, j ; i  1, 2,..., N  1 (2) with r  k h 2

Now applying central difference formula to Second B.C. , we get

ui 1, j  ui 1, j 1
 ui , j  ui 1, j  ui 1, j   hui , j
2h 2

At x=1 i .e. i=10


u11, j  u9, j   hu10, j  u11, j  u9, j  hu10, j  u9, j  .1u10, j (3)

(i) r=0.25

Putting i=10 , h=0.1 in equation (2);

1 1 1
u10, j 1  u9, j  u10, j  u11, j
4 2 4 (4)
Eliminating u11,j from eqn.(3) & eqn.(4),we get

1 19
u10, j 1  u9, j  u10, j
2 40 (5)

The other B.C. is u=0 at x=0 & t>0

 u 0,1  u 0, 2  u 0,3  .......... ..........u 0,n  0

And I.C is: u(x,0)=x(1-x); 0  x 1

u0,0  u (0, 0)  0, u1,0  u (.1, 0)  0.09, u2,0  u (.2, 0)  0.16


u3,0  u (.3, 0)  0.21, u4,0  u (.4, 0)  0.24, u5,0  u (.5, 0)  0.25, u6,0  0.24,
u7,0  0.21, u8,0  0.16, u9,0  0.09, u10,0  0
Now putting r=0.25 & h=0.1 in (2)

 ui , j 1  0.025iui 1, j  (1  0.05i )ui , j  0.025iui 1, j (6)

Ist time level: Putting i=1,2,3…….9 ,j=0 in eqn.(6)

u1,1  .025u0,0  (1  .05)u1,0  .025u2,0  0.0895


u2,1  .05u1,0  0.9u2,0  .05u3,0  0.1590
u3,1  .075u2,0  .85u3,0  .075u4,0  0.2085
u4,1  0.1u3,0  0.8u4,0  0.1u5,0  0.2380
u5,1  0.2475, u6,1  0.2370, u7,1  0.2065
u8,1  0.1560, u9,1  0.0855

Putting j=0 in equation (5)

1 19 1
u10,1 u9,0  u10,0  u9,0  0.0450
2 40 2
Now, Second time level: Putting i=1,2,3…….9 ,j=1 in equation (6)
u1,2  0.025u0,1  (1  0.05)u1,1  0.025u2,1  .0890
u2,2  0.05u1,1  0.9u2,1  0.05u3,1  0.1580
u3,2  0.075u2,1  0.85u3,1  0.075u4,1  0.2070
u4,2  0.1u3,1  0.8u4,1  0.1u5,1  0.2360
u5,2  0.2450, u6,2  0.2340, u7,2  0.2030
u8,2  0.1520, u9,2  0.0922

Putting j =1 in equation (5)

1 19
u10,1  u9,1  u10,1  0.0641
2 40

(ii) r=0.7

Put i =10,r=0.7,h=0.1 in equation(2)

u10, j 1  0.7u9, j  0.4u10, j  0.7u11, j (7)

Eliminate u11, j from equation (3) and equation (7); we get

u10, j 1  1.4u9, j  .47u10, j (8)

Put r=0.7 & h=0.1 in equation (2)

ui , j 1  0.07iui 1, j  (1  0.14i )ui , j  0.07iui 1, j (9)

Ist time level

Putting i=1,2,3…….9 , and j=0 in (9)

u1,1  .07u0,0  (1  .14)u1,0  .07u2,0  0.0886


u2,1  0.14u1,0  .72u2,0  .14u3,0  0.1572
u3,1  0.21u2,0  .58u3,0  .21u4,0  0.2058
u4,1  0.28u3,0  .44u4,0  .28u5,0  0.2344
u5,1  0.2430, u6,1  0.2316, u7,1  0.2002
u8,1  0.1488, u9,1  0.0774

Putting j=0 in (8)

u10,1  1.4u9,0  .47u10,0  .126

Second time level


Putting i=1,2,3…….9 , and j=1 in (9)

u1,12  0.07u0,1  (1  0.14)u1,1  0.07u2,1  0.0872


u2,2  0.14u1,1  0.72u2,1  0.14u3,1  0.1544
u3,2  0.21u2,1  0.58u3,1  0.21u4,1  0.2016
u4,2  0.28u3,1  0.44u4,1  0.28u5,1  0.2288
u5,2  0.2360, u6,2  0.2232, u7,2  0.1904
u8,2  0.1376, u9,2  0.1530

Putting j=1 in (8)

u10 , 2  1.4u9,1  47u10 ,1  0.0491

The results are written in Tabular Form:

For first time level For second time level

r=.7 Difference r=.25 r=.7 Difference


r=.25
I=1 .0895 .0009 .089 .0872 .0018
.0886
I=2 .159 .00180 .158 .1544 .0036
.1572
I=3 .2085 .2058 .0027 .207 .2016 .0054

I=4 .238 .2344 .0036 .236 .2288 .0072

I=5 .2475 .243 .0045 .245 .236 .0090

I=6 .237 .2316 .0054 .234 .2232 .0108

I=7 .2065 .2002 .0063 .203 .1904 .0396

I=8 .156 .1488 .0072 .152 .1376 .0144

I=9 .0855 .0774 .0081 .0923 .153 -.0608

I=10 .045 .036 .009 .064 .095 -.0308

Comparison for different values of ‘r’ in Explicit Method:‐ 
0.25 0.25
r=0.25 r=0.25
r=0.70 r=0.70
0.2 0.2

0.15 0.15
u(x,t)

u(x,t)
0.1 0.1

0.05 0.05

0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x x

 
   
   First Time Level  Second Time Level

   

 
 

 
Crank Nicolson Scheme 
Due to some limitations over Explicit Scheme, mainly regarding convergence and stability,
another schemes were developed which have less truncation error and which are
unconditionally convergent and stable. Crank and Nicolson in the year 1947 proposed a scheme
1
by introducing a fictitious time level at ( j  ) as shown in fig(3)
2

(j+1)th level
u i,j+1 
Level (j+1/2)th 
u i,j+1/2 
jth level 

u i, j 

ith level 

fig(3)

and then discretizing the given PDE

u  2u
 c2 2 at (i, j+1/2) (3.1) 
t x

 u    2u 
   c 2  2  (3.2) 
 t  i , j  1  x  i , j  1
2 2

Replacing the first order derivative by Central Difference and the second order derivative by the
average at ( i, j )th and ( i, j+1)th levels,giving

ui , j 1  ui , j
t

2(
1
x ) 2

ui1, j  2ui, j  ui1' j   ui1, j1  2ui, j1  ui1, j1   (3.3)
2.
2

which gives on rearranging:

 ru i 1, j 1  ( 2  2r )ui , j 1  ui 1, j 1  rui 1, j  ( 2  2r )ui , j  rui 1, j (3.4)


t
with, r 
( x ) 2

LHS of equation (3.4) consists of the values of u at ( j + 1 )th level whereas RHS contains values
at jth level. Thus LHS contains unknowns whereas all values in RHS are known with i = 1,2
….. ,N and j = 1,2 ……,M . Also i = 0 and i = N+1 defines the boundary.

Now putting j = 0 in equation (3.4), we get

 rui 1,1  ( 2  2r )ui ,1  ui 1,1  rui 1, 0  (2  2r )ui , 0  rui 1, 0

Putting all values of i = 1,2……..,N, we get a system of N linear algebraic equations in N


unknowns u11, u21……. uN1 which can be solved by any iterative/direct scheme.

Scheme given by equation (3.4) is called Crank Nicolson scheme which is an implicit scheme.

The computational molecules of this scheme is as shown in Fig(1).

u i‐1,j+1  u i, j  u i+1,j  Unknown Values 

2+ (j+1)th level 

2‐
jth level 

u i‐1,j  u i ,j  u i+1,j  Known Values 

Fig.(1)

Talking about the truncation error of this scheme, it can be observed from the equation (3.3) that
 t 
2

the TE is o   ox  which is definitely less then the Explicit Scheme given in lecture 2.
2

 4 

Another advantage of this scheme is that this scheme is unconditionally convergent and stable.
Thus the restriction on r<1/2 is not to be satisfied. However, care is still to be taken that ‘r’
cannot taken as too large. As per derivation of the derivative in terms of FD, both ∆t and ∆x are
t
quite small and r so obviously r cannot be too large.
(x) 2

The only disadvantage with this scheme is that the equations are to be solved simultaneously at
every time level which is time consuming. One can observe that the shape of the coefficient
matrix is tridiagonal, therefore efficient solver of tridiagonal system can be used to save
computational time.

Example 1:‐  Solve the Heat Conduction Equation


u  2 u
 0  x  1 ,t  0
t t 2

u
0
subject to B.Cs. u = 0 at x = 0 and x at x = 1 ,for all t

3x
and I.C. u ( x,0)  sin
2

Using the Crank Nicholson scheme ,choosing ∆x = 0.1 and ∆t = 0.0025 so that r = 1/4, obtain
the solution for one time level and compare it with the Explicit solution.

Solution:      
Crank Nicolson Finite-Difference representation of the given equation is:

u i , j 1  u i , j
t

1
2(x) 2
 
ui1, j  2ui, j  ui1' j   ui1, j 1  2ui, j 1  ui1, j 1 
2.
2

 rui 1, j 1  (2  2r )ui , j 1  ui 1, j 1  rui 1, j  (2  2r )ui , j  rui 1, j


r  t x 
2
with

3x
Initial condition is: u ( x,0)  sin (2) 
2
 u 
Boundary conditions are: u 0, j  0 and    0 ; N  10
 x  N , j
Replacing L.H.S by Backward Difference

u N 1, j  u N , j
 0  u N 1, j  u N , j  u10 j  u9, j (3)
x

Substituting j = 0 in equation (1)

 rui 1,1  ( 2  2r )ui ,1  ui 1,1  rui 1, 0  ( 2  2r )ui , 0  rui 1, 0


(4)

Now substituting i = 1,2,.........,9 in equation (4), we get 9 equations in 10 unknowns. So,with the
help of equation (3) we have 10 equations in 10 unknowns.

The corresponding equations are:

2.5u1,1  0.25u 2,1  1.5u1,0  0.25u 2, 0

 0.25u1, 0  2.5u 2,1  0.25u 3,1  0.25u1, 0  1.5u 2, 0  0.25u 3, 0

 0.25u 2, 0  2.5u 3,1  0.25u 4,1  0.25u 2, 0  1.5u 3, 0  0.25u 4, 0

 0.25u 3, 0  2.5u 4,1  0.25u 5,1  0.25u 3, 0  1.5u 4, 0  0.25u 5, 0

 0.25u 4, 0  2.5u 5,1  0.25u 6,1  0.25u 4 , 0  1.5u 5, 0  0.25u 6, 0

 0.25u 5, 0  2.5u 6,1  0.25u 7 ,1  0.25u 5, 0  1.5u 6 , 0  0.25u 4, 0

 0.25u 6, 0  2.5u 7 ,1  0.25u 8,1  0.25u 6, 0  1.5u 7 , 0  0.25u 5, 0

 0.25u 7 , 0  2.5u8,1  0.25u 9,1  0.25u 7 , 0  1.5u8, 0  0.25u 6, 0

 0.25u8, 0  2.5u 9,1  0.25u10 ,1  0.25u 8, 0  1.5u 9, 0  0.25u10 , 0 (5) 

with the help of equation (3) , the last equation (5) becomes-

 0.25u8, 0  2.25u 9,1  0.25u8, 0  1.75u 9, 0

On solving this system of equation we get values at the first time level as follows:

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i = 10
X= 0. X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1

j=0 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0657 .0740 .0740

j=1 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0656 .0722 .0722

Comparison between the results obtained by Crank-Nicolson and Explicit methods:

0.08

0.07

C-N
0.06
Explicit
0.05
u(x,t)

0.04

0.03

0.02

0.01

0
0 0.2 0.4 0.6 0.8 1
x

Example 2:  Consider the PDE as follows:

u  2u
   x 2 ;0  x  1, t  0                                                                                                    (1) 
t x

u 1
B.C   (i) u=0 at x=0, t>0      (ii)       u; x  1, t  0  
x 2

I.C  is   u=x(1‐x)    when t=0 &   0  x  1  

Solve this equation by Crank‐Nicolson Scheme , employing central‐difference for the boundary 
conditions. Take  x  h  .1  & r=0.25 . 

Solution:  
Here we approximate the given equation by C‐N Scheme as 

ui , j 1  ui , j ih  ui1, j 1  2ui , j 1  ui 1, j 1 ui 1, j  2ui , j  ui 1, j 


   
k 2  h2 h2   
 irhui 1, j 1  (2  2irh)ui , j 1  irhui1, j 1  irhui 1, j  (2  2irh)ui , j  irhui 1, j

Putting  r=.25 and h=.1 ,we get 

 .025iu i 1, j 1  ( 2  .05i )ui , j 1  .025iui 1, j 1  .025iu i 1, j  ( 2  .05i )ui , j  .025iu i 1, j ( 2)                     

I.C is  u(x,0)=x(1‐x);      0  x  1   

u0,0  u (0, 0)  0, u1,0  u (0.1, 0)  0.09, u2,0  u (0.2, 0)  0.16


u3,0  u (0.3, 0)  0.21, u4,0  u (0.4, 0)  0.24, u5,0  u (0.5, 0)  0.25
 
u6,0  0.24, u7,0  0.21, u8,0  0.16,
u9,0  0.09, u10,0  0

Now Ist  B.C is  :    u=0 at x=0 for  t 

 u 0,1  u 0 , 2  u 0,3  .......... ..........u 0,n  0  

u 1
nd
 2  B.C at x=1 is:   u
t 2  

Now apply central difference formula here, we get 

ui 1, j  ui 1, j 1
 ui , j  ui 1, j  ui 1, j   hui , j                 
2h 2

At  x=1  i .e.  i=10 

u11, j  u9, j   hu10, j  u11, j  u9, j  hu10, j  u9, j  .1u10, j      ;  true for all values of j                                  


(3) 

u11, j 1  u 9, j  .1u10 , j (4) 


                                                                                                                                          

Put i=10 in equation (2) 
(5) 
 .25u 9, j 1  2.5u10 , j 1  .25u11, j 1  .25u 9, j  1.5u10 , j  .25u11, j                                                                 
Now eliminate  u11, j  and  u11, j 1  from equation (5) ,using equation (3) and equation (4),              
we get 

 .5u 9, j 1  2.525u10 , j 1  .5u 9, j  1.475u10 , j                                                                                                    


(6) 

At Ist time level:   Putting  i=1,2,3,…………9 & j=0 in (2), we get 

2.05u1  0.025u 2  0.1795


 0.05u1  2.1u 2  0.05u3  0.319
 0.075u 2  2.15u3  0.075u 4  0.4185
 0.1u3  2.20u 4  0.1u5  0.478
 0.125u 4  2.25u5  0.125u6  0.4975
 0.15u5  2.3u6  0.15u7  0.477
 0.175u6  2.35u7  0.175u8  0.4165
 0.2u7  2.4u8  0.2u9  0.316
 0.225u8  2.45u9  0.225u10  0.1755
 

Put j = 0 in equation (6): 

 0.5u9  2.525u10  0.045  

After solving  these equations, we get 

u1  u1,1  0.0895, u 2  u 2,1  .1590, u3  u3,1  0.2085


u 4  u 4,1  0.2380, u5  u5,1  .2475, u6  u6,1  0.2370
 
u7  u7,1  0.2065, u8  u8,1  .1563, u9  u9,1  0.0892
u10  u10,1  0.0355

2nd time level 

Substitute i =1,2,………,9 & j =1 in equation (2), we get 
2.05u1  0.025u 2  0.1785
 0.05u1  2.1u 2  0.05u3  0.317
 0.075u 2  2.15u3  .075u 4  0.4155
 0.1u3  2.2u 4  0.1u5  0.474
 0.125u 4  2.25u5  0.125u6  0.4925
 0.15u5  2.30u6  0.15u7  0.471
 0.175u6  2.35u7  0.175u8  0.4096
 0.2u7  2.40u8  0.20u9  0.3092
 0.225u8  2.45u9  0.225u10  0.1814
  

Put j =1 in equation (6)

 .5u9  2.525u10  .09696

After solving  these equation, we get 

u1  u1, 2  .0890, u  2  u 2, 2  .1580, u3  u3, 2  .2070


u 4  u 4, 2  .2360, u5  u5  , 2  .2450, u6  u6, 2  .2340
 
u7  u7 , 2  .2032, u8  u8, 2  .1536, u9  u9, 2  .0969
u10  u10, 2  .0569

Thus,the values at first and second time level are:

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i = 10

X= 0. X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1

j=1 0 .0895 .1590 .2085 .2380 .2475 .2370 .2065 .1563 .0892 .0355
j=2 0 .0890 .1580 .2070 .2360 .2450 .2340 .2032 .1536 .0969 .0569

 
 
 

 
Implicit Scheme
The assumption of Crank Nicholson scheme with a fictitious time level and taking the
average of space derivative at jth and ( j+1)th time level was ignored by O Brein, who developed
the scheme known as Implicit Method. In this scheme, the space derivative is taken as ( j+1)th
level and thus providing

ui , j 1  ui , j

1
u  2u u  (4.1)
t x 2 i 1, j 1 i , j 1 i 1, j 1
Above representation has a truncation error ot   ox  which is comparable to C-N scheme
2 2

but less then the conventional Explicit Scheme.

Equation (4.1) can be rewritten as :

 ru i 1, j 1  1  2r u i , j 1  ru i 1, j 1  u i , j
(4.2)

Starting with j = 0,

(4.3)
 ru i 1,1  1  2r u i ,1  ru i 1,1  u i , 0

Using i = 1,2, ……. N, equation (4.3) gives a system of N equations in N unknown which can be
solved.

More generally equation (4.1) can be written as :

 
u i , j 1  u i , j  r  u i 1, j 1  2u i , j 1  u i 1, j 1   1   u i 1, j  2u i , j  u i 1, j  (4.4)

with 0    1.

For  =1 , equation(4.4) reduces to Equation (4.1), whereas   1 / 2 ,reduces it to


Crank-Nicholson Scheme and =0 reduces it to Explicit Scheme.

Rearranging equation (4.4):


 rui 1, j 1  (1  2r )ui , j 1  rui 1, j 1  r (1   )ui 1, j  1  2r (1   )ui , j  r (1   )ui 1, j (4.5)

The computational molecules for equation (4.5) can be shown as shown in Fig.(1).

u i‐1,j+1  u i, j  u i+1,j  Unknown Values 

   ‐λr    1+2λr      ‐λr  (j+1)th level 

  r(1‐  1‐2r(1‐    r(1‐ jth level 

u i‐1,j  u i ,j  u i+1,j  Known Values 

Fig.(1)

The truncation error obviously tends to zero as t  0 and x  0 .This scheme is also
unconditionally convergent and stable .Only disadvantage with it is that one has to solve
N equations at each time level ,but that can be managed if one is solving it in a coded
environment.

 
u  2 u
Example:- Solve the heat conduction equation  0  x  1 ,t  0
t t 2
subject to u = 0 at x = 0 for all t and

u 3x
 0 at x = 1 and u ( x,0)  sin
x 2

Using the Implicit Method ,choosing ∆x = 0.1 and ∆t = 0.0025 so that r = 1/4, obtain the solution
for one time level and compare with the Crank-Nicholson solution.

Solution: One Implicit Finite-Difference representation of this equation is

ui , j 1  ui , j

1
u  2u u 
t x 2 i 1, j 1 i , j 1 i1, j 1
 
or,  ru i 1, j 1  1  2r ui , j 1  ru i 1, j 1  ui , j (1) , with r  t x 
2

3x (2) 
Initial condition is: u ( x,0)  sin
2

 u 
Boundary conditions are: u 0, j  0 and    0 ; N  10
 x  N, j

Replacing L.H.S of second B.C. by Backward Difference

u N 1, j  u N, j
0  u N 1, j  u N, j  u10 j  u 9, j (3)
x

Substituting j = 0 in equation (1)

 ru i1,1  1  2r  u i,1  ru i1,1  u i,0 (4) 

Now substituting i = 1,2,.........,9 in equation (4) we get 9 equations in 10 unknowns. So,with the
help of equation (3) we have 10 equations in 10 unknowns. The
corresponding equations are:-

0.25u 0,1  1.25u1,1  0.25u 2,1  u1,0


0.25u1,1  1.25u 2,1  0.25u 3,1  u 2,0

0.25u 2,1  1.25u 3,1  0.25u 4,1  u 3,0

0.25u 3,1  1.25u 4,1  0.25u 5,1  u 4,0

0.25u 4,1  1.25u 5,1  0.25u 6,1  u 5,0

0.25u 5,1  1.25u 6,1  0.25u 7,1  u 6,0

0.25u 6,1  1.25u 7,1  0.25u 8,1  u 7,0

0.25u 7,1  1.25u 8,1  0.25u 9,1  u 8,0

0.25u 8,1  1.25u 9,1  0.25u10,1  u 9,0 (5) 

With the help of equation (3) the last equation (5) becomes-

0.25u 8,1  u 9,1  u 9,0

On solving this system of equations, we get the values at the first time level as follows:

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i = 10
X= 0. X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1 X=0.1
j=0 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0657 .0740 .0740
j=1 0 .0082 .0164 .0247 .0329 .0411 .0493 .0575 .0655 .0723 .0723

Comparison between Implicit and Crank-Nicolson results:


0.08

0.07 Implicit
C-N
0.06

0.05
u(x,t)

0.04

0.03

0.02

0.01

0
0 0.2 0.4 0.6 0.8 1
x

 
 
 

                               Three Time Level scheme


Various two time level schemes, as discussed earlier are quite efficient. Richardson,
developed a scheme by replacing the time derivative with central difference scheme and
space derivative by the usual central difference approximation in  
u  2 u
the partial differential equation:  (4.1) 
t  x 2
At the point (xi , tj), equation (4.1) is reduced to

 u    2u 
    2
 t i, j  t i, j

u i, j1  u i, j1 u i 1, j  2u i, j  u i 1, j


 
2 t  x 
2

 u i, j1  u i, j1  2r(u i 1, j  2u i, j  u i 1, j ) (4.2) 

This scheme (4.2) is called the Richardson three time level scheme. The truncation error in this

o t   o(x )2 .
2
scheme is again

This scheme is an Explicit Scheme as it obtains the result pointwise.

The computational molecule of this scheme is as shown in Fig.(1)

u i,j+1    (j+1)th level 

   jth level 

u i‐1,j    2r     ‐4r    2 r  u i+1,j  (j+1)th level 

u i, j 

   (j‐1)th level 
 
u i,j‐1 
Fig(1)

Another modification of this scheme was given by Dufort and Frankel who suggested to replace

u i, j on the R.H.S by the average of u i1, j and u i1, j ,i.e.

u i, j 
1
2
 u i1, j  u i1, j  (4.3) 

Substituting relation (4.3) in equation (4.2) ,we get

1  2r
u i, j1 
1  2r
u i. j1 
2r
1  2r
 u i1, j  u i1, j  (4.4) 

This scheme is called Dufort Frankel Explicit scheme.

The advantage of this scheme is that inspite of it being an Explicit scheme, it has truncation

error o( t) 2  o( x) 2 . But on the other hand, it requires the solution at the first time level
to be determined by any other two time level scheme. For j = 2 onwards, this scheme can be
applied.

The computational molecule of this scheme is as shown in fig(2).

u i,j+1   

   (j+1)th level 

  2r    2 r  jth level 


u i, j 
u i‐1,j  u i+1,j 

   (j‐1)th level 
 
u i,j‐1 
Fig (2)

These schemes however have some problem with stability and compatibility which will be
discussed later.

Example: Solve the partial differential equation :

u  2 u
 ; 0  x  1, t  0
t dx 2
u  x,0  x,u  0,t   0 ; u 1, t   1,
Subject to 

With r  0.75,  x  0.1

Obtain the solution at first time level using C-N scheme and obtain the second time level by
(i) Dufort Frankel (ii) Richardson

and compare the result.

Solution:   
By Crank Nicolson, equation (1) can be approximated as 

 ru i 1, j1  (2  2r)u i, j1  ru i1, j1  ru i 1, j  (2  2r)u i, j  ru i1, j              (2) 

   As r= 0.75 and  x  0.1  

  Put r =0.75 in equation (2),we get 

3u i 1, j1  14u i, j1  3u i 1, j1  3u i 1, j  2u i, j  3u i 1, j                                   (3) 

u 0,0  0,u1,0  .1,u 2,0  .2,u 3,0  .3,u 4,0  .4,u 5,0  .5
Now I.C. is  u(x, 0)  x  i.e.        
u 6,0  .6, u 7,0  .7,u 8,0  .8,u 9,0  .9,u10,0  1.0
u(o, t)  0, u 0,0  u 0,1  u 0,2  u 0,3  ......................  u 0, j  0
And B.C. is                                      
u(1, t)  1    i.e. u10,0  u10,1  u10,2  u10,3  ........................  u10, j  1
Now for Ist time level we use C‐N scheme 

14u1 3u 2  0.8


3u1  14u 2 3u 3  1.3
3u 2  14u 3 3u 4  2.4
3u 3  14u 4 3u 5  3.2
 
3u 4  14u 5 3u 6 4
3u 5  14u 6 3u 7  4.8
3u 6  14u 7 3u 8  5.6
3u 7  14u 8 3u 9  6.4
3u 8  14u 9  10.2

 u1  u1,1  0.0949, u 2  u 2,1  0.1763, u 3  u 3,1  0.2947


u 4  u 4,1  0.3988, u 5  u 5,1  0.4997, u 6  u 6,1  0.5999  

u 7  u 7,1  0.7000 , u 8  u 8,1  0.8000, u 9  u 9,1  0.9000

(i)  Dufort Frankel Explicit Scheme is 

1  2r
u i, j1 
1  2r
u i, j1 
2r
1  2r
 u i1, j  u i1, j)   
 Put r=.75 

1
u i, j1   u i 1, j  u i 1, j                                                   (3) 
3
 u i, j1 
5 5
For 2nd time level 

Put j=1 in (3) 
u 0,2  0,u10,2  1.000
1 3
u1,2  u1,0  (u 0,1  u 2,1 )  .08578
5 5
1 3
u 2,2  u 2,0  (u1,1  u 3,1 )  .19376
5 5
1 3
u 3,2  u 3,0  (u 2,1  u 4,1 )  .28506  
5 5
similarly
u 4,2  .39664, u 5,2  .49922, u 6,2  .59982
u 7,2  .69994, u 8,2  .8000,u 9,2  .9000

(ii) Richardson’s Scheme is 

u i, j1  u i, j1  2r(u i1, j  2u i, j  u i 1, j )                                       

Put r=0.75 

u i, j1  u i, j1 
3
2
 u i1, j  2u i, j  u i1, j                                                 (4) 
 

Putting  j=1 in (4) 
u 0,2  0,u10,2  1
3
u1,2  u1,0  (u 0,1  2u1,1  u 2,1 )  .07975
2
3
u 2,2  u 2,0  (u1,1  2u 2,1  u 3,1 )  .2555
2
3
u 3,2  u 3,0  (u 2,1  2u 3,1  u 4,1 )  .27855
2
u 4,2  0.38976, u 5,2  0.49895, u 6,2  0.59985
u 7,2  0.69985, u 8,2  0.8000, u 9,2  0.9000

Table showing a comparision of the values obtained by Dufort‐Frankel and Richardson 
scheme for second time‐level 

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i = 10

Dufort Frankel  0      .1937 .2851     .4992     .6999         1.000
.0858 .3966 .5998 .8000 .9000
Richardson  0      .2555 .2886     .4990     .6998         1.000
.0798 .3968 .5998 .8000 .9000

Graphically it is as follows:

0.9
Dufort Frankel
0.8 Richordson

0.7

0.6
u(x.t)

0.5

0.4

0.3

0.2

0.1

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
 
                                            
 
     Compatibility of one-dimensional Parabolic
PDE
There are variety of schemes for solving Parabolic PDE, as discussed earlier. The
implementation of these depends on three basic concepts.. Let the PDE be Lū = f , where L is
 2
the linear operator . e.g. L  2 (1.1)
t x
Let it be replaced to L*U – f = 0 , where L* is the finite difference operator corresponding
equation (1.1). If under the limit as t  0 and x  0 , Uu then we say that U is
required solution of equation (1.1).

There arise three concepts namely:

Compatibility, Stability and Convergence which every scheme has to satisfy.. Let us define
each of these terms:

Compatibility: Sometimes corresponding to a PDE, when any finite difference scheme is


implemented, then under the limit as x  0 , the solution converges to the solution of a
different differential equation, then such schemes are called as incompatible scheme. To
illustrate this undesirable situation , let us consider three schemes namely : Explicit ,
C-N and Dufort -Frankel. Let Fui, j represent the corresponding finite difference scheme.

Then,

(i) For explicit scheme , using Taylor series expansion ,

 u  2 u  1   2 u 1 2  u
2

Fui , j    2    t 2  x       (1.2) 
 t x  2  t x 4
6 

(ii) For the C-N scheme , using Taylor series expansion,

 u  2 u  1   u  2 u  1 2  u
 
4
Fu i , j    2   t   2   x  (1.3) 
 t x  2 t  t x  12 x 4

(iii) For the Dufort Frankel scheme,

 u  2 u  1  3u 1  4 u t   2 u
2
Fu i , j    2   x 2 3  x 2 4   (1.4) 
 t x  6  t 12 x x  2
t 2

The finite difference schemes are said to be compatible with the given PDE if the local
truncation error  0 as x  0 , t  0 .
The Explicit and C-N scheme are clearly compatible while in the Dufort -Frankel scheme , if
t
 a constant =   , when both x  0 , t  0 . In that case the original heat
x
conduction equation approaches to

u  2u  2u
 2 2 2  0 ,which is not the same as the original equation hence the scheme is
t x t
incompatible.

Stability: Stability means that the error at any stage of computations are not amplified but are
attenuated as the computation progress , i.e. as t increases , error does not increase. The
stability criteria has significance for Initial value problems which can be checked either by matrix
method or Numann method.

Convergence: Convergence means that as x  0 , t  0 , the solution of finite difference


equations approaches to the true solution. The proof of convergence of any scheme is a
complicated procedure therefore we follow the convergence criterion as given by LAX:

Given a properly posed Initial Boundary Value Problem, and a finite difference
approximation which is compatible, then stability is the necessary and sufficient condition for
convergence.

Revisiting equation (1.2), we can write

 u  2 u   t  2 u x 2  4 u   t 2  3u x 4  6 u 
Fu i , j    2       
 t x   2 t
2
12 x 4   6 t 3 360 x 3 


x 2  r  1   4 u  x 4  r 2  1   6u

   
2  6  x 4 6  60  x 6

, the truncation error is O x  , which is of higher order.


1
r
4
Thus if
6

The analysis of stability of different schemes will be discussed in next lecture.

 
                                                          

 
Stability of one-dimensional Parabolic PDE
For a given PDE, let u(x,t) be the solution of finite difference approximation and at the fixed
point (x0, t0) , let u(x0, t0) be computed as u(x0, t0) + ε due to range of error . The solution is thus
continued for consecutive time levels with u(x0, t0) + ε instead of u(x0, t0) . Thus if at a level
u*(x, t) is the solution then error is : u*(x, t) - u(x, t) which if remain bounded then the scheme is
said to be stable.

There are two approaches for investigating the stability of any finite difference scheme

(1) Matrix Method (2) Neumann Method

The Neumann method has flexibility for using the three time level scheme also which can not be
investigated by Matrix Method. Let us discuss both the methods with reference to the Explicit
Scheme:

(1) Matrix method :

The Explicit scheme can be written as

u i , j 1  ru i 1, j  (1  2r ) ui . j  rui i . j , i = 1,2 - --, N (2.1) 

Let the jth level has certain error.Thus the values at given (j+1)th level will have some more
error, let the computed value be denoted by u* , thus

u i , j 1  ru  i 1, j  (1  2r )u  i. j  ru  i i. j
(2.2) 
Subtracting equation (2.2) from equation (2.1) we get

ei. j  rei 1. j  (1  2r )ei . j  rei 1. j , i = 1,2,- - -, N (2.3) 

Where ei. j denotes the error at the (i, j)th node and is equal to u i. j  u *i. j

Obviously, u0, j= uo, uN+1, j= uj on using boundary conditions.

Hence e0 ,j= eN+1,.j = 0 ; equation (2.3) can be written in the matrix form as:

 e1, j1  1  2r r 0   0   e1, j 


e    
 2, j1   r 1  2r r   0   e 2, j 

            
   
            
            
(2.4) 
    
e N, j1   0    r 1  2r  e N, j 
or, e j1  A e j (2.5)

1  2r r 0   0 
 r 1  2r r   0 
 
       
A 
       
       
 
 0    r 1  2r 

Thus for different values of ‘j’,we have-

e1  A e0 , e2  A 2 e0 ,   , ek  A k e0 , (2.6) 

The ek i.e. propagated error at kth time level is depending on the matrix A and e 0 .

Let the matrix A have ‘n’ linearly independent eigen values λ1 , λ2, ---, λn corresponding
eigenvectors v1 , v2, ---, vn which are all distinct such that A vi = λi vi
Hence e 0  c i v i
(2.7) 
N N N
 ek  A e0  A
k k 1
 c Av
i 1
i i A k 1
c  v
i 1
i i i   ci  i k v i
i 1

which does not increase definitely if i  1 i.e.  max  1

This is the condition for stability of the Explicit Scheme. Now using Brauer’s theorem ,we can
have for the first row -

  1  2r   2r
or, -r   -1  2r  r
 1-3r    1  r.

2
For   1 , right hand inequality gives 0  r  2 and left hand inequality gives 0r
3
Applying Braurer’s theorems for the remaining rows :
1 1
  1  2r   2r  0r thus, r
2 2
.

For Crank Nicolson scheme ,the system of equation can be written as :

 ru i 1, j1  (2  2r)u i, j1  u i 1, j1  ru i 1, j  (2  2r)u i, j  ru i1, j

which in the matrix form is written as: (by substituting i=1,2,---,N)

 2  2r r 0   0   u1, j1   2  2r r 0   0   u1, j 


 r  u    
2  2r r   0  2, j1  r 2  2r r   0   u 2, j 
   
                   
         bj
                   
                   
     
 0    r 2  2r   u N, j1   0    r 2  2r   u N, j 
Where bj is a vector containing known boundary values.

This can be written as :

 2I N  rBN  u j1   2I N  rBN  u j  b j


 2I N  rBN   2I N  rBN 
1
 The iterative matrix A is
2  4r sin 2 k
2  N  1
whose eigen values are k  , k  1,2,   , N.
2  4r sin 2 k
2  N  1
2  4r sin 2 k
2  N  1
 max  k  max  1 for all r  0
2  4r sin 2 k
2  N  1

This C-N scheme is unconditionally convergent.

(2) Neumann Method:

This method is based on the assumption of the solution in the form of separation of variables.

Let, u  x,k   e t  Aeix  Be  ix 

Avoiding the suffixes i & j and replacing them by m & n resp. The expression for error can be

written as:

e m,n 1  re m 1,n  1  2r  e m,n  re m1,n (1)


 
Let, e m,n  ent .eimx   n .eimx ;   et (2) 
Now for stability   1, since in that case the error will not be increasing with t.

Substituting relation (2) in equation (1),we get:

 n 1eimx  r n ei (m 1) x  1  2r   n eimx  r n ei (m1) x


or,   reix  1  2r   reix
x
 1  4r sin 2
2
x 1
For stability   1  1  1  4r sin 2 1  r  .
2 2

 
 

        Convergence of one‐dimensional Parabolic PDE 
Whenever a Parabolic PDE is approximated by any finite difference scheme, it is very
important to verify whether the solution ‘U’ of FD scheme approaches to exact solution ‘u’ as
x  0, t  0 This is what we call convergence .
The difference ‘U- u‘ is called the discretization error.The magnitude of the
discretization error depends on the size , x, t , number of terms in the truncated series
etc. But is quite difficult to investigate the convergence of any scheme , specifically for
Non-Linear PDE. For linear PDE, the theorem of Lax is helpful for stability and compatibility.
For the sake of understanding , we will discuss the convergence of Explicit method.

The Explicit scheme is :


u i, j1  u i, j u i1, j  2u i, j  u i1, j (3.1)

t  x 
2

Let ei, j be the error at (i, j)th node to exact solution Ui,J.

Thus, ui ,J=Ui ,J - ei,J (3.2)


Substitutng relation (3.2) into equation (3.1):

ei, j1  rei 1, j  1  2r  ei, j  rei 1, j  U i, j1  U i, j  r  U i 1, j  2U i, j  U i 1, j  (3.3) 

Now using the Taylor’s Series expansion for Ui+1, j, Ui-1,j etc ,equation (3.3) can be replaced
by :

 U  2 U 
ei, j1  rei1, j  1  2r  ei, j  rei1, j  t   2 (3.4) 
 t x 
which is a difference equation in e i, j.

 U  2 U 
Let Ej be the max value of ei. j and M be the max modulus of   2 then
 t x 
equation (4.1) becomes as:-

ei, j1  r ei 1, j  1  2r  ei, j  r ei 1, j  tM

Provided 1  2r   0 or r 
1
2

or, ei, j1  rE j  1  2r  E j  rE j  tM  E j  tM


 E j1  E j  t M  E j1  2t M    E 0  t jM

But E0 is zero and E j1  0 as t  0. This shows that the scheme is convergent for
1
r .
2
Investigation of Non-Linear Parabolic PDE is quite difficult and can be done using the same
approach.

 
 

 
                   Elliptic Partial Differential Equations 
                                 ( Solution in Cartesian coordinate system) 
         Other category of second order PDE, which are basically used to characterize steady state
systems are called as Elliptic PDE. More prevalent examples are Laplace Equation and Poisson
Equation. Every potential function satisfies Laplace Equation. Another simple example is of heat
transfer in a rectangular plate under certain boundary conditions,where the temperature is to be
determined after a large time under steady state condition.

The Laplace/Poission equation in Cartesian coordinate system is given as

 2u  2u
 2  f ( x, y ) or  2u  f ( x, y ), a  x  b, c  y  d (1.1)
x 2
y

subject to either Dirichlet conditions or Mixed conditions.

Let the domain be subdivided by drawing horizontal and vertical lines at an equal
distance of  y and  x respectively. Let i and j be chosen as dummy variables along x and y
axis for i =1,2,...,N and j =1,2,...,M.             

Replacing both the second order derivatives in eqn.(1.1) by central difference approximations:

ui1, j  2ui , j  ui1, j ui , j 1  2ui , j  ui , j 1


  f (ix, jy) (1.2)
(x) 2 (y) 2

For x  y :

ui1, j  4ui , j  ui1, j  ui , j 1  ui , j 1  (x) 2 f (ix, jx) (1.3)

Equation (1.3) reduces to Laplace equation if f = 0. This equation can be solved iteratively both
explicitly as well as implicitly. The boundary conditions can be written as:

As a special case, Let a  0  c , then if i  1,2,...., N, and j  1,2,....., M


xi  ix, yi  iy
,
the boundary conditions can be written as u 0, j , u N 1, j and u i,0 and u i,M 1 .

Explicit scheme:

Rewritting equation (1.3) as:

(ui 1, j  ui 1, j  ui , j 1  ui , j 1 )


ui , j  (1.4)
4
The computational molecule for (1.4) can be shown as

u i,j+1 (1/4) 

(1/4)u i‐1,j   u i+1,j (1/4) 
u i, j  

u i,j‐1 (1/4) 

We start with here, j  1, i  1,2,....., N . However it involves u i 1, j as well as u i , j 1 which are
unknowns. Hence one has to start with guessed values. Thus an iterative procedure has to be
implemented. The guessed value has to be to chosen carefully in accordance with the boundary
conditions. Now R.H.S. can be handled accordingly with Jacobi’s or Gauss-Seidel approach.
The two possible iterative formulae, thus can be written as:

(uin1, j  uin1, j  uin, j 1  uin, j 1 )


uin, j 1  (1.5)
4
(uin11, j n 1
 ui , j 1  uin1, j  uin, j 1 )
uin, j 1  (1.6)
4

The superscript ‘n’ denotes the number of iterations. Both the formulae have the truncation error
o( x ) 2  o( y ) 2 . The iteration may be carried row-wise or column-wise.

It may be noted that x and y are taken to be small so usually number of nodes are
quite large. But sometimes geometrical symmetry may occur depending on the boundary
conditions. In that case the computational efforts can be reduced.  For example if the boundary
conditions are u (0, y )  u 0 , u ( a, y )  u0 , u ( x,0)  u1 , u ( x, b)  u1 then there is symmetry along
both x & y axis. This symmetry may be helpful in reducing the computations and one has to find
solution only in ¼ of the domain.

 2u  2 u
Example:   0.5 x, defined over 0  x  0.8, 0  y  0.6, with subjected to u  1 at
x 2 y 2
u
x  0, y  0, y  0.6 and  u at x  0.8, Obtain the solution correct to 2d using both
x
equations (1.5) and (1.6) and compare the result.
Solution:

 2u  2u
  0.5 x
x 2 y 2
U sin g equation (1.5) we have
(uin1, j  uin1, j  uin, j 1  uin, j 1 ) 0.50.2  i
3
n 1
u i, j   (1.7)
4 4
 u  u5,1  u3,1
  u  u 1.8
 x  4,1 2  0.2
4 ,1 4 ,1

Starting with assumed values as 0 i.e. u i,0 j  0 and


Putting i  1, j  1 in equation 1.7 

u1n,11 
1 n
4

u1,1  u 2n,1  1.996  1.9
Put i  2, j  1 in equation 1.7 
1

u 2n,11  u1n,1  u 2n,1  u3n,1  0.992
4
 1.10
Put i  3, j  1 in equation 1.7 
1

u3n,11  u 2n,1  u3n,1  u 4n,1  0.998
4
 1.11
Put i  4, j  1 in equation 1.7  and by equation(1.8)

u 4n,11 
5
13

2u3n,1  0.984  1.12

Hence finally we have four equations 1.9  , 1.10  , 1.11 , 1.12  which are solved iteratively.
The values as obtained are shown below:

u1,1 u 2,1 u 3,1 u 4,1


n=0 0.499 0.248 0.2495 0.3785
n=1 0.6858 0.4971 0.4685 0.5704
n=2 0.7947 0.6609 0.6335 0.7388
n=3 0.8629 0.7778 0.7653 0.8658
n=4 0.9092 0.8495 0.8517 0.9672
n=5 0.9384 0.9006 0.9166 1.0336
n=6 0.9587 0.9369 0.9622 1.0835
n=7 0.9729 0.9625 0.9951 1.1186
n=8 0.9829 0.9806 1.0186 1.1439
n=9 0.9899 0.9935 1.0353 1.1620
n = 10 0.9949 1.0027 1.0472 1.1748
n = 11 0.9984 1.0092 1.0557 1.1860
n = 12 1.0009 1.0138 1.0617 1.1905

Hence solution correct to 2d is:

u1,1=1 ; u 2,1=1.01 ; u 3,1=1.06 ; u 4,1=1.19

Now using equation (1.6), we have four final equations:

u1n,11 
4

1 n
u1,1  u 2n,1  1.996 

u 2n,11 
4

1 n1
u1,1  u 2n,1  u3n,1  0.992 

u3n,11 
4

1 n1
u 2,1  u3n,1  u 4n,1  0.998 

u 4n,11 
5
13

2u3n,11  0.984 
These equations are solved iteratively, the results obtained are shown below:

u1,1 u 2,1 u 3,1 u 4,1


n=0 0.499 0.3728 0.3427 0.6421
n=1 0.7169 0.6061 0.6472 0.8763
n=2 0.8297 0.7688 0.8226 1..0112
n=3 0.8986 0.8715 0.9258 1.0906
n=4 0.9415 0.9327 0.9868 1.1375
n=5 0.9676 0.9698 1.0230 1.1654
n=6 0.9833 0.9920 1.0446 1.1820
n=7 0.9828 1.0054 1.0575 1.1919
n=8 1.0020 1.0134 1.0652 1.1948

Hence solution correct to 2d is:

u1,1=1 ; u 2,1=1.01 ; u 3,1=1.06 ; u 4,1=1.19


Hence by equation (1.5),we have to work for 13 iterations where as by equation (1.6),we work
with only 9 iterations. Therefore, equation (1.6) gives faster convergence.

 
Successive Over Relaxation Method 
                    Any second order Elliptic Equation e.g. Laplace Equation, while solving by FD
method, always reduces to a equation containing u i , j , u i 1, j ,  u i 1, j and u i , j 1 which for different
values of ( i, j) may be converted to a system of equations. Rewriting equation (1.3) again:

ui1, j  ui1, j  ui , j 1  ui , j 1  4ui , j  (x) 2 f (ix, jy ).

Putting j =1, i =1,2,-------,N, then j =2, i =1,2,--------,N and in the same manner
j = M, i =1,2,----- ,N, thus finally we obtain a system of M  N equations which are solved by
any convenient method to get ui, j at all nodes. This is one of the Implicit scheme but however
sometimes the size of the system becomes so large that it is unmanageable. Hence this
method is not an efficient way for solving Elliptic PDE.

In order to increase the accuracy , the scheme (1.3) known as Five-Point Scheme,
can be modified to get a Nine-Point Scheme. This scheme in the form of computational
molecule can be written as:

(4)u i,j+1 
     (1)u i‐1,j+1  (1)u i+1,j=1 

(4)u i‐1,j  (4)u i+1,j   
(‐20)u i,j 

   (1)u i‐1,j‐1  (1)u i+1,j‐1 
(4)u i ,j‐1 

Scheme (2.1) has error of o( x )4 which is sufficiently less than Five-Point Scheme, but it
involves more computational complexity.

Another way of increasing accuracy, is to modify the scheme for solving the equation (1.4). One
of the technique used for this purpose is the Successive over relaxation (SOR) method.

To explain its implementation, we can write

u in, j 1  u in, j 

4
(x) 2
f i , j  u in1,1j  u in, j 11  u in, j 1  u in1, j  4u in, j 
 u in, j 1   ( RHS of Gauss - Seidel method )  (  1)u in, j

 is called as a relaxation parameter. It is verified that for over relaxation method ,1<  <2.
For a rectangular domain, a reasonable estimate of  can be taken as the small root of the
equation

 
2

 cos  cos   2  16  16  0
 M N

4
where M & N are number of sub-domains in each side. This shows  
2  4  k2
 
where, k  cos  cos
M N

The following table shows the value of  for different M & N.

M=N 
2 1.000
3 1.072
5 1.260
10 1.528
20 1.729
 2.000

It is observed that usually  opt = 1.5

For large M and N, one can approximat e  by


1
 1 1 2   
opt  2  2  2  2   21   , M  N
M N   M

Example: Solve  2 u=0, subject to Dirichlet conditions in the domain 0  x  0.75 ,


0  y  0.75 with   x=   y=0.25 , subject to the boundary conditions:
u(0,y) =0, u(0.75,y) =10 and u(x,0) =0, u(x,0.75) =10.
Obtain the solution at the internal nodes: (1) using symmetry (2) without using symmetry.
With; (a) Gauss- Seidel Method (b) SOR method.
And compare the results.
Work out this problem with Nine-Point formula also.
Solution:
We solve the problem with symmetry.

By Gauss-Seidal method ,we have 3 equations:

(start with assumed valuesas 0 i.e. u i,0 j  0)

u1n,11 
1 n
2
 
u 2,1

u 2n,11
1

 u1n,11  u 2n, 2  10
4

u 2n,21 
1 n1
 u 2,1  10
2

The values ,so computed are given in the following table:

u 1,1 u 2,1 u 2,2


n=0 0 2.5 6.25
n=1 1.25 4.3750 7.1875
n=2 2.8175 4.8438 7.4219
n=3 2.4219 4.9610 7.4805
n=4 2.4805 4.9902 7.4951
n=5 2.4951 4.9976 7.4988
n=6 2.4988 4.9994 7.4997
Hence solution correct to 2d is:

u1,1=2.50 ; u 2,1=5.00 ; u 3,1=7.50

(b) By SOR Method:

 
k  cos  cos , M, N  no. of sub  divisions . Here M  3, N  3
M N

The equations in the iterative form can be written as follows :

4
 k  0.5     1.072
2 4 k2
(start with assumed valuesas 0 i.e. u i,0 j  0)

1
 

u1n,11  1.072  u 2n,1  5   0.072u1n,1
2 
1
 

u 2n,11  1.072  u1n,11  u 2n, 2  10   0.072u 2n,1
4 
1
 

u 2n,21  1.072  u 2n,11  10   0.072u 2n, 2
2 

The values so computed are given in the following table:

u 1,1 u 2,1 u 2,2


n=0 0 2.68 6.70
n=1 1.4365 4.6676 7.3794
n=2 2.3984 4.9644 7.4896
n=3 2.4882 4.9844 7.4817
n=4 2.4988 4.9914 7.4917

Hence solution correct to 2d is:

u1,1=2.50 ; u 2,1=5.00 ; u 3,1=7.50

Thus SOR Method gives faster convergence.

Let us solve the problem without symmetry.

(a) By Gauss-Seidal method, we have 4 equations:

(start with assumed valuesas 0 i.e. u i,0 j  0)

u1n,11 
1
4
u
n
1, 2  u 2n,1 
u1n,21 
1
4
u
n 1
1,1  u 2n, 2  10 
u 2n,11 
1
4
u
n 1
1,1  u 2n, 2  10 
u 2n,21 
1
4
u n 1
2 ,1  u1n, 2  20 
The values so computed are given as follows:

u 1,1 u 1,2 u 2,1 u 2,2


n=0 0 2.5 2.5 6.25
n=1 1.25 4.3750 4.3750 7.1875
n=2 2.8175 4.8438 4.8438 7.4219
n=3 2.4219 4.9610 4.9610 7.4805
n=4 2.4805 4.9902 4.9902 7.4951
n=5 2.4951 4.9976 4.9976 7.4988
n=6 2.4988 4.9994 4.9994 7.4997

Hence solution correct to 2d is:

u1,1=2.50 ; u 2,1=5.00 ; u 3,1=7.50

(b) By SOR Method:

 
k  cos  cos M, N  no. of sub  divisions
M N
Here M  3, N  3

 k  0 .5
4

2 4 k2
   1.072

Hence, we have 3 equations:

(start with assumed valuesas 0 i.e. u i,0 j  0)

1
  
u1n,11  1.072  u1n, 2  u 2n,1   0.072u1n,1
 2 
1
 
u 2n,11  1.072  u1n,11  u 2n, 2  10   0.072u 2n,1
4 
1
 
u 2n,11  1.072  u1n,11  u 2n, 2  10   0.072u 2n,1
4 
1
 
u 2n,21  1.072  u 2n,11  u1n, 2  20   0.072u 2n, 2
4 
Now we record all values in table form:

u 1,1 u 1,2 u 2,1 u 2,2


n=0 0 2.68 2.68 6.70
n=1 1.4365 4.6676 4.6676 7.3794
n=2 2.3984 4.9644 4.9644 7.4896
n=3 2.4882 4.9844 4.9844 7.4817
n=4 2.4988 4.9914 4.9914 7.4917

Hence solution correct to 2d is:

u1,1=2.50 ; u 2,1=5.00 ; u 3,1=7.50

Hence SOR Method gives faster convergence.

Now by Nine-Point Formula, using symmetry, we have 3 equations:

20u1,1  8u 2,1  u2, 2  0


4u1,1  19u 2,1  4u 2, 2  55  0
u1,1  8u 2,1  20u 2, 2  110  0

On solving by Gauss- Elimination method ,we have:

u1,1=2.3810 ; u 2,1=5.00 ; u 3,1=7.6190



 
Elliptic Partial Differntial Equation in Polar System 
It is not possible always that the problem of Elliptic PDE can always be dealt with
Cartesian coordinates. Due to variety of applications of Elliptic Equations, we frequently need to
solve it in Circular domains, Elliptical domains etc. For example: Heat flows in a circular pipe,
Torsion in circular pillars etc. Therefore here we aim to discuss the solution of
Laplace Equation in Polar coordinate system which is given as follows:

 2u 1 u 1  2u
  0 (3.1)
r 2 r r r 2  2

over a circular domain Ω.

For discretization, we define the nodes by drawing radial and arcular lines with
r  i r ,   j . Then equation (3.1) can be written as:

ui 1, j  ui , j  ui 1, j 1  ui 1, j  ui 1, j  1  ui , j 1  2ui , j  ui , j 1 


       0
r  2
ir  2 r  (i r )
2
  2 

 1  1  1  1 1
1  ui 1, j  1  ui 1, j  21  u 
2  i, j
u  u 0 (3.2)
 i   i  i 2 i , j 1
2 i , j 1
 2i   2i 

Equation (3.2) can be solved in the Implicit form by putting i = 1, j =1,2,----,M;


i =2, j =1,2,----,M and so on. The boundary conditions can be implemented accordingly.

     (i+1,j) 

The computational molecule can be shown as: (i,j) 


(i,j‐1)
(i,j‐1) 

(i‐1,j) 

The truncation error is or   o(  ) 2 .In the Polar coordinates usually the discretized
2

equations are not solved by Gauss-Seidel Method (Libemann) though it is apparent that due to
large number of zeros, the matrix is sparse.
Example: Over a semi circular plate, heat is flowing with the circular edge being kept at
100C and flat edge at 10C . To obtain the temperature in the steady state condition,solve
 2 u  0 ,and obtain the temperature at the nodes with r  1 / 2,   15 correct to 2 decimals.

Solution:
The discretization of the domain is shown in fig :  

with,  r  1 / 2,   15 1000C 


1,6 

00C  1,0 
Laplace equation in the Polar coordinates is:

 2u 1 u 1  2u
  0
r 2 r r r 2  2

we define the nodes by drawing radial and arcular lines with r  ir ,   j . then equation
can be written as:

 1  1  1  1 1
1  ui 1, j  1  ui 1, j  21  u 
2  i, j
u  u 0 (3.3) Here,
 2i   2i   i     i   2 i , j 1
i   2 i , j 1

r  1 / 2,   15  
12

Put i =1 in equation (3.3),and then substitute j =1,2,---,6 and using boundary conditions ,we
have 6 equations in 6 unknowns:

 31.1805u1,1  14.5902u1, 2  300


14.5902u1,1  31.1805u1, 2  14.5902u1,3  155
14.5902u1, 2  31.1805u1,3  14.5902u1, 4  155
14.5902u1,3  31.1805u1, 4  14.5902u1,5  155
14.5902u1, 4  31.1805u1,5  14.5902u1, 6  155
29.1804u1,5  31.1805u1, 6  155

On solving, we have:
u1,1 =30.1398; u1, 2 =43.8495; u1,3 =52.9467

u1, 4 =58.6787; u1,5 =61.8310; u1, 6 =62.8358

This is how one can solve Laplace/Poisson equation in polar coordinates. Sometimes even if
required, one can solve Cartesian equation in circular domain.

 
Alternating Direction Implicit Method 
              While dealing with Elliptic Equations in the Implicit form , the number of equations to be
solved are M  N , which are quite large in number. Though the coefficient matrix has many
zeros, but it is not a banded system. Of course, sometimes simplification can be done using
partitioning of the matrix.

Peaceman and Rachford in 1955 suggested a scheme known as Alternating Direction Implicit
Method. In this scheme the solution is obtained in two stages .

Stage1: The FD representation of the Laplace Equation

ui 1, j  ui 1, j  4ui , j  ui , j 1  ui , j 1  0 (4.1)

is solved row-wise i.e. we first put j =1 and i =1,2,-----,N giving

u in1,1  u in1,1  4u in,11  u in, 0  u in, 2  0 (4.2)

a system of N equations which are solved by any method. The same is continued with j =2, j
=3,----, j=M. Thus a system of N equations is solved M times.

In general:

u in, j 1  u in, j   (u in1,1j  2u in, j 1  u in1,1j )   (u in, j 1  2u in, j  u in, j 1 )

Stage2: In this stage the solution proceeds vertically i.e. first i =1, j =1,2,------,M;
i =2 , j =1,2,------,M and so on.

Here M equations are solved N times. Thus we have

u in, j 2  u in, j 1   (u in1,1j  2u in, j 1  u in1,1j )   (u in, j 21  2u in, j 2  u in, j 21 )

Thus stages (1) and (2) are computed till the accuracy is satisfied. The above relations are
implicit but with proper ordering of the equations, the coefficient matrix becomes Tridiagonal.
The results obtained in even number of iterations are considered as the final, Since the
coefficient matrices are always same, so the computational effort is less.

Example: Solve the Heat Flow Problem in a square of size 11 ,  2 u  0 with,
x  y  1 / 4 , where x =0 and x =1 is kept at 10C and y=0 & y=1 are kept at 50C .
Use ADI and Libemann method to solve it and compare the result.
Solution:
By ADI Method:
Given,  2u  0
Stage 1:

The FD representation of the Laplace Equation

ui 1, j  ui 1, j  4ui , j  ui , j 1  ui , j 1  0 ( 4.3)

Now, fix j =1 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:

 4u1(,11)  u 2(1,1)  90 take, u1, 2  30 assumed value


u1(,11)  4u 2(1,1)  u3(1,1)  80 take, u 2, 2  30 assumed value
u 2(1,1)  4u3(1,1)  90 take, u3, 2  30 assumed value
On solving these three equations we have :
u1(,11)  31.4286 ; u 2(1,1)  35.7143 ; u3(1,1)  31.4286

Now, fix j =2 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:

 4u1(,12)  u 2(1, )2  70 take, u1,1  u1,3  30 assumed value


u1(,12)  4u 2(1, )2  u3(1, 2)  60 take, u 2,1  u 2,3  30 assumed value
u 2(1, )2  4u3(1, 2)  70 take, u3,1  u3,3  30 assumed value
On solving these three equations we have :
u1(,12)  24.2857 ; u 2(1, )2  27.1429 ; u3(1, 2)  24.2857

Now, fix j =3 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:

 4u1(,13)  u 2(1,3)  90 take, u1, 2  30 assumed value


u1(,13)  4u 2(1,3)  u3(1,3)  80 take, u 2, 2  30 assumed value
u 2(1,3)  4u3(1,3)  90 take, u3, 2  30 assumed value
On solving these three equations we have :
u1(,13)  31.4286 ; u 2(1,3)  35.7143 ; u3(1,3)  31.4286

Stage 2:
The FD representation of the Laplace equation is :

ui , j 1  4ui , j  ui , j 1  ui 1, j  ui 1, j  0 ( 4 .4 )

Now, fix i =1 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:

 4u1(,21)  u1(,22)  95.7143 take, u 2(1,1)  35.7143


u1(,21)  4u1(,22)  u1(,23)  37.1429 take, u 2(1, )2  27.1429
u1(,22)  4u1(,23)  95.7143 take, u 2(1,3)  35.7143
On solving these three equations we have :
u1(,21)  24.2857 ; u1(,22)  27.1429 ; u1(,23)  24.2857

Now, fix i =2 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:

 4u 2( 2,1)  u 2( 2, 2)  112.8572 take, u1(,11)  u3(1,1)  31.4286


u 2( 2,1)  4u 2( 2, 2)  u 2( 2,3)  48.5714 take, u1(,12)  u3(1, 2)  24.2857
u 2( 2, 2)  4u 2( 2,3)   112.8572 take, u1(,13)  u1(,13)  31.4286
On solving these three equations we have :
u 2( 2,1)  35.7143 ; u 2( 2, 2)  30 ; u 2( 2,3)  35.7143

Now, fix i =3 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:

 4u3( ,21)  u3( ,22)   95.7143 take, u 2(1,1)  35.7143


u3( ,21)  4u3( ,22)  u3( ,23)  37.1429 take, u 2(1, )2  27.1429
u3( ,22)  4u3( ,23)   95.7143 take, u 2(1,3)  35.7143
On solving these three equations we have :
u3( ,21)  30 ; u3( ,22)  24.2857 ; u3( ,23)  30

As the values at stage 1 and stage 2 do not match so we continue the process.

Again performing stage 1:

Now, fix j =1 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:
 4u1(,31)  u 2( 3,1)  87.1429 take, u1(,22)  27.1429
u1(,31)  4u 2(3,1)  u3( 3,1)  80 take, u 2( 2, 2)  30
u 2( 3,1)  4u3(3,1)  84.2857 take, u3( ,22)  24.2857
On solving these three equations we have :
u1(,31)  30.5612 ; u 2( 3,1)  35.1020 ; u3( 3,1)  29.8469

Now, fix j =2 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:

 4u1(,32)  u 2( 3, 2)  58.5714 take, u1(,21)  u1(,23)  24.2857


u1(,32)  4u 2( 3, 2)  u3( 3, 2)  71.4286 take, u 2( 2,1)  u 2( 2,3)  35.7143
u 2( 3, 2)  4u3( 3, 2)  70 take, u3( ,21)  u3( ,23)  30
On solving these three equations we have :
u1(,32)  22.0408 ; u 2( 3, 2)  29.5918 ; u3( 3, 2)  24.8980

Now, fix j =3 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:

 4u1(,33)  u 2( 3,3)  87.1429 take, u1(,22)  27.1429


u1(,33)  4u 2(3,3)  u3( 3,3)  80 take, u 2( 2, 2)  30
u 2( 3,3)  4u3(3,3)  84.2857 take, u3( ,22)  24.2857
On solving these three equations we have :
u1(,33)  30.5612 ; u 2( 3,3)  35.1020 ; u3(3,3)  29.8469

Again performing stage 2 :

Now, fix i =1 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:

 4u1(,41)  u1(,42)   95.1020 take, u 2( 3,1)  35.1020


u1(,41)  4u1(,42)  u1(,43)  39.5918 take, u 2( 3, 2)  29.5918
u1(,42)  4u1(,43)  95.1020 take, u 2( 3,3)  35.1020
On solving these three equations we have :
u1(,41)  30 ; u1(,42)  24.8979 ; u1(,43)  30

Now, fix i =2 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:
 4u 2( 4,1)  u 2( 4, 2)  110.4081 take, u1(,31)  30.5612 ; u3(3,1)  29.8469
u 2( 4,1)  4u 2( 4, 2)  u 2( 4,3)  46.9388 take, u1(,32)  22.0408 ; u3( 3, 2)  24.8980
u 2( 4, 2)  4u 2( 4,3)   110.4081 take, u1(,33)  30.5612 ; u1(,33)  31.4286
On solving these three equations we have :
u 2( 4,1)  34.8979 ; u 2( 4, 2)  29.1837 ; u 2( 4,3)  34.8979
Now, fix i =3 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:

 4u3( ,41)  u3( ,42)   95.1020 take, u2(3,1)  35.1020


u3( ,41)  4u3( ,42)  u3( ,43)  39.5918 take, u 2(3, 2)  29.5918
u3( ,42)  4u3( ,43)   95.1020 take, u2(3,3)  35.1020

On solving these three equations we have:


 
u 3( ,41)  30 ; u 3( ,42)  24.8979 ; u 3( ,43)  30

Now required accuracy is reached. Hence this is the final solution.


u1,1  30 ; u1, 2  24.8979 ; u1,3  30

u2,1  34.8979 ; u2, 2  29.1837 ; u2,3  34.8979

u3,1  30 ; u3, 2  24.8979 ; u3,3  30

By Libemnn Method: The FD representation of the Laplace Equation:

ui 1, j  ui 1, j  4ui , j  ui , j 1  ui , j 1  0 ( 4.5)

Substitute j =1 in equation (4.5)

ui 1,1  ui 1,1  4ui ,1  ui , 0  ui , 2  0 ( 4 .6 )

Substitute i =1,2,3 in equation (4.6) and boundary conditions ,we have:

 4u1,1  u1, 2  u2,1  60


u1,1  4u2,1  u3,1  50
u2,1  4u3,1  u3, 2  60

Now, substituting j =2 ; i =1,2,3 in equation (4.5) and with boundary conditions ,we have:
u1,1  4u1, 2  u 2, 2  u1,3  10
u1, 2  u 2,1  4u 2, 2  u 2,3  u3, 2  10
u 2, 2  u3,1  4u3, 2  u3,3  10

Now, substituting j =3 ; i =1,2,3 in equation (4.5) and with boundary conditions ,we have:

u1, 2  4u1,3  u2,3  60


u1,3  u2, 2  4u2,3  u3,3  50
u2,3  u3, 2  4u3,3  100

On solving these nine equations,we have:

u1,1 =30.5357 ; u1, 2 =26.0714 ; u1,3 =31.2500

u 2,1  36.0714 ; u2, 2 =32.5000 ; u2,3 =38.9286

u3,1 =31.2500 ; u3, 2  28.9286 ; u3,3  41.9623

Comparing the two methods it can be observed that the ADI method requires less
computational efforts.

 
Treatment of Irregular Boundaries 
              In real applications, it is very common that the elliptic pde are solved over a domain
which are irregular.. The above approximation of derivatives therefore cannot be applied at the
nodes , near the boundary. In such cases, the mesh do not concide with the boundary.
Therefore an appropriate formula has to be developed. Let the computational molecule be given
as :

u2 

Θ2h 
Θ1h  Θ3h 
u1  u3 

Θ4h 

u4 

 u  u  u1  u  u  u0
then    0 ;    3
 x u1 1h  x u 0 3h

u3  u0 u0  u1

 u   u 
2
3h 1h
  
x 2
x  x  (1   3 )h
2
2  u  u0 u3  u 0 
 2 1   (5.1)
h 1 1   3   3 (1   3 ) 
 2u 2  u 2  u0 u4  u0 
 2  
h  2  2   4   4  2   4 
Similarly, (5.2)
y 2

Both relations (5.1) & (5.2) have an error of o(h).

Combining the two we have,


0  c

 u  2u 2 
2
u1 u2 u3 u4  1 1 
 2  2     u0  

(5.3)
x 2
x h 1 1   3   2 ( 2   4 )  3 (1   3 )  4 1   4   
 1 3  2 4 

The values of θi are determined geometrically. The FD representation given by eqn.(5.3) is


required only near the boundary nodes which do not fall on the discretized nodes. Finally the
equations may be solved by any method namely by Gauss-Seidel / SOR etc.

Example: A semi-circular plate of radius 1 has the base at 00C and curved boundary at
1000C. Find the temperature at nodes with h = 0.25 under the steady state.

1000C 

1
7
4
8 12 

00C

For nodes 2,6 and 11 : we will have to use formula (5.3). Using geometrical considerations, we
can obtain at u2 & u11 : θi = 0.89h

Solution:

 2u  2u
The Laplace equation is:  0
x 2 y 2
At node 8, we have :
u 4  4u8  2u9  0 (5.4)
At node 9, we have :
u5  u8  4u9  u10  0 (5.5)
At node 10, we have :
u 6  u9  4u10  u11  0 (5.6)
At node 11 by formula (5.3), we have :

 u10 u7 u12  1 1 
    0  u11    0
2 
 0.250.25  0.2225 0.250.25  0.25 0.22250.25  0.2225  0.25  0.2225 0.25 
 8.4656u10  33.9775u11  1751.1920 (5.7)
At node 4, we have :
u1  4u 4  2u5  u8  0 (5.8)
At node 5, we have :
u 2  u 4  4u5  u6  u9  0 (5.9)

At node 6, we have :
u5  4u6  2u10  200 (5.10)
At node 1, we have :
2u 2  u 4  4u1  100 (5.11)
At node 2, we have :
 u1 u3 u5  1 1 
2   951.1920   u11     0
 0.250.25  0.25 0.250.25  0.25 0.250.2225  0.25  0.25 0.25  0.2225 
2

 8u1  33.9775u 2  8.4656u5  1751.1920 (5.12)

On solving these nine equations, we have:

u1  84.5590 , u 2  87.8738

u 4  62.4883, u 5  65.9220, u 6  77.4690

u8  33.5504, u 9  35.8566, u10  43.9542, u11  62.4911


 
Methods for Solving tridiagonal System 
This lecture consists of solution of an important problem arising in many process,
whether we are solving Parabolic or Elliptic PDE . While applying implicit techniques in any
of the method, we usually come across with the coefficient matrix which have many zeros. If
the equations are properly analyzed then usually the coefficient matrix is Tridiagonal. One
can thus reduce the computational efforts by using the specific tridiagonal solvers.

Let a tridiagonal system be given as

 b1 c1 0   0   x1   r1 
a b2 c2   0   x2  r2 
 2
             (6.1)
    
           
 0    an bn   xn  rn 

The total elements of n  n matrix are to be saved where as in this specific algorithm only
(3n-2) locations to be saved. Thus sufficient amount of memory is saved. This saves not
only computational time but also increases computational efficiency. The solution is obtained
in the following steps:

i  u1  b1 , ui  bi 
ai ci 1
, i  2,  , n
ui 1

ii  y1  r1 , yi  ri 
ai yi1
, i  2,  , n
ui1
y c x
iii  xn  yn
, xi  i i i1 , i  n  1,  ,1
un ui

This algorithm is known as Thomos Algorithm and is very efficient for large system of
equations.

1.98  1.01 0 0   x1  0.985


0.98  1.98 1.02
 0   x2   0.01 
Example: 
 0 0.97  1.98 1.03   x3  0.016
    
 0 0 0.96  1.98  x4  1.540 

Solve the above system using Thomos Algorithm & Gauss-Seidel Method and compare the
result.
Solution:
The given problem is of form: AX = B

Now matrix A is Tridiagonal hence applying Thomos Algorithm, we have:

b1  1.98 ; b2  b3  b4  1.98
c1  1.01 ; c2  1.02 ; c3  1.03
a2  0.98 ; a3  0.97 ; a4  0.96
ai ci1
Now, u1  b1 ; ui  bi  , i  2,3,4
ui 1
Hence, u1  1.98 ; u 2  1.4801
; u3  1.3115
; u 4  1.2261
ai yi 1
Now, y1  r1 ; yi  ri  , i  2,3,4
ui 1
Hence, y1  0.985 ; y 2  0.4775
; y 3  0.2980
; y 4  1.3220
y4 yi  ui xi  1
Now, x4  ; xi  , i  3,2,1
u4 ui
Hence, x4  1.0782 ; x3  0.6200
; x2  0.1016
; x1  0.4456

By Gauss-Seidel Method:

The given problem is of form: AX = B

Here A is already diagonally dominant.

1.98 0 0 0 
0.98 - 1.98 0 0 
D+L 
 0 0.97 - 1.98 0 
 
 0 0 0.96 - 1.98

0  1.01 0 0 
0 0 1.02 0 
U 
0 0 0 1.03
 
0 0 0 0 
Gauss-Seidel Iterative Scheme is:

X k 1  HX k  C (6.2)
where, H  D  L  U and C  D  L  B
1 1

 0.5051 0 0 0 
0.2500 - .5051 0 0 
D  L 1   00
0.1225 - .2474 - .5051 0 
 
0.0594 - .1200 - .2449 - .5051 

0 0.5051 0 0 
0 0.2525 0.5152 0 
H 
0 0.1237 0.2524 0.5202
 
0 0.06 0.1224 0.2522

 0.4975 
 0.2412 
C  D  L  B   
1

 0.1106 
 
 .7242 

0 
0 
Let initial vector X 0   
0 
 
0 

Now, by equation 6.2 , we have :


 0.4975   0.6205 
 0.2412   0.3590 
X1    ; X2  
 0.1106   0.2084
   
 0.7242   0.8788

 0.6808   0.6120 
 0.2245   0.1151 
X 
3  ; X 
4 
 0.3548   0.4453
   
 0.9498  0.9937 
 0.4932   0.4766 
 0.0410  0.0625
X 
7  ;X  
8 
  0.5693  0.5864
   
  1.0538    1.0621
 0.4656   0.4585 
 0.0767  0.0861
X9    ; X 10   
 0.5977  0.6051
   
  1.0675    1.0711

Hence,
x1  0.4585
x2  0.0861
x3  0.6051
x4  1.0711

It may be observed from the results that for large systems the Thomos algo. is very efficient.

 
Explicit Method for Solving Hyperbolic PDE
One of the important class of second order PDE are the hyperbolic partial
differential equation where B2  4AC 0 corresponding to the equation:
 2u  2u  2u u u
A B C  F ( x, y , u , v, , )  0
x 2 xy y 2 x y (1)

 2u 2  2u
One of its common example is the wave equation given by c
t 2 x 2

Other examples are:

 2u  2u  2u
(1 x 2 )  (5  2x 2 )   (1 x 2 ) 0 (2)
x 2 x y t 2

 2u  2u  2u
 2 (1 2x ) 8 x 0 (3)
x 2 x y y 2

Our discussion will be concentrated over the solution of the wave equation. Such
equations arise in field of vibrations, gas dynamics etc. To solve it, two initial & two
boundary conditions are required. The boundary conditions may be defined as:

u(0, t )  f1 ( t ) , u(1, t )  f 2 ( t ), 0  x 1, t0

The initial conditions may vary accordingly. In general, they may be written as;

u
u( x, 0)  f ( x ) ( x, 0)  g ( x )
x

One of the common method for solving wave equation is Finite difference method,the
same method which we have discussed for parabolic and elliptic pde.

Consider a rectangular mesh in the x – t plane, with i,j along x and t axis respectively ,
we can write x  i h, and t  j k
i j

Using the central difference approximation as :

  2u  u  2u u u  2u  u
  i  1, j i, j i  1, j  2u i, j  1 i, j i, j  1
 ,  (4)
 x 2  2 t 2 k2
 i, j h
The wave equation is discretized to :

 2u u 2u 2  2u2 2  u
i, j ui, ji  1, j 2 (12 r ci, )jui1, j  r i,cj (ui i, 1j, j 1 ui  1, j )  ui, j  1,
u
i , j 1 (6)
c 
h2 k2
(5)

k
   i  1, 2,3......... N  1 , with r 
.
h
The difference equation (6) consists of three time levels. The Equation (6) defines the
explicit scheme. The scheme (6) has a truncation error of o h 2  o k 2    
For the solution of equation (6), two rows for j = 0 & j = 1 must be known, however
usually the solution for j = 1 is not given.
The boundary condition is used to compute it as :

u i,1  u i,  1
 g( x i )  g i
2k (7)

or u i, 1  u i,1  2 k g i

Thus formula (6) can be rewritten for j = 1 using (7) to get ui, 1 .

The computational molecule can be shown as in


adjacent figure. This scheme is a three time level
scheme as compared to two time level schemes of j1 1
Parabolic pde. It can be shown that this scheme
converges for r  1 i.e. k  h . j r2 2 (1  r 2 ) r2
 
j 1
 
i 1 i i 1
Example: Solve the hyperbolic equation by Explicit method
 2u  2u
 ; 0  x 1 , t  0  1
t 2 x 2

With the B.C i  u 0, t   0 ii  u 1, t   0


u
And initial conditions i  u  x,0   sin  x ii   x ,0   0
t
by taking I  x  0.2, t  0.1 II  x  0.1, t  0.2
for three consecutive time levels.
Solution: Equation (1) can be written as

ui , j 1  2ui , j  ui , j 1 ui 1, j  2ui , j  ui 1, j



t  2
x 2
t
 
 ui , j 1  2 1  r 2 ui , j  r 2 ui 1, j  ui 1, j   ui , j 1; where r
x
2
Case (I) when x  0.2, t  0.1 , then r=0.5
u u
2   u i , j 1  i 1, j i 1, j  3 u i , j  u i , j 1 3
4 2
B.C’s are
i  u 0, t   0
 u 0,1  u 0,2   u 0,3  .................  0
(ii ) u (1, t )  0
 u 5,1  u 5,2   u 5,3  .................  0

I.C’s are
i  u x,0  sin  x
 u 0,0   0  u (5,0), u (1,0)  0.5878  u (4,0), u (2,0)  0.9511  u (3,0),

ii  u x,0  0 The


t
u ui ,1  ui , 1
   0  ui ,1  ui , 1 4
t 2t
problem is symmetric with respect to x=0.5
Putting j = 0 in eqn.(3) and using eqn. (4), we get
u i 1, 0  u i 1, 0
u i ,1  
3
ui ,0 5
8 4

Ist time level


Putting i = 1,2 in eqn. (5),we get

u 0,1  u 5,1  0
u 0, 0  u 2, 0 3
u1,1   u1, 0  0.5597  u 4,1
8 4
u1, 0  u 3, 0 3
u1,1   u 2, 0  0.9037  u 3,1
8 4

2nd time level


Putting j = 1 in eqn.(3), we get
u i 1,1  u i 1,1
ui ,2  
3
u i ,1  u i , 0 6 
4 2

Putting I =1,2 in eqn.(6),we get

u 0 , 2  u 5, 2  0
u 0,1  u 2,1 3
u1, 2   u1,1  u1, 0  0.4721  u 4, 2
4 2
u1,1  u 3,1 3
u 2, 2   u 2,1  u 2,0  0.7704  u 3, 2
4 2

3rd time level


Putting j = 2 in eqn. (3), we get
u i 1, 2  u i 1, 2
u i ,3  
3
u i , 2  u i ,1 7 
4 2

Putting i =1,2 in eqn. (7),we get

u 0 , 3  u 5, 3  0
u 0, 2  u 2, 2 3
u1,3   u1, 2  u1,1  0.5146  u 4,3
4 2
u1, 2  u 3, 2 3
u 2,3   u 2, 2  u 2,1  0.5915  u 3,3
4 2

Case (II):
when x  0.1, t  0.2 ,then r=2.0

 ui , j 1  4ui 1, j  ui 1, j   6ui , j  ui , j 1 8


B.C’s are
i  u 0, t   0
 u 0,1  u 0,2   u 0,3  .................  0
(ii ) u (1, t )  0
 u 10,1  u 10,2   u 10,3  .............  0

I.C’s are
i  ux,0  sin x
 u 0,0   0  u (10,0),
u (1,0)  0.3090  u (9,0), u (2,0)  0.5878  u (8,0), u (3,0)  0.8090  u (7,0),
u (4,0)  0.9511  u (6,0), u (5,0)  1.0000

ii  u x,0  0
t
u ui ,1  ui , 1
   0  ui ,1  ui , 1 9
t 2t

The problem is symmetric with respect to x=0.5


Putting j = 0 in eqn.(8) and using eqn.(9), we get

u i ,1  8u i 1, 0  u i 1, 0   12 u i , 0 10 

Ist time level


Putting i = 1,2,3,4,5 in eqn. (10),we get

u 0,1  u10,1  0
u1,1  8u 0, 0  u 2, 0   12u1, 0  0.9944  u 9,1
u 2,1  8u1, 0  u 3, 0   12u 2,0  1.8904  u8,1
u 3,1  8u 2,0  u 4, 0   12u 3,0  2.6032  u 7 ,1
u 4,1  8u 3,0  u 5, 0   12u 4, 0  3.0588  u 6,1
u 5,1  8u 4,0  u 6,0   12u 5,0  3.2176

2nd time level


Putting j =1 in eqn. (8), we get

u i , 2  4u i 1,1  u i 1,1   6u i ,1  u i , 0 11


Putting i =1,2,3,4,5 in eqn. (11), we get
u 0, 2  u10, 2  0
u1, 2  4u 0,1  u 2,1   6u1,1  u1,0  1.2862  u 9, 2
u 2, 2  4u1,1  u 3,1   6u 2,1  u 2,0  2.4602  u8, 2
u 3, 2  4u 2,1  u 4,1   6u 3,1  u 3, 0  3.3686  u 7 , 2
u 4, 2  4u 3,1  u 5,1   6u 4,1  u 4, 0  3.9793  u 6, 2
u 5, 2  4u 4,1  u 6,1   6u 5,1  u 5,0  4,1648

3rd time level

Putting j = 2 in eqn.(8), we get


u i , 3  4u i 1, 2  u i 1, 2   6u i , 2  u i ,1 12 
Putting i=1,2,3,4,5 in eqn. (12),we get

u 0,3  u10,3  0
u1,3  4u 0, 2  u 2, 2   6u1, 2  u1,1  1.1292  u 9,3
u 2,3  4u1, 2  u 3, 2   6u 2, 2  u 2,1  1.9676  u8,3
u 3,3  4u 2, 2  u 4, 2   6u 3, 2  u 3,1  2.9432  u 7 ,3
u 4,3  4u 3, 2  u 5, 2   6u 4, 2  u 4,1  3.1990  u 6,3
u 5,3  4u 4, 2  u 6, 2   6u 5, 2  u 5,1  3.6280

Comparing the results obtained by the two cases i.e. the values at the second time level
for the first case with the values at the first time level for the second case,we notice that
the values of the first case are close to that obtained by the exact solution. The reason
being, that for the second case, the value of r is greater than 1.
 
Implicit Method
2 2
In order to solve the Wave equation  u   u by finite difference, one can
t 2 u 2
use implicit methods also. There are variety of implicit schemes. Replacing the time
derivative by CD and space derivative by the average at (j -1)th and (j+1)th level of the
CD approximates, we have,

u i, j 1  2 u i, j  u i, j 1 1  
 
  u i 1, j 1  2u i, j  1  u i 1, j 1    u i  2u i, j  1  u i 1, j 1 
k2 2h 2    1, j 1 

(1)

which gives

 r 2 u i 1, j 1  2 (1 r 2 ) u i, j 1  r 2 u i 1, j 1  r 2 u i 1, j 1  2 (1 r 2 ) u i, j 1  r 2 u i 1, j 1  4 u i, j

i  1, 2 .................. N  1

These (N – 1) equations are to be solved at each time level. The computational


molecule is shown as below:

r2 2 (1  r 2 ) r2
j1

j 4

2
r 2  2 (1  r ) r2
j 1

i 1 i i 1

The error is o(h2 +  k2) in this scheme. This scheme is unconditionally stable. The
stability condition is often referred as CFL condition which states that numerical domain
of dependence must contain the analytical domain of dependence.

The implementation of Lax theorem can also be used in order to show the convergence
as both explicit and implicit schemes are linear. We will discuss the stability of explicit
scheme using Neumann approach. On the same lines, the stability of implicit scheme
can also be proved.
However, the solution by FD, when there is discontinuity in the initial conditions, is not
accurate as the propagation of discontinuity problem in the stability. However, the
problem with no discontinuities can be solved satisfactorily & efficiently by convergent
and stable FD methods with rectangular grids.
 2u  2u
Example: Solve the wave equation-  , 0  x  1, t0
t 2 x 2
using Implicit Method subject to the conditions:
u (0, t )  0  u (1, t )

u
u ( x, 0)  Cos  x, ( x, 0)  0
t
Solution: By implicit method, equation is given by

, +(1+ ) , , = , + (2 ) , + ,

+ , +( 1 ) , + ,

Putting r = 1/2

⇒ , + , – , = , + , + , + ,

- , + , (1)

B.C. u(0, t) = 0 = u(1, t)

⇒ u(0, 1) = u(0, 2) = u(0, 3) = …. = 0 = u(0, 0)

& u(5, 0) = u(5, 1) = u(5, 2) =....... = 0 

I.C. u(x,0) = cos x

⇒ u(0, 0) = 0, u(1, 0) = 0.8090 = u(4, 0), u(2, 0) = 0.3090 = u(3, 0)

The problem is symmetric w.r.t x = 0.5

Now (x, 0) = 0 ⟹ , = , (2)

Put ting j = 0 in eqn. (1)

, + , , = ( , + , )+ , + ( , + , )+ ,

⇒ , ( , + , )= ( , + , )+ , (3)

For first time level


Putting i = 1, 2 in eqn. (3)

⇒ , ( , + , )= ( , + , )+ ,

& , ( , + , )= ( , + , )+ ,

⇒ , (0+ , )= ( , + 0.3090) + (0.8090)

& , ( , + , )= ( 0.8090+ 0.3090) + (0.3090)


⇒ , , = 0.5635 ⇒ , , = 0.5009

, + , = 0.4027 ⇒ , + 17 , = 6.4432

⇒ , = 0.4098 & , = 0.4781

, = , = 0.4098, , = , = 0.478, , = , =0

For second time level

Putting j = 1 in eqn. (1)

( , + , )+ , = ( , + , )+ , + ( , + , ) ,

putting i = 1, 2

( , + , )+ , = ( , + , )+ , + ( , + , ) ,

& ( , + , )+ , = ( , + , )+ , + ( , + , ) ,

⇒ , + , = (0.4098) + (0.4781) + (0.3090) (0.8090)

& , + , = (0.4781+ 0.4098) + (0.4098) + (0.8090 + 0.3090) (0.3090)

⇒ , + , = 0.0029

& , + , = 0.5496

⇒ , = 0.5188, , = 0.7283

, = 0.5188 = , , , = 0.7283 = , , , =0=

For 3rd time level

Putting j = 2 in eqn. (1)


( , + , )+ , = ( , + , )+ , + ( , + , ) ,

putting i = 1, 2

( , + , )+ , = ( , + , )+ , + ( , + , ) ,

& ( , + , )+ , = ( , + , )+ , + ( , + , ) ,

⇒ , + , = 0.7352

& , + , = 0.6583

⇒ , = 0.6650, , = 0.7722

, = 0.6650 = , , , = 0.7722 = , , , =0=

 
 
 
 
 
 
 
 
 
 
Convergence & Stability
As shown in the rectangular grid in the adjacent figure, the value of u at P
depends on the points marked by cross. This set of points is called numerical domain of
dependence. If the initial conditions about AB & CD are changed (due to
discontinuities), then it will not change the numerical solution at P whereas analytical
solution will change. Then up may not converge to the exact solution even if h → 0 , k
→ 0. However if the characteristics PB & PC lies outside the domain of dependence
PAB, then according to CFL, the solution is convergent. This requires
r ≤ 1.

For stability, we can discuss for the explicit scheme in the following manner :

The explicit scheme is

u i, j 1  r 2 u i 1, j  ui 1, j  2(1 r 2 )u i, j  u i, j 1 (1)


 
Replacing i, j by p, q respectively as  1  iwe, can write:
u p, q 1  r 2  u p 1, q  u p 1, q   2 (1 r 2 ) u p, q  u p, q 1 (2)
 

Let denote the error at (xp, yq), then we can write:

(3)
e p, q 1  r 2  e p 1, q  e p 1, q   (1 r 2 ) e p, q  e p, q 1
 

Assuming e p, q  e q t ei p x  q . ei p x (4)

Where   e t substituting (4) in (3) we have,

 x ix 
q 1   r 2 (e  i e )  2(1 r 2 )  q  q 1
 
2   2r 2 Cos  x 1  r 2   1
 
  x 
2  21 2r 2 Sin 2 
 1  0 (5)
 2 
1 2
Equation (5) is quadratic in  which will have two roots say and .
 x 
Therefore, 1  2  21 2 r 2 Sin 2  (6)
 2 
1 2  1
1
Thus 1  ,implying that if
2

 1   1 and vice versa.


2 1
But for Stability, both    1 . Therefore it implies that    1 . This
1 2 1 2
brings, from (6)

x
   2 1  2 r 2 Sin 2
1 2 2
x
     2 1  2 r 2 Sin 2
1 2 2
x x
 1 2 r 2 Sin 2  1  r 2 Sin 2 1
2 2
 r 1

It may be shown that implicit scheme is unconditionally stable.

It may be observed that FD solutions for parabolic & elliptic pde are analytic even when
the initial conditions are discontinuous. Hyperbolic pde are however different in that the
discontinuities in initial conditions are propagated as discontinuities in the solution
domain.

Therefore FD method sometimes provides non-convergent results if it does not satisfy


CFL conditions.

In the next lecture we will discuss the method of characteristics, which is one of the
efficient method, though called as Semi Numerical Method.
 
Method of Characteristics
If the hyperbolic pde is defined with the initial Conditions which have no
discontinuity, FD schemes are quite efficient. However with discontinuities, the
propagation of discontinuities with the solution domain is difficult to deal with on
rectangular grids. Method of Characteristics, though not a pure numerical method, still is
an efficient technique to handle such hyperbolic pde .

Consider a general second order pde

 2u  2u  2u
a b c e0 (1)
x 2 x y y 2

 u u
Over a domain D, where a,b,c, and e are functions of x,y,u, , in general. Using
 x y
the following notations:

u u
p   ux , q   uy
x y

 2 u p  2u  2 u p q  2 u q
r   ,s     ,t  
x 2 x xy yx y x y 2 y

Equation (1) can be written as

ar + bs + ct + e = 0 (2)

Let G be a curve over D then we have on curve G,

p p
dp  . dx  . dy  rdx  sdy (3)
x y

q q
dq  . dx  . dy  sdx  tdy (4)
x y

Since (1) is satisfied at each point of G, eliminating r & t from eqn.(2), using equations
(3) & (4)

 dp dq   dy dx 
a
 c  e   s  a bc 0
 dx dy   dx dy 
 2 
   dy 
 e   s a    b  c  0
dy dp dq dy
or a
 c (5)
dx  dx dy    dx  dx 
 

Assuming that G satisfies :

 dy 
2 dy
a   b c0 (6)
 dx  dx

Then on curve G, from eq. (5) we have

dy dp dq dy dy
a . c  e .  0 or a dp  cdq  edy  0 (7)
dx dx dx dx dx

dy
Equation (6) is quadratic in whose roots are given by
dx

dy b  b2 - 4 ac
  f, g (8)
dx 2a

The solution of (8) defines curve (s) G in the x-y plane called characteristic (s) or
characteristic curve (s). If a, b and c are constant or functions of x, y then the equation
of curve (s) can be obtained explicitly otherwise they may dependent on u, u x and u y .
Obviously (8) gives the directions (of tangents) of characteristics at the point (x,y) of G
which are distinct for hyperbolic pde.

u u
The problem may be now given the values of (  P ), ( q ) on a curve on G, to
x y
obtain u (x,y) at different points in the hyperbolic domain.

Following steps are used to implement the MC.

Step-1: Let A,B,C,D be the points (not necessarily equidistant) on the given curve I and
denote their positions by A (xA, yA), B (xB, yB), etc.

Step-2: To draw characteristics through A, B, C, D etc, if obtain equations of


characteristics and a grid based on characteristics can be formed as shown in
Fig. (1). Af is the f characteristic and Ag is g-characteristics through A and so on.
However, if f and g involve u and / or its derivatives, then we have to determine the
location of the points of intersection of the characteristics, viz. R, S, T, etc., In that case
characteristic grid cannot be drawn beforehand, which needs to be generated point-by-
point.

Integrating (8) from A to R and (8) from B to R we get the respective approximations as

(9)
y  y  f (x  x )
R A A R A
yR  yB  g B (x R  x B ) (10)

Solving (9) and (10) we get a crude approximation for the coordinates (x, y) of the grid
point R.

Step-3: For advancing the solution to the values of ux (=p) and uy (=q) at R, i.e. pR and
qR are computed from (7) as follows:
dy
a dp  cdq  edy  0 (11)
dx
Integration of (11) from A to R along the characteristic f gives

a A f A ( p R  p A )  c A (q R  q A )  e A ( y R  y A )  0 (12a)

Similarly integration from B to R along g-characteristic gives


a B f B ( p R  p B )  c B (q R  q B )  e B ( y R  y B )  0 (12b)

Solution of (11a and 12b) will provide the values of pR and qR .

Step-4: In order to calculate u at R, i.e. uR, using:


u u
du  dx  dy  pdx  qdx.
x y

Integrating along either of the characteristics, say f, from A to R we get

p  pA q q
uR  uA  R (x R  x A )  R A
2 2

This gives the values of uR. Which can be improved by modifying step (2).

Step-5: Since values of f and g can be computed at the point R by using their average
values, i.e.
fR  fA gR  gA
yR  yA  ( x R  x A ),
and y R  y B  ( x R  x B ),
2 2
which gives improved values of (xR, yR) .
Step-6: Similarly modifying step-3 by using average values:

a  a  f f  c c e e
 A R  A R  (p  p A )  A R (q R  q A )  A R ( y R
 2  2  R 2 2
  

a  a  g g  c c e e
 B R  B R  (p  p B )  B R (q R  q B )  B R ( y R
 2  2  R 2 2
  

pR & qR and subsequently uR can be modified. This process is continued to get the
values at higher level points.

 
The method of characteristics as discussed in the previous lecture seems to
involve sufficient computations. But when it is used as an iterative scheme,
computations using coding gives the results quite efficiently.

There are many advantages of this method over FD :

(i) A FD method leads to a large system of algebraic equations using approximations,


the solution of which involves various types of errors. Method of characteristics
(MC) is free out of this.
(ii) Non linear pde can be tackled by (MC) in the routine manner.
(iii) Discontinuities along the initial condition are tackled efficiently by MC as compared
to FD.
(iv) There is no fear of instability by MC.
(v) MC can be efficiency implemented to simultaneous pde also.

There are other higher order methods for pde eg. weighted residual methods (WR),
Finite element methods (FEM), etc. which can be implemented to any type of PDE, but
WR method are more so based on analytical approach which has its own limitations for
assuming the initial polynomials. FEM are flexible and accurate methods but requires a
good knowledge in coding. For beginners, these methods are good enough to give a
vision of numerical solutions.

To implement the MC, let us solve two problems:

 2u 2  u
2
Example 1 : Solve the hyperbolic PDE u  0; 0  x  1, y  0
x 2 y 2
u
Subject to the following conditions u  x  5 x 2 ,  x along the initial line y=0
y
By using the method of characteristics, find the solution between the grid points x=0.3
and x=0.4.

Solution: Since ‘u’ is given as a continuous function of x along Ox.


u
The initial value of p   1  10 x
x
The slopes of the characteristics are the roots of the equation m 2  u 2  0

Initially f  u   g
u  x  5x 2  f   g
p  1  10 x , q  x
a  1, b  e  0, c  u 2 , P  0.3, Q  0.4
f P  0.75, f Q  1.2, g Q  1.2, p P  4.0, pQ  5.0
u P  0.75, uQ  1.2, qQ  0.4, q P  0.3, cP  0.5625, cQ  1.44
dy dy
Now  f,  g can be approximated by
dx dx
y R  y P  f P  x R  x P  & y R  yQ  g Q x R  xQ 
 y R  0  0.75 x R  0.3 & y R  0  1.2 x R  0.4 
 x R  0.4026, y R  0.07695

The equations afdp  cdq  edy  0 & agdp  cdq  edy  0 are approximated
along PR by the equations

a P f P  p R  p P   c P q R  q P   e P  y R  y P   0
aQ g Q  p R  pQ   cQ q R  qQ   eQ  y R  yQ   0
 p R  4  0.75q R  0.3  0 & p R  5  1.2q R  0.4  0
 p R  4.4308, q R  0.8744

Now approximation equation for the solution is


u R  u P   p P  pR  x R  xP   q P  qR  y R  y P 
1 1
2 2
 u R  0.75  0.75  4.43080.4026  0.3  0.8744  0.30.0770  0
1 1
2 2
 u R  1.0610

For the 2nd approximation

f R   g R  u R  1.0610, c R  u R2  1.1257

For the improved values of x R & y R , we use these following equations

y R  y P   f P  f R  x R  x P  & y R  y Q  g Q  g R x R  xQ 
1 1
2 2
 x R  0.3552 & y R  0.0503

For improved values of p R & q R ,


1
a P  a R  1  f P  f R  p R  p P   1 c P  c R q R  q P   1 eP  eR  y R  y P   0
2 2 2 2
1
aQ  a R  g Q  g R  p R  pQ   cQ  c R q R  qQ   eQ  eR y R  yQ   0
1 1 1
2 2 2 2
 q R  0.8387 & p R  4.5022

Now approximation equation for the solution is

uR  uP 
1
 p P  p R x R  x P   1 q P  q R  y R  y P 
2 2
 u R  0.75  4  4.50220.3552  0.3  0.8387  0.30.0503  0
1 1
2 2
 u R  0.9981

For the 3rd approximation


f R   g R  u R  0.9236, c R  u R2  0.8530

For the improved values of x R & y R , we use these following equations

y R  y P   f P  f R  x R  x P  & y R  y Q  g Q  g R x R  xQ 
1 1
2 2
 x R  0.3559 & y R  0.0468

For improved values of p R & q R , the equation are


1
a P  a R  1  f P  f R  p R  p P   1 c P  c R q R  q P   1 eP  eR  y R  y P   0
2 2 2 2
1
aQ  a R  1 g Q  g R  p R  pQ   1 cQ  c R q R  qQ   1 eQ  eR y R  yQ   0
2 2 2 2
 q R  0.8387 & p R  4.4866

Now approximation equation for the solution is

uR  uP 
1
 p P  p R x R  x P   1 q P  q R  y R  y P 
2 2
 u R  0.75  4  4.48660.0559  0.8754  0.30.0468  0
1 1
2 2
 u R  1.0147

For the 4th approximation

f R   g R  u R  1.0147, c R  u R2  1.0296
For the improved values of x R & y R , we use these following equations

y R  y P   f P  f R  x R  x P  & y R  y Q  g Q  g R x R  xQ 
1 1
2 2
 x R  0.3558 & y R  0.0632
For improved values of p R & q R , the equation are
1
a P  a R  1  f P  f R  p R  p P   1 c P  c R q R  q P   1 eP  eR  y R  y P   0
2 2 2 2
1
aQ  a R  1 g Q  g R  p R  pQ   1 cQ  c R q R  qQ   1 eQ  eR y R  yQ   0
2 2 2 2
 q R  0.8510 & p R  4.4971

Now approximation equation for the solution is

uR  uP 
1
 p P  p R x R  x P   1 q P  q R  y R  y P 
2 2
 u R  1.0120
The required solution is uR = 1.0120

 2u  2u
Example 2 : Solve the wave equation   0; 0  x  1, t  0
x 2 t 2
subject to the following conditions u  x 2  xt 2 along the initial line t=0
By the method of characteristics, find the solution between the grid points x=0.1 and
x=0.2.

Solution : Since ‘u’ is given as a continuous function of x along Ox.


u u
The initial value of p   2x  t 2 , q   2 xt
x t
The slopes of the characteristics are the roots of the equation m 2  1  0

Initially f  1  g
u  x  xt , f   g  1
2 2

p  2 x  t 2 , q  2 xt
a  1, b  e  0, c  1, P  0.1, Q  0.2
f P  1.0, f Q  1.0, g Q  1.0, p P  0.2, pQ  0.4
u P  0.01, qQ  0, q P  0, c P  1, cQ  1
dy dy
Now  f,  g can be approximated by
dx dx
y R  y P  f P xR  xP  & y R  yQ  g Q xR  xQ  
 xR  0.1500, y R  0.0500
The equations afdp  cdq  edy  0 & agdp  cdq  edy  0 are approximated

along PR by the equations

a P f P  p R  p P   c P q R  q P   e P  y R  y P   0
a Q g Q  p R  pQ   cQ q R  q Q   eQ  y R  y Q   0
 p R  0.3000, q R  0.1000

Now approximation equation for the solution is


u R  u P   p P  p R  x R  x P   q P  q R  y R  y P 
1 1
2 2
 u R  0.01  0.2  0.30.15  0.1  0
1 1
2 2
 u R  0.0125
For the 2nd approximation

For the improved values of x R & y R , we use these following equations

y R  y P   f P  f R  x R  x P  & y R  y Q  g Q  g R x R  xQ 
1 1
2 2
 x R  0.15 & y R  0.05

For improved values of p R & q R ,


1
a P  a R  1  f P  f R  p R  p P   1 c P  c R q R  q P   1 eP  eR  y R  y P   0
2 2 2 2
1
aQ  a R  1 g Q  g R  p R  pQ   1 cQ  c R q R  qQ   1 eQ  eR y R  yQ   0
2 2 2 2
 q R  0.1000 & p R  0.3000

Now approximation equation for the solution is

uR  uP 
1
 p P  p R x R  x P   1 q P  q R  y R  y P 
2 2
 u R  0.0125
So, the required solution is u R  0.0125
 

You might also like