0% found this document useful (0 votes)
143 views65 pages

CFD Lecture 4

The document discusses numerical methods for solving differential equations. It defines concepts like consistency, stability and convergence for finite difference methods. It also describes the Von-Neumann stability analysis technique and how it can be applied to analyze the stability of explicit and implicit schemes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views65 pages

CFD Lecture 4

The document discusses numerical methods for solving differential equations. It defines concepts like consistency, stability and convergence for finite difference methods. It also describes the Von-Neumann stability analysis technique and how it can be applied to analyze the stability of explicit and implicit schemes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

ME - 733

Computational Fluid Mechanics


Lecture 4

Dr./ Ahmed Nagib Elmekawy Nov. 3, 2018


Errors Involved in Numerical Solutions
• In the solution of differential equations with finite differences, a variety of
schemes are available for the discretization of derivatives and the solution of
the resulting system of algebraic equations.
• In many situations, questions arise regarding the round-off and truncation
errors involved in the numerical computations, as well as the consistency,
stability and the convergence of the finite difference scheme.
• Round-off errors: computations are rarely made in exact arithmetic.
• This means that real numbers are represented in “floating point” form and as a
result, errors are caused due to the rounding-off of the real numbers.
• In extreme cases such errors, called “round-off” errors, can accumulate and
become a main source of error.
Remarks and Definitions
• Before proceeding with an analysis of numerical techniques, it is necessary
to define additional terminology for concepts which will be investigated in
the upcoming chapters.
1. Consistency: A finite difference approximation of a PDE is consistent if
the finite difference equation approaches the PDE as the grid size
approaches zero.
2. Stability: A numerical scheme is said to be stable if any error introduced
in the finite difference equation does not grow with the solution of the
finite difference equation.
3. Convergence: A finite difference scheme is convergent if the solution of
the finite difference equation approaches that ofthe PDE as the grid
size approaches zero.
4. Lax's equivalence theorem: For a FDE which approximates a well-posed,
linear initial value problem, the necessary and sufficient condition for
convergence is that the FDE must be stable and consistent.
Stability Analysis: Von-Neumann Analysis
• Von-Neumann analysis is applicable only for linear equations
• Boundary effect on stability analysis is not included
• For any scalar PDE which is approximated by two-level FDE, the mathematical constrain
on the amplification factor as follows:
– If G is real, |G|<=1
– If G is complex, |G|2<=1
• The method can be easily extended to multi-dimensional problems
• Benchmark values for stability of unsteady one-dimensional problems may be
established as follows:
– Explicit problems it will have a condition for stability such as d<= 0.5
– Implicit problems unconditionally stable
• For difficult expressions of the amplification factor to be analyzed, graphical
representation along with some numerical experimentations can facilitate the
analysis
Von Neumann Stability Analysis
• In this method, a solution of the finite difference equation is
expanded in a Fourier series.
• The decay or growth of the amplification factor indicates
whether or not the numerical algorithm is stable.
• Actual stability requirement may be more restrictive than the
one obtained from the von Neumann stability analysis.
• Nevertheless, the results will provide very useful information
on stability requirements.
The procedure: assume a Fourier component for ui n
uin = U n e IP (x ) i
as where 𝐼 = −1, Un is the amplitude at time
level n, and P is the wave number in the x-direction, i.e., x=
2/P, where x is the wavelength.
• Similarly,
• If a phase angle = PΔx is defined, then:
uin = U n e I i , uin+1 = U n +1e I i and uin1 = U n e I ( i 1)
• To proceed with the application of this method, consider the explicit
representation of Stokes' first problem.
• The PDEand its FTCS explicit formulation is:
uin+1 − uin uin+1 − 2uin + uin−1
u  2u =
= 2 t (x ) 2
t x
uin +1 = uin + d (uin+1 − 2uin + uin−1 )
in terms of the diffusion number
• Utilizing the relation

• Introducing an amplification factor such that Un+1= GUn,


then G=1-2d(1-cos ),
• For a stable solution, the absolute value of G must be
bounded for all values of . Mathematically, it is
expressed as
|G| ≤ 1 or |1-2d(1-cos )| ≤ 1,
• So that 1-2d(1-cos ) ≤ 1 and 1-2d(1-cos ) ≥ -1
• First inequality is satisfied for all values of .
• With the maximum value of (1-cos ) = 2, the left-hand
side of second inequality is (1 - 4d), which must be larger
than or equal to -1; thus, 1- 4d ≥ -1 or 4d ≤ 2.
• So the stability condition is that d ≤1/2
Graphical Representation of G
• The graphical solution may be either in a polar
coordinate or a Cartesian coordinate.
• They are shown in Figures 4-9a and 4-9b, respectively.

