You are on page 1of 18

Lecture # 03 CFD Techniques and Properties of Numerical Solution

Time-stepping techniques

Unsteady flows are parabolic in time ⇒ use ‘time-stepping’ methods to


advance transient solutions step-by-step or to compute stationary solutions

time
Initial-boundary value problem u = u(x, t)
future
zone of influence

∂u
present 

 ∂t + Lu = f in Ω × (0, T ) time-dependent PDE
domain of
past dependence Bu = 0 on Γ × (0, T ) boundary conditions



u = u0 in Ω at t = 0 initial condition
space

Time discretization 0 = t0 < t1 < t2 < . . . < tM = T u0 ≈ u0 in Ω

• Consider a short time interval (tn , tn+1 ) , where tn+1 = tn + ∆t


• Given un ≈ u(tn ) use it as initial condition to compute un+1 ≈ u(tn+1 )

JetWings 1
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Space-time discretization

Space discretization: finite differences / finite volumes / finite elements


Unknowns: ui (t) time-dependent nodal values / cell mean values

Time discretization: (i) before or (ii) after the discretization in space

The space and time variables are essentially decoupled and can be discretized
independently to obtain a sequence of (nonlinear) algebraic systems

A(un+1 , un )un+1 = b(un ) n = 0, 1, . . . , M − 1

Method of lines (MOL) L → Lh yields an ODE system for ui (t)


duh
+ Lh uh = fh on (tn , tn+1 ) semi-discretized equations
dt
N
P
FEM approximation uh (x, t) = uj (t)ϕj (x), uni ≈ u(xi , tn )
j=1

JetWings 2
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Properties of time-stepping schemes


T T
Time discretization tn = n∆t, ∆t = M ⇒ M= ∆t

Accumulation of truncation errors n = 0, . . . , M − 1


p p−1
ǫloc
τ = O(∆t) ⇒ ǫglob
τ = M ǫloc
τ = O(∆t)

Remark. The order of a time-stepping method (i.e., the asymptotic rate at


which the error is reduced as ∆t → 0) is not the sole indicator of accuracy

The optimal choice of the time-stepping scheme depends on its purpose:


• to obtain a time-accurate discretization of a highly dynamic flow problem
(evolution details are essential and must be captured) or
• to march the numerical solution to a steady state starting with some
reasonable initial guess (intermediate results are immaterial)
The computational cost of explicit and implicit schemes differs considerably

JetWings 3
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Explicit vs. implicit time discretization

Pros and cons of explicit schemes


⊕ easy to implement and parallelize, low cost per time step
⊕ a good starting point for the development of CFD software
⊖ small time steps are required for stability reasons, especially
if the velocity and/or mesh size are varying strongly
⊖ extremely inefficient for solution of stationary problems unless
local time-stepping i. e. ∆t = ∆t(x) is employed

Pros and cons of implicit schemes


⊕ stable over a wide range of time steps, sometimes unconditionally
⊕ constitute excellent iterative solvers for steady-state problems
⊖ difficult to implement and parallelize, high cost per time step
⊖ insufficiently accurate for truly transient problems at large ∆t
⊖ convergence of linear solvers deteriorates/fails as ∆t increases

JetWings 4
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Predictor-corrector and multipoint methods

Objective: to combine the simplicity of explicit schemes and robustness of


implicit ones in the framework of a fractional-step algorithm, e.g.,

1. Predictor ũn+1 = un + f (tn , un )∆t forward Euler

2. Corrector un+1 = un + 12 [f (tn , un ) + f (tn+1 , ũn+1 )]∆t Crank-Nicolson


or un+1 = un + f (tn+1 , ũn+1 )∆t backward Euler

Remark. Stability still leaves a lot to be desired, additional correction steps


usually do not pay off since iterations may diverge if ∆t is too large

Order barrier: two-level methods are at most second-order accurate, so


extra points are needed to construct higher-order integration schemes

Adams methods tn+1 , . . . , tn−m , m = 0, 1, . . .


Runge-Kutta methods tn+α ∈ [tn , tn+1 ], α ∈ [0, 1]

JetWings 5
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Adams methods
Derivation: polynomial fitting f
past present future
Truncation error: ǫglob
τ = O(∆t)p
for polynomials of degree p − 1 which
interpolate function values at p points
t
tn 2 tn 1 tn tn+1
Adams-Bashforth methods (explicit)
p=1 un+1 = un + ∆tf (tn , un ) forward Euler
∆t
p=2 un+1 = un + n n
2 [3f (t , u ) − f (tn−1 , un−1 )]
∆t
p=3 un+1 = un + n n
12 [23f (t , u ) − 16f (tn−1 , un−1 ) + 5f (tn−2 , un−2 )]

Adams-Moulton methods (implicit)


p=1 un+1 = un + ∆tf (tn+1 , un+1 ) backward Euler
∆t
p=2 un+1 = un + 2 [f (t
n+1
, un+1 ) + f (tn , un )] Crank-Nicolson
∆t
p=3 un+1 = un + 12 [5f (t
n+1
, un+1 ) + 8f (tn , un ) − f (tn−1 , un−1 )]

