How to build a simulation model – and brew an espresso using a Moka pot

A few weeks back, I was pondering what to write this blog post about. I’m often drawn to thinking about how we define simulation models in terms of building them, in terms of overall philosophy and approach. Unsurprisingly as an engineer, I played with Lego a lot when growing up. Part of the fun was thinking about how to interpret what I wanted to build in terms of the blocks and pieces available. Such skills are transferable to simulation, as we are faced with a similar challenge, that of translating a physical system using a set approach of methods.

Recreating simple and commonly found systems is a good exercise in this, and I’ve done this a few times in the past, building a model of a toilet, and comparing shopping trolley designs. Over a morning espresso one morning inspiration hit me – why not model a Moka pot! A simple, thermofluidic problem, it would be a good exercise in building a model from the ground up using libraries of components, not least because I had a pot, stove and coffee on hand, which would help me build the model, recreate the process and challenge our customers when building models of their own products.

Figure 1: The Moka pot used as the subject of this post.

Figure 1: The Moka pot used as the subject of this post.

Note the characteristic melted handle, indicating a well loved pot!

In the Claytex blog, we’ve often covered why simulations are useful to build. We’re seeing simulation being applied to consumer goods in this way more and more, to reduce materials used for cost benefit, simplify production processes or to reduce the carbon footprint of producing the product, all whilst maintaining the customer end deliverables.

Defining the model scope and simulation objectives

To start with, like any engineering problem, it is important to consider the end goals of the work. How does the system deliver the benefit to the customer? What are we going to be using the model for? To that end, what effects do we need to consider? How much detail is really needed to deliver this?

Figure 2: Moka pot ready for experimental data generation

Figure 2: Moka pot ready for experimental data generation (and brewing an espresso)

For our Moka pot model, we would like to recreate the brewing process, from start to finish. Therefore, the brewing process needs to be understood. What are the system dynamics? How is the pot used? Beginning with the base, it is filled with water (to a certain height), with ground coffee added to the basket, which sits inside the top of the base. On the bottom of the basket is a funnel, which enables water to travel upwards into the coffee pack. The top half of the pot is screwed onto the base/basket assembly; a gasket and coarse filter seals the basket and base from the top chamber, which features a funnel where brewed coffee travels upwards into the collection chamber. It’s important that the coffee grounds are not too tightly packed in the basket, rather a small mound is formed. Any compression of the coffee pack occurs by the screwing on of the top, ostensibly to enable a uniform pack to be formed. In terms of dynamics, when the base is heated the rising temperature of the water and air pocket above the water level forces the water upwards into the basket under pressure, eventually out of the top of the funnel into the collection chamber at the top. This pressure dynamic is key for the pot’s function, and quality of the coffee brewed.

Figure 3: As heat is applied to the bottom of the pot, the air between the water level and the coffee basket expands, forcing the water up through the coffee to brew the espresso. Image: Wikipedia Commons.

Figure 3: As heat is applied to the bottom of the pot, the air between the water level and the coffee basket expands, forcing the water up through the coffee to brew the espresso. Image: Wikipedia Commons.

Data gathering, decisions, limitations and validation considerations

The next step in creating our model is to consider what constraints we need to put onto the model. How detailed should it be? How detailed can it be? These questions are answered by considering what data we can obtain from the real system. In our case, as we have access to the physical pot, we can obtain a decent amount of geometric data for the pot. Robust estimations of thermal properties using standard constants for parameters such as the heat capacity of the body, for the coffee pack itself, the water charge and so forth can also be made. Granted, it must be remembered that the geometric data obtained will have an element of error, due partly to the nature of the shape of the components and the consequent estimations used for elements such as the air gap in the base between the water and the basket. A kitchen weighing scale will also enable masses of water used, coffee used, coffee produced, etc. to be determined. 

Some aspects, such as the heat energy supplied will be quite variable and dependent upon the stove. In our case, we have no way to measure it so will have to use some stock values. Convection of heat to the ambient air will also have to be estimated, as once again we can’t measure the temperature gradient of the air around the pot with home equipment. Finally, we cannot reliably measure the internal or external temperatures of the pot, or the pressure, but we can take rudimentary estimations from understood knowledge, such as the internal pressure being around 1.5 bar. In a laboratory setting, these limitations will likely not occur due to professional equipment being on hand.

Figure 4: All geometric measurements were taken using the Vernier gauge in the background.

Figure 4: All geometric measurements were taken using the Vernier gauge in the background.

With these points in mind, how does that effect how we define our validation targets? It’s a known fact that the length of time the water is in contact with the coffee affects the coffee quality. Therefore, we can use the total time it takes to brew an espresso as one validation criteria. We also can weigh the amount of water left in the base after brewing is finished, and the total amount of coffee brewed. Adherence to these targets is arbitrary, although we could use falling within 5-10% as a sign that our model has a degree of validity in approach.

Targets:

  • Total espresso brewed: 38.1g
  • Total water remaining in base: 5.1g
  • Time for brew: 479s
Figure 5: Measuring the yield from a brew

Figure 5: Measuring the yield from a brew

Modelling

It can be easily deduced that we need a thermofluids model, with some form of gas/liquid sealed tank to form the base, and an open-air tank for the top chamber. Handily, the ClaytexFluids library features both these components, so is a good choice for our model.

Figure 6: With the octagonal and hexagonal shapes featuring in the design of the pot, calculating the required values for the model needed more than a little number crunching!

Figure 6: With the octagonal and hexagonal shapes featuring in the design of the pot, calculating the required values for the model needed more than a little number crunching!

