Accurate and efficient explicit approximations of the Colebrook flow friction equation based on the Wright-Omega function

The Colebrook equation is a popular model for estimating friction loss coefficients in water and gas pipes. The model is implicit in the unknown flow friction factor f. To date, the captured flow friction factor f can be extracted from the logarithmic form analytically only in the term of the Lambert W-function. The purpose of this study is to find an accurate and computationally efficient solution based on the shifted Lambert W-function also known as the Wright Omega-function. The Wright Omega-function is more suitable because it overcomes the problem with the overflow error by switching the fast growing term y=W(e^x) of the Lambert W-function to the series expansions that further can be easily evaluated in computers without causing overflow run-time errors. Although the Colebrook equation transformed through the Lambert W-function is identical to the original expression in term of accuracy, a further evaluation of the Lambert W-function can be only approximate. Very accurate explicit approximations of the Colebrook equation that contains only one or two logarithms are shown. The final result is an accurate explicit approximation of the Colebrook equation with the relative error of no more than 0.0096%. The presented approximations are in the form suitable for everyday engineering use, they are both accurate and computationally efficient.


Introduction
The Colebrook equation; Eq. ( 1), is an empirical relation which in its native form relates implicitly the unknown Darcy's flow friction factor with the known Reynolds number and the known relative roughness of inner pipe surface [1,2].Engineers use it at defined domains of the input parameters: 4000< <10 8 and for 0< <0.05.The Colebrook equation is transcendental (cannot be expressed in the term of elementary functions), the implicitly given function in respect to the unknown flow friction factor , The Colebrook equation; Eq. ( 1) has also an exact explicit analytical form in the term of the Lambert -function; Eq. ( 2) [3,4] that is also transcendental, but which can be evaluated through the numerous thoroughly tested procedures of various accuracy and complexity developed for various applications in physics and engineering [5]. , The parameter in Eq. ( 2) depends on the input parameters; the Reynolds number and the relative roughness of inner pipe surface .Its domain is 7.51< <618187.84.The Lambert -based Colebrook equation; Eq. ( 2), contains the fast growing term , which cannot be stored in computer registers due to the runtime overflow error for the certain combinations of the Reynolds number and the relative roughness of inner pipe surface that can easily occur in everyday engineering practice [6,7].The problem can be solved using the Wright -function, a cognate of the Lambert -function, which uses a shifted, not fast-growing argument [4,8,9].

This paper presents few approximate solutions of the transformed Lambert -based
Colebrook equation in the form more suitable for computing codes used in various engineering software.The best version of the presented explicit approximation gives the value of flow friction factor f, for which the Colebrook equation is in balance with the relative error of no more than 0.0096%.Such accuracy achieved without using a large number of computationally expensive logarithmic functions (or non-integer powers) is highly computationally efficient.As reported by Clamond [10], Winning and Coole [11], Biberg [4], Vatankhah [12], etc., functions such as logarithms and non-integer powers require special algorithms with execution of many more floating-point operations compared with the basic arithmetic operations (+,-,*,/) that are executed directly in the Central Processor Unit (CPU) of computers.Apparently, this is the first highly accurate explicit approximation of the Colebrook equation that contains only two computationally expensive functions (two logarithms or as an alternative two functions with non-integer powers) or even less if a combination of Padé approximations [13,14] and symbolic regression is used for a further reduction of the computational burden (where as a result one of the logarithms is approximated by simple rational functions with moderate increase of the maximal relative error).

Proposed explicit approximations and comparative analysis
The Colebrook equation in the term of the Lambert -function was apparently first proposed in 2018 by Keady [3].However, as confirmed by Sonnad and Goudar [6] and Brkić [7], the term grows so fast that cannot be evaluated easily even in registers of modern computer due to the overflow runtime error for a certain number of combinations of the input parameters; the Reynolds number and the relative roughness of inner pipe surface ; where parameter of equation ( 2) depends directly on them.The here shown procedure replaces this fast growing term by the much more numerically stable Wright -function [15].As noted by Lawrence et al. [15], the Wright -function was studied implicitly, without being named, by Wright [16], and named and defined by Corless and Jeffrey [17].

