Tải bản đầy đủ - 0 (trang)
4 Convergence, Consistency and Stability

4 Convergence, Consistency and Stability

Tải bản đầy đủ - 0trang

56



THE 1D HEAT AND WAVE EQUATIONS



that



for t = nAt. Next, substitute the trial solution into the difference equation,

and solve for the amplification factor A. Then, requiring [A1 5 1 cAt

ensures stability; 1x1 < 1 guarantees a strictly decaying solution.

Let us revisit the heat equation, specifically the fully discrete Galerkin

approximation which gave us trouble a t the end of the last section. From

(2.11), with a bit of manipulation,



+



Absolute stability requires that



1x1 5 1. Hence we must require that

2

uk2



At<---.



(2.12)



A comparison of this result with that for the fully discrete finite difference approximation (forward in time, centered in space) is instructive.

From the above, and applying a forward difference in time, we get



where the non-dimensional parameter



uAt

Ax2



p = -



'



The amplification factor is readily determined to be



For stability, we must require



Since sin2 5 I, we find

(2.13)



Convergence, Consistency and Stability



57



or

Ax2

At<-.

2a

In order to compare the Galerkin with the finite difference result, we

note that



kmax=A/A~



.



This corresponds to the fact that the highest wavenumber resolvable on a

grid of spacing Ax is the wave with a wavelength of 2Ax. Therefore,



x



= 1-(&

=



uAt



1-jlA



2



.



Hence stability of the Galerkin scheme requires

2



P 5 -8 2



*



(2.14)



The Galerkin scheme, though formally more accurate, requires a smaller

time-step. This is also a general result.

Lastly, some comments on accuracy and stability. Using the Von Neumann analysis, we can determine when a difference approximation is going

to be stable. We note, however, that this in itself does not guarantee

that the solution to the difference equation is accurate. An example is

the fully discrete Galerkin approximation. It is as we have seen stable if

At 5 2/ak&,,. Now, suppose we choose the largest stable time-step (to

minimize computational cost .) Then



According to our approximate solution, the amplitude of the kmax wave

remains constant in time and oscillates in sign at each time-step! The

exact solution, of course, requires



that is, a decaying amplitude of uniform sign. The approximate solution,

although stable, is highly inaccurate.



58



T H E 1D HEAT A N D WAVE EQUATIONS



Following the exact solution, it is reasonable to want our approximation

to be decaying in time, and to have a k of fixed sign. To achieve this, we

require



For Galerkin treatment, this implies



while for the finite difference method:



At 5 Ax2/4a

2.5



.



Time Differencing



The preceding section illustrates the consequences for stability of the forward in time, centered in space (FTCS) approximation to the heat equation,

and anticipates the general result that different spaceltime approximation

schemes can have quite different stability restrictions. To explore this latter point more carefully, we will begin by considering ordinary differential

equations of the form

du

dt



- = F ( u ,t )



with specified initial conditions. We divide the time axis into segments of

equal length ( A t ) and define

,(4 = u(t = n A t )



,



where for the remainder of this chapter the superscript notation will refer to

the time index of the solution. We assume that one or more of these values

[ u ( ~ )u,( ~ - ' ). .,.] are known in advance. The task is t o construct schemes

for determining an approximate value for u ( ~ + ' )(The

.

discussion which

follows applies equally well to the solution of partial differential equations.)

We note in advance that our emphasis will be on low-order approximations to d l d t . One reason, besides simplicity, is that stability often requires

the use of time-steps smaller than those needed for adequate accuracy. We

return to this issue below.



Time Differencing



59



Consider two simple but canonical equations, the wave equation,



du

-=F=iwu

dt



,



(2.15)



du

dt



.



(2.16)



and the fraction equation

-=



F=-ru



The former arises naturally, e.g., from the linearized advection or transport

equation:



au

au

-+c-=o

at



ax



,



u(z,t ) = U(t)eikz



dU

dt



+



- =-ikcU



*



-=--ifU



,



or from the Coriolis terms

du

-=

dt



fu,



dv

- =-fu,

dt



u=u+iu



dU

dt



.



Equations of the latter form arise from most viscous and diffusive processes

(e.g., the one-dimensional heat equation at fixed horizontal wavenumber

discussed above).

The low-order schemes that we explore include:

0



0

0

0

0



Euler (forward):

Euler (backward):

Trapezoidal:

Leapfrog:

Adams-Bashforth:



U ( n + l )=



+ AtF(")



u("+l) = u(")+ AtF(n+l)

U("+1) = ,(n) + a t { F ( " + l ) + F ( 4 )

2

%("+I)

= ufn-1) + 2At&'(n)

= .(") + A t { i F ( n )- L

2 F(n-l)}



,



where F(n)= F ( u ( ~n) A

, t).

The first three schemes involve information at two time-levels, and are

therefore known as 2-step schemes. Of these, the uncentered approximations (Euler forward and Euler backward) are O ( A t ) , while the centered

trapezoidal scheme is O(At2). Note that, whereas the Euler forward algorithm uses only known values of the right-hand-side function F ( u ,t ) , the

Euler backward and trapezoidal schemes use F[u("+l),( n l ) A t ] . The

former are referred to as explicit in time time-stepping schemes, while the

latter are implacit in time. Although the use of implicit information does

not carry a computational penalty in this simple setting, it does when spatial dependence is encountered (see Section 3.3).



+



T H E i D HEAT A N D WAVE EQUATIONS



60



The 3-step schemes (leapfrog, Adams-Bashforth) achieve second-order

accuracy without the need for implicit treatment by incorporating information from a second prior time level [(n - l)At]. As should be clear,

the leapfrog scheme is centered about time-step (n); the Adams-Bashforth

since

approximation is (less obviously) centered around time-step (n

( $ F ( n )- 2

is an extrapolated, second-order estimate to F ( n + i ) . 2



+ i)



2.5.1



The wave equation



The wave Eq. (2.15) has the solution

u(nAt) = u(0)einwAt .



Notable properties of the exact solution include no temporal change in

amplitude, and a phase change of (wAt) each time-step. In the terminology

of the Von Neumann stability analysis, the exact solution has

u(n+l) = ~ , u ( n )



IXleie



with \ A \ = 1 and 8 = wAt. The approximate schemes may depart from the

analytic solution in either amplitude and/or phase, and may be characterized as follows:



1x1



{



> 1 amplifying (unstable)

= 1 neutral (no amplitude change)

< 1 damping



> 1 accelerating



& { =1



neutral (no phase error)



< 1 decelerating .



All the 2-step schemes introduced in the prior subsection can be written



as

U ( n + l )= .(n)



+ At{clf(n) + c 2 f ( n + l )1



7



2The second-order Adams-Bashforth scheme can be generalized to produce higher-order

time differencing estimates by the utilization of additional past time levels. An example

is the popular third-order Adams-Bashforth scheme which has the form



Time Differencing



61



where c1 and c2 are constants. (Note that c1 + c2 = 1 is required for

consistency with the original differential equation.) For the wave equation

( + ~iwAt{qU(n)

1

+ C~U("+'))



u ( ~ + ' )= ~



.



Solving for u ( ~ + ' and

)

setting w = wAt:



+



1 iclw

1 - iczw

Hence



+



1 icla

A = { 1 - iczw



}=(



+



1 - c1c2a2 i a

1 cia2



+



from which the moduli of the amplification factors of the 2-step schemes

are:

0



rn

0



Euler (forward): (c1, c2) = (1, 0)

Euler (backward): (cl, c2) = (0, 1)

Trapezoidal:

(c1, c2) = (3, 3)



1x1 = (1+ w2)li2

J A J= (1

1x1 = 1



+ m2)-'I2

*



Thus, the Euler forward scheme is unconditionally unstable (always unstable, independent of At) , while the implicit-in-time schemes (Euler backward, trapezoidal) are unconditionally stable. It is generally the case that

implicit-in-time schemes have wider regimes of stability than do explicitin-time schemes. Note finally that the trapezoidal scheme does not suffer

any amplitude degradation.

Now, how about the phase change? The relative phase change per timestep (O/w) should equal unity for an exact solution. Recalling that

A



G



IA([cos(B)+ isin(B)]



,



we get



The relative phase changes are, therefore,

0



0

0



(5) 6



Euler (forward):

= arctan(w) < 1

Euler (backward): (L)= $ arctan(w) < 1

Trapezoidal:

({) = arctan[a/(l- w2/4)1 N 1



+~ ( w 2 )



62



THE 10 HEAT A N D WAVE EQUATIONS



The Euler algorithms are both decelerating, while the trapezoidal scheme

is slightly accelerating. Of the 2-step schemes, the trapezoidal approach

looks the best.

The leapfrog scheme has long been a favorite because of its simplicity

(it is explicit in time) and its accuracy (it is a second-order scheme). Let

us investigate its stability characteristics on the wave equation. From the

above:

?Jn-tI)



= U(n--l) + 2izjzt(4 .



(2.17)



Note that leapfrog (like all 3-step schemes) requires two time-levels of information (two initial conditions) to get started. The corresponding amplification equation is



x2 - i(2a)X - 1 = 0



.



This is a quadratic equation with the two solutions, corresponding t o two

possible solutions to the original approximate difference equation:



+



= i

a (1 - m y

= i m - ( l - w )2 1/2



A1

A2



.



What are we to make of these dual amplification factors? Are they both

related t o the exact solution, or is one of them somehow fictitious (purely

numerical in origin)? To answer this question, take the limit of vanishingly

small At



+1

A2 + -1



A1



}



Ot+O.



In the limit At + 0, the first solution of the amplification equation approaches unity, and clearly recovers the behavior of the exact solution. The

solution t o the ADE corresponding to A1 is called the physical solution, or

physical mode. In contrast, A2 approaches -1, clearly an artificial result;

this corresponds to the so-called computational mode.

The choice of initial conditions (there are two) determines whether the

computational mode arises or not. The general solution to Eq. (2.17) is

&)



+



= a (A,)" uy) b (A,)" uf)



,



where u y ) and up)represent the respective contributions of the physical

and computational modes at time zero, and a and b are constants. The



Time Differencing



63



initial conditions require



from which



=



(



1

(A1



- A2



)



{(A,)"



- A ~ U ( ~ ) .] }(2.18)



[&) - A2u(0)]- (A,)"



The solution (2.18) shows the respective contributions of the physical and

computational modes. The latter can be eliminated an princaple by a sufficiently clever choice of initial conditions, i.e., if (dl)

- Alu(O)) = 0. However, permanent elimination of the computational mode is not truly possible

because of the accumulation of round-off on finite-precision computers.

As (2.18) emphasizes, absolute stability requires that neither amplification factor exceed unity. For this problem, both the physical and the computational modes are conditionally stable, i e . , IAl,zl = 1 for lwl = lwAtl 5 1.

Both modes are unstable for lwl > 1. Note the appealing property that the

leapfrog scheme is neutral (neither damping nor amplifying) for solutions

to the wave equation.

Turning now to phase errors in the leapfrog solution, we consider first

w < 1, for which



62



= arctan(-a/t/l-



w2)



.



For the physical mode,



that is, it is weakly accelerating. And, from the properties of arctangents,



so that



64



THE 1D HEAT AND WAVE EQUATIONS



and both real and imaginary parts oscillate in sign. For the Nyquist fre1

quency, Iw1 =

( a= l),



el = e2 = f n / 2

and



= u(0)efina/2

The phase changes by ( ~ 1 2for

) the maximally allowable w. Since the exact

phase change is 1, there is considerable error, although the approximated

wave is stable.

The leapfrog scheme has the useful property of neutral evolution of

waves. However, this property applies equally well to both the physical

and the computational mode. Since the latter must arise to some degree in

any computation, and since it is entirely erroneous, we might well want t o

periodically remove it. How do we go about this? One popular approach

is t o occasionally apply another time-stepping scheme, one which can aggressively damp the computational mode. An example of the latter is the

leapfrog-trapezoidal scheme, in which an estimate of u at the next time level

obtained from a leapfrog step is used in a trapezoidal correction:



u* =

-



Jn+l)



u(n-1) + 2 A t f ( n )



dn)+ (,)A(f'"'t



+f*) .



For the wave equation, f = ZWZL, the leapfrog-trapezoidal scheme can be

manipulated to yield



At

2



u(n+l) = u ( n )+ - { ( i w ~ ( ~+) iw[u("-')



+ 2At(iw)u(")]}



so that the amplification equation becomes



x2 + ( a 2



- 1- i a / 2 ) X



- ( i a / 2 )= 0 .



Ignoring terms of order w 2 ,

xcz



1



+ ( i a / 2 )f [l + 3iw/2]

2



Time Differencing



65



Hence



PI2=



{ l+C?(w2)

q w 2 )



+1



+o



1







as At + 0. The inclusion of the trapezoidal correction step thus acts to

heavily damp the computational mode. Although we do not demonstrate it

here, the trapezoidal correction also enhances the region over which stable

integration can be carried out; ie., time-steps greater than

are now

allowable. The penalty for these attractive properties is the need to evaluate

the right-hand-side function f(u,t) twice, rather than once, at each timestep.

Lastly, for Adams-Bashforth,



3



so that

X1,2



= 1/2{1 f (3iw/2)



+ dl - 9w2/4 + iw}



.



Hence, in the limit of vanishingly small timestep,



X

A2 1+

+ 0l } w + o

so that the computational mode is damped. Amplitude and phase errors

arising from the Adams-Bashforth scheme are most easily appreciated from

the Taylor series evaluated at ( n $)At, for which the leading order terms

are:



+



For the wave equation, the Adams-Bashforth approximation is therefore

equivalent, at leading order, to solving the modified equation

= iwu (1



at



+ (17At2w2

48 ) I +



(15At3w4)

96



so that the scheme is accelerating and weakly amplifying.



u



THE I D HEAT AND WAVE EQUATIONS



66



The friction equation



2.5.2



The friction Eq. (2.16) has the general solution u(t) = u(0)e-'t. For our

2-step schemes

=~



( - ~r&{clu(n)

1

+ ~ ~ u (1 ~ + ~ )



or, by rearrangement,



where the non-dimensional parameter c, = r a t . Therefore,



0



Euler (forward):

Euler (backward):



IAI = (1- c,)

1x1 = (1 c,)-'



0



Trapezoidal:



14 =



0



+



(s)



The explicit Euler scheme is stable for 0 < c, 5 2, while its implicit counterpart is always stable (damping) irrespective of At. The trapezoidal approximation is likewise unconditionally stable.

For the leapfrog scheme, the amplification equation is X2+(2c,)X-1 = 0,

so that

0



Leapfrog:



X I = -c,



+ Jm



For any c, > 0, A2 < -1. Leapfrog treatment of the friction equation

is therefore unconditionally unstable. The instability of leapfrog time differencing when applied to a heat- or diffusion-type equation is especially

disappointing since leapfrog differencing does so well on wave-like terms.

On an equation combining wave-producing and frictional processes we can

expect, since the wavelike terms do not produce amplitude damping, that

treatment by leapfrog differencing will be unconditionally unstable overall.

If leapfrog differencing is nonetheless retained, frictional terms must be

given special treatment to avoid instability. A simple expedient, still most

commonly used in practice, is to lag the friction terms in time:

= u(n-l) - (2At)ru("-l) .

By lagging in time, we recover an Euler forward step over an interval of 2At,

which from results above we know to be conditionally stable. There are two



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

4 Convergence, Consistency and Stability

Tải bản đầy đủ ngay(0 tr)

×