Absolute roughness calculation by the friction factor calibration using the Alternative Hydraulic Gradient Iterative Method on water distribution networks

The main objective of this research is the development of a new formulation for calibration of the head loss universal equation friction factor using the Alternative Hydraulic Gradient Iterative Method for calculating the absolute roughness. The method was applied with the aid of Epanet2.dll library for hydraulic simulations in two fictitious distribution networks. The influence of the initial roughness adopted, the number of nodes with known pressure data and position of the nodes with known pressures was tested. To test the influence of the initial roughness to be adopted a computer subroutine has been developed in order to calculate the most appropriate initial roughness for each section. The results showed that it is recommended to use as starting absolute roughness the usual value for the pipe material as new. The developed computational subroutine is recommended for unknown pipes network material or very old networks. How higher number of known pressures in the distribution network, better the accuracy of the method. However, a good layout of the nodes with known pressures was more important than a large number of pressure measurements. The best configuration found to the nodes with known pressures they were separated compared setting together with each other. The method was simple to apply and with good results, and can be applied with a small number of iterations.


INTRODUCTION
In a modern society, it is indispensable to use water distribution networks to supply the basic needs of any population, quickly, practicality and comfort for the user of the resource.Once installed, the service life of a distribution network is considered to vary from 20 to 30 years.
Over time, due to the aging of the pipes, their characteristics, as roughness, change, generating difficulties in the analysis, operation and maintenance of the networks.Vasconcelos, Costa and Araújo (2015) report that such modifications can significantly affect the water distribution mechanism, causing losses of internal pressures, loss of fluid transport capacity and even leaks.However, the difficulty encountered in the analysis of a distribution network isn't only in the age of the pipes, but also in the initial estimation of the parameters or in the data provided by the manufacturers.Cheng and He (2011) argue that without an appropriate estimation of the parameters, a numerical model can not adequately simulate reality, with differences between predicted model and actual systems in the field behaviors.
For Dini and Tabesh (2014), due to the complexity of water distribution systems and large-scale decision-making in the analysis, design, operation and maintenance of these systems, it is increasingly necessary to use computational modeling to understand the behavior of water distribution systems.
Thus, the EPANET computational model (ROSSMAN, 2000), developed by the American Environmental Protection Agency (EPA), is widely used for simulations of water distribution systems in forced conduits.Barroso and Gastaldini (2010), as well as Soares and Reis (2004), used this model in their works.
However, Walski (1983) describes that the initial data of a distribution network are not perfect, so some values need to be calibrated to be in concordance between the model and the real.Vassiljev et al. (2015) also understand that the calibration of a computational model is necessary to approach the reality.
The calibration process, or inverse method, aims to update calculated computational data in order to approach physical data observed.For Solomatine et al. (1999), the objective of the calibration of any physical model is to find parameters, in a model, which are not known a priori.
Some authors have already used calibration in distribution network parameters such as flow (WALSKI, 1983), demand (BHAVE, 1988) or roughness (ORMSBEE;WOOD, 1986;SILVA et al., 2004).Through various methods such as Artificial Neural Networks, Genetic Algorithms or Hydraulic Gradient Methods (ROCHA et al., 2013).Kun et al. (2015) explain that the roughness is one of the characteristics of greater uncertainty in the pipes, it is difficult to measure directly in the field, being, therefore, one of the main objectives of calibration.
The calibration methods are usually iterative or search methods, which means that in addition to the computational modeling for the hydraulic simulation of the network, a computational model is also necessary to carry out the calibration process.
The objective of this work is the calculation of the absolute roughness in water distribution networks by calibrating the friction factor of the Darcy-Weisbach equation using as a calibration tool a new equation for the Alternative Hydraulic Gradient Iterative Method and as Hydraulic simulator the EPANET2 software.In addition, the influence of the number of pressures data, the position of nodes with known pressures and the initial roughness of the calibration process in the application of the proposed method will be tested.
The calibration will be performed in the sections of the network proposed by Porto (2006) and the network proposed by Gambale (2000), an adaptation of Walski's (1983) network.

ALTERNATIVE HYDRAULIC GRADIENT ITERATIVE METHOD
The Hydraulic Gradient Iterative Method, proposed by Guo and Zhang (1994), had its origin in the calibration of the hydraulic transmissivity (or conductivity) of subterranean aquifers.In this case, for the use of an optimization method in the estimation of parameters of an inverse problem, it is common to use Equation 1as the objective function to be minimized.

