Discretization Techniques
Discretization Techniques
Dynamics
[AERO 423]
Sumit Krishnan
Assistant Professor
Department of Aerospace Engineering, ASETL
Amity University Lucknow Campus-226028
E-mail: [email protected]
CFD-Module II
Discretization Techniques
9/4/2020 2
Basic Discretization Techniques
INTRODUCTION
Discretization is the process by which a closed-form mathematical expression, such as a
function or a differential or integral equation involving functions, all of which are
viewed as having an infinite continuum of values throughout some domain, is
approximated by analogous (but different) expressions which prescribe values at only a
finite number of discrete points or volumes in the domain.
Analytical solutions of partial differential equations involve closed-form expressions
which give the variation of the dependent variables continuously throughout the
domain. In contrast, numerical solutions can give answers at only discrete points in the
domain, called grid points. For example, consider Fig. 1.
9/4/2020 3
Fig. 1.
Discretization Techniques
Finite Difference Method
This is the oldest method for numerical solution of PDE's, believed to have been
introduced by Euler in the 18th century. It is also the easiest method to use for simple
geometries.
The starting point is the conservation equation in differential form. The solution domain is
covered by a grid. At each grid point, the differential equation is approximated by
replacing the partial derivatives by approximations in terms of the nodal values of the
functions. The result is one algebraic equation per grid node, in which the variable value at
that and a certain number of neighbor nodes appear as unknowns.
Taylor series expansion or polynomial fitting is used to obtain approximations to the first
and second derivatives of the variables with respect to the coordinates.
On structured grids, the FD method is very simple and effective. It is especially easy to
obtain higher-order schemes on regular grids. The disadvantage of FD methods is that the
conservation is not enforced unless special care is taken. Also, the restriction to simple
geometries is a significant disadvantage in complex flows.
9/4/2020 4
Reference: Joel H. Ferziger, Milovan Peric - Computational Methods For Fluid Dynamics-Springer (2001)
Finite Volume Method
The FV method uses the integral form of the conservation equations as its starting point. The
solution domain is subdivided into a finite number of contiguous control volumes (CVs),
and the conservation equations are applied to each CV. At the centroid of each CV lies a
computational node at which the variable values are to be calculated. Interpolation is used to
express variable values at the CV surface in terms of the nodal (CV-center) values. Surface
and volume integrals are approximated using suitable quadrature formulae. As a result, one
obtains an algebraic equation for each CV, in which a number of neighbor nodal values
appear.
The FV method can accommodate any type of grid, so it is suitable for complex geometries.
The grid defines only the control volume boundaries and need not be related to a coordinate
system. The method is conservative by construction, so long as surface integrals (which
represent convective and diffusive fluxes) are the same for the CVs sharing the boundary.
The disadvantage of FV methods compared to FD schemes is that methods of order higher
than second are more difficult to develop in 3D. This is due to the fact that the FV approach
requires three levels of approximation: interpolation, differentiation, and integration.
9/4/2020 5
Finite Element Method
The FE method is similar to the FV method in many ways. The domain is broken into a set
of discrete volumes or finite elements that are generally unstructured; in 2D, they are
usually triangles or quadrilaterals, while in 3D tetrahedra or hexahedra are most often used.
The distinguishing feature of FE methods is that the equations are multiplied by a weight
function before they are integrated over the entire domain. In the simplest FE methods, the
solution is approximated by a linear shape function within each element in a way that
guarantees continuity of the solution across element boundaries. Such a function can be
constructed from its values at the corners of the elements. The weight function is usually of
the same form.
This approximation is then substituted into the weighted integral of the conservation law
and the equations to be solved are derived by requiring the derivative of the integral with
respect to each nodal value to be zero; this corresponds to selecting the best solution within
the set of allowed functions (the one with minimum residual). The result is a set of non-
linear algebraic equations.
9/4/2020 6
Introduction to Finite Differences Method
Here, we are interested in replacing a partial derivative with a suitable
algebraic difference quotient, i.e., a finite difference. Most common finite-
difference representations of derivatives are based on Taylor's series
expansions.
For example, if ui,j, denotes the x component of velocity at point (i, j), then
the velocity u i+ 1,j at point (i + 1, j) can be expressed in terms of a Taylor series
expanded about point (i, j) as follows:
(1)
So, if we wish to approximate the partial derivative with the above algebraic
finite-difference quotient,
(3)
The truncation error in Eq. (2) tells us what is being neglected in this
approximation. In Eq. (2), the lowest-order term in the truncation error involves
∆𝑥 to the first power; hence, the finite-difference expression in Eq. ( 4.3) is called
first-order-accurate. We can more formally write Eq. (2) as
(4)
9/4/2020 8
(5)
Moreover, the lowest-order term in the truncation error involves ∆𝑥 to the first power. As a result,
the finite difference m Eq. (5) is called a first-order rearward difference.
In most applications in CFD, first-order accuracy is not sufficient. To construct a finite-
difference quotient of second-order accuracy, The information used in forming the finite-
difference quotient comes from both sides of the grid point located at (i, j); that is, it uses u i +1, j
as well as u i-1, j. Grid point (i, j) falls between the two adjacent grid points. The finite-difference
quotient in Eq. (6) is called a second order central difference.
(6)
9/4/2020 9
Summary:
9/4/2020 10
Summary :
(Continued)
9/4/2020 11
Summary :
(Continued)
9/4/2020 12
Difference Equations
Most partial differential equations involve a number of partial derivative terms.
When all the partial derivatives in a given partial differential equation are
replaced by finite-difference quotients, the resulting algebraic equation is called
a difference equation, which is an algebraic representation of the partial
differential equation.
For simplicity, we choose to examine a partial differential equation which is less
elaborate than the governing flow equations. For example, let us consider Eq.
(1), which is the unsteady, one-dimensional heat conduction equation with
constant thermal diffusivity, repeated below.
(1)
Let us replace the partial derivatives in Eq. (1) with finite-difference quotients.
This equation has two independent variables, x and t.
9/4/2020 13
Let us replace the time derivative in Eq. (1) with a forward difference patterned.
(2)
Type equation here.
Also, let us replace the x derivative in Eq. (1) with a central difference patterned.
(3)
9/4/2020 14 (4)
Explicit and Implicit approaches
The CFD technique falls into one or the other of two different general approaches, an
explicit approach or an implicit approach.
For simplicity, let us return to the one-dimensional heat conduction equation.
(1)
we chose to represent 𝜕𝑇/𝜕𝑡 with a forward difference and 𝜕 2 𝑇Τ𝜕𝑥 2 with a central
second difference, leading to the particular form of the difference equation given by Eq.
(2), repeated below:
(2)
9/4/2020 15
With some rearrangement, this equation can be written as
(3)
Let us examine the implications of Eq. (1) and its difference equation counterpart given by Eq.
(3). Eq. (1) being parabolic, lends itself to a marching solution. The marching variable here is
time t. To be more specific, consider the finite-difference grid sketched below, Fig.1.
9/4/2020 16
9/4/2020 17
Implicit Approach:
Equation (3) is not the only difference equation that can represent Eq. (1); in fact, it is only
one of many different representations of the original partial differential equation. As a
counterexample to the former discussion concerning the explicit approach, let us be somewhat
daring and return to Eq. (1), this time writing the spatial difference on the right-hand side in
terms of average properties between time levels n and n + 1. That is, we will represent Eq. (1)
by
(4)
The special type of differencing employed in Eq. (4) is called the Crank Nicolson form.
(Crank-Nicolson differencing is commonly used to solve problems governed by parabolic
equations. In CFD, the Crank-Nicolson form, or modified versions of it, is used frequently for
finite-difference solutions of the boundary-layer equations.)
9/4/202
18
0
Examine Eq. (4) closely. The unknown 𝑇𝑖𝑛+1 is not only expressed in terms of the known
quantities at time level n, namely, 𝑇𝑖𝑛+1 , 𝑇𝑖𝑛 , and 𝑇𝑖−1
𝑛
, but also in terms of other unknown
𝑛+1 𝑛+1
quantities at time level n + 1, namely, 𝑇𝑖+1 and 𝑇𝑖−1 . In other words, Eq. (4) represents
one equation with three unknowns, namely, , 𝑇𝑖+1 , 𝑇𝑖𝑛+1 , and 𝑇𝑖−1
𝑛+1 𝑛+1
. Hence, Eq. (4)
applied at a given grid point i does not stand alone; it cannot by itself result in a solution
for 𝑇𝑖𝑛+1 . Rather Eq. (4) must be written at all interior grid points, resulting in a system of
algebraic equations from which the unknowns 𝑇𝑖𝑛+1 for all i can be solved simultaneously.
This is an example of an implicit approach.
By definition, an implicit approach is one where the unknowns
must be obtained by means of a simultaneous solution of the
difference equations applied at all the grid points arrayed at a
given time level. Because of this need to solve large systems
of simultaneous algebraic equations, implicit methods are
usually involved with the manipulations of large matrices. By
now, it is easy to get the feeling that the implicit approach
involves a more complex set of calculations than the explicit
Fig. 3 An implicit finite-difference module.
approach discussed earlier. In contrast to the simple explicit
finite-difference module shown in Fig. 2. the implicit module 9/4/2020 19
for Eq. (4) is sketched in Fig. 3, clearly delineating the three
unknowns at level n + 1.
Advantages and Disadvantages of explicit and
implicit methods:
Advantages Disadvantages
Explicit Method The solution algorithm is For a given ∆𝑥, ∆𝑡 must be less than a specific limit imposed by stability
simple to set up. constraints.
This requires many time steps to carry out the calculations over a given
interval of t.
Implicit Method Stability can be maintained More complicated to set up and program.
over much larger values
of ∆𝑡. Since massive matrix manipulations are usually required at each time step,
the computer time per time step is much larger than in the explicit
Fewer time steps are approach.
needed to carry out the
calculations over a given Since large ∆𝑡 can be taken, the truncation error is large, and the use of
interval. implicit methods to follow the exact transients (time variations of the
independent variable) may not be as accurate as an explicit approach.
However, for a time-dependent solution in which the steady state is the
desired result, this relative timewise
9/4/2020 inaccuracy
20 is not important.
Errors and an Analysis of Stability
There is a formal way of examining the accuracy and stability of linear equations, and this
idea provides guidance for the behavior of more complex non-linear equations which are
governing the equations for flow fields. Consider a partial differential equation, such as one
dimensional unsteady state heat conduction equation The numerical solution of this
equation is influenced by the following two sources of error.
Discretization error:
This is the difference between the exact analytical solution of the partial differential
equation and the exact (round-off free) solution of the corresponding finite-difference
Equation. The discretization error for the finite-difference equation is simply the truncation
error for the finite-difference equation plus any error introduced by the numerical treatment
of the boundary conditions.
9/4/2020 22
(1)
(2)
(3)
From Equation (3) we see that ∈ the error also satisfies the difference equation.
If errors are already present at some stage of the solution of this equation, then the solution will
be stable if the ∈ i's shrink, or at least stay the same, as the solution progresses in the marching
direction, i.e from step n to n+1. If the ∈ i's grow larger during the progression of the solution
from step n to n+1 , then the solution is unstable. Finally, 9/4/2020 23
For a solution to be stable, the mandatory condition is
(4)
Let us examine under what circumstances Eq. (4) hold good.
Assume that the distribution of error along the x- axis is given by a Fourier series in x and
the time-wise distribution is exponential in t, i.e,
(5)
where I is the unit complex number and k the wave number. Since the difference is
linear, when Eq. (5) is substituted into Eq. (3), the behavior of each term of the series is
the same as the series itself.
Hence, let us deal with just one term of the series, and write
(6)
9/4/2020 24
Substitute Eq. (6) into (3) to get
(7)
Divide Eq. (7) by
(8)
Or,
(9)
9/4/2020 25
Recalling the identity
(10)
Eq. (8) can be written as
(11)
or,
(12)
From Eq.(6), we can write
(13)
9/4/2020 26
Combining Eqns. (12), (13) and (4), we have
(14)
Eq. (14) must be satisfied to have a stable solution. In Eq (14) the factor is called
the amplification factor and is denoted by G.
Evaluating the inequality in Eq. (14), the two possible situations which must hold
simultaneously are
9/4/2020 27
Since is always positive, this condition always holds.
The other condition is
Thus,
(15)
9/4/2020 28
Eq. (15) gives the stability requirement for which the solution of the difference will be stable.
It can be said that for a given the allowed value of ∆𝑡 must be small enough to satisfy Eq.
(15). For the error will not grow in subsequent time marching steps in t,
and the numerical solution will proceed in a stable manner.
On the contrary, if then the error will progressively become larger and
the calculation will be useless.
The above mentioned analysis using Fourier series is called as the Von Neumann stability
analysis.
9/4/2020 29