When cooking pasta, some organic foam usually forms on the surface of the boiling water and the situation can be kept under control by adjusting the heat (and/or adding some oil). Covering the pot with a lid, even loosely so, usually leads to the foam overflowing within a short time (removing the lid fixes the problem). Everybody knows that - the question is why?

It seems to me that the only variable that changes noticeably when adding the lid is the vapor pressure but I don't see how that should affect the foaming process.

-
I would guess that without the lid, the vapor is moving rather quickly and escapes from the pot, constantly disrupting and destroying the emerging bubbles of foam. With the lid, the vapor motion slows down and the membranes of the foam have a more time to peacefully form, and ultimately overflow. – Luboš Motl Jan 24 '12 at 11:03
@LubošMotl I doubt that the kinetic energy from the vapor is enough to destroy the foam so effectively. I'll try to work out the numbers and check the orders of magnitude. – calys Jan 24 '12 at 11:36

The interior of the bubbles is mostly steam. When you raise the lid cold (well, below 100C) air flows in and the steam in the bubbles condenses and collapses the bubbles.

I don't know of anyone who has done the experiment, but you should find if you lift the lid when the outside temperature is 100C or greater the foam will not collapse, or at least it will collapse more slowly. Presumably you'd still get evaporation from the foam surface.

Edit: just out of curiosity I worked out how much air would have to enter the pan to condense the steam in the foam.

Density of steam at atmospheric pressure $\rho_s$ = 5.90e-4 g/cm3

Latent heat of steam at atmospheric pressure = 2.26 kJ/g = 0.00133 kJ/cm3

Suppose your pan contains 100cm3 of steam in the foam then the heat given off when you condense it to water at 100C is 0.133kJ.

The specific heat of air is about 1 J/(g.K) so assuming the air in your kitchen is about 20C, i.e. a temperature change of 80C when it hits the steam, you need 1.66g of air. The density of air is about 1.2g/litre so you need about 1.4 litres of air to fully condense the steam. I must admit that this seems a lot.

However you probably don't have to condense all the steam to collapse the foam. I suspect (but can't prove) that condensing the steam just inside the bubble wall would be enough to destabilise it and cause the bubble to break. The remainder of the steam in the bubble would simply escape and wouldn't need to be condensed, so the volume of air needed would be greatly reduced. Still, I have to concede that evaporation could well be an important factor.

-
Since the pressure beneath the lid is (slightly) larger than the outside, if I remove the lid very slowly, then I shouldn't expect any cold air to enter in contact with the bubbles, right? I'll do the experiment but my gut feeling is that this story has little to do with temperature (everything being very close to 100C). My bet would be on vapor concentration, humidity, and evaporation rate. Maybe with the lid on the evaporation rate is much lower than with the lid off (because of the difference in air humidity around the foam), leading to a lower collapse rate for the bubbles? – calys Jan 24 '12 at 11:42
You can't have evaporation of the bubbles unless air enters the pan, because the air in the pan is (super)saturated with steam. If air enters the pan then it will inevitably cause a temperature drop as well as evaporation. That makes it very hard to separate the two effects. The obvious experiment would be to place a thermocouple at some suitable place in the foam and try and correlate any temperature changes with the foam collapse. – John Rennie Jan 24 '12 at 12:07
Very interesting... I wish there was an easy way to increase the air temperature around the pan to about 100C without changing the humidity. Then I could see if that affects the foam or not. – calys Jan 24 '12 at 13:25