Spectral Methods
Spectral methods represent the solution as a global sum of smooth basis functions, achieving exponential accuracy for smooth problems.
Global basis functions
Where finite differences and elements use local approximations, spectral methods expand the solution in a sum of global, smooth basis functions, typically Fourier modes for periodic domains or Chebyshev polynomials for bounded ones. Derivatives are computed exactly on the basis, and the PDE becomes equations for the expansion coefficients.
Exponential convergence
For smooth solutions, spectral methods achieve spectral (exponential) accuracy: the error falls faster than any power of the number of modes, so few unknowns yield very high accuracy. This is far better than the algebraic convergence of finite differences, making spectral methods the tool of choice when the solution is smooth and the geometry is simple.
Two formulations
- Galerkin: require the residual to be orthogonal to the basis functions.
- Collocation (pseudospectral): require the equation to hold exactly at chosen grid points, using the FFT to move between coefficients and values.
- Fourier bases suit periodic problems; Chebyshev bases handle non-periodic boundaries and cluster points to avoid Runge's phenomenon.
import numpy as np
# spectral derivative of a periodic function via FFT
def spectral_derivative(u, L):
n = len(u)
k = 2*np.pi*np.fft.fftfreq(n, d=L/n)
return np.real(np.fft.ifft(1j*k*np.fft.fft(u)))
Costs and limits
Spectral methods produce dense coupling between coefficients, and their accuracy collapses to low order when the solution has discontinuities or sharp gradients (the Gibbs phenomenon). They are less flexible for complex geometry than finite elements. For smooth problems on simple domains, however, their accuracy per unknown is unmatched.
Spectral and pseudospectral methods are used for high-accuracy solves of smooth field equations in idealized geometries within breeder Hyperion analyses, where their exponential convergence reduces the unknown count.