JetWings 6
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Adams methods

Predictor-corrector algorithm
1. Compute ũn+1 using an Adams-Bashforth method of order p − 1
2. Compute un+1 using an Adams-Moulton method of order p with
predicted value f (tn+1 , ũn+1 ) instead of f (tn+1 , un+1 )

Pros and cons of Adams methods

⊕ methods of any order are easy to derive and implement


⊕ only one function evaluation per time step is performed
⊕ error estimators for ODEs can be used to adapt the order
⊖ other methods are needed to start/restart the calculation
⊖ time step is difficult to change (coefficients are different)
⊖ tend to be unstable and produce nonphysical oscillations

JetWings 7
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Runge-Kutta methods

Multipredictor-multicorrector algorithms of order p

∆t
p=2 ũn+1/2 = un + n n
2 f (t , u ) forward Euler / predictor

un+1 = un + ∆tf (tn+1/2 , ũn+1/2 ) midpoint rule / corrector

∆t
p=4 ũn+1/2 = un + n n
2 f (t , u ) forward Euler / predictor
∆t
ûn+1/2 = un + 2 f (t
n+1/2
, ũn+1/2 ) backward Euler / corrector

ũn+1 = un + ∆tf (tn+1/2 , ûn+1/2 ) midpoint rule / predictor


∆t
un+1 = un + n n
6 [f (t , u ) + 2f (tn+1/2 , ũn+1/2 ) Simpson rule
+ 2f (tn+1/2 , ûn+1/2 ) + f (tn+1 , ũn+1 )] corrector

Remark. There exist ‘embedded’ Runge-Kutta methods which perform extra


steps in order to estimate the error and adjust ∆t in an adaptive fashion

JetWings 8
Lecture # 03 CFD Techniques and Properties of Numerical Solution

General comments

Pros and cons of Runge-Kutta methods


⊕ self-starting, easy to operate with variable time steps
⊕ more stable and accurate than Adams methods of the same order
⊖ high order approximations are rather difficult to derive; p function
evaluations per time step are required for a p−th order method
⊖ more expensive than Adams methods of comparable order

Adaptive time-stepping strategy ∆t ∆t ∆t ∆t ∆t ∆t ∆t ∆t


makes it possible to achieve the desired accuracy at a relatively low cost

Explicit methods: use the largest time step satisfying the stability condition

Implicit methods: estimate the error and adjust the time step if necessary

JetWings 9
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Lax-Wendroff time-stepping
∂u
Consider a time-dependent PDE ∂t + Lu = 0 in Ω × (0, T )

1. Discretize it in time by means of the Taylor series expansion


 n 2
 2 n
∂u (∆t) ∂ u
un+1 = un + ∆t + 2
+ O(∆t)3
∂t 2 ∂t

2. Transform time derivatives into space derivatives using the PDE


 
∂u ∂2u ∂ ∂u ∂ ∂u 2
= −Lu, = = (−Lu) = −L = L u
∂t ∂t2 ∂t ∂t ∂t ∂t

3. Substitute the resulting expressions into the Taylor series

n+1 n n (∆t)2 2 n
u = u − ∆tLu + L u + O(∆t)3
2
4. Perform space discretization using finite differences/volumes/elements

JetWings 10
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Lax-Wendroff scheme for pure convection


∂u
Example. Pure convection equation ∂t + v ∂u
∂x = 0 (1D case)

∂ ∂u ∂2u 2
Time derivatives L = v ∂x ⇒ ∂t = −v ∂u
∂x , ∂t2 = v 2 ∂∂xu2
  n
∂u n (v∆t)2 2
∂ u
Semi-discrete scheme un+1 = un − v∆t ∂x + 2 ∂x2 + O(∆t)3

Central difference approximation in space


  2 
∂u ui+1 −ui−1 2 ∂ u ui+1 −2ui +ui−1
∂x i = 2∆x + O(∆x) , ∂x2 = (∆x)2 + O(∆x)2
i

Fully discrete scheme (second order in space and time)

un+1
i − uni uni+1 − uni−1 v 2 ∆t uni+1 − 2uni + uni−1 2 2
+v = + O[(∆t) , (∆x) ]
∆t 2∆x 2 (∆x)2

Remark. LW/CDS is equivalent to FE/CDS stabilized by numerical dissipation


due to the second-order term in the Taylor series (no adjustable parameter)

JetWings 11
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Properties of numerical methods

The following criteria are crucial to the performance of a numerical algorithm:

1. Consistency The discretization of a PDE should become exact as the


mesh size tends to zero (truncation error should vanish)
2. Stability Numerical errors which are generated during the solution
of discretized equations should not be magnified
3. Convergence The numerical solution should approach the exact solution of
the PDE and converge to it as the mesh size tends to zero
4. Conservation Underlying conservation laws should be respected at the
discrete level (artificial sources/sinks are to be avoided)
5. Boundedness Quantities like densities, temperatures, concentrations etc.
should remain nonnegative and free of spurious wiggles

