Engineering
Espresso machine
Pull a shot on a single-boiler espresso machine cut in half and watch the pressure build, the wetting front run down the puck and the coffee fill the cup. Grind finer or coarser, change the dose, the boiler's setpoint, the relief valve and the pump's ramp, start from a cold machine, or fit the blind basket and see the relief valve hold the pressure.

What happens
A single-boiler espresso machine, cut in half. The boiler holds 0.3 L of water and a 1000 W element that a thermostat switches 2 K either side of the setpoint; it warms the group and the portafilter, and every millilitre drawn is replaced by cold water from the tank. A vibration pump delivers 7.5 mL/s against no pressure and nothing against 15 bar, along a straight line; a relief valve returns what is pushed above its setting. The water passes the group, which warms or cools it, fills the headspace above the puck and then wets the coffee from the top: nothing reaches the cup until the wetting front reaches the basket. Through the wet coffee it flows by Darcy's law, with the viscosity of water at the puck's temperature; the permeability grows as the square of the grind and opens as dissolved solids leave the grains. A third of the dose can dissolve: the broken cells at the particles' surface give theirs up within seconds, the intact cells slowly, and faster when hotter.
From a warm machine, 18 g ground at 300 µm: the headspace is full after 1.43 s, the first drop falls at 9.79 s, and the relief valve holds 9.16 bar on the puck while returning 1.14 mL/s to the tank; 36 g are in the cup after 27.07 s with a yield of 20.53 % and 10.27 % dissolved solids. Ground at 200 µm the puck chokes: 48.4 s and 25.73 %; at 450 µm it gushes at 8.50 bar with the valve shut, 16.7 s and 15.09 %. A 10 s ramp of the pump delays the shot by 3.6 s for 0.11 % more yield. With the boiler at 90 °C the yield is 19.16 %, at 105 °C 21.22 %. Started cold, the element first cuts out after 147 s while the group is still at 32.8 °C, and a shot pulled then brews at 69 °C and yields 17.47 %. The blind basket fills in 7.55 s; then the valve holds the pump at 9.55 bar and returns all of its 2.73 mL/s.
Model: a network without compliance, so the pressure follows the balance of flows at once; no channelling, fines migration or compression of the bed, no taste; the puck is eight well-mixed layers passing their solution down, the solids do not thicken the water, the crema is drawn, not computed. RK4 with steps of 0.01 s, every switch located inside its step; the journal closes the element's and the pump's work against the boiler, the group, the puck, the cup and the losses, and the water drawn less the valve's return is in the basket and the cup.
Try this
Watch the gauge, the wetting front in the cut puck and the cup filling; then grind finer or coarser and compare the shot time and the yield. Start the machine cold and speed up time: the boiler is hot long before the group.
Equations used in the module
Equations Q = Q_0·(u − p/p_max), Q_relief = K·max(p − p_set, 0) Q = k·A·Δp/(μ(T)·L), k ∝ d²·ε³/(1 − ε)² dm/dt = −k(T)·m, k(T) = k_93·exp(−E/R·(1/T − 1/T_93)) T_water = T_g + (T_b − T_g)·exp(−h·A/(ρ·c·Q))


