// Notes

Why Bubbles Refuse to Rise Straight (And Why I Took Half of Munich's Supercomputer to Figure It Out)

The next time you are staring into a glass of beer, watch the bubbles for a second. A coin dropped into a fountain does the polite thing: it falls straight down, gravity wins, end of story. A bubble, for reasons known only to bubbles and people who make their lives unnecessarily difficult, does not. It wobbles, zigzags, and sometimes climbs in a strangely elegant spiral.

That is such a familiar little bit of physics that it barely registers as a mystery. But it really should. If heavy things fall straight down, why do light things not rise straight up? Why does nature insist on taking the scenic route?

It turns out this is one of those problems that looks harmless right up until you try to simulate it. In my case, that eventually led to a full day on SuperMUC, Germany's largest supercomputer at the time, just to get a digital bubble to behave like the ones in a drink.

The annoying part: light particles are numerically difficult

In fluid dynamics, simulating something light can be absurdly heavy work. An air bubble in water has a particle-to-fluid density ratio in the neighborhood of 0.001. That is physically simple enough to describe and computationally rude enough to ruin your day.

The problem is numerical instability. If the simulated particle is too light, even tiny forces from the surrounding fluid can produce wildly exaggerated reactions. The solver overcorrects, the bubble shoots off into digital nonsense, and the simulation collapses before anything interesting happens.

The core issue is that the bubble has almost no mass of its own, so it has no real momentum buffer. Every small push from the fluid can kick off a feedback loop. The math does not gently drift into being wrong. It detonates.

The trick: make the bubble heavier without lying about the physics

The way out was a bit of mathematical sleight of hand called the virtual mass approach.

The short version is that we temporarily pretend the bubble is heavier than it really is by adding numerical mass. That extra mass stabilizes the computation and makes the object far easier to track. If that sounds suspiciously like cheating, that is because it would be, if we stopped there.

So we do not stop there. We also introduce a counteracting virtual force that corrects the motion again, which lets the bubble behave like a bubble instead of a glorified marble. The simulation becomes stable without throwing away the underlying physics.

I implemented this in waLBerla, which is a very capable high-performance C++ framework and not, in my experience, a place where anything happens by accident.

The other trick: spend detail where the chaos actually is

Even with the bubble stabilized, there is still the small matter of cost. Simulating an entire tank of water at high resolution is a good way to convert electricity into regret. So instead of resolving the whole domain equally, we used adaptive grid refinement. The simulation sharpened the mesh exactly where things got interesting, especially in the bubble wake, and kept the rest of the domain comparatively coarse. In practice, that meant we spent computational effort where the flow was unstable and avoided wasting it where nothing much happened.

That alone gave us a 71x speedup compared to running the full domain at high resolution everywhere. Which is the sort of improvement that makes you briefly believe you are a serious person.

Adaptive refinement concentrates detail around the wake instead of wasting resolution on the whole domain.

The payoff: the weird paths were real

Once the math stopped exploding and the grid started adapting, the results became much more fun.

The bubbles moved through distinct motion regimes. At some velocities, they settled into a planar zigzag, rocking from side to side while shedding vortices into the wake behind them. At higher speeds, that zigzag deformed into helical motion and the bubble started tracing a corkscrew through the liquid.

The satisfying part was that these trajectories were not just visually nice. They matched laboratory observations remarkably well. The wobbling bubble in a glass is not being whimsical. It is following a fairly intricate geometric response to forces like buoyancy and viscosity.

A higher-speed regime where the bubble path deforms into the more dramatic motion described above.

There is something deeply pleasing about using a supercomputer to confirm that a beer bubble is, in fact, doing something complicated on purpose.

What I still use from this

Today I work in product and UX, which on the surface has very little to do with fluid-solid coupling. But the underlying habit of mind transfers surprisingly well.

In both cases, you are looking for instability. In one system, a feedback loop makes the math explode. In the other, it makes users drop off, hesitate, or get stuck. The job is not to force everything into a straight line. It is to understand where the friction lives, find the mechanism that stabilizes the system, and build enough structure around the chaotic part that the whole thing keeps moving.

That was true for bubbles. It is also true for products.

And yes, if you ever get the chance to reserve half a supercomputer for 24 hours just to watch a bubble spiral properly, you should take it. Some opportunities are too educational to decline.


Found an issue or want to have a chat? Please shoot me a quick email
!
Photo of Lukas
Written by Lukas Werner

Former iPhone hacker turned product-minded developer. I've scaled startups, blocked supercomputers with fluid simulations, and helped digitize governments. Currently crafting user experiences people actually love from Barcelona.