Next: Non-Linear BVPs Up: 10.001: Numerical Solution of Previous: IVP with Systems of

# Boundary Value Problems: The Finite Difference Method

Many techniques exist for the numerical solution of BVPs. A discussion of such methods is beyond the scope of our course. However, we would like to introduce, through a simple example, the finite difference (FD) method which is quite easy to implement. Moreover, it illustrates the key differences between the numerical solution techniques for the IVPs and the BVPs.

Let's consider the linear BVP describing the steady state concentration profile C(x) in the following reaction-diffusion problem in the domain . The BVP can be stated as

 C(x=0) = 1 (30)

The analytical solution to the BVP above is simply given by .

We are interested in solving the above equation using the FD technique. The first step is to partition the domain [0,1] into a number of sub-domains or intervals of length h. So, if the number of intervals is equal to n, then nh = 1. We denote by xi the interval end points or nodes, with x1 =0 and xn+1 = 1. In general, we have xi = (i-1)h, . Let us denote the concentration at the ith node by Ci. The second step is to express the differential operator d2C/dx2 in a discrete form. This can be accomplished using finite difference approximations to the differential operators. In this problem, we will use the approximation

 (31)

For the discretization of the no flux boundary condition at x=1, we will use the discretization given by

 (32)

The finite difference discretizations given above are referred to as the central difference approximations. The local truncation error (LTE) associated with either of the approximations given above is O(h2).

Let's now derive the discretized equations. First of all, we have two boundary conditions to be implemented. The boundary condition at x=0 gives

 C1 = 1 (33)

The implementation of the no flux condition at x=1 is somewhat tricky. Note that according to Eq. 33, we should write (with i=n+1)

 (34)

However, Cn+2 is not in our domain thereby creating a difficulty. What do we do here? The solution is to extend the original domain from (0,nh) to (0, (n+1)h). This results in n+2 nodes, the n+2th one being a fictitious one. We solve for and the additional variable introduced due to the fictitious node Cn+2 and discard Cn+2 from the final solution.

So far, we have supplied 2 equations for the n+2 unknowns, the remaining n equations are obtained by writing the discretized ODE for nodes . Application of Eq. 32 and the use of the boundary conditions lead to the following system of linear equations for Ci, .

 C1 = 1 C3 - (2+h2) C2 + C1 = 0 C4 - (2+h2)C3 + C2 = 0 .................... Cn+2 - (2+h2)Cn+1 + Cn = 0 Cn+2 - Cn = 0. (35)

We can express this system compactly using matrices. The coefficient matrix, say , corresponding to the system of equations given above is

 (36)

The right hand side vector . This means that the solution to the system gives the solution vector . The system of equations can be solved using Gaussian elimination or more typically using a special linear system solver designed to take advantage of the tridiagonal structure of the coefficient matrix.

In Figure 5, the FD solution with h=0.1 and h=0.05 are presented along with the exact solution to the BVP of Eq. 31. A very good agreement between the exact and the computed solutions can be seen from there.

How does the FD scheme above converge to the exact solution as h is decreased? The absolute error at the center of the domain (x=0.5) for three different values of h are plotted vs. h in Figure 6 on a log-log plot. It can be seen from there that the error decreases as O(h2). Hence, the FD approximation used here has quadratic convergence. This is because the discretization errors in the approximation of the first and second derivative operators (see Eqs. 32 and 33) are O(h2). Indeed, the convergence characteristics can be improved by using more accurate discretization of the differential operators.

Next: Non-Linear BVPs Up: 10.001: Numerical Solution of Previous: IVP with Systems of
Michael Zeltkevic
1998-04-15