Modeling Extraction

In the academic literature, several models have been proposed for extraction of soluble components from solid coffee. Some of these models are very detailed. Some use computational fluid dynamics (CFD) to model fluid flow through the packed bed in three dimensions.

One of my favourite models was described by Moroney et al. in their 2019 paper. This model describes a cylindrical packed bed using a single dimension—depth. It treats the packed bed as being made up of two solid species—one fine and one coarse—as well as liquid filling the gaps between these particles. The equations of the model describe how soluble coffee passes from each of these phases to the others as the shot progresses.

Rather than describe the model in detail here, I’ve documented the math and code in a Jupyter Notebook, which I’ve uploaded to GitHub and Binder. In this post, I’ll go over some of the highlights.

In trying to replicate the results given in the paper, I discovered a couple of small errors.

First, the paper indicates a single effective diffusion coefficient, D_v, for both solid species. However, the authors actually used two separate coefficients, D_{v1} and D_{v2}, to match experimental data. These are calculated from values given in the paper using the following formula:

    \[h_{sli} = \frac{D_{vi}}{d_{si}}\]

Here, h_{sli} is the mass transfer coefficient and d_{si} is the grain diameter for each solid species.

Second, the paper reports the values of h_{sli} incorrectly. These values were scaled for the CFD simulation, and the scaled values were accidentally given in the paper, rather than the original values. To get the correct values, we need to divide the reported values by the liquid density (965.3 kg m-3 for water at 90 °C).

Once these changes are made, our model gives an excellent match to Figure 6(b) in the paper:

The model presented by Moroney et al. is quite good after a few seconds, but early on it predicts a very low concentration of soluble coffee, whereas the first drops out of an espresso machine are likely the most concentrated. This is because the model assumes the puck is initially saturated with clean water, so the very first drops out are clean water.

In reality, water enters the dry puck from the top, so that by the time the first drops are coming out, the water has passed through the entire puck and has dissolved quite a lot coffee. We can model this by introducing water into the puck one level at a time, then running the full model once this is complete. This gives the following plot:

This is quite a good fit, but we can probably make it better. In their paper, Moroney et al. chose mass transfer coefficients to fit the model to the experimental data. If we modify those coefficients, we can probably get a better fit with our improved initial conditions. For now I would like to look at what we can do with this model, and then we’ll come back to the fit later.

Using the modeled concentration values, we can calculate the mass of soluble material in the cup:

    \[m_s(t) = Q \int_0^t c_l(u) \mathrm{d}u\]

and the mass of liquid in the cup:

    \[m_l(t) = Q \cdot \rho_l \cdot t\]

Here, Q is the flow rate of the liquid, \rho_l is the density of the liquid, and c_l(u) is the concentration of soluble coffee we calculated above.

We can then compute TDS and extraction yield as follows:

    \[\begin{gathered}\text{TDS} =100 \cdot \frac{m_s}{m_l}, \\\text{Extraction Yield} =100 \cdot \frac{m_s}{m_0}\end{gathered}\]

Here, m_0 is the mass of the puck. This gives us the trajectory that the shot would follow in a brewing control chart.

In this plot, the ticks along the trajectory indicate shot time in seconds. This is the trajectory which was represented as a circular curve in my previous post—the path a shot follows in the brewing control chart when we allow it to run shorter or longer.

It would be interesting to compare this to a measured trajectory. This could be done by holding dose and grind setting constant, and measuring TDS for beverages with varying shot times. This might be easier, outside of a laboratory, than sampling concentration directly to determine model parameters.

We can also look at how the concentration of soluble coffee in the fine and coarse particles changes with depth and time.

In the plots above, each line represents a concentration profile at some instant in time. The top of the puck is at the top of the plot, and the bottom is at the bottom.

The rightmost line in each plot shows the initial concentration, just before the first drop. At this point in time, some coffee has been dissolved into the liquid at the top of the puck, but the bottom of the puck is still at its original concentration.

As time progresses, we move to the left. Each new line represents a five second interval. We can see that the concentration of soluble coffee in the fines drops much more quickly than in the coarse particles.

We can also see that there is significant variation with depth. This seems to imply that particles at the top of the puck will act as though they are at a later stage of extraction compared to particles at the bottom of the puck, which may have an impact on flavour.

Finally, I want to point out that the shot parameters used by Moroney et al. are not typical for an espresso shot. For the experiment, the following parameters were used:

  • 60 g of coffee
  • 563 μm nominal particle diameter
  • 59 mm puck diameter
  • 40.5 mm puck depth
  • 250 ml/min flow rate

Compare with parameters for a more typical espresso shot:

  • 18 g of coffee
  • 200 μm nominal particle diameter
  • 58.5 mm puck diameter
  • 12 mm puck depth
  • 60 ml/min flow rate

In a future post, I’d like to repeat the fitting procedure described by Moroney et al., but for a more typical espresso shot. This would give us a better idea, e.g., of how extraction in each particle species varies with depth in a typical espresso shot.

Special thanks to Dr. Kevin Moroney, whose help was indispensable in replicating the results in his paper.


  1. Hi Michael, great to see some validation work being carried out! There is a lot of data and information documented in a colleagues thesis that I think might support your work, not only on extraction modelling, but many other aspects you’ve posted about! My colleague (Borja) spent a few years working on espresso extraction from a process engineering and formulation approach. The work was carried out as part of an Engineering Doctorate (EngD) and their thesis is publicly available:

    It covers a lot of topics and has some great insights, so I hope this is useful.

    Always happy to chat if you reach out!

    1. Fantastic! I’ll take a look at it and let you know if I have any follow-up questions.

      Already I’ve noticed that the author used helium pycnometry measurements of a very find grind to determine solid density. I’m working on a cheap homemade gas pycnometer which I’ve been using to measure true density (post coming soon), so I will definitely give it a shot on ground coffee as well.

      Thanks for sharing!

Leave a comment

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