The mathematics of brewing

While drinking beer in your favourite pub, have you ever wondered how it is produced? Find here some of the science and mathematics behind brewing.

post

Egyptian hieroglyphics depict the pouring out of beer. Public Domain

Beer is the most popular and most consumed alcoholic drink around the world, and it is also one of the oldest: beer drinking and brewing have been part of human activities since the dawn of civilization. The first beer was basically made from grain, water and spontaneous fermentation due to wild yeast present in the air, just before bread was invented. Although it has been reported that the Egyptians were the first to document the brewing process around 5000 B.C, it is believed that the first brewers were part of primitive cultures of Mesopotamia.

Eventually, the recipe for beer arrived in Europe, where it became an integral part of life: the birth of modern beer was during the early Middle Ages, when German monks introduced hop as a bittering and flavouring agent. Beer brewing used to be on a domestic scale, but with the arrival of the Industrial Revolution, its production moved to mass manufacture, allowing beer to be produced on a much larger scale.

Nowadays, the brewing industry is a multimillion-dollar global business, with many multinational companies producing and exporting beer. Germany and UK are the highest producers and consumers in the world: here, beer is much more than just a drink, and the Oktoberfest is a clear example.

Different types of beer. Flickr, user: Paul Joseph, CC-BY 2.0

The Oktoberfest is the world’s largest beer festival, and it is held annually in Munich, Germany. Although the UK does not need an excuse to enjoy a pint of beer, since 2011 this festival also takes place in London, starting next week. Motivated by this, Chalkdust decided to write an article in which you can find out about the mathematics and science behind this popular drink called beer.

The process of production of beer: brewing

Brewing is a huge-scale complex process that magically transforms water, grains and hop to produce what we call beer, and this is achieved mostly with the help of a tiny little wizard that is commonly known as yeast. Our job here is to explain briefly what this magic is.

Basically, there are three key stages, and the large variety of beer is due to the different conditions (temperature, kind of grain, etc) established during these three stages. Below, a simplified diagram of beer production illustrates the whole process and the explanation of each stage is given below.

Simplified diagram of beer production

Mashing

This initial stage is where the basic ingredients such as water, malted barley (previously milled in a grain mill) and hops are mixed together in a huge kettle (macerator) to obtain the mash, which is then boiled to obtain what is known as wort. The final step of this process consists of cooling the wort down until the fermenting temperature has been reached.

Some pictures of the giant mash “kettles” taken during my visit to one of the old breweries located in Amsterdam, The Netherlands

Estimation of the heat required to heat up/cool down the mash/wort

In order to heat up and cool down the mash/wort, it is necessary to have an estimate of how much energy we must add/remove from the mash. To do this we make use of energy balances, which just require simple mathematics and thermodynamics. To calculate the energy required to heat up our initial mash, the following equation is used:

$$Q_m=\rho_m \, V \, C_p \, (T_{f}-T_{i}) \, f_{loss} $$

where $\rho_m$ and $V$ are the density and total volume of the mash respectively, $T_i$ and $T_f$ are the initial and final temperatures and $C_p$ is the heat capacity of the mash, which means the amount of energy required to increase (or decrease) the temperature of one kilogram of mash by one degree Celsius. In a real scenario, energy is lost through other mediums, so we have to provide a bit more ($f_{loss}$). For a heating process, $T_f > T_i$, and for cooling $T_f < T_i$.

All these properties and values have to be measured experimentally by the brewers. Once they have found the value of $Q_m$, what’s next? Well, the energy must come from somewhere! As we know, if we have to heat something up, we need a hot object. To increase the temperature of the mash/wort, brewers use steam water, but the question is, how much? To know the answer, the following equation needs to be satisfied:

$$Q_m=Q_s=m_s  \, H_s$$

where $Q_s$ is the energy contained in the steam water, $m_s$ is the quantity of steam water or water to be used and $H_s$ is the energy needed to evaporate or condensate the water, depending if we are considering a heating or cooling process. The values of $Q_m$ (calculated before) and $H_s$ (reported in the literature) allows us to know the amount of steam water necessary to heat or cool our mash/wort. These values are extremely useful in engineering as they permit us to calculate the area $A$ of the mash kettles and the pipes used to transport the water. The calculation of $A$ is a difficult task, and depends on the following information:

$$ A = \frac{\dot{Q}}{\Delta T_{log} \, U }$$

where $U$ is the overall heat transfer coefficient, a representative value of the whole system that will tell us if the  heat transfer is favourable, $\Delta T_{log}$ is the logarithmic mean temperature difference of all the temperatures involved in the process and $\dot{Q}$ is the heat transferred from steam water to the mash per unit of time. This information can help us calculate many other things such as how long is required to reach fermentation temperature and the number of boiling systems needed to get steam water.

This basic but important process allows transforming grain starches into fermentable sugars, which play a highly important role in the next stage.

Fermentation

This stage is the most important one and is where most of the magic of brewing occurs. In a few words, fermentation is a process where the yeast (this wizard we previously talked about) converts the fermentable (glucose) sugars present in the wort (obtained in the mashing stage) into alcohol and carbon dioxide gas.