(
) The f obj corresponds to the objective function, H C is the calculated hydraulic load, H O is the hydraulic load observed and n the number of points analyzed in the aquifer.Guo and Zhang (2000) describe the method as an iterative numerical procedure that begins with the initial estimation of the hydraulic parameters and improves the estimation according to the best condition based on the simulation results of a model with observed data.The iterative process reduces the differences between the hydraulic load calculated by the estimate and the hydraulic load simulated by the model with observed data.
The authors propose that, for the use of the cited method, the objective function to be minimized is the difference between the hydraulic gradients calculated and observed, being presented by Equation 2. where is the observed hydraulic gradient.Guo and Zhang (2000) showed that the optimal condition for the transmissivity parameter occurs when the partial derivative (Equation 3) of the objective function, as a function of transmissivity, approaches zero.
( ) where T is the transmissivity and j is the index of the cell.
Thus, the authors indicate that the parameter to be used follows what establishes Equation 4 at each iteration.
where i is the number of the iteration and α is the step length.
Bezerra et al.
In the alternative version of the method, Schuster and Araújo (2004), transformed Equation 3 into Equation 5, expressed in finite differences.
( ) where N is the number of cells with observed hydraulic load and ∆x, ∆y are the dimensions of each cell j.
In addition, the authors proposed the Equation 6 alternative instead of Equation 4.
where in each iteration i will be calculated the angle θ formed between the vectors of observed and calculated hydraulic gradients in each cell j, as shown in Equation 7.
For optimization, the angles θ j > 60º aren't considered until the calculated transmissivities in the neighboring cells cause the angle decrease.
After Schuster and Araújo (2004) developed the method, Tavares et al. (2010), Sousa et al. (2012) and Souza and Castro (2013) applied it in cases of underground flow, reason for which the method was developed.Rocha, Castro and Araújo (2009) were the first to adapt and apply the method in the calculation of roughness coefficients in water distribution networks.The authors applied the method to the calibration of the Hazen-Williams C coefficient where iterations occur using Equation 8, where C is the Hazen-Williams roughness coefficient, index i is the number of the iteration, and Index j is the number of the section.
The application in distribution networks maintained the one established by Schuster and Araújo (2004) regarding the calculation of the angle θ and the objective function, replacing only the transmissivity by the coefficient of roughness.After adaptation, this alternative method was also used in calibration of the Hazen-Williams C coefficient in the paper of Rocha et al. (2013).Pereira and Castro (2013) also applied the method in water distribution networks, however, instead of using the hydraulic gradient, they used the chlorine concentration gradient to calibrate the chlorine decay KW coefficient on the pipe walls.
In their work, the mentioned authors used Equation 9 for the calibration of the coefficient.
where C C ∇ is the calculated concentration gradient and O C ∇ the observed concentration gradient.
The established for the calculation of the angle θ was also maintained and in the objective function only replaced the hydraulic gradient by the concentration gradient.

