FLOW LAB
A laboratory for dynamical systems

Helmholtz–Hodge, in motion.

Pull apart a flow. Add noise. Find out what stays the same.

Three experiments
One connected idea
01 / Helmholtz–Hodge decomposition

One field. Three different kinds of motion.

The arrows describe a velocity at every point. Split a random smooth field into a gradient part, a solenoidal part and a harmonic part. Adjust their strengths to rebuild the total.

Seed 42 · 12 Fourier modes
Try
Periodic domain · opposite edges join
Total field f
The pointwise sum of all three fields.
Gradient −∇φ
Flows downhill in φ. Curl is zero.
Solenoidal R∇ψ
Follows contours of ψ. Divergence is zero.
Harmonic h
Uniform transport. Curl and divergence are zero.
Arrows share one linear scale. Tracers follow each field independently; their paths do not add. All coordinates and times are dimensionless.
Gradient share of squared field norm
—
Solenoidal / harmonic shares
—
Reconstruction error · relative L²
—
RMS curl(gradient) / div(solenoidal)
—
A complicated flow can be a simple sum.

The blue part organises motion down a potential; the green part moves along its own stream-function contours; the amber part carries everything across the periodic domain.

Try thisTurn off the gradient. The flow can still move and circulate, but it no longer locally compresses area. Then leave only the harmonic part: motion survives even though both curl and divergence vanish.
THE INTUITION

Downhill, around, and across

A landscape gives you a downhill direction. A stream function gives you contour-following motion. A periodic domain also permits a constant current around the whole space. The decomposition separates these geometries.

WHAT “RANDOM” MEANS HERE

A random field, fixed in time

Each seed creates smooth, arbitrary vector-valued Fourier coefficients. The field is then projected into its components. These tracers have no noise; randomness enters when the field is created. Experiment 02 adds ongoing stochastic forcing.

THE BOUNDARY MATTERS

This square is a flat torus

Leaving one edge brings a tracer back at the opposite edge. Under these periodic conditions, the harmonic field is the spatial mean. Other domains and boundary conditions can give a different harmonic part and a different split.

The decomposition, step by step Equations & definitions
f(x) = −∇φ(x) + R∇ψ(x) + h
f, x
The velocity field and a point in the two-dimensional state space. A tracer obeys dx/dt = f(x).
φ
A scalar potential. Its gradient points uphill; the minus sign makes this part point downhill.
ψ, R
A scalar stream function and a 90° anticlockwise rotation: R(a, b) = (−b, a). Rotating ∇ψ makes the flow tangent to contours of ψ.
h
The constant mean field on this flat periodic domain. It cannot be absorbed into a single-valued periodic potential.

In two dimensions, divergence is ∂xfx + ∂yfy: local expansion or compression. Scalar curl is ∂xfy − ∂yfx: local rotation. Mixed partial derivatives cancel, so

curl(−∇φ) = 0,   ∇·(R∇ψ) = 0,   curl h = ∇·h = 0.

How the random field is actually decomposed

For every nonzero wavevector k, project the field’s Fourier coefficient f̂(k) parallel to k and perpendicular to k. The zero-frequency coefficient is the harmonic part. This finite Fourier projection is exact up to floating-point arithmetic; the animation uses a grid only for drawing arrows.

ĝ(k) = kkT|k|2f̂(k),   ŝ(k) = f̂(k) − ĝ(k),   h = f̂(0)

The sliders multiply the projected components before summing them. Because the components are orthogonal under the spatial L² inner product on this domain, their squared norms add: ‖f‖² = ‖g‖² + ‖s‖² + ‖h‖². The displayed percentages use this mathematical norm; they are not a claim about physical energy.

Two different potentials. The gradient part follows φ; the solenoidal part follows contours of ψ. In a general Helmholtz–Hodge decomposition, ψ need not equal φ, and the two vector components need not be perpendicular at each point. Their orthogonality here is an integral over the domain.
Why “downhill” and “incompressible” are precise claims
For dx/dt = −∇φ:   dφdt = −|∇φ|² ≤ 0.

The potential cannot increase along pure gradient flow. This does not require divergence to be negative everywhere: a gradient field may locally expand near a maximum while still descending in φ.

For dx/dt = R∇ψ:   dψdt = ∇ψ·R∇ψ = 0.

Antisymmetry gives contour-following motion. Zero divergence also preserves infinitesimal area under the deterministic flow. Neither statement means that every divergence-free field conserves every physical energy you might assign to it.

Numerical notes

The domain is [−π, π)². Twelve independent integer wavevectors carry seeded random sine and cosine vector coefficients, with high frequencies attenuated for smoothness. The mean flow points along (1, 0.35). Diagnostics use analytic mode derivatives and a 32 × 32 quadrature grid. Tracers use fourth-order Runge–Kutta steps with periodic wrapping; their finite trails are illustrative, not a density estimator.