structural:reformatting, stylistic:style_transfer
Foams are two-phase material systems where a gas is disbursed in a second, non-gaseous material, specifically, in which gas cells are enclosed by a distinct liquid or solid material. The foam "may contain more or less liquid according to circumstances", although in the case of gas-liquid foams, the gas occupies most of the volume. The word derives from the medieval German and otherwise obsolete veim, in reference to the "frothy head forming in the glass once the beer has been freshly poured" (cf. ausgefeimt).

Theories regarding foam formation, structure, and properties—in physics and physical chemistry —differ somewhat between liquid and solid foams in that the former are dynamic (e.g., in their being "continuously deformed"), as a result of gas diffusing between cells, liquid draining from the foam into a bulk liquid, etc. Theories regarding liquid foams have as direct analogs theories regarding emulsions, two-phase material systems in which one liquid is enclosed by another.

In most foams, the volume of gas is large, with thin films of liquid or solid separating the regions of gas. A bath sponge and the head on a glass of beer are examples of foams; soap foams are also known as suds.

Solid foams can be closed-cell or open-cell. In closed-cell foam, the gas forms discrete pockets, each completely surrounded by the solid material. In open-cell foam, gas pockets connect to each other. A bath sponge is an example of an open-cell foam: water easily flows through the entire structure, displacing the air. A sleeping mat is an example of a product composed of closed-cell foam.

Foams are examples of dispersed media. In general, gas is present, so it divides into gas bubbles of different sizes (i.e., the material is polydisperse)—separated by liquid regions that may form films, thinner and thinner when the liquid phase drains out of the system films. When the principal scale is small, i.e., for a very fine foam, this dispersed medium can be considered a type of colloid.

Foam can also refer to something that is analogous to foam, such as quantum foam.