METHODOLOGY Proposal formulation
As the Alternative Hydraulic Gradient Iterative Method was developed for the calibration of the underground water flow transmissivity and, according to the Darcy formula, this parameter is inversely proportional to the hydraulic gradient, Equation 6, through few iterations, finds a result Satisfactory for transmissivity.
When adapting the method for water distribution networks, analyzinghe universal formula of the load loss (Equation 10), it is observed that the friction factor f is directly proportional to the hydraulic gradient. .
where H ∇ is the hydraulic gradient, Q is the flow and D the diameter.Thus, for the calibration of the friction factor, in this work, Equation 11 was proposed for the method for hydraulic simulations with load losses calculated through the Darcy-Weisbach equation.
The criteria for the angle formed between the hydraulic gradient vectors and the calculation of the objective function were the same as those proposed and used by Schuster and Araújo (2004) and Rocha, Castro and Araújo (2009).
The absolute roughness was calculated for each iteration of the calibration of the friction factor, so new hydraulic simulations can be performed.According to Rossman (2000), EPANET2 uses the Swamie-Jain formula (Equation 12) to calculate the friction factor.
where å is the absolute roughness and Rey is the Reynolds number.
Isolating the roughness of Equation 12, we obtain as possibilities Equations 13 or 14.
The absolute roughness calculated using Equation 13 has great magnitude, in the order of meters or kilometers.The values found with the use of Equation 14 are the expected results, in the order of the thousandths, hundredths or tenths of millimeters, or Absolute roughness calculation by the friction factor calibration using the Alternative Hydraulic Gradient Iterative Method on water distribution networks even millimeters.Thus, the absolute roughness, as a function of the calibrated friction factor, was calculated through Equation 14.
However, throughout the iterative process, for some values of friction factor calculated by Equation 11, the absolute roughness found has a negative value.For the process not to be unfeasible, the roughness found is ruled out and the roughness of the previous iteration is maintained until the neighboring sections can change the value of the friction factor so that a positive roughness is found.
For the networks tested in this paper, results with a maximum objective function of 0.000000001 were considered, thus guaranteeing the actual proximity between the calculated and observed hydraulic gradient values.
For the calibration process, two types of network, observed network and calculated network were considered.The first presents nodes with known pressures, which generates known or observed hydraulic gradient data.The second considers the roughness values calculated by the method to generate the calculated hydraulic gradient.
In this work, software was developed in Visual Basic programming language, with the help of the Epanet2.dlllibrary, to perform the iterative process of the method, according to Figure 1.

Calibrated water networks
The first network analyzed was the distribution network (Figure 2) proposed by Porto (2006).The network has 9 sections and 7 nodes.The input physical data (diameter, length, roughness, elevations and nodal consumption) of the network, as well as the pressure, flow and hydraulic gradient data obtained through the use of Epanet 2 software (ROSSMAN, 2000) are shown in Tables 1 and 2.
The second network analyzed was the distribution network (Figure 3) proposed by Walski (1983) and modified by Gambale (2000).The network has 10 sections and 7 nodes.The input physical data (diameter, length, roughness, elevations and nodal consumption) of the network, as well as the data of pressure, flow and hydraulic gradient obtained through the use of Epanet 2 software are presented in Tables 3 and 4.
The simulations performed to obtain the template had a water level of the reservoir 485,8m in the Porto network ( 2006) and 60m in the Walski (1983) -Gambale (2000) network.For both networks, diameters and lengths of the sections, besides nodal consumptions, elevations and water level were obtained through the original authors of each network.The roughnesses used in the nets were indicated in each section in a random way, in order to obtain different values to be found by the calibration process.
The template values for the pressures present in Tables 2 and 4 were used as pressures observed in the calibrations, since the networks are hypothetical and there is no way to obtain field measurements.

Accomplished simulations
For both the Porto (2006)    For the influence of the number of nodes with known pressure data analysis, for each initial absolute roughness, the networks were simulated for data known in 7, 6, 5, 4, 3, 2 and 1 node.
To know the importance of the location of the nodes that should have the measured pressure, simulations were carried out with known pressures on 3 close nodes, 3 apart nodes, 2 close nodes, 2 apart nodes, 1 node near the reservoir and 1 node away from the reservoir.
Finally, to study the relevance of the initial roughness in the iterative process and hydraulic simulations, all simulations were made for initial absolute roughness of 0.006 mm in all sections, 6 mm in all sections and for roughness found through a search subroutine that can generate different roughnesses in each section.
The computational subroutine created has the function of finding the absolute roughness, in the sections of the calculated network, that generates a calculated hydraulic gradient, for each section, as close as possible to the observed hydraulic gradient, of each section of the observed network.For this, the roughness ranges from 0.006 mm to 6 mm, in all sections of the observed and calculated networks, passing through 6 equidistant intermediate values.Thus, the roughnesses that generate the closest hydraulic gradients, in each section, will be the initial roughness.
Table 5 shows the nodes used as observed pressures for each network in each simulation.

RESULTS AND DISCUSSIONS
The results will be presented for the two simulated networks to analyze the nodal pressures found, the absolute roughness of the sections of the networks and the number of iterations required.

