carbon dioxide and espresso extraction

Carbon dioxide – What’s the fizz?Carbon dioxide regulator.

What springs to mind when you think about carbon dioxide, in the context of coffee? Perhaps the “degassing” of beans after they have roasted, or the one-way valves which keep retail coffee bags from puffing up, or maybe even that extra-foamy pour you get when using very freshly roasted coffee? Well, what if these things were clues revealing something about the complexities of espresso extraction?

Just Throwing It Out There

I’ve been working on this post for so long now that I have all but forgotten exactly what thought inspired it in the first place. What started out to be a “short” post, to distract myself from going around in circles writing about the importance of flow and the hydraulics of espresso machines, has ended up being over 2,500 words long and taking nearly a year (and in the meantime, flow has begun to get more attention thanks to the new machine from Decent Espresso).

Anyway, along the way I have learned quite a lot and have come to believe that the significance of carbon dioxide may have been underappreciated. The purpose of this post is explore the ideas that brought me to this conclusion, to generate some new discussion and, hopefully, inspire some interesting experiments!

There are three main reasons I think carbon dioxide might be of more than just a token interest:

  1. CO2 dissolves sparingly in water, but its solubility increases with pressure & decreases with temperature
  2. the density/specific volume of gaseous carbon dioxide vary with pressure and temperature
  3. the volumetric phase fraction influences the flow vs pressure drop relationship

What do these variables have to do with espresso extraction? Let’s start at the beginning…

A tale of two fluids

I’m making an espresso. I dose the basket, tamp, lock in the portafilter and hit the switch. The espresso machine pump starts and water flows through the piping toward the group. Up until the water first reaches the coffee, the pressure at the pump discharge is quite low (because there isn’t much resistance to flow at this point). But, as the water saturates the coffee the resistance to flow increases, the pressure rises and the flow begins to reduce, moving along the pump curve until the pressure reaches the set-point of the pressure regulating valve (OPV or bypass valve).

If the coffee is fresh there is likely to be a significant amount of carbon dioxide remaining in the pores (the tiny holes/voids in the coffee which are created by the expansion of gases that evolve during roasting). As the pressure in the puck increases, the carbon dioxide gas in the pores would be compressed – permitting the ingress of water, into which some of the gas will dissolve. Once it has journeyed through the puck and passed through the basket with the water and coffee extractables, the CO2 reappears as the bubbles of the crema. The crema dissipates over time, as these bubbles consolidate and burst, releasing the COinto the atmosphere and reducing the volume of the espresso.

But, what happened to it along the way? Perhaps a case of out of sight out of mind? I hadn’t really thought much of it, until writing a post about the relationship between flow and pressure in espresso machines and realised something obvious –  that there is a pressure gradient through the puck. After that, CO2 became much more interesting!

Down the slope…

Most espresso machines are configured to limit the pressure at the top of the puck (often called the brew pressure) to around 9 barg. This shouldn’t be confused with the pressure in the puck, which decreases progressively from brew pressure at the top, to atmospheric pressure at the underside of the basket (i.e. the outlet pressure). The pressure at any point in between is dependent on the downstream resistance to flow. If I wanted to model it, I would actually work backwards – estimating the total downstream pressure drop (from the flowrate) and adding it to the outlet pressure.

The pressure gradient is a measure of pressure drop over the distance – essentially the slope of a curve of pressure vs puck depth. If it were possible to measure it directly, we would probably see a non-linear pressure curve, with greater pressure gradient toward the bottom of the basket. This is important because pressure influences two key properties of carbon dioxide – its solubility in water and its specific volume (the inverse of density).

 All Things (Not) Being Equal

The solubility of carbon dioxide in water is strongly dependent on pressure. One explanation for this is offered by Kinetic Theory, which suggests that the solubility is the result of an equilibrium between gaseous and dissolved CO2. Molecules are continuously moving from the gas to the liquid phase (and visa versa) and they are said to be in equilibrium when molecules are entering and escaping the liquid at the same rate – such that there is no net loss or gain from either phase over time. Pressure influences the rate at which CO2 molecules enter the liquid, while the concentration of the dissolved CO2 (in the water) influences the rate at which they escape to the vapour phase (assuming there are no chemical reactions upsetting the balance).

