In a previous post, we looked at a numerical solution to a model of expresso extraction described by Moroney et al. in their 2019 paper. In this post, I’ll to look at an analytic solution for a simplified version of that model.
You may be asking why we would want an analytic solution. Or you may be wondering what the difference is between a numerical solution and an analytic solution.
We can solve mathematical problems in two basic ways. A numerical solution is an approximate solution expressed in terms of discrete values. An analytic solution, on the other hand, is an exact solution expressed in the language of math. For example, if asked to describe a circle, we could do it either way:
In general, numerical solutions are easier than analytic ones—in many cases, an analytic solution to a mathematical problem isn’t even possible. But where it is possible, it can be descriptive in ways that a numerical solution is not.
For this model, we’re going to divide the espresso puck into two phases: a single solid phase, made up of ground coffee particles; and a liquid phase, made up of water filling the space between coffee particles.
Where water is in contact with the coffee, some soluble compounds move from the location with higher concentration to the one with lower concentration. We describe this using the following equation:
The movement of soluble compounds across the boundary depends on two things:
- A constant, describing how easy it is to move across the boundary
- The difference in concentration, , across the boundary
The other important factor in espresso extraction is the flow of water through the puck. Fresh water enters at the top of the puck, moves through it picking up soluble compounds, and eventually exits the bottom of the portafilter. This carries away soluble compounds and keeps the concentration of soluble coffee in the water lower than it would be without flow.
Mathematically, we describe the flow of water through the puck like this:
Here, is the velocity of the liquid phase. If we put these two equations together, we get expressions for the change in concentration of soluble coffee in both phases:
The constants and describe the same thing—how easily soluble coffee moves between the solid and liquid phases—but in two different frames of reference. We can define these in terms of fundamental properties of the ground coffee as follows:
Here, is the mass transfer coefficient between the solid and liquid phases, is the surface area per unit volume for the coffee particles, is the volume fraction of the solid phase, and is the intragranular porosity of the coffee particles.
Describing a single layer
To make it easier to find a solution, we describe the puck as a single layer using discrete coordinates located as shown here:
Using this set of coordinates, we can replace the spatial derivative using a backward finite difference:
We also replace references to with a measurement centered in the puck. This gives the average concentration within the layer.
Finally, we set a boundary condition, . This says that the water entering the top of the puck is clean. With these changes, we get the following set of homogeneous differential equations:
We can solve these equations using the method of elimination. We define a few constants to keep things clean:
With these definitions, the solution is as follows:
Any value of and will give a valid solution to our system of differential equations. To find the value of these two constants corresponding with a particular situation, we look at what happens when :
We can solve this for and :
With the addition of and —the initial concentrations in the liquid and solid phases—we have a completely specified analytic solution for our system of differential equations.
Comparison with the numerical solution
Next, let’s compare this solution with the numerical solution of Moroney et al. We will compare with their finely ground single grain model (i.e., using only one size of particle in the solid phase), as well as with their experimental results.
Here, we’ve used the same parameters specified in the paper. Moroney et al. optimized the mass transfer coefficient to match the experimental data. If we do the same, rather than using their reported value, we get an even better fit:
It’s astonishing that our analytic solution matches the numerical solution so well, considering that it treats the packed bed as a single layer, whereas the numerical model treats it as several layers. This suggests that, in terms of modeling average extraction yield, it is not critical to consider the individual layers.
Transient and steady state behaviour
As an example of the descriptive power of an analytic solution, let’s look at the transient and steady state behaviour of our system. As it turns out, we can split the solution presented above into two parts: one which plays a role early in the shot, but dies out quickly, and another which is dominant later in the shot. This is fairly clear when we look at the form of our solution:
Since , we know that , and so the first term must vanish faster than the second term. We can express these two terms as separate solutions:
where is the transient solution, and is the steady state solution. We can plot these separately to get a more intuitive idea of how they contribute to the overall solution:
Here, we can see that the steady state solution encodes the simple notion of extraction that we discussed in our previous post, while the transient solution acts as a sort of correction to bring the model in line with initial conditions. I suspect—but it may be difficult to prove—that most extractions with a constant flow rate will follow a curve very close to the steady state solution.
Looking ahead, I’d like to use the analytic model to fit the extraction data I’ve been gathering.
We can eliminate a couple of variables by measuring the volume fraction of coffee particles, , and the intragranular porosity, , directly. I believe we can do this using data from gas pycnometry.
Then, we can optimize to find the model parameters which best fit experimental data. With this, extraction kinetics would be defined in terms of one parameter inherent to the ground coffee (), one inherent to the extraction process (), and one defining initial conditions ().