Pressures
For an initial absolute roughness of 0.006 mm and considering that there are data of pressures known in 7, 6, 5, 4, 3, 2 or 1 nodes, there were no large variations in the pressures found by the calibration process in the nodes of the Porto (2006) network, as can be seen in Figure 4.The largest error found in the pressure value when compared to the template value was 3.37% and occurred at node 5 when there was only 1 known pressure data.
For the Walski (1983) -Gambale (2000) network, considering the same conditions, ie initial absolute roughness of 0.006 mm and known pressures data in 7, 6, 5, 4, 3, 2 or 1 nodes, the largest Error was 0.58% and occurred at node 8 for 2 nodes with known data.Figure 5 shows the pressures found in the calibration process of said network.Absolute roughness calculation by the friction factor calibration using the Alternative Hydraulic Gradient Iterative Method on water distribution networks Table 6 shows the average percentage error found for the Porto ( 2006) network ( 1) and the Walski (1983) -Gambale (2000) network (2) considering the 7 cases of nodes with known pressures and an initial absolute roughness of 0.006 mm.
For each network, the average error for the pressure values obtained through the calibration process increases as the number of nodes with known pressures decreases.However, even when the pressure value in only one node is known, for the Porto (2006 network), the mean error was 1.04% and the maximum error did not reach 5%.For the Walski (1983) -Gambale (2000) network, although the maximum error was found when the network was calibrated for known pressures at 2 nodes, the largest average error occurred for only 1 node with known pressure.
In Figures 6 and 7 are found the results of pressures found when using, for all the sections of the two networks, an initial value of absolute roughness equal to 6 mm.
For the initial roughness of 6 mm, it is noticed that the pressures found in the iterative calibration process were not as good as when 0.006 mm was used.
For the Porto (2006) network, the maximum error reached 73.82% at node 7 for known pressure at only 1 node.For the Walski (1983) -Gambale (2000) network the maximum error was lower, being 13.87% at node 8 for 2 nodes with known pressures.
Table 7 shows the average percentage error found for the Porto ( 2006) network ( 1) and for the Walski (1983) -Gambale (2000) network (2) considering the 7 cases of nodes with known pressures and an absolute roughness initial of 6 mm.
For this initial roughness, the average error, for the found pressures through the calibration process, doesn't increase as the number of nodes with known pressures decreases.However, when this does not occur there is a small percentage difference.
When using the computational subroutine to find the initial roughness that generates greater initial proximity between the hydraulic gradients of the sections of the calculated and observed networks, for the pressure, intermediate errors were found when compared to the values found with the use of the initial roughness of 0.006 mm and 6 mm.
The pressures encountered can be seen in Figures 8 and 9.
For the Porto (2006) network, the maximum error reached 32.23% at node 7 for known pressure at only 1 node.For the Walski (1983) -Gambale (2000) network the maximum error was lower, being 7.15% in node 8 for 1 node with known pressures.
Table 8 shows the average percentage error found for the Porto (2006) network (1) and for the Walski (1983) -Gambale (2000) network (2) considering the 7 cases of nodes with known pressures and an absolute roughness calculated by the computational subroutine.
The average errors found increased as the number of nodes with known pressures decreased.The highest average error found for the Porto (2006) network was 13.30% with known pressure in only 1 node.For the Walski (1983) -Gambale (2000) network, the largest average error found was 3.40% with known pressure at only 1 node.
For the networks Porto (2006) and Walski (1983) -Gambale (2000), respectively, Figures 10 and 11 contain the pressures found for 3 and 2 nodes with known pressures, these nodes being organized in two ways, together, and apart from each other.In addition, they show the pressures for 1 node with known pressure, being close to the reservoir and away from the reservoir.These simulations were performed for initial roughness of 0.006 mm.
Table 9 shows the average percentage error found for the Porto (2006) network (1) and the Walski (1983) -Gambale (2000) network (2) considering the location of known pressure data.
As for the location of nodes with known pressure data, when the pressures in apart nodes are known, the results are better than when data is available on nodes close to each other.When it   Walski (1983) and Gambale (2000) network Table 6.Average percentage error between the real pressures and the calibrated networks pressures -initial roughness of 0.006 mm. is only possible to know the pressure at 1 node, it is preferable to know this pressure at a node farther from the reservoir than to measure the pressure near the reservoir.

Net
For both simulated networks, the average error found when we had known pressures on 3 nodes together was higher than when we had two separate nodes.

