December 2026 · Politecnico di Milano
Atmosphere and Ocean Dynamics — Lecture 7
Prof. Dr. Pedro da Silva Peixoto
Applied Mathematics
Instituto de Matemática e Estatística
Universidade de São Paulo
Visiting Professor at MOX Lab
Politecnico di Milano
Previous knowledge
Where we are going
Represent the fields by global waves instead of neighbours
(Durran 2010, Ch. 6; Williamson 2007)
\(c\): advection speed; Courant number \(c\Delta t/\Delta x\): small, so the error is that of \(\partial_x\)
Today: global waves instead of neighbours. Exact derivatives? No pole problem?
(Durran 2010, Sect. 3.3, 6.4.2; Williamson 2007)
\[\begin{aligned} &(\delta_x^2 + \delta_y^2)\Big[\sin\frac{p\pi i}{P}\,\sin\frac{q\pi j}{Q}\Big]\\ &\quad = -\frac{4}{\Delta s^2}\Big[\sin^2\frac{p\pi}{2P} + \sin^2\frac{q\pi}{2Q}\Big]\,\sin\frac{p\pi i}{P}\,\sin\frac{q\pi j}{Q} \end{aligned}\]
\(\delta_x^2\): centred second difference; \(\Delta s\): grid interval; \(i \le P = 18\), \(j \le Q = 15\): grid indices; \(p\), \(q\): mode numbers
Four discrete sines on the ENIAC grid (19 × 16 points, 736 km apart at the pole).
In a basis of eigenvectors of the discrete Laplacian, the Poisson problem is a division
(Charney et al. 1950; Platzman 1979, 310; Lynch 2008, appendix A; Durran 2010, Sect. 3.1)
Spectral methods expand the whole field in global waves; finite differences use neighbours
(Durran 2010, Sect. 6.2; Fornberg 1996)
\(M\) points \(x_j = j\,\Delta x\) on a periodic interval of length \(2\pi\):
\[\begin{aligned} \hat u_k &= \frac{1}{M}\sum_{j=0}^{M-1} u_j\,e^{-ikx_j}\\ u_j &= \sum_{k=-M/2+1}^{M/2}\hat u_k\,e^{ikx_j} \end{aligned}\]
\(u_j\): grid values; \(\hat u_k\): wave coefficients; \(k\): wavenumber
\(M\) grid values and \(M\) wave coefficients carry the same information: the FFT goes back and forth
(Durran 2010, Sect. 6.2; Fornberg 1996)
Each wave has an exact derivative:
\[\begin{aligned} \frac{d}{dx}\,e^{ikx} &= {\color{#1f5ccc} ik}\,e^{ikx}\\ \Big(\frac{\partial u}{\partial x}\Big)_j &= \sum_k {\color{#1f5ccc} ik}\,\hat u_k\,e^{ikx_j} \end{aligned}\]
In spectral space, \(\partial_x\) is a multiplication by \(ik\), and \(\nabla^2\) by \(-k^2\)
(Durran 2010, Sect. 6.2)
Advection \(u_t + c\,u_x = 0\), wave \(e^{i(kx-\omega t)}\); \(c^* = \omega/k\): numerical phase speed
The spectral derivative is exact for every wave the grid can carry
(Durran 2010, Sects. 3.3.1 and 6.2.1)
Spectral accuracy for smooth fields; ringing at jumps
(Durran 2010, Sect. 6.2.1; Fornberg 1996)
Advection, \(\partial_t u + c\,\partial_x u = 0\). In spectral space, one ODE per wave:
\[\frac{d\hat u_k}{dt} = -ic{\color{#1f5ccc}k}\,\hat u_k \;\Rightarrow\; \hat u_k = \hat u_k(0)\,e^{-ickt}\]
\(c\): advection speed; \(\hat u_k\): coefficient of the wave \(e^{ikx}\)
Spectral advection keeps the shape: no numerical dispersion in space
(Durran 2010, Sect. 6.2.1; Williamson 2007)
Notebook 07a (open in Colab · download): Fourier spectral derivatives, advection and aliasing, on a computer.
What section 2 should give: slopes −2 and −4, and the spectral drop to round-off
Predict, run, explain: write down what you expect before each run
A few lines of numpy: an FFT, a multiplication by \(ik\), an inverse FFT
(Durran 2010, Ch. 6; Fornberg 1996)
Error of \(\partial_x u\), \(u = e^{\sin x}\), \(M = 32\) points:
| centred, 2nd order | \(2.6\times10^{-2}\) |
| centred, 4th order | \(1.1\times10^{-3}\) |
| spectral | \(2.9\times10^{-15}\) |
The hump after 10 revolutions: errors 0.65, 0.36 and \(6\times10^{-5}\).
For smooth fields, a few waves do the work of many grid points
(Durran 2010, Sect. 6.2)
\[\begin{aligned} e^{ikx}\,e^{ilx} &= e^{i(k+l)x}\\ u\,v &= \sum_k \Big({\color{#1f5ccc}\sum_l \hat u_l\,\hat v_{k-l}}\Big)\,e^{ikx} \end{aligned}\]
\(k\), \(l\): wavenumbers; \(u = \sum_l \hat u_l\,e^{ilx}\), \(v = \sum_l \hat v_l\,e^{ilx}\): the waves \(l\) and \(k - l\) make the wave \(k\)
A product of waves makes sum and difference waves, up to twice the highest wavenumber
(Silberman 1954; Ehrendorfer 2012, Sect. 7.5)
But: the product has waves up to \(2N\), the grid only up to \(M/2\). Where do the others go?
\(N\): the largest kept wavenumber (the truncation); \(M\): the number of grid points, which carry the waves \(|k| \le M/2\)
Derivatives in spectral space, products on the grid: the (spectral) transform method
(Orszag 1970; Eliasen et al. 1970; Ehrendorfer 2012, Sect. 7.7)
\[\begin{aligned} e^{i(k+M)x_j} &= e^{ikx_j}\,e^{2\pi i j} = e^{ikx_j}\\ \tilde u_k = \frac{1}{M}\sum_{j=0}^{M-1} u_j\,e^{-ikx_j} &= {\color{#1f5ccc}\sum_{r} \hat u_{k+rM}} \end{aligned}\]
\(x_j = 2\pi j/M\); \(\hat u_k\): the exact coefficients of \(u(x) = \sum_k \hat u_k e^{ikx}\) (theory); \(\tilde u_k\): the coefficients computed from the \(M\) grid values (numerics), equal to \(\hat u_k\) if \(u\) has no waves beyond \(M/2\); \(r\): any integer
On a grid, a wave too short to be seen pretends to be a longer one
(Durran 2010, Sect. 4.5, 6.3; Ehrendorfer 2012, Sect. 7.9–7.10)
\[2N - M < -N \quad\Longleftrightarrow\quad M \ge 3N + 1\]
\(M\): grid points; \(N\): the largest kept wavenumber (the truncation); \(2N - M\): where the product’s wave \(2N\) lands
With three points per shortest kept wave, quadratic products are computed exactly
(Orszag 1971; Durran 2010, Sect. 6.3)
Exercise 1 — Aliasing on a small grid. Take the \(M = 8\) grid points \(x_j = 2\pi j/8\). (a) Show that \(\cos 6x_j = \cos 2x_j\) at every grid point. Which waves look like \(k = 1\) on this grid? (b) \(u = \cos 3x\) is carried by the grid. What does the grid see for \(u^2 = \tfrac12 + \tfrac12\cos 6x\)? (c) A field keeps the waves \(|k| \le N\). How many points \(M\) are needed so that no alias of \(u^2\) falls on a kept wave? Check T42 and its 128 longitudes.
(d) To hand in: cubic products. The same question for \(u^3\). Which fraction of the grid’s waves can be kept? ECMWF’s model uses a “cubic” grid, with four points per shortest wave: why the name?
In notebook 07a (exercise 4): open in Colab · download
(Orszag 1971; Ehrendorfer 2012, Sect. 7.10)
Three points per shortest kept wave for squares, four for cubes: then no alias falls on a kept wave
(Orszag 1971; Durran 2010, Sect. 6.3)
\(\varphi\): latitude; \(\lambda\): longitude; \(P_n^m\): associated Legendre function, normalised as in the IFS (no \((-1)^m\) factor)
Spherical harmonics are the waves of the sphere
(Ehrendorfer 2012, Sect. 7.11 and App. B.1; ECMWF 2026, Sect. 2.2.4; Durran 2010, Sect. 6.4)
\[\frac{\partial\zeta}{\partial t} + J(\psi, \zeta + f) = 0, \qquad \zeta = \nabla^2\psi\]
\(J(\psi, q) = \mathbf u\cdot\nabla q\), with \(u = -\frac{1}{a}\frac{\partial\psi}{\partial\varphi}\), \(v = \frac{1}{a\cos\varphi}\frac{\partial\psi}{\partial\lambda}\); \(f = 2\Omega\sin\varphi\): Coriolis parameter; \(\Omega\): rotation rate of the Earth
\(\nabla^2\) is the spherical Laplacian; spherical harmonics are its eigenfunctions:
\[\begin{aligned} \nabla^2 &= \frac{1}{a^2\cos\varphi}\frac{\partial}{\partial\varphi}\Big(\cos\varphi\,\frac{\partial}{\partial\varphi}\Big) + \frac{1}{a^2\cos^2\varphi}\frac{\partial^2}{\partial\lambda^2}\\ \nabla^2 Y_n^m &= -\frac{n(n+1)}{a^2}\,Y_n^m\\ \psi_n^m &= {\color{#1f5ccc} -\frac{a^2}{n(n+1)}}\,\zeta_n^m \quad (n \ge 1) \end{aligned}\]
\(a\): radius of the Earth; \(\lambda\): longitude; \(\varphi\): latitude; \(\psi_n^m\), \(\zeta_n^m\): coefficients of \(Y_n^m\)
The ENIAC’s Poisson problem on the sphere: a division, as with von Neumann’s sines
(Ehrendorfer 2012, Sect. 7.14; ECMWF 2026, Sect. 2.2.4)
Inverse: \(u\), \(v\), \(\nabla\zeta\) on the Gaussian grid. Direct: an FFT on each latitude circle, then a Legendre transform by Gaussian quadrature:
\[X_n^m = \sum_{j=1}^{N_{lat}} {\color{#1f5ccc} w_j}\,X_m(\mu_j)\,P_n^m(\mu_j)\]
\(X_m(\mu_j)\): Fourier coefficient on the latitude circle \(\mu_j\); \(\sum_j w_j = 1\)
To the grid by inverse transforms; back by an FFT on each latitude and a Gaussian quadrature
(ECMWF 2026, Sect. 2.2.4; Ehrendorfer 2012, Sect. 7.11)
On the grid, the product; back to coefficients; step each one in time, with a little diffusion:
\[\frac{d\zeta_n^m}{dt} = -\Big[\mathbf u\cdot\nabla(\zeta + f)\Big]_n^m - \nu_4\Big(\frac{n(n+1)}{a^2}\Big)^2\zeta_n^m\]
\(\nu_4\): coefficient of the \(\nabla^4\) hyperdiffusion; \([\,\cdot\,]_n^m\): coefficient of \(Y_n^m\)
The whole sphere: linear terms in spectral space, products on the grid
(Orszag 1970; Ehrendorfer 2012, Sect. 7.14)
The truncation \(N\) sets the resolution; the grid only has to compute the products exactly
(Ehrendorfer 2012, Sect. 7.11–7.12; Durran 2010, Sect. 6.4.1)
Exercise 2 — Rossby–Haurwitz waves. On the sphere, the barotropic vorticity equation linearized about rest is \(\partial_t\nabla^2\psi + (2\Omega/a^2)\,\partial_\lambda\psi = 0\). Take \(\psi = A\,P_n^m(\sin\varphi)\cos(m\lambda - \sigma t)\). (a) With \(\nabla^2 Y_n^m = -n(n+1)Y_n^m/a^2\), find \(\sigma\) and the angular speed \(\sigma/m\) of the pattern. East or west? (b) How many days does it take to go once round the Earth for \(n = 1, 2, 5\)? What is special about \(n = 1\)?
(c) To hand in: a stationary wave. Add an eastward wind in solid-body rotation, \(u = \omega a\cos\varphi\) (the air turns a little faster than the Earth). The pattern then turns at \(\omega - 2(\Omega + \omega)/[n(n+1)]\). Which \(\omega\) makes the wave \(n = 5\) stationary? What is \(u\) at the equator and at \(45^\circ\)N?
In notebook 07c (exercise 1): open in Colab · download
(Haurwitz 1940; Williamson et al. 1992)
On the sphere the Rossby waves are spherical harmonics, and their speed depends on \(n\) only
(Haurwitz 1940; Williamson et al. 1992)
Notebooks 07b (open in Colab · download) and 07c (open in Colab · download): the barotropic vorticity equation on a plane and on the sphere.
Expected in 07b: the cyclone drifts north-west
Predict, run, explain: model against exact speeds; the drift of the cyclone
The same model, plane or sphere: derivatives in waves, products on the grid
(Williamson et al. 1992; Galewsky et al. 2004)
A barotropically unstable jet (80 m/s at 45°N), T63, notebook 7c.
A spectral barotropic vorticity model of the whole sphere, in sixty lines of numpy
(Galewsky et al. 2004; Williamson et al. 1992)
\[\frac{\partial\delta}{\partial t} = -g\nabla^2 \eta, \qquad \frac{\partial \eta}{\partial t} = -H\delta\]
\(\eta\): height perturbation; \(H\): mean depth; \(g\): gravity
Averaged gravity-wave terms are stable for any \(\Delta t\): fast waves slowed, slow waves accurate
(Staniforth 1997; Durran 2010, Sect. 8.2)
Leapfrog with the gravity-wave terms averaged (\(\pm\): \(t \pm \Delta t\); dots: explicit terms):
\[\begin{aligned} \delta^{+} &= \delta^{-} - g\Delta t\,\nabla^2\big(\eta^{+} + \eta^{-}\big) + \dots\\ \eta^{+} &= \eta^{-} - H\Delta t\,\big(\delta^{+} + \delta^{-}\big) + \dots \end{aligned}\]
Put \(\eta^{+}\) into the first equation: a Helmholtz problem (below)
\[\Big(1 - gH\Delta t^2\,\nabla^2\Big)\,\delta^{+} = R \quad\Rightarrow\quad \delta_n^{m,+} = \frac{R_n^m}{1 + gH\Delta t^2\,{\color{#1f5ccc} n(n+1)/a^2}}\]
\(R\): everything known at \(t\) and \(t - \Delta t\); \(R_n^m\), \(\delta_n^{m,+}\): coefficients of \(Y_n^m\)
Semi-implicit: one Helmholtz problem per step, a division in spectral space
(Staniforth 1997, 35; ECMWF 2026, Sect. 2.2.7; Durran 2010, Sect. 8.2.3)
The truncation fixes the resolution; the grid only needs enough points for the products
(ECMWF 2026, Sect. 2.2.5–2.2.6; Malardel et al. 2016)
| Resolution | TCo1279: ~9 km, 137 levels up to 0.01 hPa |
| Spectral | wind, temperature, surface pressure; moisture and tracers on the grid |
| Advection | semi-Lagrangian: departure points and interpolation |
| Time step | semi-implicit, about 7 min |
| Ensemble | 50 + 1 members at 9 km |
| History | ECMWF’s first spectral model in operations: April 1983 |
The IFS: linear terms in spectral space, advection and physics on the grid, transforms every step
(ECMWF 2026; Malardel et al. 2016) · Configuration: confluence.ecmwf.int: Model information (Cy50r1)
Operations for one transform of one field (one time step) on a quadratic Gaussian grid, each curve divided by its value at T63: how fast each part grows, not which costs most.
Spectral transforms are global: their cost and communication grow faster than the grid
(Williamson 2007; Wedi et al. 2013)
Spectral models are not over: new ones keep coming, at kilometre scales
(Météo-France 2016; Yonehara et al. 2025; Figueroa et al. 2016; Krishna et al. 2025; Jiang et al. 2021; Döscher et al. 2022; Sela 1980) · GFS documentation
\[R = \frac{\partial u_N}{\partial t} + F(u_N), \quad \int_0^{2\pi}\! R\,e^{-ikx}\,dx = 0 \;\; (|k| \le N)\]
\(u_N = \sum_{|k| \le N}\hat u_k e^{ikx}\): the truncated field; \(F\): the space-derivative terms (here \(u\,\partial_x u\)); \(R\): the residual
The spectral method is a Galerkin method with global waves; finite elements use local functions
(Durran 2010, Sects. 6.1 and 6.2.3)
Notebooks 07a (open in Colab · download), 07b (open in Colab · download) and 07c (open in Colab · download): exercise 1 comes back in 07a, exercise 2 in 07c.
Spectral methods: exact derivatives and cheap implicit steps, at the price of global transforms
Reading: (Durran 2010, Ch. 6 and sec. 8.2; Ehrendorfer 2012; Williamson 2007; ECMWF 2026, Sect. 2.2.4)