Fermentation tanks. Flickr, user: Thomas Cizauskas, CC-BY 2.0

Yeast is added to giant tanks that have a characteristic conical shape and can hold over 9,000 L of wort. The fermentation begins when the cooled wort is transferred to these tanks and makes contact with the previously added yeast.  The wort is then maintained at a constant temperature; for instance, the fermentation process for Guinness may take 2-3 weeks at a temperature of 18°C, while for a lager beer the process is longer, as it takes six weeks at 9 °C.

The transformation of sugar into alcohol ($2$C$_2$H$_2$OH) and carbon dioxide may take about two weeks, following the general chemical reaction:

 CH$_6$H$_{12}$O$_6$ $\longrightarrow$ $2$C$_2$H$_2$OH + $2$CO$_2$.

When the fermentation has finished, yeast settles down to the bottom cone-shaped of the tanks, to be collected and used for the next batch of beer. The desired product, the beer, is cooled down to about 0°C and filtered to remove remaining solids.

The fermentation actually is the stage of brewing where the most mathematics is involved, and although is not an easy job to describe all the things that are going in a fermentation tank, here we will summarise some of the mathematics present during fermentation.

Specific gravity

Specific gravity $SG$ is simply defined as the density of the wort, $\rho_s$, relative to the density of water, $\rho_w$. If the value of $\rho_s$ is close to $\rho_w$, we say that the specific gravity is equal to one. Brewers measure the values of specific gravity at the beginning of fermentation ($SG_i$) and at the end ($SG_f$) , so they can determine an estimate of the alcohol content.

However, both densities $\rho_w$ and $\rho_s$ depend on the temperature, so $SG$ changes drastically as the temperature increases. In addition, the specific gravity also depends on the concentration of the wort ($C$), which makes it difficult to find reported values of $SG$ in the literature. What the brewers do is experimentally obtain functions that can predict $SG$ for different temperatures and variable concentrations:

$$ SG(T, C)= \frac{SG_s (T,C)} {SG_w (T)} = \frac{\rho_s (T,C)}{\rho_w (25°C )} \frac{\rho_w (25°C )}{\rho_w (T)}. $$

Notice that $SG_s (T,C)$ is the specific gravity or the ratio between the density of the wort at the desired temperature ($T$) and concentration ($C$)  and the density of the water at standard temperature (25°C). The definition of $SG_w (T)$ is equivalent to $SG_s (T,C)$, but with water instead. The brewers have to find these functions experimentally, then implement them afterwards with highly sophisticated software that controls the temperature, the specific gravity required and therefore, the alcohol by volume content of the product. If the brewers just work with one kind of beer, the specific gravity just depends on temperature.

Fermentation: yeast, sugar and alcohol

The fermentation, as described above, is a complex biochemical process that is very challenging to model, as there are many substances involved that are being transformed through many different pathways. A simple introduction is given below.

 

Simplified diagram of fermentation

The biomass cells (in our case, the yeast) are separated into three different groups since the yeast has been previously used: active ($X_{act}$), lag ($X_{lag}$) and dead ($X_{dead}$) cells. The most important ones are the active cells $X_{act}$, as they are responsible for alcohol production. The lag cells $X_{lag}$ are those that have not been yet activated and finally, the dead cells $X_{dead}$ were active cells that are no longer useful.

Every time a batch of beer is obtained, yeast is collected from the bottom of the fermentation tanks and is used again. We call this group of active, lag and dead cells inoculum, and the concentration of each type of cell has to be determined experimentally. Usually, before the lag phase begins, the inoculum $X_{inc}$ is composed of $50 \%$ dead cells, with the rest a combination of active and lag cells:

$$X_{act}(0) +X_{lag}(0) = 0.5 X_{inc}(0), \, \, t<t_{lag} .$$

The lag phase begins when the dead cells settle down to the bottom of the tank (reaction b) and most importantly, the lag cells are activated (process a in the diagram) according to the following equation:

$$\frac{\mathrm{d}X_{act}(t)}{\mathrm{d}t}=k_{lag} \, X_{lag}(t),$$

where the derivative with respect to time is the growth (or rate of change) of active cells, $k_{lag}$ is the kinetic coefficient of production of active cells in the lag phase. If this coefficient is large, the production of $X_{act}$ is quicker. The lag phase ends at $t=t_{lag}$, and fermentation phase begins when $80 \%$ of lag cells have been activated.

During fermentation phase, a lot of processes and transformations are going on simultaneously: active yeasts grow, giving new biomass (reaction c), the remaining lag cells $X_{lag}$ are still being activated (a) and some active cells are dying (reaction f) and settling down to the bottom (b). The concentration of $X_{act}$ is then governed by these processes:

$$\frac{\mathrm{d} X_{act}(t)}{\mathrm{d}t}=k_{c} X_{act}(t)-k_{f}X_{act}(t) + k_{a}X_{lag}(t), \, \, t>t_{lag},$$

where a negative sign in the second term means $X_{act}$ is being consumed. As we previously mentioned, active cells are the ones where the fermentation occurs, or in other words, where the sugar $S$ is transformed and consumed (process e) to produce alcohol $A$ (reaction d), according to the following equations:

$$\frac{\mathrm{d} S(t)}{\mathrm{d}t}=-k_{e} X_{act}(t)$$

$$\frac{\mathrm{d} A(t) }{\mathrm{d} t}=k_{d} X_{act} (t).$$

It is important to point out that all the kinetic coefficients $k_a$, $k_b$,…, $k_f$ are not constant. In fact, they depend on many things, including temperature, whose dependence is given by:

$$k _i=K_i \exp { \Big(\frac{-E_i}{R\,T}\Big)}, $$

where $K_i$ is a constant that has to be determined experimentally, $E_i$ is an energetic value that has to be satisfied to achieve the process in question, $R$ is the gas constant and $T$ is the temperature. A lot more processes occur simultaneously apart from those that we have already described, for example, production of carbon dioxide CO$_2$, and the creation of undesired products such as proteins.

The solution of this large system of differential equations is useful to determine information such as the total time of fermentation, lag time,  the ideal temperature to maximise alcohol production and minimise the concentrations of undesired products, to understand what is the ideal concentration of active cells to achieve the desired production, etc. In addition, the solution of these equations, along with mass and energy conservation, will provide information on the best design of fermentation tanks.

My brewers friends Juan José, Alejandra and Omar and their own local brewery located in Mexico City. Behind them there is a kettle, a macerator and a water tank for grain washing. To the right, next to the door, a fermentation tank.

Last stages: beer conditioning, packaging and distribution.

Bottles and tap beer in a pub in London, Public Domain

Following the fermentation, the next stage is beer conditioning, where the fresh beer is stored in conditioning tanks at temperatures around 2°C. The length of this stage may vary depending on the kind of beer, but it can take more than 50 days. During conditioning, beer absorbs carbon dioxide, becomes clearer and the ideal aroma, flavour and foam are achieved. The conditioned beer is then filtered to remove any kind of remaining particle.

Finally, once the purified beer has satisfied quality standards, it is packaged in glass or special tanks to be distributed.

As stated above, every type beer is produced under different process conditions, which leads to different product characteristics, such as alcohol content, calorie content, carbonation level, etc. These characteristics of the beer mainly depend on the initial (before fermentation) and final (after fermentation) specific gravity, $SG_i$ and $SG_f$, respectively.

The number of calories that goes directly to your body after drinking a 12-ounce bottle of beer $C_B$ is calculated according to the following equation:

$$C_B = C_S \,+ \,C_A \,+ \, C_P $$

$$C_B = 3621 \, SG_f \Big [(0.8114 SG_f +0.1886 SG_i -1) + 0.53 \frac{SG_i-SG_f}{1.775-SG_i}\Big]. $$

The total number of calories $C_B$ has dependent on three elements: the sugar that was not transformed into alcohol $C_S$, the alcohol $C_A$ and a small contribution because of the protein that was obtained as an undesired product in the fermentation, $C_P$. Higher values of $SG_f$ and $SG_i$ will result in a higher content of calories in the beer, as there might be more sugar on it. Here you can find a list of more than 200 popular beers and their caloric content.

 

A 12 oz bottle of beer and a mug, CC-BY 3.0

There is a lot more science behind brewing, for example, how to measure the colour of beer, carbonation level, etc, but this space is too small to cover all this information. Now that you have discovered many things about this popular drink, you might be thirsty, so I exhort you to go to your favourite pub with your friends and enjoy a cold one.

 

References

  1. De Andrés-Toro, B., Girón-Sierra, J.M., López-Orozco, J.A., Fernández-Conde, C., Peinado, J.M, García-Ochoa, F., A kinetic model for beer production under industrial operational conditions, Mathematics and Computers in Simulation, Elsevier, 48 (1998), 65-74.
  2. Hall, M., Brew by the numbers, Add up what’s in your beer, ZYMURGY, Summer 1995.
  3. Gee, D.A., Fred-Ramírez, W., A flavour model for beer fermentation, Journal of the Institute of Brewing, Sept.-Oct., 1994, Vol. 100 pp., 321-329.
  4. Urpiner, Brewery, http://www.urpiner.eu/en/about-the-brewery.

Attributions:

[Pictures: 1- Malted Barley by Neil916, CC-BY 3.0; 2- adapted from Flickr.com–More than a Few Six Packs by Alan Levine, Public Domain; 3- adapted from pixabay -Barley by  Free-Photos, Public Domain; 4-adapted from pixabay, Water by OpenClipart-Vectors, Public Domain; 5-adapted from  Flickr, Bottle Shop Beer by Kerry L, CC-BY 2.0; 6-Brewery, used with permission of DISTRITO CERVECERO® ; other pictures by Chalkdust]

 

Hugo is a chemical engineer doing a PhD in Mathematics at University College London. He is currently working on non-Newtonian fluid dynamics. He is also interested in transport phenomena and rheology (the science of deformation).

More from Chalkdust