62
3. Finite Difference Methods
can be relaxed by using functions other than complex exponentials but any
change in geometry or boundary conditions requires a considerable change in
the method, making spectral methods relatively inflexible. For the problems
to which they are ideally suited (for example, the simulation of turbulence in
geometrically simple domains), they are unsurpassed.
3.10.2 Another View of Discretization Error
Spectral methods are as useful for providing another way of looking at truncation errors as they are as computational methods on their own. So long as
we deal with periodic functions, the series (3.54) represents the function and
we may approximate its derivative by any method we choose. In particular,
we can use the exact spectral method of the example above or a finite difference approximation. Any of these methods can be applied term-by-term to
the series so it is sufficient to consider differentiation of eikx. The exact result
is ikeikx. On the other hand, if we apply the central difference operator of
Eq. (3.9) to this function we find:
where k e ~
is called the effective wavenumber because using the finite difference
approximation is equivalent to replacing the exact wavenumber k by ketf.
Similar expressions can be derived for other schemes; for example, the fourth
order CDS, Eq. (3.14), leads to:
sin(k Ax)
k e ~
=
[4 - C O S ( ~
AX)] .
3Ax
For low wavenumber (corresponding to smooth functions), the effective
wavenumber of the CDS approximation can be expanded in a Taylor series:
sin(k Ax) = k -
k3 (Ax)'
keff =
Ax
6
'
which shows the second-order nature of the approximation for small k and
small Ax. However, in any computation, wavenumbers up to k, , ,
= n/Ax
may be encountered. The magnitude of a given Fourier coefficient depends
on the function whose derivatives are being approximated; smooth functions
have small high wavenumber components but rapidly varying functions give
Fourier coefficients that decrease slowly with wavenumber.
In Fig. 3.6 the effective wavenumbers of the second and fourth order
CDS scheme, normalized by k,,,,
are shown as functions of the normalized
wavenumber k* = k/k,,,.
Both schemes give a poor approximation if the
wavenumber is larger than half the maximum value. More wavenumbers are
included as the grid is refined. In the limit of small spacings, the function is
3. Finite Difference Methods
can be relaxed by using functions other than complex exponentials but any
change in geometry or boundary conditions requires a considerable change in
the method, making spectral methods relatively inflexible. For the problems
to which they are ideally suited (for example, the simulation of turbulence in
geometrically simple domains), they are unsurpassed.
3.10.2 Another View of Discretization Error
Spectral methods are as useful for providing another way of looking at truncation errors as they are as computational methods on their own. So long as
we deal with periodic functions, the series (3.54) represents the function and
we may approximate its derivative by any method we choose. In particular,
we can use the exact spectral method of the example above or a finite difference approximation. Any of these methods can be applied term-by-term to
the series so it is sufficient to consider differentiation of eikx. The exact result
is ikeikx. On the other hand, if we apply the central difference operator of
Eq. (3.9) to this function we find:
where k e ~
is called the effective wavenumber because using the finite difference
approximation is equivalent to replacing the exact wavenumber k by ketf.
Similar expressions can be derived for other schemes; for example, the fourth
order CDS, Eq. (3.14), leads to:
sin(k Ax)
k e ~
=
[4 - C O S ( ~
AX)] .
3Ax
For low wavenumber (corresponding to smooth functions), the effective
wavenumber of the CDS approximation can be expanded in a Taylor series:
sin(k Ax) = k -
k3 (Ax)'
keff =
Ax
6
'
which shows the second-order nature of the approximation for small k and
small Ax. However, in any computation, wavenumbers up to k, , ,
= n/Ax
may be encountered. The magnitude of a given Fourier coefficient depends
on the function whose derivatives are being approximated; smooth functions
have small high wavenumber components but rapidly varying functions give
Fourier coefficients that decrease slowly with wavenumber.
In Fig. 3.6 the effective wavenumbers of the second and fourth order
CDS scheme, normalized by k,,,,
are shown as functions of the normalized
wavenumber k* = k/k,,,.
Both schemes give a poor approximation if the
wavenumber is larger than half the maximum value. More wavenumbers are
included as the grid is refined. In the limit of small spacings, the function is
