cfd6
TRANSCRIPT
-
8/9/2019 cfd6
1/11
CFD 6 1 David Apsley
6. TIME-DEPENDENT METHODS SPRING 20106.1 The time-dependent scalar-transport equation
6.2 One-step methods
6.3 Multi-step methods
6.4 Uses of time-marching in CFDSummary
Examples
6.1 The Time-Dependent Scalar-Transport Equation
The time-dependent scalar-transport equation for an arbitrary control volume is
sourcefluxnetamountt
=+)(d
d(1)
where: amount total quantity in a cell = mass concentration = V;flux is the rate of transport through the boundary .
In Section 4 it was shown how the flux and source terms could be discretised as
P
F
FFPP baasourcefluxnet = (2)
In this Section the time derivative will also be discretised.
We first examine numerical methods for the first-order differential equation
Ft=
d
d, 0)0( = (3)
where Fis an arbitrary function oftand . Then we extend the methods to CFD.
Initial-value problems of the form (3) are solved by time-
marching. There are two main types of method:
one-step methods: use the value from the previous timelevel only;
multi-step methods: use values from several previous times.
t
old
new
t told new
t
t
t(n+1)
(n+1)
(n)
(n-1)
(n-2)
t(n)
t(n-1)
t(n-2)
-
8/9/2019 cfd6
2/11
CFD 6 2 David Apsley
6.2 One-Step Methods
For the first-order differential equation
Ft=
d
d(3)
the one-step problem is:given at timet(n) compute at timet(n+1)
The following notation is used:
identify everything at t(n) by a superscript old this is what we currently know; identify everything at t(n+1) by a superscript new this is what we seek.
By integration of (3), or from the figure above,
tFav= (4)
or
tFavoldnew += (5)These are exact. However, since the average derivative, F
av, isnt known until the solution
is known, it must be estimated.
6.2.1 Simple Estimate of Derivative
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.
Forward Differencing(Euler Method)
Take Fav
as the derivative at the
startof the time-step:
Backward Differencing(Backward Euler)Take F
avas the derivative at
the endof the time-step:
Centred Differencing(Crank-Nicolson)
Take Fav
as the average of
derivatives at the beginning and end.
tFoldoldnew += tFnewoldnew += tFF newoldoldnew )(21 ++=
t
old
new
t told new t
old
new
t told new t
old
new
t told new
t12 t
12
For:
Easy to implement becauseexplicit(the RHS is known).
For:
In CFD, no time-steprestrictions;
For:
Second-order accurate in t.
Against:
Only first-order in t;
In CFD, stability imposes
time-step restrictions.
Against:
only first-order in t;
implicit (although, in CFD,
no more so than steady case).
Against:
Implicit;
In CFD, stability imposes time-
step restrictions.
t
old
new
t told new
t
-
8/9/2019 cfd6
3/11
CFD 6 3 David Apsley
Classroom Example 1
The following differential equation is to be solved on the interval [0,1]:
1)0(,d
d==
t
t
Solve this numerically, with a step size t= 0.2 using:
(a) forward differencing;
(b) backward differencing;
(c) Crank-Nicolson.
Solve the equation analytically and compare with the numerical approximations.
Classroom Example 2
Solve, numerically, the equation
33
d
d
=
tt , 1)0( = in the interval 0 t 1 using a timestep t= 0.25 by:(a) the forward differencing (fully-explicit) method;
(b) the backward-differencing (fully-implicit) method;
(c) the Crank-Nicolson (semi-implicit) method.
Note that, since the equation is non-linear, the implicit methods (parts (b) and (c)) will
require iteration at every timestep.
-
8/9/2019 cfd6
4/11
CFD 6 4 David Apsley
6.2.2 Other Methods
For equations of the form Ft=
d
d, improved solutions may be obtained by making
successive estimates of the average gradient. Important examples include:
Modified Euler Method(2 function evaluations; similar to Crank-Nicolson, but explicit)
)(
),(
),(
2121
12
1
+=
++=
=
ttFt
tFt
oldold
oldold
Runge-Kutta (4 function evaluations)
)22(
),(),(
),(
),(
432161
34
2
1
22
1
3
21
121
2
1
+++=
++=++=
++=
=
ttFtttFt
ttFt
tFt
oldold
oldold
oldold
oldold
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-usedmethod in engineering. However, in CFD, and F represent vectors of nodal values, andcalculating 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.
6.2.3 One-Step Methods in CFD
General scalar-transport equation:
0)(d
d
=+ sourcefluxnetVtP (6)
For one-step methods the time derivative is always discretised as
t
VVV
t
old
P
new
PP
)()()(
d
d (7)
Flux and source terms could be discretised at any particular time level as
PFFPP baasourcefluxnet = (8)Different time-marching schemes arise from the time level at which (8) is evaluated.
-
8/9/2019 cfd6
5/11
CFD 6 5 David Apsley
Forward Differencing
[ ] 0)()( =+ old
PFFPP
old
P
new
P baat
VV
Rearranging, and dropping any new superscripts as tacitly understood:old
FFPPPP abat
Vt
V
++= )( (9)
Assessment.
Explicit; no simultaneous equations to be solved.
Timestep restrictions; for stability a positive coefficient of oldp requires 0 Pat
V.
Backward Differencing
[ ] 0)()( =+ new
PFFPP
oldPnewP baat
VV
Rearranging, and dropping any new superscripts:
oldPPFFPP
t
Vbaa
t
V)()(
+=+ (10)
Assessment.
Straightforward to implement; amounts to a simple change of coefficients:
old
PPPPt
Vbb
t
Vaa )(++ (11)
No timestep restrictions.
Crank-Nicolson
[ ] [ ] 0)()(21
21 =++
new
PFFPP
old
PFFPP
old
P
new
P baabaat
VV
Rearranging, and dropping any new superscripts:old
FFPPPPFFPP abat
Vbaa
t
V
+++=+ )()()( 2121212121
or, multiplying by 2 for convenience: old
FFPPPPFFPP abat
Vbaa
t
V
+++=+ )()2()2( (12)
Assessment.
Fairly straightforward to implement; amounts to a change of coefficients:old
FFPPPPPPP abat
Vbb
t
Vaa
++++ )()2(,2 (13)
Timestep restrictions; for stability, a positive coefficient of oldp requires 02 Pa
t
V.
-
8/9/2019 cfd6
6/11
CFD 6 6 David Apsley
In general, weightings 1 and can be applied to derivatives at each end of the time step:
oldnew
P FFVt
)1()(d
d+ (14)
This includes the special cases of Forward Differencing ( = 0), Backward Differencing
( = 1) and Crank-Nicolson ( = ).
For 0 this so-called method can be implemented by a simple change in matrix
coefficients. For 1 (i.e. anything other than fully-implicit Backward-Differencing),
stability imposes a timestep restriction
old
Pa
Vt )(
1
1
< (15)
Example. Consider a 1-d time-dependent advection-diffusion problem
Sx
uxt
=
+
)()(
with the first-order upwind advection scheme on a uniform grid of spacing x, it is readily
shown that at any time-level the coefficients in the flux-source discretisation are
CDaaaDaCDa EWPEW +=+==+= 2,,
where the mass flow rate Cand diffusive transfer coefficientD are given by
x
ADuAC , ==
In the 1-d case the cross-sectional areaA = 1 and the time-step restriction (15) becomes
1
1
)(
2
2
-
8/9/2019 cfd6
7/11
CFD 6 7 David Apsley
6.3 Multi-Step Methods
One-step methods use only information from time level t(n)
to
calculate (d/dt)av.
Multi-step methods use the values of at earlier time levels aswell: t
(n-1), t
(n-2), ... .
One example is Gears method:
tt
nnnn
2
43
d
d )2()1()()( +=
(17)
This is second-order in t; (exercise: prove it).
A wider class of schemes is furnished by so-calledpredictor-correctormethods which refine
their initialprediction with one (or more) corrections. A popular example of this type is theAdams-Bashforth-Moulton method:
predictor: ]5559379[ 1232411 nnnnnn
pred FFFFt +++=+
corrector: ]9195[ 1122411 ++ +++= npred
nnnnnFFFFt
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.
6.4 Uses of Time-Marching in CFD
Time-dependent schemes are used in two ways:
(1) for a genuinely time-dependent problem;
(2) for time marching to steady state.
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 tis 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).
t
t(n+1)
(n+1)
(n)
(n-1) (n-2)
t(n)
t(n-1)
t(n-2)
-
8/9/2019 cfd6
8/11
CFD 6 8 David Apsley
Summary 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 thetime step) or implicit(require iteration at each time step).
Common one-step methods are Forward Differencing (fully-explicit), BackwardDifferencing (fully-implicit) and Crank-Nicolson (semi-implicit).
One-step methods are easily implemented via changes to the matrix coefficients. Forthe Backward-Differencing scheme the only concessions required are:
t
Vbb
t
Vaa
old
P
PPPP
)(,
++
The only unconditionally-stable two-time-level scheme is Backward Differencing(fully-implicit timestepping). Other schemes have time-step restrictions: typically
limitations on the Courant number
x
tuc =
The Crank-Nicolson scheme is second-order accurate in t. The Backward-Differencing and Forward-Differencing schemes are both first order in t, which
means they need more time steps to achieve the same time accuracy.
Multi-step methods may be used to achieve accuracy and/or stability. However, theseare less favoured in CFD because of large storage overheads.
Time-accurate solutions require a global time step. A local time step may be used fortime-marching to steady state. In the latter case, high time accuracy is not required
and backward differencing is favoured as the most stable approach.
-
8/9/2019 cfd6
9/11
CFD 6 9 David Apsley
Examples
Q1.
Use: (a) forward-differencing; (b) backward-differencing to solve the equation
0)0(,2d
d 2
==
tt numerically over the interval 0 t 1, using a timestep t= 0.25.
Q2.
Gears scheme for the approximation of a time derivative is
tt
nnnn
2
43
d
d )2()1()()( +=
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
sourcefluxoutwardnetamountt
=+)(d
d
over a control volume, centred at node P and containing fluid mass V, can be written
PFFPPP baaVt
=+ )(d
d
(a) Show that time integration using backward differencing, with a timestep t, can beimplemented 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.
Q4. (Computational Hydraulics examination, May 2008 part)(a) Solve the first-order differential equation
1)0(,1d
d12
==
t
t
with a timestep t= 0.25 on the interval 0 t 1, using:
(i) forward differencing;
(ii) backward differencing.
(b) State (without mathematical detail) the advantages and disadvantages of using:
(i) forward-differencing
(ii) backward-differencingmethods in computational fluid dynamics.
-
8/9/2019 cfd6
10/11
CFD 6 10 David Apsley
Selected Answers
Classroom Example 1
t
(a) Forwarddifferencing
(b) Backwarddifferencing
(c) Crank-Nicolson Exact( tet += 21 )
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
-
8/9/2019 cfd6
11/11
CFD 6 11 David Apsley
Q1.
(a) Forward differencing:
told
old tnew
new0.00 0 0.25 0
0.25 0 0.50 0.01563
0.50 0.01563 0.75 0.070310.75 0.07031 1.00 0.1758
(b) Backward differencing:
told
old tnew
new0.00 0 0.25 0.01042
0.25 0.01042 0.50 0.04861
0.50 0.04861 0.75 0.1262
0.75 0.1262 1.00 0.2508
Q4(a)
(i) Forward differencingoldt old newt 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
(ii) Backward differencingoldt old newt new
0 1 0.25 1.2778
0.25 1.2778 0.50 1.4238
0.50 1.4238 0.75 1.3995
0.75 1.3995 1.00 1.2830
1.00 1.2830