Professional Documents
Culture Documents
Time-Dependent Methods SPRING 2016: B A A V T
Time-Dependent Methods SPRING 2016: B A A V T
TIME-DEPENDENT METHODS
SPRING 2016
(1)
(2)
new
old
t
t old
t new
(n+1)
(n)
(n-2) (n-1)
(n-2)
CFD
61
(n-1)
(n)
(n+1)
David Apsley
new
old
t
t old
or
F av
F avt
t
t new
(4)
(5)
Since the derivative F depends on the unknown , the average slope must be estimated.
Backward Differencing
(Backward Euler)
Take Fav as the derivative at
the end of the time-step:
Centred Differencing
(Crank-Nicolson)
Take Fav as the average of
derivatives at the beginning and end.
new old 12 ( F old F new )t
new
new
new
old
old
old
1
2
t old
t new
t old
t new
t old
1
2
t
t new
For:
Easy to implement because
explicit (the RHS is known).
For:
In CFD, no time-step
restrictions.
For:
Second-order accurate in t.
Against:
Only first-order in t.
Against:
Only first-order in t.
Against:
Implicit, so needs iteration (but
in CFD, no worse than the
steady case).
In CFD there are time-step
restrictions.
CFD
62
David Apsley
Classroom Example 1
The following differential equation is to be solved on the interval [0,1]:
d
t ,
(0) 1
dt
Solve this numerically, with a step size t = 0.2 using:
(a)
forward differencing;
(b)
backward differencing;
(c)
centred differencing.
Solve the equation analytically and compare with the numerical approximations.
CFD
63
David Apsley
d
F , improved solutions may be obtained by making
dt
successive estimates of the average gradient. Examples include:
2 t F (t old t , old 1 )
12 (1 2 )
Runge-Kutta (4 function evaluations; strictly this is 4th-order explicit Runge-Kutta)
1 t F ( old , t old )
2 t F (t old 12 t , old 12 1 )
3 t F (t old 12 t , old 12 2 )
4 t F (t old t , old 3 )
16 (1 2 2 2 3 4 )
For scalar , such methods are popular. The Runge-Kutta version above is probably the
single most widely-used method in engineering. However, in CFD, and F represent vectors
of nodal values, and calculating the derivative F (i.e. evaluating flux and source terms) is
very expensive. The majority of CFD calculations are performed with the simpler methods of
the previous subsection.
Exercise. Using any computational tool solve the Classroom Examples from the previous
subsection using Modified-Euler and Runge-Kutta methods.
CFD
64
David Apsley
(6)
(7)
(8)
Forward Differencing
(V P ) new (V P ) old
a P P a F F bP
t
old
P (
a P ) P bP a F F
t
t
old
(9)
Assessment.
Explicit; no iteration.
CFD
V
aP 0
t
Only first-order accurate in time.
65
David Apsley
Backward Differencing
(V P ) new (V P ) old
a P P a F F bP
t
new
(10)
Assessment.
(11)
Crank-Nicolson
(V P ) new (V P ) old 1
2 a P P a F F bP
t
old
12 a P P a F F bP
new
(
2 a P ) P 12 a F F 12 bP (
2 a P ) P 12 (bP a F F )
t
t
V
V
a P ) P a F F bP (2
a P ) P (bP a F F )
t
t
old
old
(12)
Assessment.
Implicit.
V
V
aP aP 2
,
bP bP (2
a P ) P (bP a F F )
t
t
old
Timestep restrictions: for boundedness, a positive coefficient of p requires
V
aP 0
t
Second-order accurate in time.
(13)
CFD
66
David Apsley
In general, weightings 1 and can be applied to derivatives at each end of the timestep:
d
(14)
(V P ) F new (1 ) F old
dt
This method includes the special cases of forward differencing ( = 0), backward
differencing ( = 1) and Crank-Nicolson ( = ).
For 0 the method can be implemented by a simple change in matrix coefficients. For 1
(i.e. anything other than fully-implicit backward-differencing), boundedness imposes a
timestep restriction:
1 V old
(15)
t
( )
1 aP
() (u) 0
t
x
Integrating over a cell and applying the basic upwind advection scheme on a uniform grid of
spacing x, it is readily found that the coefficients in the flux-source discretisation are
aW C,
a E 0,
a P aW a E C
where the mass flux C is given by
C uA
With volume V Ax , the time-step restriction (15) becomes
ut
1
x 1
Special cases are:
ut
1
x
no restrictions.
The quantity
ut
(16)
c
x
is called the Courant number. It can be interpreted physically as the ratio of the distance
travelled in one timestep, ut, to the mesh spacing x.
For the fully-explicit method the Courant-number restriction c 1 means that the distance
which information can be advected in one timestep should not exceed the mesh spacing.
CFD
67
David Apsley
(n+1)
(n)
(n-1)
(n-2)
(n-2)
(n-1)
(n)
(n+1)
2t
dt
This is second-order in t. (Exercise: prove it).
( n)
(17)
n1
n 1
1
n 24
t [ F n2 5F n1 19F n 9Fpred
]
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 requires a singlestep method (or other information).
CFD
68
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 (average time derivative known at the start
of the timestep) or implicit (require iteration at each timestep).
One-step methods are easily implemented via changes to the matrix coefficients. For
the backward-differencing scheme this amounts to:
(V P ) old
V
aP aP
,
bP bP
t
t
The Crank-Nicolson scheme is second-order accurate in t. The backwarddifferencing and forward-differencing schemes are both first order in t, which means
they need smaller timesteps to achieve the same time accuracy.
Multi-step methods may be used to achieve higher accuracy. However, these are less
favoured in CFD because of large storage overheads.
Time-accurate solutions require a global timestep. A local timestep may be used for
time-marching to steady state. In the latter case, high time accuracy is not required
and backward differencing is favoured because it is unconditionally bounded.
CFD
69
David Apsley
Examples
Q1.
Use: (a) forward-differencing; (b) backward-differencing to solve numerically the equation
d
t 2 2 ,
(0) 0
dt
over the interval 0 t 1, using a timestep t = 0.25.
Q2.
Gears scheme for the approximation of a time derivative is
3 ( n ) 4 ( n1) ( n2)
d
2t
dt
where superscripts (n 2), (n 1), (n) denote successive time levels. Show that this scheme is
second-order accurate in time.
( n)
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 boundedness.
(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 timestep for boundedness.
CFD
6 10
David Apsley
(u ) s
t
x
x
where is density, u is velocity, is diffusivity and s is source density.
(*)
(a)
By integrating over an interval [xw, xe] (a 1-d volume) show that equation (*) can be
written in a corresponding conservative integral form. State what is meant by fluxes in
this context, identify the advective and diffusive fluxes and explain in what sense their
treatment is conservative.
(b)
Time-stepping schemes similar to those used for solving the unsteady advectiondiffusion equation may be used to solve simpler ordinary differential equations of the
form d / dt f (t , ) . Solve the equation
d
(0) = 1,
1 t 2 ,
dt
for (t) in the domain 0 t 2 with a time step t = 0.5 using:
(i)
forward- differencing
(ii)
backward-differencing
(iii)
centred-differencing (Crank-Nicolson)
time-stepping schemes.
(c)
State the advantages and disadvantages of each of the timestepping schemes in part
(b) when used to solve the time-dependent advection-diffusion equation.
Q6.
For the equation
d
= 2 when t = 0,
(t )
2 ,
dt
use the following methods with a timestep t = 0.25 to find the value of at t = 1:
(a)
forward differencing (fully-explicit);
(b)
backward differencing (fully-implicit);
(c)
centred differencing (semi-implicit).
CFD
For a fixed timestep, which of the integration methods in (a) might be expected to
give the most accurate results, and why?
6 11
David Apsley