p6 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

6.

Time-Dependent Methods

Why Perform Time-Dependent Calculations?

● Solve a time-dependent problem

or

● Iterate toward steady state

Steady Geometry ... But Unsteady Flow

1
Time-Dependent Scalar-Transport Equation

Conservation: u
d V un
(amount)  net flux  source A
dt

d
(ρV P )  a P  P   a F  F  bP
dt

d
 F (t , ) 1st-order in time; solve by time-marching
dt

General Methods For


1st-Order Differential Equations
d
 F (t , )
dt

General Methods For 1st-Order Differential


Equations
d
 F (t , ) 
dt new


One-step methods: old
● given (n), find (n+1) t

t
t old t new

(n+1)
Multi-step methods: (n)
● given (n), (n-1), (n-2), …, find (n+1) (n-2) (n-1)

(n-1) (n) (n+1)


t
t
(n-2)
t t t

2
One-Step Methods

new
d
F F is the gradient. 
dt
old
t

t
t old
t new

Replace infinitessimals by finite differences:

d Δ
F  F av Δ  F av Δt
dt Δt

 new   old  F av Δt

One-Step Methods

new
d
F  new   old  F av Δt
dt

old
t

t
t old t new

1. Forward Differencing (explicit): F av  F old

2. Backward Differencing (implicit): F av  F new

3. Crank-Nicolson (semi-implicit): F av  12 ( F old  F new )

Example
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.

3
Forward Differencing
(Explicit or Forward Euler Method)

Estimate the average gradient from the start of the timestep


d Δ
F  F old
dt Δt new

Δ  F old Δt old

 new   old  F old Δt


t
t old t new

Forward Differencing: Assessment

 new   old  F old Δt

For
● Easy to implement (because explicit)

Against
● Only 1st-order accurate in t
● In CFD, timestep restrictions

Backward Differencing
(Implicit or Backward-Euler Method)

Estimate the average gradient from the end of the timestep

d Δ
 new
F  F new
dt Δt

Δ  F newΔt
old
 new   old  F newΔt
t
t old t new

4
Backward Differencing: Assessment

 new   old  F newΔt

For
● In CFD, no timestep restrictions

Against
● Implicit; usually requires iteration
● Only 1st-order accurate in t

Crank-Nicolson
(Semi-Implicit or Time-Centred Method)

Use the average of the gradients at the start and end of the
timestep

new
d Δ 1
F  ( F old  F new )
dt Δt 2
1 old
Δ  ( F old  F new )Δt
2
1
2 t 1
2 t
1 t
 new   old  ( F old  F new )Δt t old
t new
2

Crank-Nicolson: Assessment

1
 new   old  ( F old  F new )Δt
2

For
● 2nd-order accurate in t

Against
● Implicit; usually requires iteration
● In CFD, timestep restrictions

5
Example

Solve the equation


d
 t 2  2 2 (0)  1
dt
numerically on the interval 0  t  2, using a timestep t = 0.5, by:

(i) the forward-Euler (explicit) method;


(ii) the backward-Euler (implicit) method;
(iii) the Crank-Nicolson (semi-implicit) method.

Other One-Step Methods

d
 F (t , ) Δ  Δt F
dt

Modified Euler Δ1  Δt F (t old ,  old )


(Heun’s method): Δ 2  Δt F (t old  Δt ,  old  Δ1 )
Δ  12 (Δ1  Δ 2 )

Runge-Kutta: Δ1  Δt F (t old ,  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 )

One-Step Methods in CFD

6
One-Step Methods in CFD

Scalar-transport equation:
d
(amount)  net flux  source
dt

(ρV P ) new  (ρV P )old


 net flux  source  0
av

Δt

net flux  source  aP P   aF F  bP

Methods differ in the time level at which this is


evaluated

Forward Differencing

d
Conservation: (amount)  source  net flux
dt

(ρV P ) new  (ρV P )old


Forward differencing:
Δt

 bP  aP  P   aF  F 
old

old
ρV  ρV 
Rearrange (dropping “new”):  P  (  aP ) P  bP   aF  F 
Δt  Δt 

● Explicit; no iteration.
ρV
● Timestep restriction for boundedness: Δt 
aP
● Only first-order accurate in time.

Case: 1-d Advection


d
u (amount)  net flux  0
A dt

(ρ P ) new  (ρ P ) old (pure advection)


AΔx  ρuA eav  ρuA av
w 0
x Δt

e   P ,  w  W (upwind differencing)

" av"  " old " (forward differencing)

uΔt old
 new
P   old
P ) ( P  Wold )  0
Δx

uΔt old uΔt old


 new
P  (1  ) P  W
Δx Δx

Requirement for boundedness: Courant number uΔt


1
Δx

7
Backward Differencing

d
Conservation: (amount)  source  net flux
dt

(ρV P ) new  (ρV P ) old


Backward-differencing:
Δt

 bP  a P  P   a F  F 
new

ρV ρV
Rearrange: (  a P ) P   a F  F  bP  (  P ) old
Δt Δt

● Implicit (but better than steady state)


● Implemented by modifying matrix coefficients aP and bP
● No timestep restrictions
● Only first-order accurate in time

Crank-Nicolson
d
Conservation: (amount)  source  net flux
dt

Time-centred-differencing:

(ρV P ) new  (ρV P ) old 1


Δt 2

 bP  a P  P   a F  F 
old

1
2
bP  a P  P   a F  F 
new

old
ρV 1  ρV 1 
Rearrange: (  a P ) P  12  a F  F  12 bP  (  2 a P ) P  12 (bP   a F  F )
Δt 2  Δt 
old
ρV  ρV 
(2  a P ) P   a F  F  bP  (2  a P ) P  (bP   a F  F )
Δt  Δt 

● Implicit
● Implemented by modifying matrix coefficients aP and bP
ρV
● Timestep restriction for boundedness: Δt  2
aP
● Second-order accurate in time

Multi-Step Methods

(n+1)
(n)
 (n-2) 
(n-1)

(n-1) (n) (n+1)


t
t
(n-2)
t t t

Problems:
● Storage
● Start-up

8
Gear’s Scheme

(n)
 d  3 ( n )  4 ( n1)   ( n2)
  
 dt  2Δt

2nd-order accurate in t

Predictor-Corrector Methods

d
F Δ  Δt F
dt

Adams-Bashforth predictor:
1
npred  n  24
1
Δt [9F n3  37 F n2  59F n1  55F n ]

Adams-Moulton corrector:
n1  n  24
1
Δt[ F n2  5F n1  19F n  9Fpred
n 1
]

4th-order accurate in t

Uses of Time-Marching

● Solve a genuinely time-dependent problem:


– need accuracy
– require a global timestep

● Iterate toward steady state:


– need boundedness and stability, not accuracy
– can use a local timestep

9
Summary (1)

● The fluid-flow equations are 1st-order in time, and are


solved by time-marching

● Time-marching methods can be either:


– explicit (direct update)
– implicit (require iteration)

● One-step methods:
– forward differencing (explicit)
– backward differencing (implicit)
– Crank-Nicolson (semi-implicit)

Summary (2)

● One-step methods are easily implemented by modifying


matrix coefficients

● Explicit schemes have time-step restrictions


– Courant number c = ut / x

● Crank-Nicolson is 2nd-order accurate in time;


forward-differencing and backward-differencing are 1st-order.

● Multi-step methods are less common in CFD

● The timestep t may be global or local

10

You might also like