Investigation into the Computational Costs of Using Genetic Algorithm and Simulated Annealing for the Optimization of Explicit Friction Factor Models

Abstract

Research reports show that the accuracies of many explicit friction factor models, having different levels of accuracies and complexities, have been improved using genetic algorithm (GA), a global optimization approach. However, the computational cost associated with the use of GA has yet to be discussed. In this study, the parameters of sixteen explicit models for the estimation of friction factor in the turbulent flow regime were optimized using two popular global search methods namely genetic algorithm (GA) and simulated annealing (SA). Based on 1000 interval values of Reynolds number (Re) in the range of and 100 interval values of relative roughness () in the range of , corresponding friction factor (f) data were obtained by solving Colebrook-White equation using Microsoft Excel spreadsheet. These data were then used to modify the parameters of the selected explicit models. Although both GA and SA led to either moderate or significant improvements in the accuracies of the existing friction factor models, SA outperforms the GA. Moreover, the SA requires far less computational time than the GA to complete the corresponding optimization process. It can therefore be concluded that SA is a better global optimizer than GA in the process of finding an improved explicit friction factor model as an alternative to the implicit Colebrook-White equation in the turbulent flow regime.

Share and Cite:

Alabi, S. and Ekpenyong, A. (2022) Investigation into the Computational Costs of Using Genetic Algorithm and Simulated Annealing for the Optimization of Explicit Friction Factor Models. Journal of Materials Science and Chemical Engineering, 10, 1-9. doi: 10.4236/msce.2022.1012001.

1. Introduction

The Colebrook-White model, given in Equation (1), has been widely accepted and used in engineering practices as sufficiently accurate for the calculation of pipe friction factor (f) in the turbulent flow regime [1] [2].

1 f = 2 log ( E / D 3.71 + 2.51 R e f ) (1)

However, due to the implicit nature of Colebrook-White equation, it requires an iterative solution method such as the Newton-Raphson where numerous calculations are required for long pipelines and network of pipes to obtain the value of f as a function of Reynolds Number(Re)and relative roughness of the pipe( E / D ). This method is time-consuming and complicated. Moody provided a diagram called Moody chart [3], as a graphical solution of Colebrook equation. Although the chart eliminates the requirement for iteration, obtaining data from this chart and interpolating the friction factor values is error-prone. Moreover, it is inconvenient for computer simulation. In order to overcome these drawbacks, various explicit friction factor models have been developed using diverse parameter estimation methods.

In comparison with the iterative solution of Colebrook-White equation, the explicit models differ in their accuracies, complexities and relative computational efficiencies (see [4] [5] [6] ). Most of the existing explicit friction factor models were developed using local optimization methods. Cojbasić and Brkić [7] selected two models proposed by Serghides [8] and, Romeo and Co-workers [9] and have been proven to be among the most accurate explicit models by Winning and Cooles [10] to modify their parameters using genetic algorithm (GA), a global optimization technique. After successful optimization, the accuracies of these models were improved 53 and 16 times, respectively. Thus, Brkić and Ćojbašić [11] made efforts to improve the accuracies of several explicit models by modifying their parameters using genetic algorithm (GA). Although GA has been used to improve the accuracies of several existing explicit friction factor models, the computational burden associated with its use has not been discussed. Souza and Co-workers [12] used simulated annealing, another global optimization algorithm to directly obtain the parameters of very few explicit friction factor models. Unfortunately, the authors were silent about the computational burdens associated with the use of SA and its use for explicit friction factor modelling and optimization has yet to be widely studied.

Consequently, using the model accuracy and the computational time of the search algorithm, as the performance indicators, this study investigates extensively the effectiveness of the GA and SA for the parameters estimation of several explicit friction factor models.

2. Theoretical Background

2.1. Genetic Algorithm

Genetic algorithms are one of the evolutionary computational intelligence techniques, inspired by Darwin’s theory of biological evolution. Genetic algorithms are very powerful tools for optimization. It is a method for solving both constrained and unconstrained optimization problems that is based on natural selection, the process that drives biological evolution. The genetic algorithm repeatedly modifies a population of individual solutions. At each step, the genetic algorithm selects individuals at random from the current population to be parents and uses them to produce the children for the next generation. Over successive generations, the population “evolves” toward an optimal solution. Genetic algorithm (GA) can be applied to solve a variety of optimization problems that are not well suited for standard optimization algorithms, including problems in which the objective function is discontinuous, non-differentiable, stochastic, or highly nonlinear. The genetic algorithm can address problems of mixed integer programming, where some components are restricted to be integer-valued. The fundamental details about this algorithm are beyond the scope of this study; interested Reader is referred to MathWorks’ Global Optimization Toolbox User Guide [13].