Transformation and formulation
The shifted Wright -function transforms the argument to in the series ; where .In that way, the undesirably fast growing term in Eq. ( 2) is approximated accurately through .The transformation is based on unsigned Stirling numbers of the first kind as reported by Rollmann and Spindler [9].
Table 1 shows values of compared with its approximate replacement in the domain of applicability of the Colebrook equation.Without the proposed transformation and simplification, the runtime overflow error occurs during the evaluation of the friction factor in computers for certain pairs or the Reynolds number and the relative roughness of inner pipe surface ; where parameter x of Eq. ( 2) depends directly on them (#VALUE! is overflow error in Table 1).The values in Table 1 are calculated in MS Excel.
Instead of logarithmic functions in the proposed explicit approximation; Eq. ( 3), a new form for and can be introduced, where can be any sufficiently large constant, where the larger value of gives the more accurate approximation of logarithmic function, Eq. ( 4): , Very accurate results are obtained for .Choosing this value, power is a fraction with integer numerator and denominator, where the appropriate form depends on the programming language and the option with fever floating point operations should be chosen [28].
The forms such as requires evaluation of two transcendental functions because compilers in most programming languages interpret it through [10].
For more accurate results or can be used.These new approximations were found by symbolic regression software Eureqa [29][30][31] and they are 2.5 and 16.7 times respectively more accurate compared with the expression from Table 1.The related approximations are given with Eq. ( 5) and Eq. ( 6), respectively. , , In Eq. ( 5) and Eq. ( 6), parameters and are the same as in Eq. (3).

Accuracy
With the friction factor f computed using the approximate equations Eq. ( 3), the Colebrook equation is in balance with the relative error of no more than 0.13%, while using Eq. ( 5) of no more than 0.045%, and finally, using Eq. ( 6) of no more than 0.0096%, respectively.Related distribution of errors is shown in Figure 1.The presented approximations require evaluation of only two computationally expensive functions (two logarithms; Eq. ( 3), Eq. ( 5) and Eq. ( 6) or alternatively two non-integer powers; Eq. ( 4)), and therefore they are not only accurate, but also efficient for calculation.
The here shown approximation; Eq. ( 3) based on the Wright -function with the relative error up to 0.13% is about ten times more accurate compared with the approximation from Brkić [22], while Eq. ( 5) more than 25 times and finally, Eq. ( 6) is more than 100 times more accurate than [22].
The approximations from Brkić [22,23] are based on the Lambert -function.The most accurate approximations available up to date are by Vatankhah [12], Buzzelli [32], Vatankhah and Kouchakzadeh [33], Romeo et al. [34], Zigrang and Sylvester [35] and Serghides [36].All approximations mentioned or developed in this paper are listed in Appendix while its evaluated relative error in Table 2.

Complexity and computational burden
In computer environment, a logarithmic function and non-integer powers require more floating-point operations to be executed in the CPU compared with the simple arithmetic operations such as adding, subtracting, multiplication or division [10][11][12].With the relative error of up to 0.0096%, the here proposed explicit approximation of the Colebrook equation; Eq. ( 6), that contains only two computationally expensive functions, is not only accurate but also sufficiently efficient.Winning and Coole [11] reported relative effort for computation as: Addition- On the other hand, Biberg [4] adds division in the group of more expensive functions.
For comparison, Table 2 provides number of logarithmic functions and non-integer terms used in available approximations.Table 2 shows only highly accurate approximations with the relative error of no more than 1% according to criterions set by Brkić [29].All approximations from Table 2 are given in Appendix of this article.Here developed; Eq. ( 6) 0.0096% 2 0 2 Here developed; Eq. ( 5) 0.045%, 2 0 2 Here developed; Eq. ( 3) 0.13% 2 0 2 Here developed; Eq. ( 4 1 All approximations are listed in Appendix of this paper, 2 in brackets: according to Clamond [10] noninteger powers require evaluation of two computationally expensive functionslogarithm and exponential function, 3 in addition contains also one square root function. In addition to the here presented, the approximation by Brkić [22,23] is also based on the Lambert W-function, but with four logarithmic functions used, it is also much more computationally expensive (with the relative error of about 2.2% it is also significantly less accurate).
In the next Section, the logarithmic function of from Eq. ( 3) is approximated very accurately trough rational polynomial expression, so complexity and computational additionally decrease.Also, subtraction requires less floating-point operations than division, so the computational cheaper form should be used instead.

Simplifications
A simple rational approximation of the logarithm term of the novel Colebrook approximation formulas; Eq. ( 3), Eq. ( 5) and Eq. ( 6), is shown in this Section.The logarithm represents the most computationally expensive operation of the Colebrook formula, while the most its approximations also contain computationally demanded non-integer power terms.In order to reduce computation costs, the idea is to replace the term that contains the logarithmic function by simple rational functions.A combination of Padé approximation [14,43] and an artificial intelligence symbolic regression procedure [29-31,] is used for this.Although the logarithm is a transcendental function, the found rational approximation remains simple and accurate with the maximal relative error limited to 0.2%.Although this rational approximation of the logarithm is not very nice for a human perception, it is very fast at computers, as it requires only a limited number of basic arithmetic operations to be executed in the CPU.
For the purpose of this simplification, the observed form from Eq. ( 3) can be transformed as; Eq. ( 7): In Eq. ( 7), for term , constant 315012.6 is carefully selected in order to minimize the error of the /2,3/ order Padé approximation of at the expansion point .The proposed Padé approximant of the /2,3/ order of at point 1 is; Eq. ( 8): , The value 315012.
Further, a symbolic regression technique based on computer software Eureqa [30,31], is used for a further more precise approximation of .The aim is to construct a more accurate rational approximation of in comparison with Eq. ( 9) using two known variables: the ratio and its Padé approximation .In order to reduce the burden for the CPU, the symbolic regression model should have a computationally cheap evaluation.For this reason, only rational functions are assumed for the symbolic regression model.To achieve that, 200 carefully selected quasi-random points of using LPTAU51 algorithm is used [44,45].For these generated numbers, the Padé approximation is calculated using Eq. ( 8).Also, is calculated in order to train the model in Eureqa for the purpose to find a rational approximation of by using and pairs.
The developed models were successfully tested using 2048 quasi-random points.As a result, value is approximated by simple rational functions; Eq. ( 10), with the negligible maximal relative error 0.0765%., Here the symbol denotes the Padé approximant given by Eq. ( 8) and is its argument.
When the Horner nested representation and the Variable Precision Arithmetic (VPA) at 4 decimal digit accuracy is assumed, the approximation of can be simplified by Eq. ( 11): , In this case, the maximal relative error remains negligible, 0.0793% compared with calculated using Eq. ( 3).

The combined approach with Padé approximant and the symbolic regression introduces in this
Section is based on a human observation and introducing the ratio with the subsequent symbolic regression of and pairs by the Eureqa.The maximal relative error of introduced by Eq. ( 11) is small; 0.0793% and in total if it is used instead of from Eq. (3), the total maximal error of the explicit approximation of the Colebrook equation can go up to 0.4%.As can be seen from Table 2, with the only one-log call for from Eq. ( 3), this approximation is the cheapest for computation to date presented extremely accurate explicit approximation of the Colebrook equation.
The here presented combined approach with Padé approximation and the symbolic regression can be also used for faster but still accurate probabilistic modeling of gas networks, which requires millions of model evaluations [46][47][48].

Conclusion
Although the implicit Colebrook equation for flow friction is empirical and hence with disputed accuracy, in many cases it is necessary to repeat calculations and to resolve the equation accurately in order to compare scientific results.An iterative solution [49,50] requires extensive computational efforts especially for flow evaluation of complex water or gas pipeline networks [51][52][53].Although various available explicit approximations offer a good alternative, they are by the rule very accurate, but too complex and vice versa [39].In contrary to previous approximations of the Colebrook equation, the here presented relation with the relative error limited to 0.0096% belongs to the group of the most accurate available explicit approximations of the Colebrook equation.Moreover, the here presented approach is also very cheap, as it needs only one or two logarithms (or alternatively two non-integer powers).According to the both criterions; accuracy and complexity, the here presented approximations show interesting performance.For this reason, the here presented approximations can be recommended for implementation in software codes for engineering use.
The Colebrook equation is relevant only for the turbulent flow, while for the full-scale flow different unified equations can be used [54].

Table 1 .
Values of compared with its approximate replacement .
explicit approximate form that can be used efficiently in everyday engineering practice; Eq. (3): ,

Table 2 .
Number of computationally expensive functions in the available approximations of theColebrook equations that introduce relative error of no more than 1%.
6 is a weighted average of the Reynolds number for the turbulent zone