The system was broken down into 3 subsystems; the base, containing the water charge; the basket containing the coffee pack and the top collection pot for the coffee. As these three components are separate, it is logical to divide the model up this way, not least because conductive heat transfer will occur between all these components.

Looking at the base model, the ClaytexFluid.Volumes.ExpansionTankSingle was modified (to have an external heat transfer connector to enable heat flow into the fluids) to represent the water charge and air gap, with a standard IF97 water model and compressible air model deployed. This was then connected to a lumped thermal mass representing the aluminium body, with a pipe model used to model the funnel element of the basket which is submerged in the water charge. Water mass can easily be monitored from the volume of water and the dynamic density, as this will change with thermal expansion.

Figure 7: Base featuring modified water tank

Figure 7: Base featuring modified water tank

The basket model is a little bit less straight forward. Primarily, this is due to the nature of the issue, which is a volume filled with a permeable solid in terms of the coffee grounds. Therefore, we need to model a volume, and apply some form of pressure drop. Taking the rule of thumb figure regarding internal pressure of 1.5 bar, a 0.5bar pressure drop was added to a control volume to simulate the basket’s volume. Lastly, a check valve was used after the volume to represent the basket; partially this was to avoid backwards flow at initialisation of the funnel (more on this concept later). Both the aluminium mass of the basket and the coffee were lumped together.

Figure 8: The basket model with pressure drop and check valve

Figure 8: The basket model with pressure drop and check valve

The third subsystem was the top chamber, comprising the collection pot itself and the funnel the coffee travels up. A similar approach to the base was used, although this could be a similar model, with the top chamber not needing to be thermally connected as we aren’t especially interested in the heat absorption of the brewed coffee. The funnel is connected to the thermal system, as this influences the pressure gradient through the system. An off the shelf open to atmosphere tank model was used – ClaytexFluid.Volumes.OpenTankSingle. All the mass of the top was lumped together, including the plastic handle and lid knob, even though these are plastic.  

Figure 9: Top chamber featuring funnel


Figure 9: Top chamber featuring funnel

The three subsystems were then brought together into a single assembly, with the thermal circuit connected. Thermal resistance to the transfer of heat between the three components was estimated from the surface areas of contact, whilst the convection to the ambient air was similarly estimated, using an estimate of the air temperature around the pot (this would very much be dependent on the geometry of the individual burner being used).

Figure 10: Complete assembly including thermal connections

Figure 10: Complete assembly including thermal connections

Heat flow into the system was estimated at 400W at 1950C, in terms of a small burner (this is a small 2 cup Moka pot) at around 1/3 to 1/2 setting.

Figure 11: Top level of the experiment with heat rejection to ambient and heat supply to base

Figure 11: Top level of the experiment with heat rejection to ambient (shown by the red thermal connector on the left which is connected to the pot convection models) and heat supply to base

Results

Running the simulation, the results correlate quite well with the measured data. The simulation will be run until the simulation fails due to the pressure being too low at the base tank outlet (bottom of the basket funnel), as this is analogous to how the actual pot finishes brewing, and why there’s always residual water charge in the base after brewing. Let’s review our metrics of validation we established earlier before looking at some results in more detail:

  • Total espresso brewed: 37.2g (-0.25%)
  • Total water remaining in base: 8.13g (+59.14%)
  • Time for brew: 469s (+2.90%)

As we can see, the model achieves the first and the third metrics well, although misses the metric for water remaining in the base. Given that some of the water in brewing an espresso is retained in the coffee pack post brew, then this is likely where the excess of water is lost in the actual brewing process versus our model. This would be in addition to the steam losses associated with the real brewing process.

If we look closer at some of the results, we can observe some of the dynamics of the model at work.

If we look at the comparison of the masses in the base and the top chamber, we see that mass flows from soon after the heat is applied (starting at 5s, to enable better initialization, ramping up smoothly). This is backed up by reviewing the mass flow rate plot, which charts the flow into the top chamber funnel. As anyone familiar with using a Moka pot will tell you, this isn’t the case. So what’s occurring in the model? Within all the components, there is a water fluid “present” within them (part of how 1D fluids are modelled) from initialization. What this means is that as the body warms up, the fluid water models begin to move immediately out of the funnel once the pressure/temperature reach the required level. This is in contrast to having to displace the air within the pot first, as would be the case in real life. Therefore there is much less of a delay to coffee yield in our model versus real life. We can see in the mass flow chart and the mass comparison, that around the 400s mark, the flow rates accelerate, which is indicative of coffee brew emerging from the pot.

Conclusions and final remarks

Looking back at this exercise, we can see how a simulation model is built from scratch using off the shelf components with minimal adaptations. By considering the system being modelled from the beginning, taking time to understand the limitations of the data available and understanding the desired validation objectives, we can create a representative simulation model. Granted, for detailed design purposes, such as trying to understand the effect of the design on the quality of the coffee produced, then more data would be required. That being said, the model created has a good overall correlation, making it a good candidate for further refinement. Obtaining improved data would not be a huge hurdle with access to CAD or design data, as people often have. Now, time to drink the espresso brewed to further validate the model!

Please feel free to download the model created in this example here! I would be happy to answer any questions regarding the model as well.

Written by: Theodor Ensbury – Senior Project Engineer

Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion.

CONTACT US

Got a question? Just fill in this form and send it to us and we'll get back to you shortly.

Sending

© Copyright 2010-2024 Claytex Services Ltd All Rights Reserved

Log in with your credentials

Forgot your details?