In genetic algorithm, the function that needs to be optimized is called fitness function. The fitness function which is the explicit model is coded and passed as a function handle input argument to the main genetic algorithm function. While coding the initial numerical coefficient is specified, “x”. These are the numbers of variables in the fitness function. These x components are provided with lower and upper bounds for GA to search for the best optimal solution. These upper and lower bounds are within the neighborhood of the initial values.

2.2. Simulated Annealing

Simulated annealing (SA) is a method for solving unconstrained and bound-constrained optimization problems. SA is one of the most flexible techniques available for solving hard combinatorial problems. The main advantage of SA is that it can be applied to large problems regardless of the conditions of differentiability, continuity, and convexity than are normally required in conventional methods. Annealing is a heat treatment process where a material is subjected to high temperature, with subsequent cooling, so as to obtain high-quality crystals (i.e., crystals whose structure form perfect lattices). During the cooling process, it is assumed that thermal equilibrium (or quasi equilibrium) conditions are maintained. The cooling process ends when the material reaches a state of minimum energy, which, in principle, corresponds with a perfect crystal. It is known that defect-free crystals (i.e., solids with minimum energy) are more likely to be formed under a slow cooling process. The two main features of the simulated annealing process are:

1) The transition mechanism between states and

2) The cooling schedule.

When applied to combinatorial optimization, simulated annealing aims to find an optimal configuration (or state with minimum “energy”) of a complex problem. The objective function of an optimization problem corresponds with the free energy of the material. An optimal solution is associated with a perfect crystal, whereas a crystal with defects corresponds with a local optimal solution. The analogy is not complete, however, because in the annealing process there is a physical variable that is the temperature, which under proper control leads to the formation of a perfect crystal.

When simulated annealing is used as an optimization technique, the temperature becomes simply a control parameter that has to be properly determined in order to achieve the desired results. The temperature affects two aspects of the algorithm: the distance of a trial point from the current point and the probability of accepting a trial point with higher objective function value.

Temperature can be a vector with different value for each component of the current point. The initial temperature is a scalar. Temperature decreases gradually as the algorithm proceeds. The slower the rate of temperature decreases, the better the chances of finding the optimal solution. The fundamental details about this algorithm are beyond the scope of this study; interested Reader is referred to MathWorks’ Global Optimization Toolbox User Guide [13].

3. Materials and Method

3.1. Data Generation

Sixteen explicit models with excellent performance and high precision which can be used as alternative to Colebrook white equation were selected from the literature and analyzed. The friction factor (f) of the equations were generated using Microsoft Excel spreadsheet with 1000 interval values of Reynolds number (Re) in the range of 4 × 10 3 R e 1 × 10 8 and 100 interval values of relative roughness ( E / D ) in the range of 10 6 E / D 5 × 10 2 . Subsequently, the Re and E / D data were used to iteratively solve Colebrook-White equation (Equation (1)).

3.2. Error Estimation

The measure of deviation of each explicit model prediction from the iterative solution of Colebrook-White equation can be based on absolute error, mean square error (MSE), average error and absolute relative error (%). In this paper, we focused on the maximum absolute relative error (MARE) of each explicit model to estimate their level of accuracy. The data obtained in Section 3.1 were used to measure each deviation. Absolute relative error is computed using the formula given in Equation (2)

AbsoluteRelativeError ( % ) = | f colebrook f explicit | f colebrook × 100 (2)

3.3. Optimization

3.3.1. Genetic Algorithm Optimization

The optimization with the genetic algorithm was carried out using GA tool in the Global optimization toolbox in MATLAB installed HP Intel® Pentium® CPU N3540 @ 2.16 GHz Windows 10 Laptop Computer. The data obtained in section 3.1 were used in the optimization process to obtain new parameters for each explicit model. The models before and after optimization with GA as well as the time for the completion of each optimization process are presented in Table 1 and Table 2, respectively.

Table 1. Explicit models to Colebrook-White equation before and after optimization with genetic algorithm (GA) and simulated annealing (SA).

Table 2. Performance of the optimized explicit friction factor models.

3.3.2. Simulated Annealing Optimization

