An interactive Geophysical Fluid Dynamics Textbook Notation

Ch 22. Hamiltonian & variational GFD

Overview

Integrate the same vortex system with a humble 2nd-order method and with classical RK4, and watch the energy: RK4’s error is far smaller — and grows forever — while the cruder method’s error, if the method carries the right geometry, stays bounded until the end of time. The geometry is Hamiltonian structure, and this chapter uses it to answer a question the whole book has leaned on without answering: GFD’s conservation laws are Noether charges of symmetries, and PV — the book’s central quantity since Ch. 7 — is the charge of the fluid’s own peculiar symmetry, particle relabeling.

The model

Notebook: notebooks/ch22_hamiltonian-gfd.py → exported to /nb/ch22_hamiltonian-gfd.html. Governing equations use the symbols in notation.

Γidxidt=∂H∂yi,Γidyidt=−∂H∂xi,H=−14π∑i<jΓiΓjln⁡rij2.\Gamma_i\frac{dx_i}{dt}=\frac{\partial H}{\partial y_i},\qquad \Gamma_i\frac{dy_i}{dt}=-\frac{\partial H}{\partial x_i},\qquad H=-\frac{1}{4\pi}\sum_{i<j}\Gamma_i\Gamma_j\ln r_{ij}^2.

gfdlib.vortex implements the Kirchhoff point-vortex system — an exact finite-dimensional Hamiltonian reduction of 2D Euler in which positions themselves are the conjugate pair — with its four Noether invariants (H, Q, P, L), a symplectic implicit-midpoint integrator, and a same-order non-symplectic control (Heun). Known solutions (co-rotating pair period, dipole translation speed) are verified in the test suite.

Prefer to run it yourself? Download as a Jupyter notebook — it installs its own dependencies in the first cell. The sliders are static in Jupyter; edit value= and re-run to change a parameter.

Both fluids

Exercises

  1. (analytic) Verify by direct differentiation that Kirchhoff’s H=−14π∑i<jΓiΓjln⁡rij2H=-\frac{1}{4\pi}\sum_{i<j}\Gamma_i\Gamma_j\ln r_{ij}^2 generates exactly gfdlib.vortex.vortex_rhs through Γix˙i=∂H/∂yi\Gamma_i\dot x_i=\partial H/\partial y_i, Γiy˙i=−∂H/∂xi\Gamma_i\dot y_i=-\partial H/\partial x_i, and show ddt∑iΓixi=0\frac{d}{dt}\sum_i\Gamma_ix_i=0 directly from the antisymmetry of the double sum.
  2. (computational) Modify ch22_hamiltonian-gfd.py to add leapfrog applied naively to (x,y)(x,y) as a fourth method. It fails (leapfrog’s symplecticity requires a separable Hamiltonian, and Kirchhoff’s is maximally non-separable) — document how it fails compared to Heun.
  3. (exploratory) For the chaotic 4-vortex configuration, find the (Δt,T)(\Delta t, T) combination at which RK4’s secular energy error first crosses above midpoint’s bounded band. How does that crossing time scale as you halve Δt\Delta t? (Prediction: RK4’s error ∼Δt4t\sim\Delta t^4t, midpoint’s band ∼Δt2\sim\Delta t^2, so t×∼Δt−2t_\times\sim\Delta t^{-2}.)

Further reading

Salmon, R. (1988), Ann. Rev. Fluid Mech. 20, 225–256 (“Hamiltonian fluid mechanics”); Salmon, Lectures on Geophysical Fluid Dynamics, ch. 7; Shepherd, T. G. (1990), Adv. Geophys. 32, 287–338; Aref, H. (1983), Ann. Rev. Fluid Mech. 15, 345–389 (point-vortex motion); Hairer, Lubich & Wanner, Geometric Numerical Integration 2nd ed., ch. VI (symplectic methods, backward error analysis).