# Urban Maths: How to W!

Rain, storms, floods, overflowing drains; we cannot get away from them be it summer or winter. Trying, unsuccessfully, to avoid an overflowing drain recently, I started to wonder what sort of calculations, if any, are done to determine the pressure drops and flow rates through the network of drainage pipes.

Commonly, for steady internal flows through a rough pipe, the frictional pressure drop, , along a section of length, , is obtained from

where is diameter, is fluid density, and is fluid velocity. The dimensionless constant of proportionality, , is known as the friction factor. For laminar flow the friction factor is inversely proportional to Reynolds number, Re, a measure of the relative importance of inertial forces to viscous forces (given by , where is the fluid dynamic viscosity). The constant of proportionality simply depends on the cross-sectional shape of the pipe. For turbulent flow, on the other hand, the friction factor is more complicated, being a function of not only the Reynolds number, but also the relative roughness, , of the pipe, and is generally calculated from an empirically derived correlation. A commonly used such correlation is the Colebrook–White equation (see [1] for example):

(1)

You will notice that this is an implicit equation for , which occurs on both the left- and right-hand sides. To find we therefore need to use an iterative method, or obtain an approximate explicit representation (of which there are several) as there is no way of rearranging equation (1) to get an exact explicit formulation for in terms of elementary functions or is there?

It turns out that by making use of a not so well-known function, called the LambertW function (see [2], for example), we can, in fact, do just that, as I will demonstrate below. First though, let’s have a look at the LambertW function itself.

The LambertW function is defined via the following equation:

(2a)

It is the value of that satisfies equation (2a) for a given value of ; i.e.\ is the input and is the output: . By taking logs of both sides we can also express the equation as:

(2b)

The function is defined for complex numbers, but we will only consider real numbers here. For real numbers the function is defined for values of from to . For there is a unique value of for each . However, between and 0 there are two real values of for each . We therefore consider the function to have two real branches, conventionally labelled (the higher branch) and . These are plotted in Figure 1.

We will only deal with the upper branch here.

The function was first considered by Euler (who else!) when studying an equation developed by J.H. Lambert (1728–1777); though it was not named until the 1990s, and Lambert himself knew nothing of it! There is a great introduction to the function written at an elementary level by Brian Hayes [3].

So how do we use it to rewrite the Colebrook–White correlation exactly in explicit form? It is not immediately obvious, as equation (1) looks nothing like equation (2a), and not too much like equation (2b). We need to do some manipulation.

Let’s start by defining:

(3a)

so that:

(3b)

We now rewrite equation (1) in terms of log to the base , rather than log to the base 10; replace the left-hand side by equation (3b); use equation (3a) on the right-hand side, and do a little rearranging to get:

This is beginning to look a little like equation (2b), but is not quite there yet, so let’s add to both sides of this equation and make use of the addition property of logarithms to get:

(4)

We now define

(5)

and

(6a)

so that:

(6b)

which enables us to write equation (4) as: ; namely, the same as equation (2b).

Making use of equation (5) in equation (3b) and doing a little manipulation we can now write an exact explicit form of the Colebrook–White equation as:

(7)

where I have explicitly recognised that is a function (the LambertW function) of , and (a function of Reynolds number and relative roughness) is as defined in equation (6b).

Now there has been a lot of manipulation to get from equation (1) to equation (7). Do the two equations really produce the same value friction factors for given values of Reynolds number and relative roughness? I’m never happy until I have done some numerical comparisons to check, so Figure 2 shows a graph of friction factor against a range of turbulent Reynolds numbers for three different relative roughnesses, calculated from an iterative technique for equation (1) and using the LambertW function for equation (7). The figure speaks for itself!

‘Hold your horses,’ I hear you cry, ‘you’ve just pulled off a sleight of hand – you still have to calculate the value of , possibly using an iterative method, so you have not really gained anything over the original implicit equation!’ Oh really? I did not hear you complain when I used the logarithmic function earlier; nor would you have complained at the use of other elementary functions, such as trigonometric or hyperbolic ones, nor indeed at such simple expressions as ! These also have to be calculated one way or another when we want numerical results. It does not devalue their use as symbolic placeholders (and, anyway, numerical analysts are always looking for ways to make numerical evaluation of important functions speedier and more efficient).

The reality is that we tend to feel slightly uncomfortable with the above simply because we are not so familiar with the LambertW function. I have no doubt many people are uncomfortable with the logarithmic function when they first meet it. The more we use something the happier we are with it, so I think we should be looking to make much greater use of the LambertW function until it becomes commonplace and we all treat it like an old friend!

That said, I very much doubt it will do much to improve the situation with regard to overflowing drains!

#### Acknowledgement

‘Urban Maths’ cartoonist: Adrian Metcalfe –  www.thisisfruittree.com

#### References

1. en.wikipedia.org/wiki/Darcy_friction_factor_formulae
2. Weisstein, E.W. Lambert W-Function from MathWorld; mathworld.wolfram.com/LambertW-Function.html
3. Hayes, B. (2005) Why W?, American Scientist, vol. 93, no. 2, p. 104, DOI:  10.1511/2005.2.104.

Reproduced from Mathematics Today, February 2017