Simulated annealing uses temperature parameter to control its global search. The temperature parameter starts off high and is slowly cooled during each iteration step. As it is in GA, the explicit model to be optimized is the objective function. Each explicit model is coded with all numerical variables taking input argument, “x”. For the minimization of the objective function, it is passed in a function handle to the objective function as well as specifying the start point for each variable. Since it is a bound constraint, the lower and upper bounds for each variable is imputed as a vector. The range of the values is arbitrary and at neighborhood of the initial values. The algorithm searches within the range for the best points that optimize the objective function. Data from section 3.1 were used for the optimization of each model, where optimized parameters were obtained for each input argument, x.

3.4. Performance Evaluation of the Optimized Explicit Models

The deviations of the outputs of the original explicit models and the optimized explicit models from the output of Colebrook-White equation were obtained. The results in terms of maximum absolute relative errors (MAREs) are summarized in Table 2. Moreover, the times taken for the optimized solutions to be obtained for both GA and SA are also presented in Table 2.

4. Discussion

From Table 2, it is observed that the performances of the optimized models using both GA and SA improve either moderately or significantly as they give rise to lower MAREs when compared with those of the original models before optimization. It is noteworthy that MAREs obtained for the SA-optimized models are lower than those for GA-optimized models which indicate that SA is a superior optimizer when compared to GA in terms of accuracy.

Furthermore, from Table 2, it is seen that the times taken by GA to find the optimal solutions for each model are significantly larger than the corresponding times taken by SA. Thus, it is obvious that it is computationally cheaper to use SA for the optimization of the explicit friction models.

Therefore, since SA leads to more accurate explicit friction factor models and requires less computational times than the GA, it can be concluded that SA is a better optimizer than GA in the process of finding an improved explicit friction factor model as an alternative to the implicit Colebrook-White equation.

5. Conclusion and Recommendation

Existing reports show that the performances of the explicit friction factor models developed in lieu of the Colebrook-White equation improve when genetic algorithm (GA), a global optimization method was used to modify their parameters. Unfortunately, the computational costs associated with this process was neither investigated nor reported.

Consequently, this study has successfully investigated the computational burden associated with the use of GA in optimizing the parameters of several existing explicit friction factor models. Moreover, the effectiveness of Simulated Annealing (SA), another global optimization search algorithm was investigated.

Although both GA and SA led to either moderate or significant improvements in the accuracies of the existing friction factor models, SA outperforms the GA. Moreover, the SA requires far less computational time than the GA to complete the corresponding optimization process.

It can therefore be concluded that SA is a better global optimizer than GA in the process of finding an improved explicit friction factor model as an alternative to the implicit Colebrook-White equation.

The current work is limited to the use of GA and SA. It is therefore recommended that the effectiveness of global optimization methods other than the GA and SA should be investigated for estimating the parameters of the explicit friction factor models.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Colebrook, C.F. and White, C.M. (1937) Experiments with Fluid Friction Factor in Roughened Pipes. Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, 161, 367-381.
https://doi.org/10.1098/rspa.1937.0150
[2] Colebrook, C.F. (1939) Turbulent Flow Pipe Particular Reference to the Transition Region between the Smooth and Rough Pipe Law. Journal of the Institution of Civil Engineers, 11, 133-156.
https://doi.org/10.1680/ijoti.1939.13150
[3] Moody, L.F. (1944) Friction Factors for Pipe Flow. Transactions of the ASME, 66, 671-684.
https://doi.org/10.1115/1.4018140
[4] Offor, U.H. and Alabi, S.B. (2016) An Accurate and Computationally Efficient Explicit Friction Factor Model. Advances in Chemical Engineering and Science, 6, 237-245.
https://doi.org/10.4236/aces.2016.63024
[5] Pérez-Pupo, J., Navarro-Ojeda, M., Pérez-Guerrero, J. and Batista-Zaldívar, M. (2019) On the Explicit Expressions for the Determination of the Friction Factor in Turbulent Regime. Revista Mexicana de Ingeniería Química, 19, 313-334.
https://doi.org/10.24275/rmiq/Fen497
[6] Niazkar, M. and Talebbeydokhti, N. (2020) Comparison of Explicit Relations for Calculating Colebrook Friction Factor in Pipe Network Analysis Using h-Based Methods. Iranian Journal of Science and Technology—Transactions of Civil Engineering, 44, 231-249.
https://doi.org/10.1007/s40996-019-00343-2
[7] Cojbasić, Ž. and Brkić, D. (2013) Very Accurate Explicit Approximations for Calculation of the Colebrook Friction Factor. International Journal of Mechanical Sciences, 67, 10-13.
https://doi.org/10.1016/j.ijmecsci.2012.11.017
[8] Serghides, T.K. (1984) Estimate Friction Factor Accurately. Chemical Engineering, 91, 63-64.
[9] Romeo, E., Royo, C. and Monzón, A. (2002) Improved Explicit Equations for Estimation of the Friction Factor in Rough and Smooth Pipes. Chemical Engineering Journal, 86, 369-374.
https://doi.org/10.1016/S1385-8947(01)00254-6
[10] Winning, H.K. and Coole, T. (2013) Explicit Friction Factor Accuracy and Computational Efficiency for Turbulent Flow in Pipes. Flow, Turbulence and Combustion, 90, 1-27.
https://doi.org/10.1007/s10494-012-9419-7
[11] Brkić, D. and Ćojbašić, Ž. (2017) Evolutionary Optimization of Colebrook’s Turbulent Flow Friction Approximations. Journal of Fluids Engineering, 2, 1-27.
https://doi.org/10.20944/preprints201703.0015.v1
[12] Sousa, J., Cunha, M.C. and Marques, A.S. (1999) An Explicit Solution of the Colebrook-White Equation through Simulated Annealing. Water Industry Systems: Modelling and Optimization Applications, 2, 347-355.
[13] MathWorks, Inc. (2015) Global Optimization Toolbox User’s Guide. Natick, 604 p.
[14] Chen, N.H. (1979) An Explicit Equation for Friction Factor in Pipe. Industrial & Engineering Chemistry Research, 18, 296-297.
https://doi.org/10.1021/i160071a019
[15] Barr, D.I.H. (1981) Solutions of the Colebrook-White Functions for Resistance to Uniform Turbulent Flows. Proceedings of the Institution of Civil Engineers, 71, 529-536.
https://doi.org/10.1680/iicep.1981.1895
[16] Papaevangelou, G., Evangelides, C. and Tzimopoulos, C. (2010) A New Explicit Relation for Friction Coefficient in the Darcy-Weisbach Equation. Proceedings of the 10th Conference on Protection and Restoration of the Environment, Volume 166, 1-7.
[17] Avci, A. and Karagoz, I. (2009) A Novel Explicit Equation for Friction Factor in Smooth and Rough Pipes. ASME Journal Fluids Eng., 131, 61-203.
https://doi.org/10.1115/1.3129132
[18] Shacham, M. (1980) An Explicit Equation for Friction Factor in Pipe. Industrial & Engineering Chemistry Fundamentals, 19, 228-229.
https://doi.org/10.1021/i160074a019
[19] Manadilli, G. (1997) Replace Implicit Equations with Signomial Functions. Chemical Engineering, 104, 129-132.
[20] Zigrang, D.J. and Sylvester, N.D. (1982) Explicit Approximations to the Colebrook’s Friction Factor. AIChE Journal, 28, 514-515.
https://doi.org/10.1002/aic.690280323
[21] Ghanbari, A., Farshad, F. and Rieke, H.H. (2011) Newly Developed Friction Factor Correlation for Pipe Flow and Flow Assurance. Journal of Chemical Engineering and Materials Science, 2, 83-86.
[22] Swamee, D.K. and Jain, A.K. (1976) Explicit Equations for Pipe Flow Problems. Journal of the Hydraulics Division, 102, 657-664.
https://doi.org/10.1061/JYCEAJ.0004542
[23] Fang, X., Xu, Y. and Zhou, Z. (2011) New Correlations of Single-Phase Friction Factor for Turbulent Pipe Flow and Evaluation of Existing Single-Phase Friction Factor Correlations. Nuclear Engineering and Design, 241, 897-902.
https://doi.org/10.1016/j.nucengdes.2010.12.019
[24] Sonnad, J.R. and Goudar, C.T. (2006) Turbulent Flow Friction Factor Calculation Using a Mathematically Exact Alternative to the Colebrook-White Equation. Journal of Hydraulic Engineering, 132, 863-867.
https://doi.org/10.1061/(ASCE)0733-9429(2006)132:8(863)
[25] Buzzelli, D. (2008) Calculating Friction in One Step. Machine Design, 80, 54-55.

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.