These benchmarks were run in 2019 and reflect Julia and FFTW versions from that era. Modern improvements to the Julia compiler and FFTW library may have changed the relative performance of these methods. The algorithmic principles (memory layout, in-place operations, FFT planning) are timeless, but the concrete speedup factors may differ on your system.
This chapter demonstrates how to solve a 2D rotation advection problem using spectral methods in Julia. The problem serves as an excellent case study for:
The rotation problem is physically intuitive (something just spins), mathematically elegant, and computationally useful for benchmarking numerical schemes.
The 2D advection equation with a rotational velocity field is:
\[\frac{\partial f}{\partial t} + \left(y \frac{\partial f}{\partial x} - x \frac{\partial f}{\partial y}\right) = 0\]
This equation describes how a scalar quantity \(f(x, y, t)\) evolves under a velocity field that causes pure rotation:
\[\vec{v} = (-y, x)\]
This velocity field creates counter-clockwise rotation around the origin with angular velocity \(\omega = 1\) rad/time-unit.
For a smooth initial condition \(f(x, y, 0) = f_0(x, y)\), the exact solution is obtained by rotating the initial condition:
\[f(t, x, y) = f_0(x \cos(t) + y \sin(t), -x \sin(t) + y \cos(t))\]
This means the field at time \(t\) is the initial field rotated counter-clockwise by angle \(t\).
Domain Definition
\[x \in [-\pi, \pi], \quad y \in [-\pi, \pi], \quad t \in [0, 200\pi]\]
Note: \(t \in [0, 200\pi]\) means the domain spins through 100 complete rotations. This long simulation time tests: