Lecture 6: Spectral Methods

An idea

  • Suppose we are solving $$ \begin{align*} -\Delta u &= f \\ u &= 0\quad\text{on }\Gamma, \end{align*} $$ in $\Omega = [0,1]^2$ (unit square)

  • Idea: why not $$ v^{(k,\ell)} := \sin(k \pi x) \sin(\ell \pi x) $$ as basis functions?

  • It is a good idea: $$ -\Delta v^{(k,\ell)} = \pi^2 (k^2+\ell^2) v^{(k,\ell)} $$ (in other words, $v^{(k,\ell)}$ are eigenvalues of $-\Delta$)

  • Can use Fast Sine Transform (FST) to obtain the coefficients in $$ u^h = \sum _{k,\ell} c _{k,\ell} v^{(k,\ell)} $$

  • We then can easily solve:

    • Sample $f$ at points $(i h, j h)$, $h=1/N$;
    • Find the coefficients $\hat{f} _{k,\ell}$ in $$ f = \sum _{k,\ell} \hat{f} _{k,\ell} v^{(k,\ell)} $$ (i.e., apply the FST)

    • Find the coefficients of the solution $$ {\pi^2(k^2+\ell^2)} \hat{u}^h _{k,\ell} = \hat{f} _{k,\ell} $$

    • Find the solution (i.e., apply the inverse FST) $$ \hat{u} _h = \sum _{k,\ell} \hat{u}^h _{k,\ell} v^{(k,\ell)} $$
  • To think: Did we discretize the domain?

  • Smoothness in x <-> fast decay in the Fourier domain

  • Smooth in Fourier domain <-> decays fast in x

Time-dependent example

$$ \begin{align*} u _t &= \Delta u \\ u &= u^0\quad\text{at }t=0 \\ u &= 0\quad\text{on }\Gamma, \end{align*} $$

in $\Omega = [0,1]^2$ (unit square)

  • If we assume the same spatial discretization, then $$ u _h(t,x,y) = \sum _{k,\ell} e^{-(k^2+\ell^2) t} \hat{u}^0 _{k,\ell} v^{(k,\ell)} $$

  • The algorithm is then:

    • Find $\hat{u}^0 _{k,\ell}$ (apply the FST)
    • Calculate $\hat{u}^h _{k,\ell}(T) := e^{-(k^2+\ell^2) T}\, \hat{u}^0 _{k,\ell}$
    • Hence find $u^h(T)$ (apply the inverse FST)

Other uses of the spectral methods (1):

  • Suppose we need to compute $$ {\rm div}(K \nabla u) $$ with (for a change) periodic boundary conditions (so FFT can be applied) in a unit square.

  • The algorithm is then:

    • Given values of $u$
    • Calculate $\hat{u} = {\rm FFT}(u)$
    • Calculate $i\pi k \hat{u} _{k,\ell} = {\rm FFT}(\frac{\partial}{\partial x} u)$
    • Calculate $\frac{\partial}{\partial x} u = {\rm iFFT}(i\pi k \hat{u} _{k,\ell})$
    • Then multiply by $K$
    • and again apply $\frac{\partial}{\partial x}$ using ${\rm FFT}$ and ${\rm iFFT}$.
    • Repeat with $\frac{\partial}{\partial y}$.
  • Nonlinear problems can be treated in a similar way

    • But extra care must be exercised (check out, e.g., what is an aliasing error)

Other uses of the spectral methods (2):

  • Can use polynomials instead of trigonometry: $$ T _n(x) = \cos(n \arccos (x)) $$ are Chebyshev polynomials! If one generates meshes with nodes $x _k = \arccos (h k)$, one can use FFT!

Other uses of the spectral methods (3):

  • Can split the domain into several quadrilaterals, and use a spectral discretization in each $\rightarrow$ Spectral element method

  • Closely related to the hp-FEM

Limitations of the Spectral Method:

  • Efficient only if the solution is smooth (otherwise not more accurate than a FEM of some order)
  • Can be used only in rectangular domains
    • or smooth deformations of rectangular domains
    • or their union
  • Parallelization is not easy
Questions?

In [1]:
from IPython.core.display import HTML
def css_styling():
    styles = open("./styles/alex.css", "r").read()
    return HTML(styles)
css_styling()


Out[1]:

In [ ]: