Professional Documents
Culture Documents
In Section 4 it was shown how the flux and source terms could be discretised as
net flux − source = a P φ P − ∑ a F φ F − bP (2)
F
In this Section the time derivative will also be discretised.
∆φ
• φ old
one-step methods: use the value from the previous time
level only; ∆t
t
t old t new
φ
φ
(n+1)
t
t(n-2) t(n-1) t(n) t(n+1)
This is the commonest class of time-stepping scheme in general-purpose CFD. There are
three obvious methods of making a single estimate of the average derivative.
φ new = φ old + F old t φ new = φ old + F new t φ new = φ old + 12 ( F old + F new ) t
φ φ φnew φ
φnew
φ new
1 1
2∆ t 2∆ t
t t t
t old t new t old t new t old t new
For: For: For:
• Easy to implement because • In CFD, no time-step • Second-order accurate in t.
explicit (the RHS is known). restrictions;
Against: Against: Against:
• Only first-order in t; • only first-order in t; • Implicit;
• In CFD, stability imposes • implicit (although, in CFD, • In CFD, stability imposes time-
time-step restrictions. no more so than steady case). step restrictions.
Solve the equation analytically and compare with the numerical approximations.
Classroom Example 2
Note that, since the equation is non-linear, the implicit methods (parts (b) and (c)) will
require iteration at every timestep.
More details of these – and other advanced methods – can be found in the course notes for the
“Computational Mechanics” unit.
For scalar φ, such methods are popular. Runge-Kutta is probably the most widely-used
method in engineering. However, in CFD, φ and F represent vectors of nodal values, and
calculating the derivative F (evaluating flux and source terms) is very expensive. The
majority of CFD calculations are performed with the simpler methods of 6.2.1.
Exercise. Using Microsoft Excel (or other computational tool of your choice) solve the
Classroom Examples from the previous subsection using Modified-Euler or Runge-Kutta
methods.
Assessment.
• Explicit; no simultaneous equations to be solved.
V
• Timestep restrictions; for stability a positive coefficient of φ old
p requires − aP ≥ 0 .
t
Backward Differencing
( Vφ P ) new − ( Vφ P ) old
t
[
+ a P φ P − ∑ a F φ F − bP ]
new
=0
Rearranging, and dropping any “new” superscripts:
V Vφ P old
( + a P )φ P − ∑ a F φ F = b P + ( ) (10)
t t
Assessment.
• Straightforward to implement; amounts to a simple change of coefficients:
V V
aP → aP + bP → bP + ( ) old (11)
t t
• No timestep restrictions.
Crank-Nicolson
( Vφ P ) new − ( Vφ P ) old 1
t
[
+ 2 a P φ P − ∑ a F φ F − bP ]
old
[
+ 12 a P φ P − ∑ a F φ F − bP ]
new
=0
Rearranging, and dropping any “new” superscripts:
old
V 1 V 1
( + 2 a P )φ P − 12 ∑ a F φ F = 12 bP + ( − 2 a P )φ P + 12 (bP + ∑ a F φ F )
t t
or, multiplying by 2 for convenience:
old
V V
(2 + a P )φ P − ∑ a F φ F = b P + ( 2 − a P )φ P + (bP + ∑ a F φ F ) (12)
t t
Assessment.
• Fairly straightforward to implement; amounts to a change of coefficients:
old
V V
aP → aP + 2 , b P → b P + ( 2 − a P )φ P + (bP + ∑ a F φ F ) (13)
t t
V
• Timestep restrictions; for stability, a positive coefficient of φ old
p requires 2 − aP ≥ 0 .
t
Courant Number
For the fully-explicit method the Courant-number restriction c < 1 means that the distance
which information can be advected in one time step should not exceed the mesh spacing.
Just as three-point advection schemes permit greater spatial accuracy than two-point schemes,
so the use of multiple time levels allows greater temporal accuracy. However, there are a
number of disadvantages which limit their application in CFD:
• Storage; each computational variable has to be stored at all nodes at each time level.
• Start-up; initially, only data at time t = 0 is available; the first step inevitably requires
a single-step method.
In case (1) accuracy and stability often impose restrictions on the time step and hence how
fast one can advance the solution in time. Because all nodal values must be updated at the
same rate the time step t is global; i.e. the same at all grid nodes.
In case (2) one is not seeking high accuracy so one simply adopts a stable algorithm, usually
Backward Differencing. Alternatively, if using an explicit scheme such as Forward
Differencing, the time step can be local, i.e. vary from cell to cell, in order to satisfy Courant-
number restrictions in each cell individually.
In practice, for incompressible flow, steady flow should be computable without time-
marching. This is not the case in compressible flow, where time-marching is necessary in
transonic calculations (flows with both subsonic and supersonic regions).
• The time-dependent fluid-flow equations are first-order in time and are solved by
time-marching.
• Time-marching schemes may be explicit (time derivative known at the start of the
time step) or implicit (require iteration at each time step).
• One-step methods are easily implemented via changes to the matrix coefficients. For
the Backward-Differencing scheme the only concessions required are:
V ( Vφ P ) old
aP → aP + , b P → bP +
t t
• Multi-step methods may be used to achieve accuracy and/or stability. However, these
are less favoured in CFD because of large storage overheads.
• Time-accurate solutions require a global time step. A local time step may be used for
time-marching to steady state. In the latter case, high time accuracy is not required
and backward differencing is favoured as the most stable approach.
Q1.
Use: (a) forward-differencing; (b) backward-differencing to solve the equation
dφ
= t 2 − 2φ , φ(0) = 0
dt
numerically over the interval 0 ≤ t ≤ 1, using a timestep ∆t = 0.25.
Q2.
Gear’s scheme for the approximation of a time derivative is
3φ ( n ) − 4φ ( n −1) + φ ( n − 2 )
(n)
dφ
=
dt 2 t
where superscripts (n – 2), (n – 1), (n) denote successive time levels. Show that this scheme is
second-order accurate in time.
Q3.
The semi-discretised version of the scalar transport equation
d
(amount ) + net outward flux = source
dt
over a control volume, centred at node P and containing fluid mass V, can be written
d
( Vφ P ) + a P φ P − ∑ a F φ F = bP
dt
(a) Show that time integration using backward differencing, with a timestep t, can be
implemented by simple changes to the coefficients aP, {aF} and bP.
(b) Show that time integration using forward differencing is explicit, but imposes a
maximum timestep for stability, tmax.
(c) Show that time integration using the Crank-Nicolson method, with a timestep t, can
be implemented by changes to the coefficients aP, {aF} and bP and derive an
expression for the maximum stable timestep, tmax.
(b) State (without mathematical detail) the advantages and disadvantages of using:
(i) forward-differencing
(ii) backward-differencing
methods in computational fluid dynamics.
Classroom Example 1
t φ
(a) Forward (b) Backward (c) Crank-Nicolson Exact
differencing differencing ( φ = t − 1 + 2e −t )
0 1 1 1 1
0.2 0.8 0.866667 0.836364 0.837462
0.4 0.68 0.788889 0.738843 0.740640
0.6 0.624 0.757407 0.695417 0.697623
0.8 0.6192 0.764506 0.696250 0.698658
1.0 0.65536 0.803755 0.733296 0.735759
Classroom Example 2
(a) Forward-differencing
t(old) φ(old) t(new) φ(new)
0.00 1.0000 0.25 0.7500
0.25 0.7500 0.50 0.6484
0.50 0.6484 0.75 0.6115
0.75 0.6115 1.00 0.6598
(b) Backward-differencing:
t(old) φ(old) t(new) φ(new)
0.00 1.0000 0.25 0.8502
0.25 0.8502 0.50 0.7681
0.50 0.7681 0.75 0.7627
0.75 0.7627 1.00 0.8559
(c) Crank-Nicolson:
t(old) φ(old) t(new) φ(new)
0.00 1.0000 0.25 0.8104
0.25 0.8104 0.50 0.7156
0.50 0.7156 0.75 0.6960
0.75 0.6960 1.00 0.7737
Q4(a)
(i) Forward differencing
t old φ old t new φ new
0 1 0.25 1.2500
0.25 1.2500 0.50 1.5186
0.50 1.5186 0.75 1.6574
0.75 1.6574 1.00 1.4905
1.00 1.4905