These properties must be verified for each (component of the) numerical scheme

JetWings 12
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Consistency

Relationship: discretized equation ←→ differential equation

Truncation errors should vanish as the mesh size and time step tend to zero

∂u
Example. Pure convection equation ∂t + v ∂u
∂x = 0 discretized by

un+1 − uni uni+1 − uni−1


CDS in space, FE in time: i
+v = O[(∆t)q , (∆x)p ]
∆t 2∆x
  2 n
n+1 n ∂u n (∆t)2 ∂ u
Taylor series expansions: ui = ui + ∆t ∂t i + 2 ∂t2 + ...
i
 n 2
 2 n 3
 3 n
∂u (∆x) ∂ u (∆x) ∂ u
uni±1 = uni ± ∆x ∂x i + 2 ∂x2 ± 6 ∂x3 + ...
i i

un+1 −un un n
i+1 −ui−1
n
∂u
Hence, i
∆t
i
+ v 2∆x + v ∂u
− ∂x i + ǫτ = 0
∂t where
 n  n
∆t ∂ 2 u (∆x)2 ∂ 3 u
ǫτ = − 2
−v 3
+ O[(∆t)2 , (∆x)4 ]
2 ∂t i 6 ∂x i
residual of the difference scheme for the exact nodal values um
j = u(j∆x, m∆t)

JetWings 13
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Stability

numerical solution of exact solution of


Relationship: ←→
discretized equations discretized equations

Definition 1 Numerical errors (roundoff due to final precision of computers)


should not be allowed to grow unboundedly
Definition 2 The numerical solution itself should remain uniformly bounded

Stability analysis: can only be performed for a very limited range problems

Matrix method: Aun+1 = Bun ⇒ un+1 = Cun , where C = A−1 B


is assumed to be a linear operator. In practice un = ūn + en so that

un+1 = Cun for the numerical solution un of the discretized equations


ūn+1 = C ūn for the exact solution ūn of the discretized equations
en+1 = Cen for the roundoff error en incurred in the solution process

JetWings 14
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Convergence

numerical solution of exact solution of the


Relationship: ←→
discretized equations differential equation

Definition: A numerical scheme is said to be convergent if it produces the


exact solution of the underlying PDE in the limit h → 0 and ∆t → 0

Lax equivalence theorem: stability + consistency = convergence


• For practical purposes, convergence can be investigated numerically by
comparing the results computed on a series of successively refined grids
• The rate of convergence is governed by the leading truncation error of
the discretization scheme and can also be estimated numerically:
u = uh + e(u)hp + . . . = u2h + e(u)(2h)p + . . . = u4h + e(u)(4h)p + . . .
 
u −u
u2h − uh ≈ e(u)hp (1 − 2p ) log u4h 2h
2h −uh
p p p
⇒ p≈
u4h − u2h ≈ e(u)h (1 − 2 )2 log 2

JetWings 15
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Conservation

Physical principles should apply at the discrete level: if mass, momentum


and energy are conserved, they can only be distributed improperly

Integral form of a generic conservation law


Z Z Z

u dV + f · n dS = q dV, f = vu − d∇u
∂t V S V
accumulation influx source/sink flux function

Caution: nonconservative discretizations may produce reasonably looking


results which are totally wrong (e.g. shocks moving with a wrong speed)
• even nonconservative schemes can be consistent and stable
• correct solutions are recovered in the limit of very fine grids

Problem: it is usually unclear whether or not the mesh is sufficiently fine

JetWings 16
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Boundedness

Convection-dominated / hyperbolic PDEs P e ≫ 1, Re ≫ 1

• spurious undershoots and overshoots occur in the vicinity of steep gradients


• quantities like densities, temperatures and concentrations become negative
• the method may become unstable or converge to a wrong weak solution

1 1

low-order →
0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0
← high-order 0

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Idea: make sure that important properties of the exact solution (monotonicity,
positivity, nonincreasing total variation) are inherited by the numerical one

JetWings 17
Lecture # 03 CFD Techniques and Properties of Numerical Solution

Analysis of numerical dissipation and dispersion

Modified equation method: the exact solution of the discretized equations


satisfies a PDE which is generally different from the one to be solved

Original PDE Modified equation Aun+1 = Bun


∞ ∞
∂u ∂u X ∂ 2p u X ∂ 2p+1 u
+ Lu = 0 ≈ + Lu = α2p 2p + α2p+1 2p+1
∂t ∂t p=1
∂x p=1
∂x

Motivation: PDEs are difficult or impossible to solve analytically but their


qualitative behavior is easier to predict than that of discretized equations

• Expand all nodal values in the difference scheme in a double Taylor series
about a single point (xi , tn ) of the space-time mesh to obtain a PDE
• Express high-order time derivatives as well as mixed derivatives in terms
of space derivatives using this PDE to transform it into the desired form

JetWings 18

You might also like