Upload
others
View
25
Download
4
Embed Size (px)
Citation preview
Computational Fluid Dynamics IPPPPIIIIWWWW
ElementaryNumerical Analysis:
Finite Difference Approximations-III
Instructor: Hong G. ImUniversity of Michigan
Fall 2001
Computational Fluid Dynamics IPPPPIIIIWWWW• The linear advection-diffusion equation• Finite difference approximations• Finite Difference Approximation of the linear
advection-diffusion equation• Accuracy• Stability• Consistency• Higher order finite difference approximations in
space• Time integration: implicit versus explicit and higher
accuracy • Finite Volume Approximations
Outline
Computational Fluid Dynamics IPPPPIIIIWWWW
Stability
Computational Fluid Dynamics IPPPPIIIIWWWW
As long as accuracy is reasonable, integration at larger time steps is more efficient and desirable.
Can we increase the time step indefinitely?
Let’s repeat the 1-D advection-diffusion equation with larges time step.
Stability
Computational Fluid Dynamics IPPPPIIIIWWWW
Evolution forU=1; D=0.05; k=1
N=21∆t=0.2
Exact
Numerical
Stability
Computational Fluid Dynamics IPPPPIIIIWWWW
Instead of decaying as it should, the amplitude of the numerical solution keeps increasing.
Indeed, if we continued the calculations, we would eventually produce numbers larger than the computer can handle. This results in an “overflow” or “NaN” (not a number).
Stability
Computational Fluid Dynamics IPPPPIIIIWWWWStability
Stability Analysis of1st Order ODE(Euler Method)
Computational Fluid Dynamics IPPPPIIIIWWWW
0)0(),,(' yytyfy ==
Stability
Consider a differential equation
Stability analysis seeks the conditions (of stepsize h)for which the numerical solution remains bounded.
Taylor Expansion:
[ ]20
20000
00000
)(,)(),()(
),()(),(),(
ttyyOtyftttyfyytyftyf
−−+′−+
′−+=
!+++=′ tyy βαλ
Computational Fluid Dynamics IPPPPIIIIWWWW
0)0(,' yyyy == λ
Stability
A Linearized Model Equation
where IR iλλλ +=For the Euler Method
)1(1 hyhyyy nnnn λλ +=+=+
Solution at time step nn
n hyy )1(0 λ+=
Computational Fluid Dynamics IPPPPIIIIWWWW
11 ≤+ hλ
Stability
The numerical solution is stable (bounded) if
Stability boundary
1)1( 222 =++ hh IR λλ
)( IR iλλλ +=
Stable
hIλ
hRλ−1
−1
1
If λ is real and negative,
λ2≤h
Computational Fluid Dynamics IPPPPIIIIWWWWStability
Stability Analysis ofAdvection-Diffusion Equation:
Von Neumann Method
Computational Fluid Dynamics IPPPPIIIIWWWW
Generally, stability analysis of the full nonlinear system of equations is too involved to be practical, and we study a model problem that in some way mimics the full equations.The linear advection-diffusion equation is one such model equation, and we will apply von Neumann's method to check the stability of a simple finite difference approximation to that equation.
Stability
Computational Fluid Dynamics IPPPPIIIIWWWW
2
2
xfD
xfU
tf
∂∂
∂∂
∂∂ =+
21111
1 22 h
fffD
hff
Ut
ff nj
nj
nj
nj
nj
nj
nj −+−+
+ +−=
−+
∆−
Stability
Consider the 1-D advection-diffusion equation:
In finite-difference form:
Computational Fluid Dynamics IPPPPIIIIWWWW
fj ,exactn+1 + ε j
n+1( )− fj ,exactn + ε j
n( )∆t
+
Ufj +1,exact
n + ε j +1n( )− fj −1,exact
n + ε j −1n( )
2h=
Dfj +1,exact
n + ε j +1n( )− 2 f j,exact
n + ε jn( )+ fj −1,exact
n + ε j −1n( )
h2
fjn = f j,exact
n + ε jn
Stability
Substitute
into the finite difference equation
Computational Fluid Dynamics IPPPPIIIIWWWWStability
Since
22
21111
1
hD
hU
t
nj
nj
nj
nj
nj
nj
nj −+−+
+ +−=
−+
∆− εεεεεεε
nexactjf , satisfies the equation, we get
Write the error as a wave:
∑∞
−∞=
==k
ikxnkj
nnj
jex εεε )(
Dropping the subscriptjikxnn
j eεε =
Computational Fluid Dynamics IPPPPIIIIWWWW
ε jn = εneikx j
ε j +1n = εneikx j+1 = εneik (x j + h) = εneikx j eikh
ε n+1 − εn
∆ t+ U
ε n
2h(eikh − e− ikh) = D
ε n
h2 (eikh − 2 + e−ikh )
Stability
The error at node j is:
The error at j+1 and j -1 can be written as
ε j −1n = ε neikx j−1 = ε neik (x j −h) = ε neikx j e−ikh
Substituting and canceling yields:eikx j
Computational Fluid Dynamics IPPPPIIIIWWWW
ε j +1n = ε neikx j eikh
ε n+1eikx j − ε neikx j
∆t+ U εn
2h(eikheikx j − e− ikheikx j ) =
Dε n
h2 (eikheikx j − 2eikx j + e− ikheikx j )
Stability
Substituting
ε j −1n = ε neikx j e−ikh
ε jn+1 − ε j
n
∆t+ U
ε j +1n − ε j −1
n
2h= D
ε j +1n − 2ε j
n + ε j −1n
h2
ε jn = εneikx j
into
yields
Computational Fluid Dynamics IPPPPIIIIWWWW
)2()(2
1 2
1ikhikhikhikh
n
n
eeh
tDeehtU −−
+
+−∆+−∆−=ε
ε
Stability
= 1 −U∆t2h
2i sin kh +D∆th2 2(cos kh −1)
= 1 − 4D∆th2 sin2 k
h2
− iU∆t2h
sin kh
Dividing by the error amplitude at n:
or
amplification factor
Computational Fluid Dynamics IPPPPIIIIWWWW
ε n+1
ε n = 1− 4D∆th2 sin2 k
h2
− iU∆t2h
sin kh
ε n+1
ε n ≤ 1
Stability requires that
Since the amplification factor is a complex number, and k, the wave number of the error, can be anything, the determination of the stability limit is slightly involved.
We will look at two special cases: (a) U = 0 and (b) D = 0
Stability
The ratio of the error amplitude at n+1 and n is:
Computational Fluid Dynamics IPPPPIIIIWWWW
ε n+1
ε n = 1− 4D∆th2 sin2 k
h2
Since the amplification factor is always less than 1, and we find that it is bigger than -1 if
sin2 () ≤ 1
(a) Consider first the case when U = 0, so the problem reduces to a pure diffusion
21
2 ≤∆h
tD
−1 ≤ 1− 4D∆th2 ≤ 1
Stability
Computational Fluid Dynamics IPPPPIIIIWWWW
Since the amplification factor has the form 1+i() the absolute value of this complex number is always larger than unity and the method is unconditionally unstable for this case.
ε n+1
ε n = 1− iU∆t2h
sin kh
(b) Consider now the other limit where D = 0 and we have a pure advection problem.
iU∆t2h
sin kh
1
ε n+1
ε n
Stability
Computational Fluid Dynamics IPPPPIIIIWWWWStability
(c) For the general case (Hirsch v.1, pp. 403-408)
Stability Condition
)1(cos2sin1 −+−= khkhiG βσRecall amplification factor
2,h
tDhtU ∆=∆= βσ
0 1
Re(G)
Im(G)
G σ
2β122 ≤≤ βσ
Computational Fluid Dynamics IPPPPIIIIWWWWIn summary, the stability condition for a general 1-Dconvection-diffusion equation becomes:
Notice that high velocity and low viscosity lead to instability according to the second restriction.
21
2 ≤∆h
tD2
2
≤∆D
tUand
Stability
or
≤∆
Dh
UDt
2,2Min
2
2
Computational Fluid Dynamics IPPPPIIIIWWWW
ε i, jn = ε nei(kxi +ly j )
41
2 ≤∆h
tD4|)||(| 2
≤∆+D
tVUand
81
2 ≤∆h
tD and 8|)||||(| 2
≤∆++D
tWVU
Stability
For a two-dimensional problem, assume an error of the form
A stability analysis gives:
For a three-dimensional problem we get:
Computational Fluid Dynamics IPPPPIIIIWWWW
Convergence – the solution to the finite-difference equation approaches the true solution to the PDE having the same initial and boundary conditions as the mesh is refined.
Stability
Lax’s Equivalence TheoremGiven a properly posed initial value problem and a finite-difference approximation to it that satistfies the consistencycondition, stability is the necessary and sufficient condition for convergence.
Stability – Now you know!
Computational Fluid Dynamics IPPPPIIIIWWWW
ConsistencyDoes the error always
go to zero?
Computational Fluid Dynamics IPPPPIIIIWWWW
Modified Equation (Finite Difference Equation):Using the finite difference approximation, we are effectively solving for equations that are slightly different from the original partial differential equations.
Does the finite difference equation approach the partial differential equation in the limit of zero ∆t and h?
Consistency
Computational Fluid Dynamics IPPPPIIIIWWWWConsider the 1-D advection-diffusion equation
and its finite-difference approximation
fjn+1 − fj
n
∆t+ U
fj +1n − fj −1
n
2h= D
f j+1n − 2 fj
n + fj −1n
h2
Consistency
2
2
xfD
xfU
tf
∂∂
∂∂
∂∂ =+
The discrepancy between the two equations can be found by deriving the modified equation.
Computational Fluid Dynamics IPPPPIIIIWWWWSubstituting
into the finite difference equation
fjn+1 − fj
n
∆t=
∂f (t)∂t
−∂ 2 f (t)
∂t2∆t2
+!
""
fj +1n − fj −1
n
2h=
∂f (x)∂x
−∂ 3 f (x)
∂x3h2
6+!
""
fj +1n − 2 f j
n + fj −1n
h2 =∂ 2 f (x)
∂x 2 −∂ 4 f (x)
∂x4h2
12+!
fjn+1 − fj
n
∆t+ U
fj +1n − fj −1
n
2h= D
f j+1n − 2 fj
n + fj −1n
h2
Consistency
Computational Fluid Dynamics IPPPPIIIIWWWW
),(12
)(6
)(2
)( 22
4
42
3
3
2
2
2
2
htOhx
xfDhx
xfUtt
tfx
fDxfU
tf
∆=+−+∆+
=−+
!∂
∂∂
∂∂
∂∂∂
∂∂
∂∂
Therefore, the finite-difference scheme is effectively solving the above modified equation.In this case, the error goes to zero as h�0 and ∆t�0, so the approximation is said to be consistent. Although most finite difference approximations are consistent, innocent-looking modifications can sometimes lead to approximations that are not!
Computational Fluid Dynamics IPPPPIIIIWWWWHW Examine the Frankel-Dufort method
2
2
xf
tf
∂∂ν
∂∂ =
Diffusion Equation
In finite-difference form
[ ]nj
nj
nj
nj
nj fff
htff
112
11
22 −+
−+
+−=∆− ν
Leapfrog method