Spectral Method

Category: Fluid Analysis – Solver Methods | Revised 2026-10-01
CAE visualization for spectral methods theory - technical simulation diagram
Spectral Method

Theory: representing functions as sums of waves

Overview

🙋

Spectral methods are said to be very accurate. How do they differ from finite differences?

🎓

A finite difference computes a derivative at a point from a few nearby values. A spectral method represents values across the whole domain as a sum of waves (sines and cosines), differentiates each wave exactly and sums them back. Finite differences misrepresent the speed and shape of fine waves, while spectral methods handle every representable wave exactly. So for smooth solutions, error drops rapidly with more points. Using every point makes complex geometry awkward, though, and discontinuities produce oscillations.

Differentiation by Fourier series

$$ u(x) = \sum_{k=-N/2}^{N/2-1} \hat u_k\, e^{ikx},\qquad \frac{du}{dx} = \sum_k ik\,\hat u_k\, e^{ikx} $$

Coefficients come from the fast Fourier transform (FFT), costing about N log N for N points. For non-periodic problems, Chebyshev polynomials are used with points clustered toward both ends.

Modified wavenumber

$$ k'h = \sin(kh)\ (\text{2nd}),\qquad k'h = \frac{8\sin(kh) - \sin(2kh)}{6}\ (\text{4th}),\qquad k'h = kh\ (\text{spectral}) $$

Finite differencing treats a wave of wavenumber k as if it had k′. The larger kh (fewer points per wavelength), the smaller k′ and the slower the wave travels. Spectrally, k′ = k.

Coffee Break Trivia

The method behind turbulence DNS

In 1972 Orszag and Patterson computed turbulence in a periodic box directly with a spectral method. In 1987 Kim, Moin and Moser computed turbulent channel flow combining Fourier series and Chebyshev polynomials; their results are still widely used to validate turbulence models. Spectral accuracy let limited grid points represent the finest eddies faithfully, and the invention of the FFT in 1965 made it practical.

Worked examples

Example 1: max derivative error of exp(sin x) (period 2π)

PointsSpectral2nd-order FD4th-order FD
84.3×10⁻³3.4×10⁻¹1.4×10⁻¹
161.8×10⁻⁷9.4×10⁻²1.6×10⁻²
323.8×10⁻¹⁵2.6×10⁻²1.1×10⁻³
649.4×10⁻¹⁵6.5×10⁻³7.6×10⁻⁵

Doubling points cuts finite-difference error by 4 (2nd order) or 16 (4th order), while the spectral error hits round-off at 32 points and goes no lower.

Example 2: points per wavelength for correct wave speed

MethodWithin 1%Within 0.1%
2nd-order FD25.681.1
4th-order FD8.315.0
6th-order FD5.78.6
SpectralExact above 2Same

In 3D point counts are cubed. Second-order FD at 1% (25.6 points) versus spectral at about 3 points per wavelength including dealiasing differ by about 620 times in grid points for the same wave.

Example 3: a non-periodic function (Chebyshev)

PointsChebyshevUniform 2nd-order FD
176.5×10⁻¹7.9×10⁻¹
335.4×10⁻²3.5×10⁻¹
651.9×10⁻⁴9.3×10⁻²

Derivative of 1/(1 + 25x²) on [−1, 1]. For a rapidly varying function, even the spectral method errs badly with few points, but the error drops quickly once there are enough.

🙋

With few points, Chebyshev and finite differences aren't so different.

🎓

Right. Fast spectral convergence appears only once there are enough points to represent the finest variation. Here the fine structure is the peak about 0.2 wide near x = 0, which 17 points can't capture. Going four times finer to 65 points cuts the finite-difference error by about 9 but the Chebyshev error by about 3,500. DNS is the same: without a grid that resolves the smallest eddies, spectral advantages don't appear. Conversely, a true discontinuity like a shock can never be captured however many points are added, leaving Gibbs oscillations.

Where to use it and caveats

  1. Use for simple geometry (periodic box, channel, pipe) with smooth solutions.
  2. Compute nonlinear products in physical space and dealias (e.g. 3/2 rule).
  3. Use Chebyshev polynomials in non-periodic directions.
  4. Chebyshev points cluster tightly at the ends; watch explicit time steps.
  5. For complex geometry consider spectral element or high-order FE methods.
Coffee Break Trivia

“A DNS whose energy kept rising”

A spectral DNS of turbulence in a periodic box saw kinetic energy, which viscosity should steadily reduce, start rising at some point and blow up. The cause was aliasing in the nonlinear term: when velocity products were computed in physical space, unrepresentable fine waves masqueraded as coarse waves, injecting energy. Adding the 3/2 rule (computing products on 1.5 times as many points) made energy decrease monotonically. Being so accurate, spectral methods have no numerical viscosity to hide such errors, so they show up clearly.

Common mistakes

Mistakes and fixes

MistakeEffectFix
No dealiasingEnergy grows, blow-up3/2 rule
Used on discontinuitiesGibbs oscillationsFinite-volume etc.
Fourier in non-periodic directionLarge boundary errorsChebyshev
Smallest scales unresolvedNo accuracy gainRevise grid
Large step with ChebyshevExplicit instabilityUse implicit terms
🙋

I'd like to learn related topics.

Related Simulators

Experience the theory firsthand with the interactive simulator for this field

All Simulators

Related fields

Thermal AnalysisV&V · Quality AssuranceStructural Analysis
Rate this article
Thank you for your feedback!
Helpful
More details
Report error
Helpful
0
More details
0
Report error
0