Mvse-101 Pde
Mvse-101 Pde
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 ... xN1 xN b
The grid points are equi-spaced and computed as
ba
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 yi1
y xi i1 o(h2 )
2
h
y y
y xi i1 i1 o(h2 )
2h
that is
yi1 2yi yi 1 y y
c(xi ) i 1 i1 d(xi )yi e(xi )
h2 2h
h h
or ( 1 c i )yi1 (2 h2di )yi ( 1 c i )yi1 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 cN1)yN 2 (2 h2dN1)yN1 [h2eN1 (1 cN1)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
N1 N1 (N1)X(N1)
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 xN1
2 2 h
h eN1 (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
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
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 )yi1 (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
2h10 y0 10 y1 y 1 2h1
Or
2h2NyN 2N yN1 yN1 2h2
y0 b0
y 2
1 h e1
y . B ...
yN1 h2e
N1
yN
bN
h h
i 2 h2di , i 1 ci , ui 1 ci, bi h2ei; i 2,3,...,N 1
2 2
a01 0 2h0 (10 / 10 ) , a02 2 ,
aN,N N 2huN ( 2N / 2N ), aN1,N 2
b0 h2e0 2h01 / 10 bN h2eN 2huN2 / 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
a01 a02 b0
0 1 u1 b
1
0 2 u2 b
b 2
. ... .
0
N1 uN1 b
N1
0
aN,N
bN
(N1)X(N1)
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
1
1
d2 y y 2yi yi1
i1 ,i 1,2,3,4;
2
dx i h2
The substitution at i=1,2…N grid points, where the solution is desired, yields:
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
N1 N1
dx 2 N 2h
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
The convergence is not good. More iteration are required for better solution.
Using elimination gives the following solution:
Lecture 1
Y [y0 ,y1,y2,...,yN1,yN ]T
Due to Dirichlet boundary conditions
y 0 , yN
Such that
g0(Y) y0 ; gN(Y) yN ;
2 yi1 yi1 b a (5.3)
g(Y)
i (yi1 2yi yi1) 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
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
ba
yi( ) (xi a); xi a ih,h
ba 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 , y 0 0, yN 1
y2 2
y f(x,y,y)
y
f 1 y2 f 2y
or` ;
y i y 2 i y i y i
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
y2 2
y f(x,y,y)
y
y y ba
gi (Y) (yi1 2yi yi1) h2 f(xi,yi, i 1 i1 ); i 1,2,...,N 1,h
2h N
y y
G(Y) [(yi1 2yi yi1) h2 (2 ( i1 i1 )2 / yi ]
2h
y y
G(Y) [( yi1 2yi yi1) (2h2 ( i1 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.
2u 2u 2u
A B C F x, y, u, u x , u y G 0 (1)
x 2 xy 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
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.
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
Au xx Bu xy Cu yy Du x Eu y Fu G 0 (3)
The corresponding characteristics are distinct or single or not real, depends upon the value of
discriminent (B2-4AC).
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
u (x) 3 3u
u( x x, y) u( x x, y) 2x
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
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)
xy 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
Solution:
r 2r r
u i , j 1 u i 1, j ar u i , j 1 ar u i 1, j
x x 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.
For this, let us discuss first step, which is common to all methods i.e. discretization.
t
∆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;
(1.2)
The initial condition then can be written as: u x,0 u 0 x u i , 0 u 0 ix
u 0, t u1 t u 0, j u1 jt
The boundary condition will be converted to: (1.3)
u L, t u 2 t u N , j u 2 jt
u i,j+1
1 (j+1)th level
r 1‐ r jth level
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
3x
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
3x
The exact solution is u x, t e 4
sin
2
Solution-
u 2u
2
t i , j x i , j
t
where, r
x
2
(2)
3x
Initial condition is: u ( x,0) sin
2
u
Boundary conditions are: u0, j 0 and 0 ; N 10
x N , j
u N 1, j u N , j
0 u N 1, j u N , j u10 j u9, j (3)
x
ui ,1
1
4
ui1,0 2ui,0 ui1,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
9 2t
3x
u x, t e 4
sin
2 (here t=0.0025)
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
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:
ui 1, j ui 1, j 1
ui , j ui 1, j ui 1, j hui , j
2h 2
(i) r=0.25
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)
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
1 19
u10,1 u9,1 u10,1 0.0641
2 40
(ii) r=0.7
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)
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
ui1, j 2ui, j ui1' j ui1, j1 2ui, j1 ui1, j1 (3.3)
2.
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.
Scheme given by equation (3.4) is called Crank Nicolson scheme which is an implicit scheme.
2+ (j+1)th level
2‐
jth level
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 ox 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.
u
0
subject to B.Cs. u = 0 at x = 0 and x at x = 1 ,for all t
3x
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
ui1, j 2ui, j ui1' j ui1, j 1 2ui, j 1 ui1, j 1
2.
2
3x
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
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.
with the help of equation (3) , the last equation (5) becomes-
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
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
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
Now Ist B.C is : u=0 at x=0 for t
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
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
At Ist time level: Putting i=1,2,3,…………9 & j=0 in (2), we get
Put j = 0 in equation (6):
After solving these equations, we get
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)
After solving these equation, we get
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 ot ox which is comparable to C-N scheme
2 2
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.
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.
The computational molecules for equation (4.5) can be shown as shown in Fig.(1).
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 3x
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.
ui , j 1 ui , j
1
u 2u u
t x 2 i 1, j 1 i , j 1 i1, 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
3x (2)
Initial condition is: u ( x,0) sin
2
u
Boundary conditions are: u 0, j 0 and 0 ; N 10
x N, j
u N 1, j u N, j
0 u N 1, j u N, j u10 j u 9, j (3)
x
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:-
With the help of equation (3) the last equation (5) becomes-
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
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
u 2u
2
t i, j t i, j
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
jth 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
1
2
u i1, j u i1, j (4.3)
1 2r
u i, j1
1 2r
u i. j1
2r
1 2r
u i1, j u i1, j (4.4)
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.
u i,j+1
(j+1)th level
(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.
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
Obtain the solution at first time level using C-N scheme and obtain the second time level by
(i) Dufort Frankel (ii) Richardson
Solution:
By Crank Nicolson, equation (1) can be approximated as
ru i 1, j1 (2 2r)u i, j1 ru i1, j1 ru i 1, j (2 2r)u i, j ru i1, j (2)
As r= 0.75 and x 0.1
Put r =0.75 in equation (2),we get
3u i 1, j1 14u i, j1 3u i 1, j1 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
(i) Dufort Frankel Explicit Scheme is
1 2r
u i, j1
1 2r
u i, j1
2r
1 2r
u i1, j u i1, j)
Put r=.75
1
u i, j1 u i 1, j u i 1, j (3)
3
u i, j1
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
Put r=0.75
u i, j1 u i, j1
3
2
u i1, j 2u i, j u i1, 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 , Uu then we say that U is
required solution of equation (1.1).
Compatibility, Stability and Convergence which every scheme has to satisfy.. Let us define
each of these terms:
Then,
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
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
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.
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.
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
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
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:
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
Where ei. j denotes the error at the (i, j)th node and is equal to u i. j u *i. j
Hence e0 ,j= eN+1,.j = 0 ; equation (2.3) can be written in the matrix form as:
1 2r r 0 0
r 1 2r r 0
A
0 r 1 2r
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
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 0r
3
Applying Braurer’s theorems for the remaining rows :
1 1
1 2r 2r 0r thus, r
2 2
.
This method is based on the assumption of the solution in the form of separation of variables.
Avoiding the suffixes i & j and replacing them by m & n resp. The expression for error can be
written as:
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.
Let ei, j be the error at (i, j)th node to exact solution Ui,J.
ei, j1 rei 1, j 1 2r ei, j rei 1, j U i, j1 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, j1 rei1, j 1 2r ei, j rei1, 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:-
Provided 1 2r 0 or r
1
2
But E0 is zero and E j1 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.
2u 2u
2 f ( x, y ) or 2u f ( x, y ), a x b, c y d (1.1)
x 2
y
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:
For x y :
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:
Explicit scheme:
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:
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
(uin1, j uin1, j uin, j 1 uin, j 1 ) 0.50.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
u1n,11
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:
u1n,11
4
1 n
u1,1 u 2n,1 1.996
u 2n,11
4
1 n1
u1,1 u 2n,1 u3n,1 0.992
u3n,11
4
1 n1
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:
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:
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.
u in, j 1 u in, j
4
(x) 2
f i , j u in1,1j u in, j 11 u in, j 1 u in1, 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
M=N
2 1.000
3 1.072
5 1.260
10 1.528
20 1.729
2.000
u1n,11
1 n
2
u 2,1
u 2n,11
1
u1n,11 u 2n, 2 10
4
u 2n,21
1 n1
u 2,1 10
2
The values ,so computed are given in the following table:
k cos cos , M, N no. of sub divisions . Here M 3, N 3
M N
4
k 0.5 1.072
2 4 k2
(start with assumed valuesas 0 i.e. u i,0 j 0)
1
u1n,11 1.072 u 2n,1 5 0.072u1n,1
2
1
u 2n,11 1.072 u1n,11 u 2n, 2 10 0.072u 2n,1
4
1
u 2n,21 1.072 u 2n,11 10 0.072u 2n, 2
2
u1n,11
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:
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
1
u1n,11 1.072 u1n, 2 u 2n,1 0.072u1n,1
2
1
u 2n,11 1.072 u1n,11 u 2n, 2 10 0.072u 2n,1
4
1
u 2n,11 1.072 u1n,11 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:
2u 1 u 1 2u
0 (3.1)
r 2 r r r 2 2
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:
1 1 1 1 1
1 ui 1, j 1 ui 1, j 21 u
2 i, j
u u 0 (3.2)
i i i 2 i , j 1
2 i , j 1
2i 2i
(i+1,j)
(i‐1,j)
The truncation error is or 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
100C and flat edge at 10C . 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 :
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 ir , j . then equation
can be written as:
1 1 1 1 1
1 ui 1, j 1 ui 1, j 21 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:
On solving, we have:
u1,1 =30.1398; u1, 2 =43.8495; u1,3 =52.9467
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 .
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:
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.
u in, j 2 u in, j 1 (u in1,1j 2u in, j 1 u in1,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 11 , 2 u 0 with,
x y 1 / 4 , where x =0 and x =1 is kept at 10C and y=0 & y=1 are kept at 50C .
Use ADI and Libemann method to solve it and compare the result.
Solution:
By ADI Method:
Given, 2u 0
Stage 1:
Now, fix j =1 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:
Now, fix j =2 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:
Now, fix j =3 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:
Stage 2:
The FD representation of the Laplace equation is :
Now, fix i =1 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:
Now, fix i =2 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:
Now, fix i =3 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:
As the values at stage 1 and stage 2 do not match so we continue the process.
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:
Now, fix j =3 ; substituting i =1,2,3 in equation (4.3) and with boundary conditions, we have:
Now, fix i =1 ; substituting j =1,2,3 in equation (4.4) and with boundary conditions, we have:
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:
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:
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
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
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
3
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.250.25 0.2225 0.250.25 0.25 0.22250.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.250.25 0.25 0.250.25 0.25 0.250.2225 0.25 0.25 0.25 0.2225
2
u1 84.5590 , u 2 87.8738
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 yi1
, i 2, , n
ui1
y c x
iii xn yn
, xi i i i1 , i n 1, ,1
un ui
This algorithm is known as Thomos Algorithm and is very efficient for large system of
equations.
Solve the above system using Thomos Algorithm & Gauss-Seidel Method and compare the
result.
Solution:
The given problem is of form: AX = B
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 ci1
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:
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
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 xy y 2 x y (1)
2u 2 2u
One of its common example is the wave equation given by c
t 2 x 2
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:
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
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, )jui1, 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 .
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),
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
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
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
I.C’s are
i ux,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 2t
u 0,1 u10,1 0
u1,1 8u 0, 0 u 2, 0 12u1, 0 0.9944 u 9,1
u 2,1 8u1, 0 u 3, 0 12u 2,0 1.8904 u8,1
u 3,1 8u 2,0 u 4, 0 12u 3,0 2.6032 u 7 ,1
u 4,1 8u 3,0 u 5, 0 12u 4, 0 3.0588 u 6,1
u 5,1 8u 4,0 u 6,0 12u 5,0 3.2176
u 0,3 u10,3 0
u1,3 4u 0, 2 u 2, 2 6u1, 2 u1,1 1.1292 u 9,3
u 2,3 4u1, 2 u 3, 2 6u 2, 2 u 2,1 1.9676 u8,3
u 3,3 4u 2, 2 u 4, 2 6u 3, 2 u 3,1 2.9432 u 7 ,3
u 4,3 4u 3, 2 u 5, 2 6u 4, 2 u 4,1 3.1990 u 6,3
u 5,3 4u 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
i 1, 2 .................. N 1
r2 2 (1 r 2 ) r2
j1
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, t0
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)
, + , , = ( , + , )+ , + ( , + , )+ ,
⇒ , ( , + , )= ( , + , )+ , (3)
⇒ , ( , + , )= ( , + , )+ ,
& , ( , + , )= ( , + , )+ ,
⇒ , , = 0.5635 ⇒ , , = 0.5009
, + , = 0.4027 ⇒ , + 17 , = 6.4432
, = , = 0.4098, , = , = 0.478, , = , =0
( , + , )+ , = ( , + , )+ , + ( , + , ) ,
putting i = 1, 2
( , + , )+ , = ( , + , )+ , + ( , + , ) ,
& ( , + , )+ , = ( , + , )+ , + ( , + , ) ,
⇒ , + , = 0.0029
& , + , = 0.5496
⇒ , = 0.5188, , = 0.7283
putting i = 1, 2
( , + , )+ , = ( , + , )+ , + ( , + , ) ,
& ( , + , )+ , = ( , + , )+ , + ( , + , ) ,
⇒ , + , = 0.7352
& , + , = 0.6583
⇒ , = 0.6650, , = 0.7722
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 :
(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
x ix
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 21 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 21 2 r 2 Sin 2 (6)
2
1 2 1
1
Thus 1 ,implying that if
2
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 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.
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 .
2u 2u 2u
a b c e0 (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 xy yx y x y 2 y
ar + bs + ct + e = 0 (2)
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 bc 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
dy
2 dy
a b c0 (6)
dx dx
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.
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.
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)
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 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.
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.
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.75q R 0.3 0 & p R 5 1.2q R 0.4 0
p R 4.4308, q R 0.8744
f R g R u R 1.0610, c R u R2 1.1257
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
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.50220.3552 0.3 0.8387 0.30.0503 0
1 1
2 2
u R 0.9981
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
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.48660.0559 0.8754 0.30.0468 0
1 1
2 2
u R 1.0147
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
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.
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
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
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
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