Almost every morning, I start the day with an experiment on flow in porous media. First, I generate some fine-grained sediment with a well-defined average grain size and proper sorting; then I use that sediment to fill a little basin of sort and try to mimic compaction. Finally, I use a machine to put water under pressure and force it to flow through this miniature sedimentary basin. Then I sit down to drink the fluid which is not simple water anymore, due to its interaction with the grains; and its taste and consistency tell me whether I got the grain size and the porosity right.
That's a geologist's view of making espresso. Unless you have a fully automated and ultra-expensive espresso machine, creating a high-quality caffeine concoction is not trivial, because the water must have the right temperature and has to spend the right amount of time in contact with the coffee grains that have the right size. The right temperature is 85–95 °C (185–203 °F), and, at least with our simple machine, the trick is to start the brewing at the right time. Better espresso machines do not use steam to generate pressure because that makes the water too hot; instead, they have a motor-driven pump that generates the ~9 bars of pressure. The correct grain size is easily achieved with a burr grinder (as opposed to a simple blender); a good espresso grind is a fine grind, because the water spends relatively little time in contact with the grains.
The duration of this contact is the most difficult bit to get right. To get a good shot with lots of crema, it cannot be less or more than 20 to 30 seconds. Not just grain size, but grain sorting as well play a role. If the coffee grinder produces a poorly sorted 'sediment' (and that's what a blender does), the coffee will not be porous and permeable enough. Another factor is how well the sediment is compacted; that is, how much pressure do you apply to the coffee during tamping. This affects permeability again. Finally, it matters how much coffee you put in the coffee holder; the thicker the layer that the water has to go through, the longer the trip becomes for the same amount of water.
After using the machine hundreds of times, I still manage from time to time to produce something undrinkable. The art and science of espresso making started to make more sense once I started to think of it in terms of Darcy's Law.
Henry Darcy was a French engineer who initially had made a name for himself by designing an enclosed and gravity-driven water-supply system for the town of Dijon. Later he had time and opportunity to do experiments of his own interest. In 1855 he measured the discharge of water under variable hydraulic heads through sand columns of different heights, and found that the discharge was directly proportional with the hydraulic head and inversely related to the height of the sand column:
where A is the cross sectional area of the sand column, L is the height of the sand column, K is the hydraulic conductivity (which is constant for the same granular material and same fluid), and H1-H2 is the hydraulic head. This is Darcy's drawing of his experimental setup:
The hydraulic conductivity depends on both the properties of the fluids and of the granular material; these properties are the viscosity and density of the fluid, and the permeability of the sediment:
where K = hydraulic conductivity, k = permeability, ρ = fluid density, and μ is the dynamic viscosity.
In coffee speak, the hydraulic head is given by the pressure generated by the machine, and is fixed; one cannot change the density and viscosity of water either. The most important variable is coffee permeability, which is influenced by size, sorting, and packing (compaction) of the coffee grains. Also, it helps if you get the value of L right, that is, you shouldn't try to save coffee.
Darcy's Law was established with some simple experiments, and it has since then been generalized and derived from the Navier-Stokes equations, but it has a huge range of applicability, from ground-water hydrology to soil physics and petroleum engineering.
Add to that list everyday espresso making.
ps. Fantastic resource on Darcy's work and his law here.