How significant could the change in solubility be? An answer to that question really requires experimentation, but we can get an idea of what might happen using water as an analog for espresso. Assuming that the gas in the pores at the top of the puck is pure CO2 at a brew pressure of 9 barg, solubility data indicates that around 4.7 mg of CO2 will dissolve per gram of water (at 90°C). Compare this to the bottom of the basket, where the pressure is close to atmospheric (0 barg) and less than 0.2 mg of CO2 will dissolve.

Chart showing the approximate solubility of carbon dioxide in pure water at 90 C vs pressure.

Figure 1 – The solubility of carbon dioxide in water increases with partial pressure.

This difference in solubility means that the water at the top of the puck could hold in the order of 30 times more CO2 than it can when it reaches the bottom of the puck! In other words, most of the carbon dioxide that is dissolved in the water at the top of the puck has probably come out of solution by the time the it drips through the basket! Think about what happens when you shake a bottle of soft drink / beer before opening it – that is carbon dioxide coming out of solution (rather rapidly) due to a reduction in pressure!

To expand on that…

The second reason the pressure gradient is relevant is because pressure impacts the specific volume of gaseous carbon dioxide. Gases are highly compressible, which means there is a strong relationship between their pressure and density (which is the inverse of specific volume).  We can get an idea of what might happen to carbon dioxide on it’s journey through the puck, by estimating the volume occupied by a quantity of gas across the range of conditions, using an equation of state.

There are lots of different equations of state with varying validity and complexity. Luckily, as carbon dioxide behaves almost ideally within the range of pressures and temperatures seen in an espresso machine, we should get a meaningful estimate from one of the simplest equations – the ideal gas law:

PV= znRT

To be able to calculate the volume (V) using the ideal gas law, we need to know (or be able to estimate) the temperature (T), pressure (P) and compressibility factor (z). The gas constant (R) has different values depending on which units you use for the other variables. The number of moles (n) is a measure of how many gas molecules there are, which is calculated by dividing the mass (m) by the molar mass of CO2 (MCO2):

n = m / MCO2

It doesn’t really matter what value we assume for the number of moles, because the assumption is cancelled out anyway, when we divide by the mass to calculate the specific volume (ν):

ν = V/m

To generate the chart below, I assumed that the CO2 remains at a constant temperature of 90°C during its journey through the puck (isothermal conditions is the conservative assumption, with respect to an increase in volume). Under these conditions the ideal gas law predicts that its volume should increase as the pressure decreases (i.e. it expands). As you can see from the chart below, the specific volume at atmospheric pressure (just outside the basket) is predicted to be about 9.8 times greater than it is at a brew pressure of 9 barg!

Plot of specific volume of CO2 vs gauge pressure as predicted by the ideal gas law.

Figure 2 – the ideal gas law predicts that the specific volume of CO2 increases as pressure decreases (assuming isothermal conditions)

Just how much CO2 is there?

The amount of CO2 present in coffee grounds will probably vary significantly with roast degree and age, but I did manage to find one article which reported concentrations of 4 – 8.6 mg (CO2) / g (coffee), with an average of 5.7 mg/g . A 20g dose of such coffee would on average contain the equivalent of approx. 114 mg of CO2, which would have a volume of 58 mL of CO2 at STP.

More than just a phase

So you might be wondering by now, what the relevance of all this is? Let me introduce you to my old friend, the phase fraction! The phase fraction describes how much of a fluid is in each phase (liquid, gas solid etc.), measured as a fraction of the total fluid (on a mass, volume or molar basis). I’ve written a bit more about them here if you are interested.
The phase fraction is important because of its influence on two of the most important espresso extraction variables – the flowrate and the upstream pressure (i.e. brew pressure). These two variables are related – in fact, I prefer to think of brew pressure as being the result of the resistance to the flow through the puck (whereas in speciality coffee people often seem to view flow as the result of a pressure difference).

La Résistance

The puck of ground, tamped coffee that we use to make espresso is an example of what is known in fluid mechanics as porous media. One of the most well-known models relating pressure drop to flowrate through porous media, was developed by French engineer Henry Darcy nearly 200 years ago. Darcy’s law, as it is now commonly known, is still used today to model flow through sand filters, groundwater aquifers and petroleum reservoirs, to name but a few examples.  If we were to assume Darcy’s law was valid for an espresso pour and that there is only one fluid phase present, we could define the pressure drop (ΔP) across the puck as a function of the volumetric flowrate (Q), the viscosity (μ), the cross sectional area (A) and depth (L) of the puck, and the puck permeability (κ) using the following equation:

