Sie sind auf Seite 1von 6

Lecture 9a: Finite Difference Method

KXGM 6104 Computational Mathematics


9a.1 Introduction
Analytical methods may fail if
i)
ii)
iii)
iv)
v)

The PDE is not linear and cant be linearized without seriously affecting the result.
The solution region is complex.
The boundary conditions are of mixed types.
The boundary conditions are time-dependent.
The medium is inhomogeneous or anisotropic.

The finite difference method (FDM) was first developed by A. Thom* in the 1920s under the title the method of
square to solve nonlinear hydrodynamic equations. *A. Thom and C. J. Apelt, Field Computations in Engineering and
Physics. London: D. Van Nostrand, 1961.
The finite difference techniques are based upon the approximations that permit replacing differential equations by
finite difference equations. These finite difference approximations are algebraic in form, and the solutions are related
to grid points.
Thus, a finite difference solution basically involves three steps:
i)
Dividing the solution into grids of nodes
ii)
Approximating the given differential equation by finite difference equivalence that relates the solutions to
grid points.
iii)
Solving the difference equations subject to the prescribed boundary conditions and/or initial conditions.
9a.2 Methods of Discretization
Non-linear continuous equations need to be transformed into a discretized system of equations. Discretization can be
done by using Taylor series expansion,

f ( x) an ( x b)

n 0

i)

First derivative forward derivation


Use general expansion of the equation,

f ( x x) f ( x) (x)

f (x)2 2 f (x)3 3 f

......
x
2! x 2
3! x3

----- (1)

What we can do is to arrange the expansion in order to get the derivation of the derivative. Rearranging the
equation to get the first order ordinary differential equation

f
,
x

f
f ( x x) f ( x) x 2 f (x)2 3 f

...
x
x
x
2! x 2
3! x3
If we cut off higher order terms the equation will become,

f
f ( x x) f ( x)

O(x)
x
x
Or normally known as first forward difference approximation as shown in Figure 1.1 and is written as,

f f
f
i 1 i O(x)
x
x

Figure 1.1: Forward first derivative


ii)

First-derivative backward derivation


From the general Taylors expansion for f ( x x) ,

f (x)2 2 f (x)3 3 f
f ( x x) f ( x) (x)

......
x
2! x 2
3! x3
After rearranging,

f
f ( x) f ( x x)

O(x)
x
x
Or is normally presented in the following form,

f fi 1
f
i
O(x)
x
x
The graph depiction of the case is as in Figure 1.2.

Figure 1.2: Backward first derivative

----- (2)

iii)

First derivative Central Difference Approximation


To obtain the first order central difference approximation, take away equation (2) from equation (1),

f ( x x) f ( x x) 2x

f
O(x)2
x

Rearranging the equation,

f
f ( x x) f ( x x)

O(x)2
x
2x
fi 1 fi 1
f

O(x)2
x
2x

This approximation is known as central difference approximation of order (x) 2 .


iv)

Second Derivative Central Difference approximation


To derive Second Order Central Difference approximation, use the following 2 derivation of the Taylor series,

f (x)2 2 f (x)3 3 f

......
x
2! x 2
3! x3
f (2x)2 2 f (2x)3 3 f
f ( x 2x) f ( x) (2x)

...... (3)
x
2! x 2
3! x3
f ( x x) f ( x) (x)

(1.3) 2 x (1.1):

2 f
f ( x) 2 f ( x x) f ( x 2x)

2
x
(x)2
f 2 fi 1 fi 2
2 f
i
(4)
2
x
(x)2
This equation is the forward difference approximation for the second derivative. We can do similarly for the
derivation backward difference second order equation,

f 2 fi 1 fi
2 f
i 2
2
x
(x)2

(5)

To derive central difference second order equation as in Figure 1.3, add equation (1) and (2)

f 2 fi fi 1
2 f
i 1
2
x
(x)2

Figure 1.3: Second order Central Difference

9a.3 Classification of Equation


PDE is normally classified into three classes,
i)

Elliptic
Elliptic equation is a closed domain problem with prescribed boundary condition all around it. An example of
elliptic equation is the Poisson equation.

2 2

f ( x, y )
x 2 y 2

Figure 1.4: Elliptic closed system


ii)

Parabolic
Parabolic equation is an open system problem with an open solution domain. The solution is advancing for
example with time. An example of parabolic equation problem is the unsteady heat condition,

2
2
t
x

Figure 1.5: Parabolic open system


iii)

Hyperbolic
Hyperbolic equation is more related to wave equation. An example of a first-order hyperbolic equation with
one initial condition needed to be supplied.

a
t
x

Figure 1.6: Hyperbolic wave system


It is important to know the nature of the problem and the classification of the equations related to the physics of the
problem before we solve it.
9a.4 Steady, Unsteady, Uniform and Non-Uniform Simulation
There are 4 general classifications of moving fluid condition. They are steady-state, unsteady, uniform and non-uniform
conditions.
i)

Steady-state and uniform when at any time and any point in the considered domain, the velocity of the
fluid is constant. Velocity of the fluid is constant throughout. An example is a fluid moving along a constant
diameter pipe.

ii)

Steady-state and non-uniform when at all the time, the speed of the fluid is constant at one particular
location. An example is steady moving fluid along a pipe with not constant diameter.

iii)

Unsteady and uniform when the speed of the fluid at any time and point changes uniformly with time. An
example is when the rate of change of inlet of a fluid moving in a pipe is suddenly increased or decreased.

iv)

Unsteady and non-uniform when the speed of the moving fluid at any time and any point is not the same.
An example is a tornado or a cyclone.

9a.5 Solution Methods


Solution methods are divided into two categories,
i)

Direct methods - Direct methods compute the solution to a problem in a finite number of steps, e.g.
Gaussian Elimination, Factorization, etc.
a) Laasonen Method
b) Crank Nicolson method

ii)

Iterative methods a mathematical procedure that generates a sequence of improving approximate


solutions for a class of problems.
a) Jacobi
b) Gauss-Seidel
c) Conjugate Gradient
d) Multigrid

9a.6 Pressure and Density based Solvers


Pressure based or also commonly known as segregated is normally used to solve incompressible, low Reynolds number
problems with constant density. Because the density is constant, ideal gas equation cannot be used to close the system
of equations, i.e. Navier-Stoke Equations. Some of the famous name related to Pressure based equation is the Projection

method where pressure correction equation (Poisson equation) is solved in order to get the solution mass conservation
of the velocity field.
Density based solver or coupled method is normally linked to solving high speed flow with high pressure when the prime
properties such as velocities and pressure are strongly influenced to each other. The word coupled means that the
Continuity, Momentum, Energy and other transport equations are solved sequentially and not separately or in
segregated manner.
9a.7 Common Dimensionless Constants
i)

Reynolds number (viscous flow, dynamic viscosity)

uL
inertia

vis cos ity

Re
ii)

Froude number (Open Channel flow, gravity)

u
inertia

L g gravity

Fr
iii)

Mach Number (Compressible flow, speed of sound)

Ma
iv)

u
c

Peclet number

Pe

uL convection

k
diffusion

9a.8 Methodology of the Code


The symbol used in the program for l (lower), u(upper) and d(diagonal) are designated based on the matrix common
names lower, lower and diagonal. The main objective of the initial steps is to get the matrix to be solved.

Ax d

Figure 1.7
Where x is the value of properties and d is the right-hand-side vectors. For the FVM, the number of equations obtained
will be the number of control volumes. For example, the number of control volume is 5, and then the number of
equations will also be 5 equations in total. The matrix that will result from this will be a matrix of 5 by 5. By right, the
total of spaces required to store the matrix is 5 x 5 = 25. But because the matrix is a sparse matrix, there is a way of
storing only the number of diagonals according to dimensions of the problem solved.
For a one-dimensional problem, the matrix is tridiagonal as in Figure 1.1. It means that there are only 3 diagonal matrix
that are not zero. The rest of locations are all zero. The same will happen with solving two and three dimensional
problems. We will have pentadiagonal and hexadiagonal matrix respectively.

Das könnte Ihnen auch gefallen