Finite Difference Methods Mixed Boundary Condition
Finite Difference Methods Mixed Boundary Condition
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: