Why this is not curl noise — create, sampleMany, sampleGrad

Curl noise takes a noise potential and finite-differences its curl: divergence-free up to the truncation error of the stencil, on the grid it was differenced on. This field is a closed-form curl, so ∇·u = 0 is an identity you can measure at any point, at any scale, with no grid anywhere. The consequence stated all over this repo is that advected ink stretches and folds but is only ever rearranged — it never piles up and never tears open a void. That claim is worth nothing without something to compare it to, so the right-hand panel is the same field with its divergence dialled up until you can photograph it.

Both panels start from the identical particle set, run the identical RK4 integrator at the identical step, and read their velocities from the identical HelixNoise.create field. The only difference is a post-transform applied to the sampled velocity on the right: scale uz multiplies the third component by 1−s, which makes ∇·u = −s·∂zuz; + ∇φ adds s·∇(cos x + cos y + cos z), a pure gradient — the exact opposite of a curl. The library cannot produce either one; they are built on this page, on purpose, by breaking the field it does produce. Drag break to 0 and the right column of the table collapses onto the left, which is the point: this is one code path with a knob, not a passing panel and a separate failing one.

helix field · exactly ∇·u = 0
—
control · ∇·u ≠ 0
—

Receipts — measured this frame, both panels, same code

—
quantityhelix fieldcontrol
max |tr ∇u| ⁄ max ‖∇u‖F, from sampleGrad — the trace of the velocity gradient is the divergence. Pass < 1e−12. ——
max |∇·u| ⁄ max ‖∇u‖F, central differences of sample, h = 1e−3 — independent of the gradient routine, so it cannot be zero by construction. Its floor is the O(h²) truncation error, not the field. Pass < 1e−5. ——
worst |det F − 1| over 32 tracers — F is the deformation gradient carried along a trajectory by dF/dt = (∇u)·F, integrated with the same RK4. Volume ratio of a transported blob; det F ≡ 1 exactly when ∇·u ≡ 0. Pass < 1e−4. ——
particle occupancy σ⁄μ over 8³ cells of the box — — particles seeded uniformly at random; a measure-preserving flow map leaves them uniform forever, so this should sit on the Poisson floor — and not move. ——
occupancy max ⁄ min over the same cells — the same statistic in the cruder form: how much fuller is the fullest cell than the emptiest. An empty cell counts as 1, so this saturates rather than dividing by zero. ——
max |xcontrol − xhelix| over all — particles — how far the two experiments have actually separated. Exactly 0 on a run started at break = 0: same seed, same step, same integrator, one experiment. ——

Two honest notes about the numbers. The finite-difference row is the one that matters most: checking tr ∇u from sampleGrad alone would only prove the gradient routine is internally consistent, so the second row differences sample itself and reads its own truncation floor of about 3e−7 — six decades below the control, and nowhere near zero. And the det F row is a statistic of the integrator as much as of the field: the residual on the left is RK4 error and floating-point cancellation in a matrix whose entries have already stretched by two to three decades, not a defect in ∇·u. Neither number is ever exactly zero, and that is how you can tell they were actually computed.

—