Absolute roughness
Tables 10 and 11 show the absolute roughness found by the iterative calibration process for the Porto (2006) and Walski (1983) -Gambale (2000) networks, respectively, for initial roughness of 0.006 mm.In Tables 12 and 13 for initial roughness of 6 mm        14 and 15 for initial roughness calculated by the computational subroutine.
As occurred with the calculation of the pressures, the absolute roughness found by the method proposed here was also satisfactory.
For the Porto (2006) network, considering an initial roughness of 0.006 mm, only section 3 presented high roughness values for pressure measurements from 3 nodes.However, for Walski (1983) -Gambale (2000) network, for the same initial roughness, only section 10, with a real roughness of 1 mm, did not reach close values for any simulated condition of quantity of nodes with measured pressures.However, for the other sections, the results were satisfactory.
When calibrations were performed with initial roughness of 6 mm, unreal absolute roughness values were obtained for both networks.
For the initial calculated roughness through the developed computational subroutine some roughnesses were found out of the reality, however, many values were close to the template, principally for a larger number of nodes with measured pressures.Absolute roughness calculation by the friction factor calibration using the Alternative Hydraulic Gradient Iterative Method on water distribution networks

Number of required iterations
One of the great advantages of the proposed method is the number of required iterations to achieve the calibration result.
In the majority of the simulations, there were a small number of iterations to reach a satisfactory result of the calibration process of the distribution networks.
In this work, the iterations were performed until the desired objective function of 0.000000001 was reached or if it reached 100 iterations.
Only for the Walski (1983) -Gambale (2000) network simulations for the configuration of 3 close nodes, the method did not reach the desired objective function, reaching 100 iterations.
For initial roughness of 0.006 mm, in the majority of the simulations, it was not necessary more than 2 iterations.Thus, even without a computational model, it is possible to perform the calibration process proposed in this work with satisfactory results only with the aid of a hydraulic simulator and spreadsheets.
Table 16 shows the number of required iterations to find the calibration result through the method with the proposed equation.

CONCLUSIONS
The calculation of the pressures for both simulated networks, using Equation 11 for the calibration of the friction factor using an initial absolute roughness equal to 0.006 mm, presented satisfactory results, with errors less than 5%.As used in the usual PVC roughness value, it is noted that using the actual values of the new material for initial roughness is a good choice.For this initial roughness value, good roughness values were found after the calibration process.
Through the simulations mentioned, how higher the number of known pressure data, closer the reality will be to the result.
However, when the simulations were made using the initial roughness values of 6 mm, it was observed that for both networks with known pressure data at 3 nodes or less, we saw pressure errors higher than 5% and absolute roughness out of reality.Thus, it is recommended that a very high roughness not be used as the initial roughness of the calibration process.
The computational subroutine, developed for the calculation of the initial roughness to be used in the iterative calibration process, did not find the best results but found satisfactory results, with small differences between the calculated network and the template, but with an excellent relation between the network Observed and calculated.Thus, it is concluded that the developed computational subroutine is a great tool to be used when it wasn't known about the material of the existing network or, even, about a high age of the network.
Through the simulations carried out with known pressures in nodes located in different positions it was possible to perceive that the place where the pressure must be measured may be even more important than the number of measured pressures.This shows the importance of carrying out a previous study to choose the nodes to have the measured pressure before the calibration of a distribution network.
Because it is a method that generally requires few iterations to find a satisfactory result and uses an easily applied equation, this method can be considered simple to apply.

Figure 1 .
Figure 1.Flow diagram of the process used.

Figure 8 .
Figure 8. Found pressures for initial roughness calculated by the computational subroutine -Porto (2006) network.

Figure 10 .
Figure 10.Found pressures for initial roughness of 0.006 mm with different positions of known data -Porto (2006) network.

Figure 11 .
Figure 11.Found pressures for initial roughness of 0.006 mm with different positions of known data -Walski (1983) and Gambale (2000) network.

Table 5 .
Nodes with known pressures.

Table 7 .
Average percentage error between the real pressures and the calibrated networks pressures -initial roughness of 6 mm.

Table 8 .
Average percentage error between real and calibrated networks -initial roughnesses calculated by the computational subroutine.

Table 9 .
Average percentage error between real and calibrated networks -initial roughness of 0.006 mm and with data in different locations.

Table 10 .
Absolute roughness (mm) found by the iterative calibration process with initial roughness of 0.006 mm -Porto (2006) network.

Table 16 .
Number of required iterations.