Flow Lab

Syllabus / Part III — Partial Differential Equations

Module 10

Numerical Methods for PDEs

From the 5-point stencil to multigrid: finite differences, stability analysis, advection schemes, elliptic solvers, finite volumes, spectral and finite element methods.

Builds on: Module 2 — Multivariable & Vector Calculus, Module 9 — Classical PDEs: Heat, Waves & Potentials, Module 4 — Numerical Methods for ODEs — The Theory, Module 8 — Boundary Value Problems & Fourier Series, Module 1 — Linear Algebra, Reloaded

  1. Grids, stencils, deriving FD formulas from Taylor series, truncation error, the discrete Laplacian, and grid convergence studies.

    🌊 Every grid-based fluid solver (including Stam's) is built from these stencils.

  2. FTCS (forward-time centered-space), method of lines, the stability limit Δt ≤ Δx²/(2α), and watching instability explode.

    🌊 Why Stam calls naive explicit diffusion 'unstable' — and why he switches to an implicit solve.

  3. Fourier modes on a grid, amplification factors, stability conditions, and the Lax equivalence theorem.

    🌊 Von Neumann analysis was invented for fluid simulations at Los Alamos.

  4. Backward Euler in time (BTCS), Crank–Nicolson, tridiagonal systems and the Thomas algorithm, ADI for 2D.

    🌊 Implicit viscosity is standard in fluid solvers for large time steps.

  5. Leapfrog for waves, the Courant–Friedrichs–Lewy condition, numerical dispersion, and absorbing boundaries.

    🌊 The CFL number dictates the time step in essentially every explicit CFD code.

  6. Why centered differences fail for advection; upwind, Lax–Friedrichs, Lax–Wendroff; numerical diffusion vs dispersion; flux limiters.

    🌊 Numerical diffusion is why simulated smoke looks blurry — the motivation for higher-order advection.

  7. Stam's key idea: trace particles backward and interpolate. Unconditional stability, interpolation choices, MacCormack/BFECC corrections.

    🌊 This is the 'advect' step of Stable Fluids, built from scratch.

  8. Solving Poisson's equation on a grid: the matrix structure, Jacobi, Gauss–Seidel, red-black ordering, SOR, convergence rates.

    🌊 Stam's 'lin_solve' routine is Gauss–Seidel; the pressure solve is the bottleneck of every incompressible solver.

  9. 10.9

    Multigrid

    open

    Why Jacobi kills high frequencies but not low ones; coarse-grid correction; V-cycles; near-optimal O(N) Poisson solves.

    🌊 Production fluid solvers use multigrid or multigrid-preconditioned CG for pressure.

  10. Cell averages and fluxes; conservative discretization; Godunov's method and Riemann problems; finite volumes on unstructured meshes.

    🌊 OpenFOAM, ANSYS Fluent and most industrial CFD codes are finite-volume codes.

  11. Collocated vs staggered grids, checkerboard pressure, MAC layout, ghost cells, no-slip/free-slip/inflow/outflow boundaries, obstacles.

    🌊 The MAC grid (Harlow & Welch, 1965) is the standard layout for incompressible solvers — and what you'll use in the wind tunnel.

  12. Representing solutions in Fourier modes; spectral differentiation; pseudo-spectral methods; aliasing and dealiasing.

    🌊 Stam's 'FFT fluids' and turbulence research codes are spectral.

  13. Weak forms, basis 'hat' functions, assembling a stiffness matrix, 1D and 2D triangular elements, and when to choose FEM.

    🌊 Structural analysis of an airframe (and some CFD) uses finite elements.