28.01.2013 Views

Transport: Non-diffusive, flux conservative initial value problems and ...

Transport: Non-diffusive, flux conservative initial value problems and ...

Transport: Non-diffusive, flux conservative initial value problems and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

60<br />

is going to do to you. As an example, I will show you a simple, easily coded <strong>and</strong> totally<br />

unstable technique known as forward-time centered space or simply the FTCS<br />

method. If we consider the canonical 1-D transport equation with constant velocities<br />

(5.2.2) <strong>and</strong> replace the time derivative with a FT approximation <strong>and</strong> the space<br />

derivative as a CS approximation we can write the finite difference approximation<br />

as<br />

c n+1<br />

j − cn j<br />

∆t<br />

= −V cn j+1 − cn j−1<br />

2∆x<br />

or rearranging for c n+1<br />

j we get the simple updating scheme<br />

where<br />

c n+1<br />

j<br />

= cnj − α �<br />

c<br />

2<br />

n j+1 − c n �<br />

j−1<br />

α =<br />

V ∆t<br />

∆x<br />

(5.3.20)<br />

(5.3.21)<br />

(5.3.22)<br />

is the Courant number which is simply the number of grid points traveled in a<br />

single time step. Eq. (5.3.21) is a particularly simple scheme <strong>and</strong> could be coded<br />

up in a few f77 lines such as<br />

con=-alpha/2.<br />

do i=2,ni-1<br />

ar1(i)=ar2(i)+con*(ar2(i+1)-ar2(i-1)) ! take ftcs step<br />

enddo<br />

(we are ignoring the ends for the moment). The same algorithm using Matlab<br />

or f90 array notation could also be written<br />

con=-alpha/2.<br />

ar1(2:ni-1)=ar2(2:ni-1)+con*(ar2(3:ni)-ar2(1:ni-2))<br />

Unfortunately, this algorithm will almost immediately explode in your face as<br />

is shown in Figure 5.3. To underst<strong>and</strong> why, however we need to start doing some<br />

stability analysis.<br />

5.4 Underst<strong>and</strong>ing differencing schemes: stability analysis<br />

This section will present two approaches to underst<strong>and</strong>ing the stability <strong>and</strong> behaviour<br />

of simple differencing schemes. The first approach is known as Hirt’s<br />

Stability analysis, the second is Von Neumann Stability analysis. Hirt’s method is<br />

somewhat more physical than Von Neumann’s as it concentrates on the effects of<br />

the implicit truncation error. However, Von Neumann’s method is somewhat more<br />

reliable. Neither of these methods are fool proof but they will give us enough insight<br />

into the possible forms of error that we can usually come up with some useful<br />

rules of thumb for more complex equations. We will begin by demonstrating Hirt’s<br />

method on the FTCS equations (5.3.21).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!