当前位置:首页 >> 机械/仪表 >>

计算流体力学(CFD)文档——6. Time-dependent methods


6. TIME-DEPENDENT METHODS 6.1 The time-dependent scalar-transport equation 6.2 One-step methods 6.3 Multi-step methods 6.4 Uses of time-marching in CFD Summary Examples

SPRING 2011

6.1 The Time-Dependent Scalar-Transport Equation The time-dependent scalar-transport equation for an arbitrary control volume is d (amount ) + net flux = source dt 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 net flux ? source = a P φ P ? ∑ a F φ F ? bP
F

(1)

(2)

In this Section the time derivative will also be discretised. We first examine numerical methods for the first-order differential equation dφ φ(0) = φ 0 =F, dt where F is an arbitrary function of t and φ. 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 time level only;
φ
old new

(3)

φ

?φ ?t

t old
φ

t new

t

?

multi-step methods: use values from several previous times.
φ (n) φ (n-2) φ (n-1)

φ

(n+1)

t(n-2)

t(n-1)

t(n)

t(n+1)

t

CFD

6–1

David Apsley

φ

6.2 One-Step Methods For the first-order differential equation dφ =F dt the one-step problem is: given φ at time t(n) … compute φ at time t(n+1)

φ

new



(3)

φ

old

?t

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.

t old

t new

t

By integration of (3), or from the figure above, φ = F av t (4) or φ new = φ old + F av t (5) av These are exact. However, since the average derivative, F , isn’t 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 start of the time-step: φ new = φ old + F old t
φ φ new φ old
φold φ

Backward Differencing (Backward Euler) Take Fav as the derivative at the end of the time-step: φ new = φ old + F new t
φnew

Centred Differencing (Crank-Nicolson) Take Fav as the average of derivatives at the beginning and end.
old φ new = φ old + 1 + F new ) t 2 (F

φ φnew

φold
1 2?

t old

t new

t

t old

t new

t

t

1 2?

t t new

t old

t

For: ? Easy to implement because explicit (the RHS is known). Against: ? Only first-order in t; ? In CFD, stability imposes time-step restrictions.

For: ? In CFD, no time-step restrictions; Against: ? only first-order in t; ? implicit (although, in CFD, no more so than steady case).

For: ? Second-order accurate in t. Against: ? Implicit; ? In CFD, stability imposes timestep restrictions.

CFD

6–2

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) Crank-Nicolson. Solve the equation analytically and compare with the numerical approximations.

Classroom Example 2 Solve, numerically, the equation dφ = t 3 ? φ3 , φ(0) = 1 dt 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.

CFD

6–3

David Apsley

dφ = F , improved solutions may be obtained by making dt successive estimates of the average gradient. Important examples include:

6.2.2 Other Methods

For equations of the form

Modified Euler Method (2 function evaluations; similar to Crank-Nicolson, but explicit) φ1 = t F (φ old , t old ) φ 2 = t F (φ old + φ1 , t old + t ) φ= 1 2 ( φ1 + φ 2 ) Runge-Kutta (4 function evaluations) φ1 = t F (φ old , t old )

φ 2 = t F (φ old +

1 2

φ1 , t old +

1 2

t)

old φ 3 = t F (φ old + 1 +1 2 φ2 , t 2 t)

φ 4 = t F (φ old + φ 3 , t old + t ) φ= 1 6 ( φ1 + 2 φ 2 + 2 φ 3 + φ 4 ) 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.

6.2.3 One-Step Methods in CFD

General scalar-transport equation: d ( Vφ P ) + net flux ? source = 0 dt For one-step methods the time derivative is always discretised as ( Vφ P ) new ? ( Vφ P ) old d ( Vφ P ) → dt t Flux and source terms could be discretised at any particular time level as net flux ? source = a P φ P ? ∑ a F φ F ? bP Different time-marching schemes arise from the time level at which (8) is evaluated.

(6)

(7) (8)

CFD

6–4

David Apsley

Forward Differencing ( Vφ P ) new ? ( Vφ P ) old old + a P φ P ? ∑ a F φ F ? bP =0 t Rearranging, and dropping any “new” superscripts as tacitly understood:

[

]

V ? V ? φ P = ?( ? a P )φ P + b P + ∑ a F φ F ? t ? t ?

old

(9)

Assessment. ? Explicit; no simultaneous equations to be solved. ?
Timestep restrictions; for stability a positive coefficient of φ old p requires
V ? aP ≥ 0 . t

Backward Differencing ( Vφ P ) new ? ( Vφ P ) old + a P φ P ? ∑ a F φ F ? bP t Rearranging, and dropping any “new” superscripts: Vφ P old V ) ( + a P )φ P ? ∑ a F φ F = b P + ( t t

[

]

new

=0

(10)

Assessment. ? Straightforward to implement; amounts to a simple change of coefficients: V V aP → aP + bP → bP + ( ) old t t ? No timestep restrictions.

(11)

Crank-Nicolson ( Vφ P ) new ? ( Vφ P ) old 1 + 2 a P φ P ? ∑ a F φ F ? bP t Rearranging, and dropping any “new” superscripts:

[

]

old

a P φ P ? ∑ a F φ F ? bP +1 2
old

[

]

new

=0

V 1 ? V 1 ? ( a φ =1 b + ?( + 2 a P )φ P ? 1 ? 2 a P )φ P + 1 (bP + ∑ a F φ F )? 2∑ F F 2 P 2 t ? t ? or, multiplying by 2 for convenience: V V ? ? (2 + a P )φ P ? ∑ a F φ F = b P + ?( 2 ? a P )φ P + (bP + ∑ a F φ F )? t t ? ?
old

(12)

Assessment. ? Fairly straightforward to implement; amounts to a change of coefficients:
V ? ? (13) b P → b P + ?( 2 ? a P )φ P + (bP + ∑ a F φ F )? t ? ? V Timestep restrictions; for stability, a positive coefficient of φ old ? aP ≥ 0 . p requires 2 t aP → aP + 2 V , t
old

?

CFD

6–5

David Apsley

In general, weightings 1 – and can be applied to derivatives at each end of the time step: d (14) ( Vφ P ) ≈ F new + (1 ? ) F old dt This includes the special cases of Forward Differencing ( = 0), Backward Differencing ( = 1) and Crank-Nicolson ( = ?). 0 this so-called “ method” can be implemented by a simple change in matrix For coefficients. For 1 (i.e. anything other than fully-implicit Backward-Differencing), stability imposes a timestep restriction V 1 ( ) old t< (15) 1 ? aP

Example. Consider a 1-d time-dependent advection-diffusion problem ? ? ?φ ( φ) + ( uφ ? )=S ?t ?x ?x 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 aW = D + C , a E = D, a P = aW + a E = 2 D + C where the mass flow rate C and diffusive transfer coefficient D are given by A C = uA, D= x In the 1-d case the cross-sectional area A = 1 and the time-step restriction (15) becomes 2 t u t 1 + < 2 x 1? ( x)
Special cases are:–

? ? ?

explicit (forward differencing; = 0) and pure diffusion (u = 0): explicit (forward differencing; = 0) and pure advection ( = 0): implicit (backward differencing; = 1):

( / ) t 1 < ( x) 2 2 u t <1 x no restrictions.

Courant Number The Courant number c is defined by: u t (16) c= x It can be interpreted as the ratio of distance of travel in one time step (u t) 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 time step should not exceed the mesh spacing. The Courant-number restriction is only slightly milder when = ? (Crank-Nicolson). CFD 6–6 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 as well: t(n-1), t(n-2), ... .
One example is Gear’s method:
3φ ( n ) ? 4φ ( n ?1) + φ ( n ? 2 ) ? dφ ? ? ? = 2 t ? dt ? This is second-order in t; (exercise: prove it).
(n)

φ φ (n) φ (n-2) φ (n-1)

(n+1)

t(n-2)

t(n-1)

t(n)

t(n+1)
(17)

t

A wider class of schemes is furnished by so-called predictor-corrector methods which refine their initial prediction with one (or more) corrections. A popular example of this type is the Adams-Bashforth-Moulton method: +1 n n ?3 1 φn + 37 F n ?2 ? 59 F n?1 + 55F n ] predictor: pred = φ + 24 t [ ?9 F

corrector:

φ n +1

= φn +

1 24

n +1 t [ F n ?2 ? 5 F n ?1 + 19 F n + 9 F pred ]

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 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 Courantnumber restrictions in each cell individually. In practice, for incompressible flow, steady flow should be computable without timemarching. This is not the case in compressible flow, where time-marching is necessary in transonic calculations (flows with both subsonic and supersonic regions).

CFD

6–7

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 the time step) or implicit (require iteration at each time step). Common one-step methods are Forward Differencing (fully-explicit), Backward Differencing (fully-implicit) and Crank-Nicolson (semi-implicit). One-step methods are easily implemented via changes to the matrix coefficients. For the Backward-Differencing scheme the only concessions required are: ( Vφ P ) old V aP → aP + , b P → bP + t t 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 u t c= x 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 more time steps to achieve the same time accuracy. 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.

?

?

? ?

CFD

6–8

David Apsley

Examples

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 ) ? dφ ? = ? ? 2 t ? 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) (b) (c) Show that time integration using backward differencing, with a timestep implemented by simple changes to the coefficients aP, {aF} and bP. t, can be

Show that time integration using forward differencing is explicit, but imposes a maximum timestep for stability, tmax. 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 dφ = 1 ? φt , φ(0) = 1 φ 2 dt 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-differencing methods in computational fluid dynamics.

CFD

6–9

David Apsley

Q5. (MSc Examination, May 2010) (a) Explain what is meant by the terms explicit and implicit when applied to timemarching schemes for differential equations of the type dφ = F (t , φ) . dt (b) The equation dφ φ = 2 when t = 0, = t ? φ4 , dt is to be solved numerically, using a time step t = 0.1. Solve this equation up to time t = 0.4 using the following approaches to time-marching: (i) forward-differencing (“fully-explicit”); (ii) backward-differencing (“fully-implicit”); (iii) centred-differencing (“semi-implicit”). Note. Be very careful how you rearrange the implicit schemes for iteration. The 1-d time-dependent equation for a transported scalar φ is ?φ ?φ +u = 0, ?t ?x where t is time, x is distance and u is a constant positive velocity. Using first-order upwind differencing for the advection term, determine the restriction on the size of the timestep when the time derivative is discretised by forward-differencing, and state the corresponding restriction on the Courant number (which should be defined).

(c)

CFD

6 – 10

David Apsley


赞助商链接
相关文章:
更多相关文章: