0% found this document useful (0 votes)
57 views

Finite Difference Methods Mixed Boundary Condition

The document discusses finite difference methods for solving linear boundary value problems with mixed boundary conditions. It begins by presenting the general form of the boundary value problem and computational grid. For problems with mixed boundary conditions, the solution must be computed at the boundary points in addition to internal grid points. This increases the number of unknowns to N+1, where N is the number of grid points. Finite difference approximations are derived for the differential equation at internal and boundary points. The resulting finite difference equations form a system of N+1 linear algebraic equations that can be solved to obtain the approximate solution at grid points. An example problem is presented to demonstrate the application of the method.

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)
57 views

Finite Difference Methods Mixed Boundary Condition

The document discusses finite difference methods for solving linear boundary value problems with mixed boundary conditions. It begins by presenting the general form of the boundary value problem and computational grid. For problems with mixed boundary conditions, the solution must be computed at the boundary points in addition to internal grid points. This increases the number of unknowns to N+1, where N is the number of grid points. Finite difference approximations are derived for the differential equation at internal and boundary points. The resulting finite difference equations form a system of N+1 linear algebraic equations that can be solved to obtain the approximate solution at grid points. An example problem is presented to demonstrate the application of the method.

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/ 6

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


.

You might also like