Flow Lab

Syllabus / Part II — Ordinary Differential Equations

Module 4

Numerical Methods for ODEs — The Theory

You've coded Euler and RK45; now learn why they work: error analysis, stability regions, stiffness, adaptivity and structure-preserving integrators.

Builds on: Module 3 — First-Order ODEs, Module 2 — Multivariable & Vector Calculus, Module 1 — Linear Algebra, Reloaded

  1. Taylor-series analysis of one-step methods: truncation error, accumulation into global error, order of accuracy and convergence plots.

    🌊 A '2nd-order accurate' fluid solver halves its error 4× when you halve the grid spacing — verifying this is how solvers are tested.

  2. Explicit and implicit Euler, improved Euler (Heun) and midpoint — derivations, orders and first look at stability on y' = λy.

    🌊 Stam's 'stable fluids' uses implicit (backward Euler) diffusion so it never blows up.

  3. Deriving RK2, the classical RK4, the Butcher tableau notation, order conditions, and why RK4 is the workhorse.

    🌊 RK3/RK4 are standard for time-stepping advection in CFD and for tracing particles.

  4. Embedded Runge–Kutta pairs (Fehlberg, Dormand–Prince), error estimation, step-size control, tolerances, dense output.

    🌊 Adaptive time stepping in CFD picks dt from the CFL number — a physics-based version of the same idea.

  5. Absolute stability regions in the complex plane, A-stability, stiff equations, and why implicit methods win for stiff problems; Newton's method in implicit steps.

    🌊 Viscous terms on fine grids make fluid equations stiff — the reason for implicit diffusion solves.

  6. Adams–Bashforth and Adams–Moulton families, starting values, zero-stability and the Dahlquist barriers.

    🌊 Many CFD codes advance nonlinear terms with Adams–Bashforth and viscous terms implicitly (IMEX schemes).

  7. Why RK4 makes planets spiral away: Hamiltonian systems, energy drift, symplectic Euler, Störmer–Verlet/leapfrog.

    🌊 SPH and particle-based fluid simulators use leapfrog/Verlet integration.