Polar

Cartesian
Figure 4-9. Amplification factor G=1-2d(1-cos ),
illustrated for various values of d.
• Note that in Figure 4-9a, when d = 0.625, some values of G have
fallen outside the circle of radius 1; and in Figure 4-9b, it has
exceeded the stability limit, indicating an unstable solution for this
value of d.
• Consider a 1-D equation with both convection and diffusion terms,
i.e., u u  2u
= −a +
t x x 2
• The FTCS explicit formulation is expressed as
uin +1 − uin uin+1 − uin−1 uin+1 − 2uin + uin−1
= −a +
t 2x (x ) 2
n +1 c n
ui = u − (ui +1 − uin−1 ) + d (uin+1 − 2uin + uin−1 )
n
i
2
• Following the von Neumann stability analysis,
• Eliminating eIi,

• With the identities: 𝑒 𝐼𝜃 + 𝑒 −𝐼𝜃 𝑒 𝐼𝜃 − 𝑒 −𝐼𝜃


𝑐𝑜𝑠𝜃 = 𝑎𝑛𝑑 𝑠𝑖𝑛𝜃 =
2 2𝐼

• Equation ( 4-35) is written as:

• from which it follows that

• Note that, for this particular problem, the amplification factor has
real and imaginary parts.
• A stable solution requires that the modulus of the amplification
factor must be bounded.
• Thus, a formal requirement may be expressed as
• Before mathematical arguments are considered, a
graphical presentation is studied.

• It is the equation of an ellipse


• For a stable solution, the ellipse should fall inside the
circle of unit radius.

Real
• The two most extreme cases are 1- 2d = 0 or d = 0.5, or c = 1
• Thus, it appears that the stability requirements are d ≤ 0.5 and c ≤ 1.
• However, a more restrictive condition is found by considering the formal
requirement that the modulus of must be bounded, i.e., |G|2 ≤ 1.

d = 0.5 c=1
• This quadratic equation represents either a convex
curve (with a minimum) or a concave curve (with a
maximum)
• It can be shown that for a stable solution, this quadratic function may
not have a global maximum, i.e., the curve cannot be concave.
• The mathematical procedure is as follows.
• The first and second derivatives of the function IGI2 with respect to cos
are
Graphical Representation of G
Graphical G

• Graphical representation
of the amplification
factor for various values
of c and d is illustrated in
Figures 4-14a and 4-14b.
Example from Chapter 3
• Consider a fluid bounded by two parallel plates extended
to infinity such that no end effects are encountered.
• The planar walls and the fluid are initially at rest.
• Now, the lower wall is suddenly accelerated in the x-
direction.
• The spacing between two plates is denoted by h.
• The Navier-Stokes equations for this problem may be
expressed as
•  u  2
u
=  2 Parabolic equation
t y

• where  is the kinematic viscosity of the fluid.


• It is required to compute the velocity profile u = u(t, y).
• The initial and boundary conditions for this problem are
stated as follows:
Stability Analysis: Error Analysis
• For the model equation

• Dissipation error:
– It is the error associated with first-order accurate methods
– Associated with even derivatives

• Dispersion error:
– It is the type of errors associated with
second order accurate methods
- Associated with odd derivatives
Stability Analysis: Error Analysis
• For the model equation

• The modified equation for FTBS becomes:

• The artificial viscosity:


– Represents the second derivative term coefficient

– This term dissipate he solution, as a results gradients are reduced


Parabolic PDEs: Discretization
• The b scheme of the parabolic model equation is:

un+1 - u n é un+1 - 2u n+1


+ u n+1
u n
- 2u n
+ u n ù
j j
= n êb j+1 j j-1
+ (1- b ) j+1 j j-1
ú + O(Dt, (Dy) 2
)
Dt ë (Dy) 2
(Dy) 2
û

b = 0 - - - > FTCS
b =1 - - - > BTCS
b =1 / 2 - - - > Crank - Nicolson

For 1 / 2   − − −  Unconditionally stable


For 0    1 / 2 − − −  Conditionally stable
Parabolic PDEs: Stability Analysis
• Von-Neumann method is the most commonly used method
for stability analysis
• The error function is written in a Fourier series
representation:
u = åU e n iK m y

where i = -1 K m, is the wave number, and U n is the error


amplitude.
• For stable solution, the amplification factor G

U n+1
G £1 where G = n
U
Parabolic PDEs: Stability Analysis
• FTCS: G =1+ 2D (Cos(q )-1) 0 £ D £1

Polar Cartesian

• BTCS: 1
G=
1+ 2D (1- Cos(q ))
Parabolic PDEs: Modified Equation
• By substituting back with Taylor series expansion of each
term into the finite difference equation, the modified
Modified Equation
equation is obtained.
29
un+1
j = u n
j + D(u n
j+1 - 2u n
j + u n
j-1 )
Dividingby thefollowingequation isobtained
u t 2
u t2 3
u t3 4
u 4
O t
t 2 t2 3! t3 4! t4
Modified
2
u y Equation
u
O y
2 4
4

y2 12 y4
30
• equationof
Themodified Truncation
Thisequation Error =SFDE-PDE
can bewritten
theFTC as
-Explicit =
schemeis
Is the scheme consistent?
2 2 2 4
u u 2 t u y u 2 4
y O t , y
ut t uyy y2 2 tt2 uyyyy 12O t y24, y 4
2 6
Using thegoverningequation (theparabolicpartial differential equation)
Parabolic PDEs: Explicit Methods
• FTCS method:

– The scheme is first order in time and second order in space


– The amplification factor G =1+ 2D (Cos(q )-1)
leads to a stability constrain on the diffusion number to be 0 £ D £1/ 2
• Richardson method:

– The scheme is second order time and space


– Amplification factor G = -b ± b 2 +1 where
b = 2D(cosq -1)
– Unconditionally unstable (has no practical value)
Parabolic PDEs: Explicit Methods
• DuFort-Frankel method

– The scheme is second order in time and second order in space


– For stability considerations the uin term in the diffusion term is
replaced with an average between uin+1 and uin-1
– The resulting equation is explicit formulation

– The amplification factor is b± b 2 + 4(1- 4D 2 )


G=
where b = 4D cosq 2(1+ 2D)
– The scheme is unconditionally stable
Parabolic PDEs: Implicit Methods
• Laasonen method (BTCS):

– The scheme is first order in time and second order in space


1
– The amplification factor G=
1+ 2D (1- Cos(q ))
– Unconditionally stable
• The Beta formulation

– The scheme conditionally stable when 0 £ b £1/ 2


– The scheme is unconditionally stable when 1/ 2 £ b £1
– The formulation is FTCS when b =0
– The formulation is Crank-Nicolson when b =1/ 2
Parabolic PDEs: Implicit Methods
• Crank-Nicolson method

– The scheme is second order time and space


– The diffusion term is replaced by a time average value of the second order central space
difference term
– The second order in time is unclear, but if we thought of as a summation of two-step
computations:

1. Explicit step

2. Implicit step
Parabolic PDEs: Schemes Comparison
Error at Time = 0.18 sec. Error at Time = 1.08 sec.

Error at Time = 1.0 sec.


For BTCS method
Summary
• A summary on application and limitations of the von Neumann
1. The von Neumann stability analysis can be applied to linear
equations only.
2. The influence of the boundary conditions on the stability of
solution is not included.
3. For a scalar PDE which is approximated by a two-level FDE,
the mathematical requirement is imposed on the
amplification factor as follows:
(a) if G is real, then IGI ≤ 1
(b) if G is complex, then IGI2 ≤ 1, where IGI2 = 𝐺 𝐺ҧ
4. For a scalar PDE which is approximated by a three-level FDE,
the amplification factor is a matrix. In this case, the
requirement is imposed on the eigenvalues of Gas follows:
(a) if> is real, then || ≤ 1
(b) if>  is complex, then |  |2 ≤ 1
5. The method can be easily extended to multidimensional
problems.
6. The procedure can be used for stability analysis of a
system of linear PDEs. The requirement is imposed on
the largest eigenvalue of the amplification matrix.
7. Benchmark values for the stability of unsteady one-
dimensional problems may be established as follows:
(a) For most explicit formulations:
I. Courant number, c ≤ 1
II. Diffusion number, d ≤ 0.5
III. Cell Reynolds number, Rec ≤ (2/c)
(b) For implicit formulation, most are unconditionally stable.
8. For multi-dimensional problems with equal grid sizes in
all spatial directions, the stated benchmark values are
usually adjusted by dividing them by the number of
spatial dimensions.
9. On occasions where the amplification factor is a
difficult expression to analyze, graphical solution along
with some numerical experimentation will facilitate the
analysis.
Modified Equation
• In order to determine the dominant error term of a finite difference
equation, Taylor series expansions are substituted back into the finite
difference equation and, after some algebraic manipulation, the so-called
modified equation is obtained.
• Consider the first-order FDE

• Arrange as
• This equation is known as the modified equation.
• When compared to the original PDE, the error introduced in the approximation
process is clearly indicated.
• Note that the dominating term in the error is the second term on the right-
hand side of Equation (4-84), which includes the second derivative.
• Consider a second-order method in which the
dominant error term includes a third-order (odd)
derivative.
• Such a formulation is the midpoint leapfrog method
given by ( 4-53).
• The equation may be rearranged as
Artificial Viscosity
• Recall the modified Equation (4-84)
Applications
Dispersion Error
Finite Difference: Elliptic Equations

