Basic Aspects of Discretization
http://aircraftdesign.nuaa.edu.cn/aca/Slide/17-Basic%20Aspects%20of%20Discretization.pdf
Solution Methods
Singularity Methods
Panel method and VLM
Simple, very powerful, can be used on PC
Nonlinear flow effects were excluded
Direct numerical Methods (Field Methods)
Finite difference approach
Direct numerical solution of differential equations
Finite volume approach
Direct approximations to the integral form of the governing
equations
Area of CFD
Grid generation
Flowfield discretization algorithms
Efficient solution of large systems of equations
Massive data storage and transmission
technology methods
Computational flow visualization
Outline
Approximations to partial derivatives
Finite difference representation of Partial Differential
Equations
Discretization
Consistency
Stability
Convergence
Explicit and implicit approaches
The finite volume technique
Boundary conditions
Stability analysis
Approximations to partial derivatives
Mathematic basis
Taylor series expansions
0
0 0
2 2 3 3
0 0
2 3
( ) ( )
( ) ( )
2 6
x
x x
df x d f x d f
f x x f x x
dx dx dx
+ = + + + +
The ways to obtain finite difference
representations of derivatives
Forward difference
Backward difference
Central difference
Forward difference
first order accurate
one-sided difference
approximation
0
0 0
2 2 3 3
0 0
2 3
( ) ( )
( ) ( )
2 6
x
x x
df x d f x d f
f x x f x x
dx dx dx
+ = + + + +
0
0
2
0 0
2
( ) ( ) 1
2
x
x
f x x f x df d f
x
dx x dx
+
=
0
0 0
( ) ( )
( )
x
f x x f x df
O x
dx x
+
= +
Truncation Error
Backward difference
first order accurate
one-sided difference approximation
0
0 0
2 2 3 3
0 0
2 3
( ) ( )
( ) ( )
2 6
x
x x
df x d f x d f
f x x f x x
dx dx dx
= + +
0
0 0
( ) ( )
( )
x
f x x f x df
O x
dx x
= +
Central difference
Second order accurate
Two-sided difference approximation
0
0
3 3
0 0
3
( )
( ) ( ) 2
3
x
x
df x d f
f x x f x x x
dx dx
+ = + + +
0
2
0 0
( ) ( )
( )
2
x
f x x f x x df
O x
dx x
+
= +
0
0 0
2 2 3 3
0 0
2 3
( ) ( )
( ) ( )
2 6
x
x x
df x d f x d f
f x x f x x
dx dx dx
+ = + + + +
0
0 0
2 2 3 3
0 0
2 3
( ) ( )
( ) ( )
2 6
x
x x
df x d f x d f
f x x f x x
dx dx dx
= + +
The finite difference approximation to
the second derivative
Adding the Taylor series expressions for the forward and
backward expansions results in the following expression.
0
2
2 4
0 0 0
2
( ) ( ) 2 ( ) ( ) ( )
x
d f
f x x f x x f x x O x
dx
+ + = + +
0
2
2
0 0 0
2 2
( ) 2 ( ) ( )
( )
( )
x
f x x f x f x x d f
O x
dx x
+ +
= +
Shorthand Notation
Nomenclature for use in partial differential equation difference expressions
Shorthand Notation
1, ,
, 1,
1, 1,
2
( ) 1
( ) 1
( ) 2
2
i j i j
i j i j
i j i j
f f
f
O x st order forward difference
x x
f f
f
O x st order backward difference
x x
f f
f
O x nd order central difference
x x
+
= +
= +
= +
2
1 , 1,
2
2 2
2
( ) 2
( )
i i j i j
f f f
f
O x nd order central difference
x x
+
+
= +
Finite difference representation of Partial
Differential Equations
Steps and Requirements to Obtain a Valid Numerical Solution
On the selection of a finite difference approximation
Depends on the physics of the problem being studied
Any scheme that fails to represents the physics correctly will
fail when you attempt to obtain a solution
Connection between grid points used in numerical method and equation type
Example of Finite difference
representation of PDE
Heat equation
2
2
x
u
t
u
Grid nomenclature for discretization
Using a forward
difference in time, and a
central difference in space
Discussion on Steps of Numerical Solution
Discretization
Consistency
Stability
Convergence
Discretization
This is the process of replacing derivatives by finite
difference approximations.
This introduces an error due to the truncation error arising
from the finite difference approximation and any errors due
to treatment of BCs.
The size of the truncation error will depend locally on the solution.
In most cases we expect the discretization error to be larger than
round-off error.
Consistency
A finite-difference representation of a PDE is
consistent if the difference between the PDE and
its difference representation vanishes as the mesh
is refined, i.e.,
Consider a case where the truncation error is
O(t / x). In this case we must let the mesh go
to zero just such that:
Stability
A stable numerical scheme is one for which errors from any
source (round-off, truncation) are not permitted to grow in the
sequence of numerical procedures as the calculation proceeds
from one marching step, or iteration, to the next, thus:
errors grow unstable
errors decay stable
Comments
Stability is normally thought of as being associated with
marching problems
Stability requirements often dictate allowable step sizes
In many cases a stability analysis can be made to define the
stability requirements.
Convergence
The solution of the FDEs should approach the
solution of the PDE as the mesh is refined.
Lax Equivalence Theorem (linear, initial value
problem):
For a properly posed problem, with a consistent finite
difference representation, stability is the necessary and
sufficient condition for convergence.
In practice, numerical experiments must be
conducted to determine if the solution appears to
be converged with respect to mesh size.
Two Different Approaches
There are many difference techniques used in
CFD, you will find that any technique falls into
one or the other of following two different
general approaches:
Explicit approach
Implicit approach
Explicit Scheme
Heat equation
2
2
x
u
t
u
The solution at time step n is known. At time
n+1 there is only one unknown.
Finite difference equation
1
1 1
2
( 2 )
( )
n n
n n n
i i
i i i
u u
u u u
t x
+
+
= +
Grid points used in typical explicit calculation
the value of u at i and the n+1 time step:
we can solve for each new value explicitly without
solving a system of equations in terms of known
values from the previous time step.
1
1 1
2
( 2 )
( )
n n n n n
i i i i i
t
u u u u u
x
+
+
= + +
Discussions on explicit scheme
Advantages:
Relative simple to set up and program
This scheme is easily vectorized and a natural for
massively parallel computation
Disadvantage:
Stability requirements require very small steps sizes
Implicit Scheme
Grid points used in typical implicit calculation
The finite difference representation
we need to find the
values along n+1
simultaneously.
1
1 1 1
1 1
2
( 2 )
( )
n n
n n n
i i
i i i
u u
u u u
t x
+
+ + +
+
= +
This leads to a system of algebraic equations that must be
solved.
Defining
The finite difference equation became:
1
1 1 1
1 1
2
( 2 )
( )
n n
n n n
i i
i i i
u u
u u u
t x
+
+ + +
+
= +
The approach that leads to the formulation of a problem
requiring the simultaneous solution of a system of
equations is known as an implicit scheme.
Advantage:
Stability requirements allow a large step size
Disadvantages:
More complicated to set up and program
This scheme is harder to vectorize or parallelize
Since the solution of a system of equations is required at each
step, the computer time per step is much larger than in the
explicit approach.
Example - Elliptic PDE
Using Laplaces equation as the model problem
0 = +
yy xx
Grid points used in a typical representation of an elliptic equation
Use the second order accurate central difference
formulas at i,j:
2
2
, 1 , , 1
) (
) (
2
x O
x
j i j i j i
xx
+
+
=
+
2
2
1 , , 1 ,
) (
) (
2
y O
y
j i j i j i
yy
+
+
=
+
0
) (
2
) (
2
2
1 , , 1 ,
2
, 1 , , 1
=
+
+
+
+ +
y x
j i j i j i j i j i j i
If x = y, solve this equation for
ij
:
) (
1 , 1 , , 1 , 1
4
1
, + +
+ + + =
j i j i j i j i j i
This expression illustrates the essential physics of
flows governed by elliptic PDEs:
ij
depends on all the values around it
all values of must be found simultaneously
computer storage requirements are much greater than those
required for parabolic and hyperbolic PDEs
) (
1 , 1 , , 1 , 1
4
1
, + +
+ + + =
j i j i j i j i j i
Solution schemes
Because of the large number of mesh points, it is
generally not practical to solve the system of
equations
Instead, an iterative procedure is usually employed.
Initial guess for the solution is made and then each mesh
point in the flow field is updated repeatedly until the values
satisfy the governing equation.
This iterative procedure can be thought of as having a
time-like quality
A Note on Conservation Form
Care must be taken if the flow field has discontinuities
(shocks)
The correct solution of the partial differential equation will only be
obtained if the conservative forms of the governing equations are
used.
2D steady x-momentum equation
the conservative forms the classical standard forms
The Finite Volume Technique
Each conservation law had both differential and
integral statements.
The integral form is more fundamental, not
depending on continuous partial derivatives.
The finite volume method discretize the the
integral form of the equations.
Example of Finite Volume Approach
Conservation of mass in the integral statement
Introducing the specific notation and assuming 2-D
flow, the conservation law can be rewritten as:
Where H=( F, G) = V, q =
H
x
= F = u , H
y
= G = v
dV dS
t
V n i
0 dV dS
t
+ =
q H n i
Using the definition of n in Cartesian coordinates, and considering
for illustration the Cartesian system given above
Basic nomenclature for finite volume analysis
along AB, n = -j, dS =dx, and: Hn dx = - Gdx
along BC, n = i, dS =dy, and: Hn dy = F dy
in general: Hn ds = F dy - Gdx
Using the general grid the integral
statement, can be written as:
Define the quantities over each
face (AB) :
Here A is the area of the quadrilateral ABCD, and q
i,j
is the average value of q
over ABCD.
,
( ) ( ) 0
DA
j k
AB
Aq F y G x
t
+ =
0 dV dS
t
+ =
q H n i
Similarly for faces BC, CD and
AD
Assuming A is not a function of time, and combining:
Along AB
Along BC
Along CD
Along DA
Supposing the grid is regular Cartesian as shown
above. Then A = xy, and along:
Comments on Finite Volume Method
Differences between finite difference and finite
volume method
Finite difference
Approximates the governing equation at a point
Finite difference methods were developed earlier, the analysis
of methods is easier and further developed
Finite volume
Approximates the governing equation over a volume
Finite volume is the most physical in fluid mechanics codes,
and is actually used in most codes.
Comments on Finite Volume Method
The advantages of the finite volume method
Good conservation of mass, momentum, and energy
using integrals when mesh is finite size
Easier to treat complicated domains
integral discretization [averaging] easier to figure out,
implement, and interpret
Average integral concept much better approach when
the solution has shock waves (i.e. the partial
differential equations assume continuous partial
derivatives).
Boundary Conditions
We have obtained expressions for interior points on the
mesh.
What about expressions for points on the boundary ?
Near-field BC
Far-field BC
Handle the Far-field BC (1)
Go outfar enough and set = 0 for 0, as
the distance from the body goes to infinity
Advantage
Simple and frequently used
Disadvantage
Require excessive use of grid points in regions
where we normally arent interested in the details
of the solution.
Handle the Far-field BC (2)
Transform the equation to another coordinate system, and
satisfy the boundary condition explicitly at infinity
Handle the Far-field BC (3)
Blocks of Grids
The grid points are used efficiently in the region of
interest.
a dense innergrid
a coarseouter grid.
Adaptive Grid
The grid will adjust automatically to concentrate
points in regions of large flow gradients.
Handle the Far-field BC (4)
Match the numerical solution to an analytic
approximation for the farfield boundary condition.
The boundary numerical solution reflects the correct
physics at the boundary
It allows the outer boundary to be placed at a reasonable
distance from the body, and properly done.
Particularly important in the solution of the Euler
equations.
Effort is still underway to determine the best way to
implement this approach.
Handle the Far-field BC
Comments
BCs on the FF boundary are important, and can be especially
important for Euler codes which march in time to a steady
state final solution.
How to best enforce the FF BC is still under study - research
papers are still being written describing new approaches.
0
0
0
=
z
p
z
w
w
y
w
v
x
w
u
t
w
y
p
z
v
w
y
v
v
x
v
u
t
v
x
p
z
u
w
y
u
v
x
u
u
t
u
Handle the Near-field BC (1)
Using a standard grid and allow the surface
to intersect grid lines in an irregular manner
Handle the Near-field BC (2)
Using the surface of the body as a coordinate surface
Body conforming grid for easy application of BCs on curved surfaces
Handle the Near-field BC (3)
Using thin airfoil theory boundary conditions
Approximate approach to boundary condition specification
Finite difference representation of the BC's
(1)
Using Laplaces Equation as an example
Two types of boundary conditions associated with the
boundary:
The Dirichlet problem
The value on the boundary is simply specified, and no special
difference formulas are required.
The Neumann problem
/n is specified, and special difference formulas are required.
0 = +
yy xx
Finite difference representation of the BC's
(2)
The normal velocity, v, is zero at the outer boundary
Dummy Row
Outer Boundary
The required boundary condition at j = NY is:
The equations are then solved up to Y
NY
, and whenever you need
at NY+1, simply use the value at NY-1.
Finite difference representation of the BC's
(3)
Thin airfoil theory boundary conditions at the surface
( nondimensionalizedby U )
Using central differences at j =2
Dummy Row
Stability Analysis
Introduction
In many cases some finite difference representation
proved impossible to obtain solutions.
Frequently the reason was the choice of an inherently
unstable numerical algorithm.
In this section we present one of the classical
approaches to the determination of stability criteria for
use in CFD.
These types of analysis provide insight into grid and
step size requirements
Step size : time steps
Grid size : spatial size
Von Neumann Stability Analysis
for parabolic equation (heat equation)
Assume at t = 0, that an error, possibly due to finite length arithmetic,
is introduced in the form:
Using the explicit finite difference representation
Substitute Eq. (1) into (2), and solve for (t + t)