Why is it so easy for coffee to splash out of a cup when carrying it, even if you don't fill the cup all the way up? University of California engineers decided to tackle this curiosity after watching attendees at a fluid dynamics conference (where else?) struggle with rushing from room to room while precariously carrying mugs filled with hot coffee. In a laboratory experiment, they monitored the pace of subjects walking at different speeds, each carrying a coffee cup with sensors to detect the level of spillage.
It turns out that the fluid dynamics of coffee in a cylindrical cup are significantly affected by the gait of the person who's holding it. The surface of a cup of coffee oscillates as other liquids do in a container, in a waveform determined by variables such as the diameter of the cup. The amplitude or height of that wave can rise or fall depending on the cup's frequency of movement. The coffee itself also has a natural frequency, which the engineers found that for a standard-size coffee cup just so happens to match up with the frequency of movement for a person at walking pace. That means that just the natural motion of steady walking is enough to cause the coffee to resonate and rise above the cup's edge. But not everyone has the same gait or walks with the same speed, nor are all coffee cups the same size. The study found that spillage also occurs because of subtle changes in a person's gait--an irregular pace or sudden hand motions will cause fluctuations in the wave oscillation. This creates sloshing, which has enough of an effect in the relatively small area of a coffee mug to incite spillage.
So how do you stop from spilling coffee? The answers are obvious: paying attention to the cup as you're walking allows you to monitor the coffee surface waveform and make adjustments to compensate for sloshing, such as slowing down your pace or steadying your hand. Filling the cup with less coffee also works--the engineers calculated that the gap between the top of the mug and the coffee should be at least one-eighth the diameter of the mug, or about a centimeter for most mugs. They also pointed out that changing the shape of the mug could also help. The addition of an inward-facing lip on the rip of the cup would prevent spillage, but that would make drinking out of the cup a little more inconvenient. The best time-tested solution? Put a lid on it.