dP = Q*L*mu/K*A

This form of Darcy’s equation states that pressure drop is inversely proportional to the permeability and linearly dependent on flowrate. So, if we reduce the permeability by grinding finer we would predict that a greater pressure drop must be overcome to achieve the same flowrate, or that a lower flowrate would incur the same pressure drop.  There are some other useful insights there too, but they will have to wait for a future post!

Permeability?

The (intrinsic or absolute) permeability is a property of the porous media that is essentially a measure of how easily a fluid can pass through it. It depends primarily on the geometry of the void space between the particles (i.e. the flow path) and may be determined experimentally, by flowing water through a sample of the media at different rates and measuring the resulting pressure drop. Experiments with spent ground coffee have reported values the order of 10-13 mto 10-14 m2 (which is quite a large range in practical terms!).

Relative Permeability

I mentioned earlier the assumption there was “only one phase present”. One approach to extending Darcy’s Law to two-phase flows through porous media is to apply the concept of relative permeability. The relative permeability is the permeability “experienced” by each phase, as a fraction of the absolute permeability, κ. It can be incorporated into Darcy’s Law by as a multiplier of the absolute permeability as shown below, where κri represents the relative permeability with respect to phase i:

dP = (Q_i / A) * (mu_i L)/(k_ri * k)

The relative permeability for each phase is almost always between zero and one, with smaller values representing a greater resistance to flow, relative to what the fluid would experience during single phase flow. The relative permeability for each phase is correlated to a property of the two-phase fluid referred to as the saturation – which is just another name for my old friend the volumetric phase fraction!

Below we can see how the relative permeability of water (through two different porous media) is affected by the liquid fraction:

Figure 3 – As the volume fraction of air increases, the relative permeability of water in sand decreases.

This chart illustrates nicely how the presence of a gas phase (in this case, air) makes the porous media less permeable to the water. If it is valid to assume this relationship holds even at a very small scales (which may not be the case), then it is not unreasonable to predict that the relative permeability of a coffee puck would decrease from top to bottom (as the CO2 expands).

Putting it all together

Since you’re reading this, I guess I haven’t bored you to death yet! Unless perhaps you just skipped ahead to read the conclusion? Either way, now is probably a good time for a recap…
This post considered how carbon dioxide might behave during an espresso extraction, using water/CO2 as an analog for the considerably more complex fluid that we call espresso. The brew pressure really only relates to water at the top of the puck and the pressure decreases progressively toward the bottom of the puck, reaching atmospheric pressure as it exits the basket. There is carbon dioxide present in the pores of freshly roasted coffee and CO2 solubility data suggests that much of what dissolves at the top of the puck will come out of solution again as the water moves through the puck and the pressure decreases.
The ideal gas law predicts that CO2 that comes out of solution or is displaced by the water as it flows through the puck, will expand with the decrease in pressure and this would progressively increase the vapour phase fraction. Darcy’s law (modified for two phase flow) suggests that the increasing vapour fraction will make the coffee puck less permeable to the liquid phase – which suggests that more CO2 would mean less water flow at the same pressure drop.

Of course, the real world is far more complex than this. There are a lot of really significant factors which I haven’t addressed. The impact of viscosity, coffee solubles, other fluid phases, solid particles, solution kinetics and the dynamic unsteady nature of the flow, just to name a few. I often quote George E. P. Box, who wrote that all models are wrong, but some are useful. It is important to remember that the model I have described above is not intended to accurately describe exactly what is happening during an espresso pour. It’s at best a rough approximation (of only a few key factors). The point is only to provide some useful insight into the kinds of effects which might be at play in an espresso machine and which might be worth exploring further by experimentation (whether to challenge and/or refine the model).

If CO2 does have a significant influence on the flow / pressure drop relationship, it raises a few questions:

  • Is carbon dioxide a key factor influencing espresso flowrate?
  • If so, how much impact does the outgassing of CO2 on the need for grinder adjustment?
  • Could “stale” coffee be made to pour more like fresh coffee, using pressurised CO2?
  • Do my low-flow espresso shots lack crema, because less CO2 is dissolved (or displaced) at the reduced pressure?

 

Thanks for reading! I’ll probably revisit this post as I learn more, but in the meantime I would love to hear your thoughts, so please leave a comment or send me a tweet!

2 Responses to “carbon dioxide and espresso extraction

Leave a Reply

Your email address will not be published. Required fields are marked *