Finite Difference Method
Finite Difference Method
Finite Difference Method
539)
Numerical Problems are of two types, viz., Initial Value Problems and Boundary Value
Problems. Boundary Value Problems (BVPs) differ in one very important respect relative to
Initial Value Problems (IVPs). This difference is related to the specification of the n conditions
needed to uniquely determine the n arbitrary coefficients in the general solution to an nth order
ODE. For a BVP, the n boundary conditions are specified at two or more points in the domain
of interest (whereas the n conditions are specified at a single point for IVPs). This difference
gives rise to significant variations in the algorithms used to solve these problems - especially in
the numerical solution schemes.
For BVPs one needs to satisfy conditions at up to n boundary points. For example, we might
have
where p1, p2, up to pn are the boundary points for an nth order system.
More often, however, there are only two boundary points, p1 and p2, with multiple conditions at
each point. If we define n1 and n2 as the number of conditions at points p1 and p2, respectively,
then n = n1 + n2 for an nth order system. The boundary conditions at the two points can be
written in a very general form as
where
The most common situation that arises in practical applications, of course, is the 2nd order BVP.
In this case, there is a single boundary specification for each of the two boundary points. These
can be written as
If both w1 and w2 are zero, the boundary conditions (BCs) are said to be homogeneous. Also if
both a1 and a2, for example, are nonzero, then this boundary condition is referred to as a mixed
BC. Various combinations can occur and a variety of specific examples are treated in this
section of notes and throughout the remainder of the course.
Mathematical Method
Basic Concepts
The Finite Difference (FD) method essentially converts the ODE into a coupled set of algebraic
equations, with one balance equation for each finite volume or node in the system. The general
technique is to replace the continuous derivatives within the ODE with finite difference
approximations on a grid of mesh points that spans the domain of interest. The boundary
nodes are treated as special cases. The coupled set of equations that results can then be
solved by a variety of techniques (see Section VI - Numerical Solution of Algebraic Equations).
A simple algorithm for the basic FD method (for linear systems) is outlined as follows:
1. Convert continuous variables to discrete variables. Note that the mesh grid or nodal scheme
for the independent variable may be evenly spaced (usually gives a relatively simple
formulation) or set on an uneven grid (resultant equations are usually slightly more complex),
as necessary.
2. Approximate the derivatives at each point using formulae derived from a formal Taylor Series
expansion using the most accurate approximation available that is consistent with the given
problem.
3. Treat the boundary points separately, being careful to get the best approximation as possible
to the desired BCs.
4. Solve the resultant set of coupled equations using either direct or iterative schemes as
appropriate for the problem.
If the original ODE is nonlinear the above procedure is still valid, except an additional outer
iteration is needed in the overall solution strategy. Highly nonlinear problems are often difficult
to converge, but mildly nonlinear or variable coefficient problems are usually solvable using a
simple outer iteration scheme.
This section of notes first reviews the basic Taylor Series and the development of several
derivative approximations, and then illustrates the FD method via an example.
A key step in the Finite Difference method is to replace the continuous derivatives in the
original ODE with appropriate approximations in terms of the dependent variable evaluated at
different mesh points in the region of interest. The basis for doing this is related to the Taylor
Series expansion for a function in the vicinity of some discrete point, xi.
To formalize this discussion, let’s start by defining a discrete notation for both the independent
and dependent variables. For the independent variable we simply evaluate the continuous
variable x at discrete points xi. If the domain of interest is broken into evenly spaced nodes,
then
These two equations can be used to derive several common derivative approximations, as
follows:
Central Difference Approximation - subtract eqn. (5.19) from eqn. (5.18) to give
or
where we notice that the central derivative formula is more accurate, with truncation errors on
the order of h2 [which is denoted as O(h2)].
or
These first and second derivative approximations are the most common representations used
when converting the continuous ODE into FD form. There are other formulae that are
sometimes used (see the next subsection on Some Additional Derivative Approximations), but
the set given here forms the basis for most implementations of the finite difference method.
The above derivative approximations [eqns. (5.20) - (5.33)] represent a good inventory of
formulae for use in the FD method. Many other formulae are also available, since there are a
variety of schemes and assumptions that can be used in the development of such formulae.
As an example, let’s derive the forward approximation for fi’ with error O(h2) as given above in
eqn. (5.28). We start with Taylor Series expansions for fi+1 and fi+2, which can be written as
Now let’s eliminate the second derivative term by multiplying eqn. (5.34) by 4 and subtracting
eqn. (5.35) from the result, giving