exim

3

Click here to load reader

Transcript of exim

Page 1: exim

CHMLTECH 501 Computational Fluid Dynamics

Explicit and Implicit Finite-Difference Solutions

The essence of finite-difference solutions in CFD is to use the difference quotients toreplace the partial derivatives in the governing flow equations, resulting in a system of al-gebraic difference equations for the dependent variables at each grid point. In this section,we examine some of the basic aspects of a difference equation.

Consider the following model equation, in which we assume that the dependent variableu is a function of x and t.

∂u

∂t=

∂2u

∂x2(1)

This equation is parabolic.

If we replace the time derivative in Equation (1) with a forward difference, and thespatial derivative with a central difference, the result is

un+1i − un

i

∆t=

uni+1 − 2un

i + uni−1

∆x2(2)

In Equation (2), some common notation is used for the difference of the time derivative.the index for time usually appears as a superscript in CFD, where n denotes conditions attime t, (n+1) denotes conditions at time (t+ t∆t), and so forth. The subscript still denotesthe grid point location; for the one spatial dimension considered here, clearly we need onlyone index, i.

Questions: What is the truncation error for the complete finite-difference equation?Obviously, there must be a truncaton error because each one of the finite-difference quotientshas its own truncation error. Let us address this question. Combining Equation (1) and(2), and explicitly writing the truncation errors associated with the difference quotients, wehave

∂u

∂t− ∂2u

∂x2=

un+1i − un

i

∆t− un

i+1 − 2uni + un

i−1

∆x2+

[−

(∂2u

∂t2

)n

i

∆t

2+

(∂4u

∂t4

)n

i

(∆x)2

12+ · · ·

] (3)

Examining Equation (3), on the left-hand side is the original partial differential equa-tion, the first two terms on the right-hand side are the finite difference representation ofthis equation and the terms in the square brackets are the truncation error for the completeequation. Note that the truncation error for this representation is 0[∆t, (∆x)2].

Does the finite-difference equation reduce to the original differential equation as thenumber of grid points foes to infinity, i.e. as ∆x → 0 and ∆t → 0? Examining Equation(3), we note that the truncation error approaches zero, and hence the difference equation

1

Page 2: exim

does indeed approach the original differential equation. When this is the case, the finite-difference representation of the spatial differential equation is said to be consistent.

The solution of Equation (2) takes the form of a ‘marching’ solution in steps of time.Assuming that we know the dependent variable at all x at some instant in time, say fromgiven initial conditions. Examining Equation (2), we see that it contains only one unknown,namely un+1

i . In this fashion, the dependent variable at time (t + ∆t) can be obtained ex-plicitly from the known results at time t, i.e. un+1

i is obtained directly from the knownvalues un

i+1, uni , un

i−1. This is an example of an explicit finite-difference solution .

As a counter example, let us return to the original partial differential equation given byEquation (1). This time, we write the spatial differences on the right-hand side in terms ofaverage properties between n and (n + 1), that is

un+1i − un

i

∆t=

12

[un+1

i+1 + uni+1 − 2un+1

i − 2uni + un+1

i−1 + uni−1

∆x2

](4)

The differencing shown in Equation (4) is called the Crank-Nicolson form. Examine Equa-tion (4) closely. The unknown un+1

i is not only expressed in terms of the known quantitiesat time index n, namely un

i+1, uni , and un

i−1, but also in terms of unknown quantities at timeindex n+1, namely un+1

i+1 , un+1i , and un+1

i−1 . Hence, Equation (4) applied at a given grid pinti cannot by itself result in the solution for un+1

i . Rather, Equation (4) must be written atall grid points, resulting in a system of algebraic equations from which the unknown un+1

i

for all i can be solved simultaneously. This is an example of an implicit finite-differencesolution . Because they deal with the solution of large systems of simultaneous linear alge-braic equations, implicit methods are usually involved with manipulation of large matrices.

The relative major advantages and disadvantages of these two approaches are summa-rized as follows.

1. Explicit approach

• Advantage: Relatively simple to set up and program.

• Disadvantage: In terms of the example above, for a given ∆x, ∆t must be lessthan some limit imposed by stability constraints. In many cases, ∆t must bevery small to maintain stability; this can result in long computer running timesto make calculations over a given interval of t.

2. Implicit approach

• Advantage: Stability can be maintained over much larger values of ∆t, henceusing considerably fewer time steps to make calculations over a given interval oft. This result in less computer time.

• Disadvantage:

– More complicated to set up and program.– since massive matrix manipulations are usually required at each time step,

the computer time per time step is much larger than in the explicit approach.

2

Page 3: exim

– Since large ∆t can be taken, truncation error is larger, and the use of implicitmethods to follow the exact transients (time variations of the independentvariable) may not be as accurate as an explicit approach. However, for atime-dependent solution in which the steady state is the desired result, thisrelative time-wise inaccuracy is not important.

During the period 1969 to about 1979, the vast majority of practical CFD solutionsinvolving ‘marching’ solutions (such as in the above example) employed explicit methods.Today, they are still the most straightforward methods for flow field solutions. However,many of the more sophisticated CFD applications—those requiring very closely-spaced gridpoints in some regions of the flow—would demand inordinately large computer runningtimes due to the small marching steps required. This has made the advantage listed abovefor implicit methods very attractive, namely the ability to use large marching steps evenfor a very fine grid. For this reason, implicit methods are today the major focus of CFDapplications.

3