Solution Technique
• Elliptic equations in engineering are typically used to characterize steady-state,
boundary value problems.

• For numerical solution of elliptic PDEs, the PDE is transformed into an algebraic
difference equation.

• Because of its simplicity and general relevance to most areas of engineering, we


will use a heated plate as an example for solving elliptic PDEs.
The Laplacian Difference Equations/
 2T  2T
+ 2 =0
x 2
y Laplace Equation
 2T Ti +1, j − 2Ti , j + Ti −1, j
= O[(x)2]
x 2 x 2
 2T Ti , j +1 − 2Ti , j + Ti , j −1 O[(y)2]
=
y 2
y 2
Ti +1, j − 2Ti , j + Ti −1, j Ti , j +1 − 2Ti , j + Ti , j −1
+ =0
x 2
y 2

x = y Laplacian difference
Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1 − 4Ti , j = 0 equation.
Holds for all interior points
• In addition, boundary conditions along the edges must be
specified to obtain a unique solution.
• The simplest case is where the temperature at the boundary is
set at a fixed value, Dirichlet boundary condition.
• A balance for node (1,1) is:

T21 + T01 + T12 + T10 − 4T11 = 0


T01 = 75
T10 = 0
− 4T11 + T12 + T21 = −75
• Similar equations can be developed for other interior points to
result a set of simultaneous equations.
• The result is a set of nine simultaneous equations with nine
unknowns:

4T11 − T21 − T12 = 75


− T11 + 4T21 − T13 − T22 =0
− T21 + 4T31 − T32 = 50
− T11 + 4T12 − T22 − T13 = 75
− T21 − T12 + 4T22 − T32 − T23 =0
− T31 − T22 + 4T32 − T33 = 50
− T12 + 4T13 − T23 = 175
− T22 − T13 + 4T23 − T33 = 100
− T32 − T23 + 4T33 = 150
Finite Difference: Parabolic Equations
• Parabolic equations are employed to characterize time-variable (unsteady-state)
problems.
• Conservation of energy can be used to develop an unsteady-state energy balance
for the differential element in a long, thin insulated rod.
• Energy balance together with Fourier’s law of heat
conduction yields heat-conduction equation:

 2T T
k 2 =
x t
• Just as elliptic PDEs, parabolic equations can be solved
by substituting finite divided differences for the partial
derivatives.
• In contrast to elliptic PDEs, we must now consider
changes in time as well as in space.
• Parabolic PDEs are temporally open-ended and involve
new issues such as stability.
Explicit Methods
• The heat conduction equation requires approximations for the second
derivative in space and the first derivative in time:
 2T Ti +l 1 − 2Ti l + Ti −l 1
=
x 2
x 2
l +1
T Ti − Ti l
=
t t
Ti +l 1 − 2Ti l + Ti −l 1 Ti l +1 − Ti l
k =
(x ) 2
t
kt
Ti l +1 l
(
= Ti +  T − 2Ti + T
l l l
) =
i +1 i −1
(x )2
• This equation can be written for all interior nodes on
the rod.
• It provides an explicit means to compute values at
each node for a future time based on the present
values at the node and its neighbors.
A simple Implicit Method
• Implicit methods overcome difficulties associated with
explicit methods at the expense of somewhat more
complicated algorithms.
• In implicit methods, the spatial derivative is
approximated at an advanced time interval l+1:

 2T Ti l++11 − 2Ti l +1 + Ti l−+11



x 2
(x ) 2

which is second-order accurate.


A simple Implicit Method
Ti l++11 − 2Ti l +1 + Ti l−+11 Ti l +1 − Ti l
k =
(x ) 2
t
−  Ti l−+11 + (1 + 2 )Ti l +1 −  Ti l++11 = Ti l
This eqn. applies to all but the first and the last interior nodes, which must be
modified to reflect the boundary conditions:

( )
T0l +1 = f 0 t l +1
(1 + 2 )T1l +1 − T2l +1 = T1l + f 0 (t l +1 )
i=m
(1 + 2 )Tml +1 − Tml +−11 = Tml + f m +1 (t l +1 )
Resulting m unknowns and m linear algebraic equations
Assignment # 3
• Chapter 2
• Computational Fluid Dynamics by Klaus Hoffmann

• Problems:
• 2.1, 2.2 (parts: a, b), 2.3, 2.6, 2.7 and 2.8
Assignment # 2

• Page 25-28
• Problems:

• 1.2, 1.4, 1.6, 1.8, 1.9 and 1.12

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy