The Phase Map simulates an $N \times N$ grid of pendulums in parallel. Each pixel is one independent starting condition $(\theta_1, \theta_2)$ with $\omega_1 = \omega_2 = 0$.
All state lives in a single GPU storage buffer. Each pendulum occupies 8 × f32 (32 bytes):
slot: [0] [1] [2] [3] [4] [5] [6] [7]
field: θ₁ ω₁ θ₂ ω₂ flipCount firstFlipTime elapsed frozen
One WGSL compute thread per pendulum, workgroup size 256. At $800 \times 800$ (640,000 pendulums) that is 2,500 workgroups per dispatch, all running in parallel on the GPU. Each thread runs its own RK4 loop for $N$ steps and writes results back in-place. No inter-thread communication is needed.
Flip detection runs inside the per-step loop. A "flip" occurs when the lower bob passes over the top, detected when $\sin(\theta_2)$ changes sign while $\cos(\theta_2) < 0$:
$$\sin(\theta_2^{\text{prev}}) \cdot \sin(\theta_2^{\text{new}}) < 0 \;\text{ and }\; \cos(\theta_2^{\text{new}}) < 0$$
firstFlipTime is recorded once and never overwritten. A separate reinit shader resets the buffer on resolution or region change, avoiding a 20 MB CPU→GPU upload.
Coloring modes:
Time to first flip: each pixel's color encodes firstFlipTime. The boundary between fast-flip and slow-flip regions is fractal: a one-pixel shift in initial angle can double the flip time.
Live $\theta_2$: pixels colored by the current lower angle through a palette. Colors evolve continuously as the simulation advances, revealing the flow structure of phase space.