🫧 Foam Drainage — Plateau Borders & Laplace Pressure
Liquid drains from foam through Plateau border channels. Laplace pressure differences drive flow, while disjoining pressure stabilises thin films. Watch coarsening and bubble collapse.
About this simulation
This simulation models foam drainage — the way liquid trapped between bubbles gradually flows downward through the network of Plateau border channels that form wherever three soap films meet. A 2D Voronoi diagram builds the bubble network from random seed points, each cell tracks its own water content and effective radius, and Laplace pressure differences between neighbouring bubbles (P = γ/r) drive flow along the shared borders until thin films rupture and bubbles coarsen together.
🔬 What it shows
A live Voronoi foam of polygonal "bubbles", each coloured by its water content — brighter, more saturated cells are wetter. Liquid flows between neighbouring cells according to their Laplace pressure difference (Pi = γ/ri), gravity slowly drains liquid toward the bottom of the screen, and when a shared film thins below the critical thickness hcrit the two bubbles rupture and merge, which is exactly how real foam coarsens over time.
🎮 How to use
Drag Surface tension γ, Drainage rate κ and Critical film hcrit to change how fast liquid moves and how readily films rupture, or use Bubble count to rebuild the foam with more or fewer cells. Click or tap anywhere on the canvas to inject extra liquid into the nearest bubble and watch it drain into its neighbours. Pause/Resume and Reset are available in the HUD, and the ⓘ info button opens a modal with the underlying algorithm and key equations.
💡 Did you know?
Joseph Plateau worked out the geometric rules that govern soap-film networks — three films always meet at 120°, four Plateau borders always meet at the tetrahedral angle of 109.47° — despite having gone blind decades before finishing this work. The same rules shape everything from a pint's head to the packing of biological cells.
Frequently asked questions
What exactly is being drawn on screen?
Each polygon is a bubble in a 2D Voronoi foam generated from randomly placed seed points. Its fill colour encodes water content (darker and less saturated when dry, brighter cyan/blue when wet), the border thickness also grows with water content to suggest a thicker film, and small glowing dots at each vertex mark the Plateau borders where three films meet.
How does the simulation move liquid between bubbles?
Every bubble gets a Laplace pressure P = γ/r from its surface tension γ and effective radius r — smaller bubbles have higher pressure. For every pair of neighbouring bubbles the flow is Q = κ·(P_i − P_j)·Δt, moving water from the higher-pressure (smaller) bubble to the lower-pressure (larger) one each frame, on top of a small constant gravity term that drains liquid toward the bottom of the canvas.
What triggers a bubble merge?
The model estimates a film-thickness proxy between each pair of neighbours from their combined water content divided by the distance between their centres. When that value drops below the Critical film hcrit slider, the shared film is treated as ruptured and the two bubbles are merged into one larger cell with combined area and water — visually this is foam coarsening, the same process by which real bubbles disappear and neighbours grow.
What do the Surface tension, Drainage rate and Critical film sliders control?
Surface tension γ scales every bubble's Laplace pressure, so higher γ produces stronger pressure gradients and faster flow. Drainage rate κ is a direct multiplier on the flow between neighbours, so it speeds up or slows down the whole simulation. Critical film hcrit sets the rupture threshold — raise it and films rupture (and bubbles merge) far more readily, producing a drier, more chaotic foam.
Is this a physically exact foam simulation?
No — it is a simplified, qualitatively faithful model built for intuition rather than a full solution of the foam drainage equation or real 3D Plateau border geometry. The Voronoi cells approximate bubble shapes, radius and water content are proxies for true curvature and film thickness, and the pairwise flow/rupture rules capture the right trends (drainage from small to large bubbles, coarsening via rupture) without solving the underlying continuum equations exactly.
Liquid drains from foam through Plateau border channels. Laplace pressure differences drive flow, while disjoining pressure stabilises thin films. Watch coarsening and bubble collapse.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install