Ripples

Python on the GPU · Fun & games

Each step of the wave equation is wave(), a Python function compiled to a WebGPU compute shader. Click or drag to drop a stone. In Double slit a plane wave from the top meets a wall with two gaps; the two gaps send out circles that overlap and make bands of crests and troughs.

0.2%/step
– cells– fps
checking GPU against CPython…
The grid is 512 cells across. Its outer edge absorbs waves, and the wall holds still. Dark is a trough, pale is a crest, and the light comes from the upper left.