Physicists from Berkeley say they've figured out the insanely complex math behind the way bubbles pop when they're in a foam — and they've got an extraordinarily accurate video to prove it.

The math behind a single bubble popping is relatively straightforward. Scale that up to a cluster of foamy soap bubbles, on the other hand, and you've suddenly got something that's considerably more complicated.

Unlike a single bubble that pops in isolation, clustered bubbles work off each other to produce a complex set of physical events that span both space and time. When one bubble pops, the other bubbles quickly rearrange themselves to balance out the cluster. This sets off a cascade of forces that influence the overall configuration of the cluster and the timing of subsequent pops.

Given all this complexity, physicists have struggled to accurately describe the behavior of foams with equations.

So, to capture all these layers of effects, researchers Robert Saye and James Sethian divided a foam’s lifecycle into three independent phases that could be mathematically modeled: rearrangement (how bubbles reorient themselves after a pop), drainage (accounting for the effect of gravity on a bubble’s ultra-thin membrane), and rupture (calculating the moment when the bubble pops).

In the video above, the scientists explain:

Liquid drains from the bubbles' thin walls until they rupture, after which the remaining bubbles rearrange, often destabilizing other bubbles, which subsequently pop. Note the sunset reflections. The research could help in modeling industrial processes in which liquids mix or in the formation of solid foams such as those used to cushion bicycle helmets.

They call it a scale-separated approach, one which allowed them to identify the important physics taking place in each of the distinct scales. The researchers were then able to take these equations for expression within a computer simulation. And for added realism, they also developed equations that described the way a sunset would look when reflected in bubbles.

Interestingly, it took five days for supercomputers at the Department of Energy's National Energy Research Scientific Computing Center to churn through each layer of equations to produce the simulation.

Read the entire study at Science: “Multiscale Modeling of Membrane Rearrangement, Drainage, and Rupture in Evolving Foams.”

Image: Saye & Sethian, UC Berkeley/LBNL.