# Efficient Double-Tee Junction Mixing Assessment by Machine Learning

^{1}

^{2}

^{*}

Next Article in Journal

Next Article in Special Issue

Next Article in Special Issue

Previous Article in Journal

Previous Article in Special Issue

Previous Article in Special Issue

Department of Fluid Mechanics and Computational Engineering, Faculty of Engineering, University of Rijeka, 51000 Rijeka, Croatia

Center for Advanced Computing and Modeling, University of Rijeka, 51000 Rijeka, Croatia

Author to whom correspondence should be addressed.

Received: 8 November 2019
/
Revised: 28 December 2019
/
Accepted: 11 January 2020
/
Published: 15 January 2020

(This article belongs to the Special Issue Machine Learning Applied to Hydraulic and Hydrological Modelling)

A new approach in modeling of mixing phenomena in double-Tee pipe junctions based on machine learning is presented in this paper. Machine learning represents a paradigm shift that can be efficiently used to calculate needed mixing parameters. Usually, these parameters are obtained either by experiment or by computational fluid dynamics (CFD) numerical modeling. A machine learning approach is used together with a CFD model. The CFD model was calibrated with experimental data from a previous study and it served as a generator of input data for the machine learning metamodels—Artificial Neural Network (ANN) and Support Vector Regression (SVR). Metamodel input variables are defined as inlet pipe flow ratio, outlet pipe flow ratio, and the distance between the pipe junctions, with the output parameter being the branch pipe outlet to main inlet pipe mixing ratio. A comparison of ANN and SVR models showed that ANN outperforms SVR in accuracy for a given problem. Consequently, ANN proved to be a viable way to model mixing phenomena in double-Tee junctions also because its mixing prediction time is extremely efficient (compared to CFD time). Because of its high computational efficiency, the machine learning metamodel can be directly incorporated into pipe network numerical models in future studies.

The mixing of fluids in water distribution networks is a complex phenomenon that has been extensively subjected to research as it is relevant to several specific areas of application such as water distribution quality and safety [1,2,3], pollution source detection systems (both large [4,5] and small networks [6]), and optimal pollution sensor placement in a water distribution network [7,8,9,10]. The elements that form water distribution networks are pipes and junctions. When modeling mixing in a complex system, a correct mixing model must be applied to accurately describe the contaminant transport through the network due to the fact that a wrong solution could present a hazard to a great number of network users.

Usually, mixing in a pipe network is modeled as either complete mixing or bulk mixing. Complete mixing can be described as an even split of contamination at a network junction. Complete mixing models such as the one developed in the hydraulic analysis software EPANET are implemented by calculating the flow-weighted concentrations at the inlet pipes of a junction and then assuming an even split in the outlet pipes. The complete mixing model can be assumed correct only if there is a single outlet at a junction and if the distance between two junctions is great enough. For certain distances [11,12], it does not describe the physical process of mixing correctly.

Bulk mixing is an idealized mixing in which the flow between two inlet pipes is not interacting and the diffusive behavior between the inlet pipe streams is ignored (the streams are only touching at an interface). To model the bulk mixing, the flow momentum in the inlet pipes is calculated, and it determines how the concentration splits between the outlets. The inlet pipe with the higher momentum will dominate in concentration transfer into the outlet pipe, which follows the same direction as the inlet pipe. The inlet pipe with lower flow momentum will only transfer the concentration into its neighboring outlet pipe. This kind of mixing behavior is usually specific to cross junctions. The bulk mixing model is implemented in the software EPANET-BAM [13] (which can be considered as an extension of EPANET). If the expected mixing behavior is neither complete nor bulk, an experimentally-calibrated mixing model parameter can be used, by which type of mixing is defined.

In research by McKenna et al. [14], it is shown that, for a cross junction (which is a special case of a double-Tee junction in which the distance between converging and diverging pipes is equal to zero), a strong deviation from complete mixing occurs when the Reynolds number at each inlet and outlet pipe is equal. On the other hand, stronger turbulence can also create a considerable unpredictability of mixing in cross junctions [15]. The mixing that occurs at two sequential Tee junctions is especially complex due to increased chaotic eddying of flow, which in turn increases the diffusion between the streams. It is proved in several studies [12,16,17] that the length between double-Tee junctions is important since it determines the behavior of mixing of fluids or rather the transport of contaminant into each diverging pipe. In addition, variation of flows at both inlet and outlet pipes causes the mixing behavior to vary [11,12]. Another property of a pipe system that can cause an incomplete mixing behavior are uneven pipe diameters, where a large difference between pipe diameters can produce a more complete mixing [18]. The orientation of pipes for a double-Tee junction also affects the mixing behavior, and it is shown that mixing for a case when the pipes are at a opposite side compared to the case where they are at the same side, behaves differently [11,12] (assuming planar configuration). It is also shown that transitional and laminar flows in pipes exhibit a specific mixing behavior [19].

Instead of an experimental approach to studying mixing behavior in double-Tee junctions, computational fluid dynamics (CFD) can also be used. A species transport model coupled with RANS turbulence models yields good results [12,16] that can be used to further enhance simpler 1D mixing models (such as EPANET-BAM). Additionally, a high fidelity LES turbulence model can also be used to study mixing with more detail [20]. The problem with CFD simulations and the contaminant transport model is that they need to be calibrated as they are dependant on the turbulent Schmidt number, the value of which is very much case-specific [21,22] and has been differently reported in several studies regarding CFD analysis of mixing in double-Tee junctions [12,23,24]. Furthermore, CFD simulations are computationally expensive and producing results for a range of combinations of mixing scenarios (varying inlet and outlet flow, distance between junctions, and even pipe diameters) is quite impractical. Alternatively, mixing behavior can be predicted by use of data analysis (i.e., interpolation on a fixed previously produced dataset), as was done in a previous study [25] where Kriging and Delaunay triangulation were combined to describe mixing for different Reynolds numbers.

Recently, machine learning (ML) algorithms used in hydrology and hydraulics include Artificial Neural Networks (ANN) and variations [26,27], Random Forest [28], and Support Vector Machine [29]. ML has been previously successfully implemented in pipe flow systems. A selection of ML algorithms such as Random Forest, Bagging Algorithm, and Regression Tree were used to predict various characteristics of a wastewater pipe system and it was found that Regression Trees are most successful [30]. Several ML algorithms were also used to predict pressure gradients, liquid holdup, and flow pattern identification of multiphase flow on a pipe segment (where data were generated by CFD) and, for some of the characteristics, the Gradient Boosting algorithm and Support Vector Machine yielded best results [31]. Deep learning (i.e., ANN) was successfully applied to produce the best valve scheduling scenario in the case of pipe network contamination instead of searching for a contamination source [32]. Similarly, Support Vector Regression (SVR) was used to detect anomalies in a pipe network system [33] and a modified ANN approach was used for pipe network management [34].

A ML approach can be also used to evaluate the mixing behavior based on previously obtained data (either by experiment or by CFD). In this study, two ML algorithms—SVR and ANN—were tested in predicting mixing behavior for a combination of different inlet and outlet pipe flow ratios and different distances between double-Tee junctions, on one pipe configuration. Training data were generated by 3D CFD that was calibrated on an experiment presented in a previous study [12]. A supercomputer was used for CFD modeling due to its high computational demand and need to generate as many data as possible for better ML training.

Mixing prediction was performed for a previously reported experiment [12], in which the setup includes varying distances between double-Tee junctions and varying inflows in pipes.

Figure 1 shows the pipe configuration used. Branch pipes are on the opposite sides and the arrows represent the flow direction. Tap water (T) (which was used as a tracer) enters the main inlet pipe 1 while distilled water (D) enters the branch inlet pipe 2 causing the mixture (M) of tap and distilled water to exit both the main outlet pipe 3 and the branch outlet pipe 4. The electrical conductivity of tap water in the experiment was measured to be around 200 μS/cm^{2} while the distilled water conductivity was around 2 μS/cm^{2} at pipe inlets 1 and 2, respectively. This difference of electrical conductivity of the fluids was used to determine the mixing process in the double-Tee junctions since they differed by a factor of 100. The electrical conductivity of the mixture that leaves pipe outlets 3 and 4 was measured and was always constrained between the inlet tap water and inlet distilled water electrical conductivity. The rate of mixing or the electrical conductivity of the mixture at outlets depends on the flow conditions in the inlet and outlet pipes.

The measure of mixing taken from experimental data and used for further investigation of mixing was the branch outlet pipe 4 to main inlet pipe 1 (see Figure 1) conductivity ratio, which is defined as
where ${c}_{4}$ represents the conductivity at outlet pipe 4, while ${c}_{1}$ is the conductivity at inlet pipe 1.

$${R}_{c}=\frac{{c}_{4}}{{c}_{1}}$$

This ratio was chosen due to its usage in previous studies [13,35] as it can be used in mixing prediction for simpler 1D models (EPANET-BAM). The inlet pipe flow ratio was also varied in the experiment and it is defined as
where ${Q}_{1}$ defines the flow at inlet pipe 1 and ${Q}_{2}$ the flow at inlet pipe 2. The values of ${Q}_{1}$ and ${Q}_{2}$ were controlled with valves in the experiment until a steady state behavior was achieved and then the measurement of the electrical conductivity at each outlet pipe was made.

$${R}_{{q}_{in}}=\frac{{Q}_{1}}{{Q}_{2}}$$

The inflow pipe ratios ${R}_{{q}_{in}}$ used in the experiment were 0.333, 0.5, 1, 2, and 3, while the flow at both outlet pipes was the same. One of the purposes of this study was to examine the behavior of mixing when ${R}_{{q}_{in}}$ is not equal to 1 while the flow at both outlet pipes is also being varied since there is a lack of previous research regarding these combinations (which in a realistic case are most probable). Another important characteristic of the experiment is the distance between the double-Tee junction that was varied as $5.6D$, $10D$, and $15D$ (where D is the diameter of the pipes). All of the relevant specifications of the experiment are summarized in Table 1.

A CFD approach was used as both a comparison of efficiency with the ML approach and a dataset generator for ML algorithms. The open-source CFD toolbox OpenFOAM [36] was used to model the mixing phenomena as it was previously proven to work well for the given problem. The isothermal 3D steady Reynolds-Averaged Navier–Stokes (RANS) equations with the passive scalar transport model and the k-Epsilon (k-$\u03f5$) turbulence model were solved, where k represents the turbulence kinetic energy and $\u03f5$ is the turbulence energy dissipation. The passive scalar transport model is defined as:
In Equation (3), parameter c represents a dimensionless scalar value, set as $c=0$ for distilled water and $c=1$ for tap water as it represents the tracer in pipes; ${D}_{t}$ is the turbulent diffusivity defined by Equation (4); and **v** represents the advection velocity vector. Equation (3) can be physically interpreted as transport of a scalar quantity c by the fluid flow, which is resolved by the coupled RANS/(k-$\u03f5$) model. The additional passive scalar transport model in Equation (3) was coupled with the steady-state turbulent OpenFOAM solver simpleFoam making it a new fluid flow solver referred to as tracerFoam.

$$\nabla \times \left(\mathbf{v}c\right)=\nabla \times \left({D}_{t}\nabla c\right)$$

$${D}_{t}={D}_{mol}+\frac{{\nu}_{t}}{{S}_{ct}}$$

$${\nu}_{t}={C}_{\mu}\frac{{k}^{2}}{\u03f5}$$

Equation (4) is essential for modeling mixing phenomena as the turbulent Schmidt number ${S}_{ct}$ needs to be calibrated. According to the results of the previous study [12], ${S}_{ct}$ was defined as ${S}_{ct}=0.5$. As for other parameters, ${D}_{mol}$ is the molecular diffusivity of water (set as ${D}_{mol}=1.7\phantom{\rule{0.166667em}{0ex}}\times \phantom{\rule{0.166667em}{0ex}}{10}^{-9}$ m^{2}/s [37]), ${\nu}_{t}$ represents the kinematic eddy viscosity, and the constant ${C}_{\mu}$ was set to ${C}_{\mu}=0.09$.

A bounded second-order upwind-biased scheme was used for the divergence terms of the model, while for the gradient terms the central difference scheme was used. The fluid used for all simulation runs was water with kinematic viscosity of $\nu =1\phantom{\rule{0.166667em}{0ex}}\times \phantom{\rule{0.166667em}{0ex}}{10}^{-6}$ m^{2}/s.

A uniform value for velocity $\mathbf{v}$ was defined at pipe inlets and outlets and a no-slip boundary condition was defined at the pipe walls. The values of $\mathbf{v}$ were set at the pipe inlets and pipe outlets to form an exact ratio of both ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$ for all cases (0.333, 0.5, 1, and 2). Pressure $p=0$ was defined at outlet pipe 4 and zero pressure gradient in the normal direction was defined on the inlets, outlet pipe 3, and pipe walls. The concentration c was fixed at the inlets ($c=1$ for inlet pipe 1 and $c=0$ for inlet pipe 2), while, at the outlets and pipe walls, the derivative of concentration in the normal direction was set to zero. Additionally, the value of c was monitored at outlet pipe 3, and, to achieve a steady state regime, it had a convergence criterion of 10^{−5}. For the (k-$\u03f5$) turbulence model, the values of k and $\u03f5$ at inlets and outlets were defined the same way as for c except at the pipe walls, where turbulence wall functions were used. Boundary conditions used in the numerical model are summarized in Table 2.

Firstly, to use it as a dataset generator, the CFD model was validated with the previously obtained experimental data. A mesh independence study was done to find the optimal mesh sizes for data generation. Each distance between the double-Tee junctions yielded a differently sized mesh, with greater distances requiring more cells. The CFD approach mesh independence was validated with ${R}_{{q}_{in}}$ equal to 1 and with equal flow at outlet pipes (${R}_{{q}_{out}}$ equal to 1) for all of the above-mentioned distances (Table 1). The grid convergence residual criterion was set to 10^{−5} for Equation (3). Meshes used in the mesh independence study can be seen in Table 3 where the average cell size ranged from 1.2 to 0.5 mm, while the summary of the mesh independence study is presented in Table 4 where ${R}_{c}$ is the branch outlet pipe to main inlet pipe conductivity ratio. For ML model data generation, the fine mesh was chosen.

After the mesh independence study was completed and the numerical model was validated, CFD was used to generate data for ML. As it was defined in the experiment, the value of the inlet pipe flow ratio in Equation (2) was varied with the outlet pipe flow ratio, which is defined in Equation (6), where ${Q}_{3}$ is the main pipe 3 outlet flow and ${Q}_{4}$ is the branch pipe 4 outlet flow.

$${R}_{{q}_{out}}=\frac{{Q}_{3}}{{Q}_{4}}$$

For an array of ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$, the value of ${R}_{c}$ was obtained (${R}_{{c}_{CFD}}$). The ratios were all possible combinations of 0.333, 0.5, 1, 2, and 3 between the inlet pipes and the outlet pipes (e.g., ${R}_{{q}_{in}}$ set as 2 and ${R}_{{q}_{out}}$ as 0.333, ${R}_{{q}_{in}}$ = 1 and ${R}_{{q}_{out}}$ = 2, or ${R}_{{q}_{in}}$ = 0.333 and ${R}_{{q}_{out}}$ = 0.5).

This was conducted for all distances ($5.6D$, $10D$, and $15D$), comprising a total of 75 simulations on the fine mesh (25 simulations per distance).

Both an Artificial Neural Network (ANN) and Support Vector Regression (SVR) were used to train a model which predicts the behavior of mixing in a double-Tee junction case. For both methods, the input and output data were split as 70% for model training and 30% for model accuracy testing.

Generally, ANNs are a type of ML algorithms that are used to model complex phenomena, which are not as easy to model using conventional data analysis methods. The type of ANNs used in this study are Feedforward Multilayer Perceptron Neural Networks. This type of ANN is constructed using an input layer, which is usually data that cause the emergence of complex phenomena modeled, one or more hidden layers, and one output layer, which is usually the outcome of the complex phenomena. Layers consist of artificial neurons and a link exists between every layer of the ANN. Training an ANN is the process of fitting the weights of the artificial neuron links so that for each input datum a path of links is made to a certain output. Further information on ANNs can be found in the literature [38].

In this study, three hidden layers were added between the input and output layers and between every layer a dense connection was defined. The input layer consisted of three different data, the inlet pipe flow ratio ${R}_{{q}_{in}}$, the outlet pipe flow ratio ${R}_{{q}_{out}}$, and distance between the double-Tee junctions ($5.6D$, $10D$, and $15D$). The first hidden layer consisted of 50 neurons, both the second and third hidden layer consisted of 25 neurons, and all hidden layers used the rectifier activation function. The output layer was the value of Equation (1) or ${R}_{{c}_{ANN}}$. The sigmoid activation function was used at the output layer. The layer configuration is summarized in Table 5.

SVR can be considered as a special case of Support Vector Machine (SVM) models. SVMs can be used for both classification and regression problems and SVR would obviously belong to a family of algorithms used to create regression models. The SVR model is given training data in the form of inputs and outputs and it learns the relationship between the data. The inputs are n-dimensional vectors and the outputs are continuous values (unlike in classification problems). The input–output dependency or mapping is approximated using kernel functions and weights. Similar to in ANNs where the link weights are being fitted, the weights in SVR models are also fitted. In the process of learning, a hyperplane is created between the n-dimensional data along with error planes. The main goal is to find the data (or the support vectors) that are within the error margin. A further description of SVR can be found in the literature [41].

The data input and output values were the same as the ones for the ANN (defined in Section 2.3.1). A fifth-degree radial basis function (RBF) kernel was used for the model, a tolerance of 0.001 (which is the model fitting stopping criterion), an $\u03f5$ of 0.0001 (which specifies the error margin), and a penalty parameter equal to 3 (which is enforced for values outside the error margin). SVR was implemented in the Python ML library Scikit-learn [42].

The CFD analysis was done for 75 different scenarios by varying ${R}_{{q}_{in}}$, ${R}_{{q}_{out}}$, and three distances ($5.6D$, $10D$, and $15D$). The CFD simulation with ${R}_{{q}_{in}}$ equal to 0.333, 0.5, 2, and 3 and ${R}_{{q}_{out}}$ equal to 1 were compared with the experimental values to make sure that the procedure is valid and that a CFD model can be used as a data generator for ML (simulation results for ${R}_{{q}_{in}}$ equal to 1 are previously given in Section 2.2.2). The results are summarized in Table 6.

For the distance of $5.6D$ between double-Tee junctions, the root-mean-square error (RMSE) is 0.0214 with the minimum relative error being +0.3% and the maximum relative error −10% between the experimental and CFD values of ${R}_{c}$. The distance of 10D had the RMSE of 0.0246, the minimum relative error of experimental and CFD ${R}_{c}$ as −3.05%, and the maximum relative error +11%. For the $15D$ distance, the RMSE is 0.013 with minimum relative error as 0.9% and maximum relative error 8.9%. The error results are summarized in Table 7.

It can be seen that the error of the CFD model for the $15D$ distance is the lowest one. This can be attributed to a larger distance between double-Tees since the mixture is already averaged enough (and closer to complete mixing) across the pipe cross section before it is transported into the diverging pipes where, arguably, the most complex eddying of flow is happening. At smaller distances, that averaging of concentration before the diverging pipe is less visible. This can be seen in Figure 2 where Figure 2a is the concentration in the pipe cross section at $1.67D$ before the branch pipe 4 center-line for $5.6D$ distance, Figure 2b represents the same but for the $10D$ distance, and Figure 2c shows results for $15D$. In Figure 2d, the modeled kinetic energy of turbulence is shown and it is the highest at the entrance of branch pipe 4, which could be the cause of a slightly higher error for smaller distances. Overall, the errors are acceptable and CFD proved to be a viable tool in modeling this phenomena.

Even though the CFD method used provides a good model for mixing phenomena in double-Tee junctions, there is still a problem of computational efficiency. All simulations (for the fine mesh that ranged from approximately 1.8 to 3 million cells) were done using the BURA supercomputer resources at the University of Rijeka. All runs were executed in parallel on 8 Intel E5 nodes with 20 threads per node resulting in 160 processes in total. The computational run times (until the residual of Equation (3) fell below ${10}^{-5}$) for each case is summarized in Table 8.

Taking into account that these results were obtained with a supercomputer on 160 Intel E5 cores, this methodology is very inefficient if employed on an personal computer, especially since a lot of computation is necessary for a large variety of possible combinations of inlet pipe flows, outlet pipe flows, and distances between double-Tee junctions.

Of the 75 obtained simulation results, 70% were used for model training, and 30% were used for the purpose of model accuracy testing for both ANN and SVR since this train-to-test ratio provides that the training dataset should include all possible patterns used for defining the problem and should extend to the edge of the modeling domain. Both models were tested 10 times with randomly selected input data and the models with the minimum RMSE value of the test data were adopted and used further (both ML models RMSE varied for around 0.008 between the minimum and maximum value). The CFD obtained results were taken to be exact (since they exhibit a good agreement with the experimental results based on the average RMSE) and ANN and SVR model results were compared with them to examine their accuracy. For the same data inputs (${R}_{{q}_{in}}$, ${R}_{{q}_{out}}$, and distance), the ANN model performed better than the SVR model regarding the accuracy of the testing data (predictions of ${R}_{c}$). The RMSE of ANN predictions was 0.0172 while for SVR it was 0.0361 with the maximum error of 0.0427 for ANN and 0.119 for SVR. The results of training data predictions are summarized in Table 9 while a detailed comparison of predicted data can be seen in Table 10.

The values of ${R}_{{c}_{SVR}}$ (SVR predicted ${R}_{c}$) and ${R}_{{c}_{ANN}}$ (ANN predicted ${R}_{c}$) in Table 10, which were obtained from the 30% of the input dataset, in bold better predict the CFD modeled values ${R}_{{c}_{CFD}}$, which serve as correct results of mixing behavior. ANN had a better prediction than SVR for 14 out of 23 input data values but for the other 9 predictions it was also quite close to the CFD modeled values. Overall, both models exhibit solid accuracy for predicting the input data even though ANN would obviously be a better choice for further examination.

Another useful test was done on the ANN and SVR models, which is the prediction of ${R}_{c}$ for distances that were not in the input training data. The chosen distances were $7.5D$ and $12.5D$ since they are in between the training data values ($5.6D$, $10D$, and $15D$). The results of the $7.5D$ and $12.5D$ tests can be seen in Table 11 and again the results in bold are the ones that agree better with the CFD prediction.

After testing the prediction on different double-Tee junction distances (which were not included in the training data), it is obvious that ANN greatly outperforms SVR on this task. Henceforth, further double-Tee mixing ML analysis (of a whole range of ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$ values) was only done using ANN.

A prediction of a range of possible combinations of inlet pipe flow and outflow ratios was done, albeit on a range that is still inside the minimum and maximum values of ${R}_{{q}_{in}}$, ${R}_{{q}_{out}}$ (from 0.333 to 3), and the distance of the training model, thus no extrapolation of data was done. The purpose of this test was to obtain the whole ${R}_{{q}_{in}}$–${R}_{{q}_{out}}$ surface for a given distance between the double-Tee junction. Before extracting the surface data from the ANN model, which show mixing behavior for the whole array of ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$, an additional check of validity of the ANN model was performed for a ${R}_{{q}_{in}}=1.3$ and ${R}_{{q}_{out}}=1$ since the testing data were done only for ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$ of 0.333, 0.5, 1, 2, and 3. The CFD model result ${R}_{{c}_{CFD}}$ was 0.706 while the ${R}_{{c}_{ANN}}$ was 0.681, which corresponds to an error of +3.54% when ${R}_{{c}_{CFD}}$ is considered to be the exact value.

Figure 3, Figure 4 and Figure 5 show the predicted values of ${R}_{c}$ by ANN for the distances 5.6D, 10D, and 15D, respectively. Values of ${R}_{{c}_{ANN}}$ are represented by color and iso-lines. All three figures show continuous values of ${R}_{{c}_{ANN}}$ instead of the discreet ones obtained by CFD and experiments. It can be noticed by comparing the figures that the gradient of ${R}_{{c}_{ANN}}$ is smoother (the difference between the minimum and the maximum value is smaller) when the double-Tee distance is increased, which is logical since a much more complete mixing behavior is achieved with an increased distance. Another thing that can be noticed (for all distances) in the figures is that, when both ${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$ are increased, the value of ${R}_{{c}_{ANN}}$ tends towards 1, which can be interpreted as, when simultaneously both the flow in the main inlet pipe and the main outlet pipe are increasing, the concentration in the main outlet pipe is also increasing, and therefore deviating more from complete mixing. A similar thing happens when both (${R}_{{q}_{in}}$ and ${R}_{{q}_{out}}$) are decreasing, making the concentration ${R}_{{c}_{ANN}}$ lower (it tends towards 0).

Additionally, in Figure 6, a 3D ${R}_{{c}_{ANN}}$ plot that contains the surfaces for $5.6D$, $10D$, and $15D$ distances is presented to better depict the gradient or the steepness of the surfaces.

It is hard to quantify the efficiency of the ANN model since it is dependant on previously generated data (either by CFD or experiment) but if a task were to generate, with a trained ANN, the whole range of new values of ${R}_{c}$ from a range of input values, then it could be argued that ANN is extremely efficient since obtaining ${R}_{{c}_{ANN}}$ for 23 input data lasted 0.18 s.

In this paper, a new methodology for double-Tee junctions mixing modeling is presented based on an experiment from the previous literature. A CFD model was calibrated with the experimental data to serve both as a computational efficiency benchmark and a data-generator for a ML approach for the presented double-Tee junction mixing phenomena assessment problem.

In total, 75 simulations were done by the calibrated CFD RANS k-$\u03f5$ turbulence model and the data were used to train two different ML models. The input variables were defined as the inlet pipe flow ratio, the outlet pipe flow ratio, and distance between the double-Tee junction, while the output was the outlet branch pipe to main inlet pipe conductivity ratio, which is a relevant variable that describes the mixing behavior in a double-Tee junction.

The two tested ML algorithms were Support Vector Regression and Artificial Neural Network (specifically Feedforward Multilayer Perceptron), and, of the two, ANN outperformed SVR in accuracy. Empirical results obtained with the ANN model used show good approximation in predicting the mixing behavior for different distances between double-Tee junctions and inlet/outlet pipe flow ratios.

Besides the accuracy of ANN, it was determined that the computational efficiency of the ANN model is much greater than that of the CFD model, which makes it a great tool for modeling this kind of phenomena. Since many previous studies produced experimental data for a great number of different combinations (which include different Reynolds numbers ranges in pipes, varied pipe diameters, distances between double-Tees, pipe configuration, etc.), a further study could be done to create an ANN that takes into account all of these variables and produces all the relevant parameters to accurately model mixing. With its computational efficiency, a fast model such as ANN could be directly incorporated into complex water network supply pipe network models (such as EPANET and similar), which would greatly improve their accuracy and in turn make them a more powerful tool for predicting water network pollution dispersion and similar hazardous phenomena.

Conceptualization, L.G., L.K., S.D., and I.L.; Data curation, L.G. and I.L.; Formal analysis, L.G.; Funding acquisition, L.K.; Investigation, L.G., L.K., and I.L.; Methodology, L.K., S.D., and I.L.; Project administration, L.K. and S.D.; Resources, L.K. and S.D.; Software, L.G.; Supervision, S.D.; Validation, L.G. and I.L.; Writing—original draft, L.G.; and Writing—review and editing, L.G., L.K., S.D., and I.L. All authors have read and agreed to the published version of the manuscript.

This research was funded by the Center for Advanced Computing and Modeling, University of Rijeka.

The authors declare no conflict of interest.

- Di Nardo, A.; Di Natale, M.; Guida, M.; Musmarra, D. Water network protection from intentional contamination by sectorization. Water Resour. Manag.
**2013**, 27, 1837–1850. [Google Scholar] [CrossRef] - Grayman, W.M.; Murray, R.; Savic, D.A. Effects of redesign of water systems for security and water quality factors. In Proceedings of the World Environmental and Water Resources Congress 2009, Kansas City, MO, USA, 17–21 May 2009; pp. 1–11. [Google Scholar]
- Bello, O.; Abu-Mahfouz, A.M.; Hamam, Y.; Page, P.R.; Adedeji, K.B.; Piller, O. Solving Management Problems in Water Distribution Networks: A Survey of Approaches and Mathematical Models. Water
**2019**, 11, 562. [Google Scholar] [CrossRef][Green Version] - Kessler, A.; Ostfeld, A.; Sinai, G. Detecting accidental contaminations in municipal water networks. J. Water Resour. Plan. Manag.
**1998**, 124, 192–198. [Google Scholar] [CrossRef] - Adedoja, O.; Hamam, Y.; Khalaf, B.; Sadiku, R. Towards development of an optimization model to identify contamination source in a water distribution network. Water
**2018**, 10, 579. [Google Scholar] [CrossRef][Green Version] - Kranjčević, L.; Čavrak, M.; Šestan, M. Contamination source detection in water distribution networks. Eng. Rev.
**2010**, 30, 11–25. [Google Scholar] - Ciaponi, C.; Creaco, E.; Di Nardo, A.; Di Natale, M.; Giudicianni, C.; Musmarra, D.; Santonastaso, G.F. Reducing Impacts of Contamination in Water Distribution Networks: A Combined Strategy Based on Network Partitioning and Installation of Water Quality Sensors. Water
**2019**, 11, 1315. [Google Scholar] [CrossRef][Green Version] - Krause, A.; Leskovec, J.; Guestrin, C.; VanBriesen, J.; Faloutsos, C. Efficient sensor placement optimization for securing large water distribution networks. J. Water Resour. Plan. Manag.
**2008**, 134, 516–526. [Google Scholar] [CrossRef][Green Version] - Berry, J.; Hart, W.E.; Phillips, C.A.; Uber, J.G.; Watson, J.P. Sensor placement in municipal water networks with temporal integer programming models. J. Water Resour. Plan. Manag.
**2006**, 132, 218–224. [Google Scholar] [CrossRef][Green Version] - Hart, W.E.; Murray, R. Review of sensor placement strategies for contamination warning systems in drinking water distribution systems. J. Water Resour. Plan. Manag.
**2010**, 136, 611–619. [Google Scholar] - Song, I.; Romero-Gomez, P.; Andrade, M.A.; Mondaca, M.; Choi, C.Y. Mixing at junctions in water distribution systems: An experimental study. Urban Water J.
**2018**, 15, 32–38. [Google Scholar] [CrossRef] - Grbčić, L.; Kranjčević, L.; Lučin, I.; Čarija, Z. Experimental and Numerical Investigation of Mixing Phenomena in Double-Tee Junctions. Water
**2019**, 11, 1198. [Google Scholar] [CrossRef][Green Version] - Ho, C.K.; O’Rear, L., Jr. Evaluation of solute mixing in water distribution pipe junctions. J. Am. Water Work. Assoc.
**2009**, 101, 116–127. [Google Scholar] [CrossRef] - McKenna, S.A.; Orear, L.; Wright, J. Experimental determination of solute mixing in pipe joints. In Proceedings of the World Environmental and Water Resources Congress 2007, Tampa, FL, USA, 15–19 May 2007; pp. 1–11. [Google Scholar]
- Austin, R.; Waanders, B.v.B.; McKenna, S.; Choi, C. Mixing at cross junctions in water distribution systems. II: Experimental study. J. Water Resour. Plan. Manag.
**2008**, 134, 295–302. [Google Scholar] [CrossRef][Green Version] - Shao, Y.; Yang, Y.J.; Jiang, L.; Yu, T.; Shen, C. Experimental testing and modeling analysis of solute mixing at water distribution pipe junctions. Water Res.
**2014**, 56, 133–147. [Google Scholar] [CrossRef] [PubMed] - Yu, T.; Tao, L.; Shao, Y.; Zhang, T. Experimental study of solute mixing at double-Tee junctions in water distribution systems. Water Sci. Technol. Water Supply
**2014**, 15, 474–482. [Google Scholar] [CrossRef] - Yu, T.; Qiu, H.; Yang, J.; Shao, Y.; Tao, L. Mixing at double-Tee junctions with unequal pipe sizes in water distribution systems. Water Sci. Technol. Water Supply
**2016**, 16, 1595–1602. [Google Scholar] [CrossRef] - Shao, Y.; Zhao, L.; Yang, Y.J.; Zhang, T.; Ye, M. Experimentally Determined Solute Mixing under Laminar and Transitional Flows at Junctions in Water Distribution Systems. Adv. Civ. Eng.
**2019**, 2019, 3686510. [Google Scholar] [CrossRef] - Webb, S.W.; van Bloemen Waanders, B.G. High fidelity computational fluid dynamics for mixing in water distribution systems. In Proceedings of the Water Distribution Systems Analysis Symposium 2006, Cincinnati, OH, USA, 27–30 August 2006; pp. 1–15. [Google Scholar]
- Gualtieri, C.; Angeloudis, A.; Bombardelli, F.; Jha, S.; Stoesser, T. On the values for the turbulent Schmidt number in environmental flows. Fluids
**2017**, 2, 17. [Google Scholar] [CrossRef][Green Version] - Valero, D.; Bung, D.B. Sensitivity of turbulent Schmidt number and turbulence model to simulations of jets in crossflow. Environ. Model. Softw.
**2016**, 82, 218–228. [Google Scholar] [CrossRef] - Ho, C.K.; Wright, J.L.; McKenna, S.A.; Orear Jr, L. Contaminant Mixing at Pipe Joints: Comparison between Laboratory Flow Experiments and Computational Fluid Dynamics Models; Technical Report; Sandia National Lab. (SNL-NM): Albuquerque, NM, USA, 2006.
- Romero-Gomez, P.; Choi, C.; van Bloemen Waanders, B.; McKenna, S. Transport phenomena at intersections of pressurized pipe systems. In Proceedings of the Water Distribution Systems Analysis Symposium 2006, Cincinnati, OH, USA, 27–30 August 2006; pp. 1–20. [Google Scholar]
- Gilbert, D.; Mortazavi, I.; Piller, O.; Ung, H. Low dimensional modeling of Double T-junctions in water distribution networks using Kriging interpolation and Delaunay triangulation. Pac. J. Math. Ind.
**2017**, 9, 2. [Google Scholar] [CrossRef][Green Version] - Le, X.H.; Ho, H.V.; Lee, G.; Jung, S. Application of Long Short-Term Memory (LSTM) Neural Network for Flood Forecasting. Water
**2019**, 11, 1387. [Google Scholar] [CrossRef][Green Version] - Tian, Y.; Xu, Y.P.; Yang, Z.; Wang, G.; Zhu, Q. Integration of a parsimonious hydrological model with recurrent neural networks for improved streamflow forecasting. Water
**2018**, 10, 1655. [Google Scholar] [CrossRef][Green Version] - Saadi, M.; Oudin, L.; Ribstein, P. Random Forest Ability in Regionalizing Hourly Hydrological Model Parameters. Water
**2019**, 11, 1540. [Google Scholar] [CrossRef][Green Version] - Gedik, N. Least Squares Support Vector Mechanics to Predict the Stability Number of Rubble-Mound Breakwaters. Water
**2018**, 10, 1452. [Google Scholar] [CrossRef][Green Version] - Granata, F.; de Marinis, G. Machine learning methods for wastewater hydraulics. Flow Meas. Instrum.
**2017**, 57, 1–9. [Google Scholar] [CrossRef] - Kanin, E.; Vainshtein, A.; Osiptsov, A.; Burnaev, E. The Method of Calculation the Pressure Gradient in Multiphase Flow in the Pipe Segment Based on the Machine Learning Algorithms; IOP Conference Series: Earth and Environmental Science; IOP Publishing: Bristol, UK, 2018; Volume 193, p. 012028. [Google Scholar]
- Hu, C.; Cai, J.; Zeng, D.; Yan, X.; Gong, W.; Wang, L. Deep reinforcement learning based valve scheduling for pollution isolation in water distribution network. Math. Biosci. Eng.
**2019**, 17. [Google Scholar] - Vries, D.; van den Akker, B.; Vonk, E.; de Jong, W.; van Summeren, J. Application of machine learning techniques to predict anomalies in water supply networks. Water Sci. Technol. Water Supply
**2016**, 16, 1528–1535. [Google Scholar] [CrossRef] - Sattar, A.M.; Ertuğrul, Ö.F.; Gharabaghi, B.; McBean, E.A.; Cao, J. Extreme learning machine model for water network management. Neural Comput. Appl.
**2019**, 31, 157–169. [Google Scholar] [CrossRef] - Ho, C.K. Solute mixing models for water-distribution pipe networks. J. Hydraul. Eng.
**2008**, 134, 1236–1244. [Google Scholar] [CrossRef] - Jasak, H.; Jemcov, A.; Tukovic, Z. OpenFOAM: A C++ library for complex physics simulations. In International Workshop on Coupled Methods in Numerical Dynamics; IUC: Dubrovnik Croatia, 2007; Volume 1000, pp. 1–20. [Google Scholar]
- Mills, R. Self-diffusion in normal and heavy water in the range 1–45. deg. J. Phys. Chem.
**1973**, 77, 685–688. [Google Scholar] [CrossRef] - Nielsen, M.A. Neural Networks and Deep Learning; Determination Press: San Francisco, CA, USA, 2015; Volume 25. [Google Scholar]
- Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. arXiv
**2014**, arXiv:1412.6980. [Google Scholar] - Chollet, F. Keras: The Python Deep Learning Library. 2019. Available online: https://keras.io/ (accessed on 24 October 2019).
- Scholkopf, B.; Smola, A.J. Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond; MIT Press: Cambridge, MA, USA, 2001. [Google Scholar]
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn: Machine learning in Python. J. Mach. Learn. Res.
**2011**, 12, 2825–2830. [Google Scholar]

Parameter | Value | Unit |
---|---|---|

Internal pipe diameter (D) | 18 | mm |

Inlet pipes length | $20D$ | mm |

Outlet pipes length | $40D$ | mm |

Tee distances | $5.6D,10D,15D$ | mm |

Flow in mixing zone | 0.08−0.43 | l/s |

Reynolds number range | 5658−30416 | - |

Inlet flow ratios | 0.333, 0.5, 1, 2, 3 | - |

Kinematic viscosity of water | $1\phantom{\rule{0.166667em}{0ex}}\times \phantom{\rule{0.166667em}{0ex}}{10}^{-6}$ | m^{2}/s |

Variable | Inlets | Outlets | Pipe Walls |
---|---|---|---|

$\mathbf{v}$ | $\mathbf{v}$ | $\mathbf{v}$ | $\mathbf{v}=0$ |

p | $\partial p/\partial \mathbf{n}=0$ | p and $\partial p/\partial \mathbf{n}=0$ | $\partial p/\partial \mathbf{n}=0$ |

c | c | $\partial c/\partial \mathbf{n}=0$ | $\partial c/\partial \mathbf{n}=0$ |

k | k | $\partial k/\partial \mathbf{n}=0$ | ${f}_{wall}$ |

$\u03f5$ | $\u03f5$ | $\partial \u03f5/\partial \mathbf{n}=0$ | ${f}_{wall}$ |

Distance | Coarse | Mid | Fine | Finest |
---|---|---|---|---|

$5.6D$ | 196 | 861 | 1819 | 4900 |

$10D$ | 401 | 1300 | 2950 | 5000 |

$15D$ | 538 | 1960 | 3000 | 5200 |

Distance | Coarse | Mid | Fine | Finest | Experiment |
---|---|---|---|---|---|

$5.6D$ | 0.602 | 0.607 | 0.613 | 0.613 | 0.610 |

$10D$ | 0.563 | 0.560 | 0.552 | 0.560 | 0.563 |

$15D$ | 0.541 | 0.541 | 0.530 | 0.530 | 0.539 |

Layer | Neurons | Activation | Data |
---|---|---|---|

Input Layer | 3 | - | ${R}_{{q}_{in}}$, ${R}_{{q}_{out}}$, Distance |

Hidden Layer 1 | 50 | Rectifier | - |

Hidden Layer 2 | 25 | Rectifier | - |

Hidden Layer 3 | 25 | Rectifier | - |

Output Layer | 1 | Sigmoid | ${R}_{{c}_{ANN}}$ |

Distance | ${\mathit{R}}_{{\mathit{q}}_{\mathit{in}}}$ | ${\mathit{R}}_{{\mathit{c}}_{\mathit{CFD}}}$ | ${\mathit{R}}_{\mathit{c}}$ |
---|---|---|---|

$5.6D$ | 0.333 | 0.262 | 0.239 |

$5.6D$ | 0.5 | 0.377 | 0.342 |

$5.6D$ | 2 | 0.798 | 0.801 |

$5.6D$ | 3 | 0.880 | 0.857 |

$10D$ | 0.333 | 0.249 | 0.280 |

$10D$ | 0.5 | 0.356 | 0.370 |

$10D$ | 2 | 0.741 | 0.719 |

$10D$ | 3 | 0.825 | 0.790 |

$15D$ | 0.333 | 0.246 | 0.268 |

$15D$ | 0.5 | 0.343 | 0.359 |

$15D$ | 2 | 0.712 | 0.719 |

$15D$ | 3 | 0.800 | 0.809 |

Distance | RMSE | Min. Error | Max. Error |
---|---|---|---|

$5.6D$ | 0.0214 | +0.3% | −10% |

$10D$ | 0.0246 | −3.05% | +11% |

$15D$ | 0.013 | 0.9% | 8.9% |

Distance | Cell Number | Time |
---|---|---|

$5.6D$ | 1.86 million | 56 min |

$10D$ | 2.95 million | 82 min |

$15D$ | 3.00 million | 83 min |

Model | RMSE | Max Error |
---|---|---|

ANN | 0.0172 | 0.0427 |

SVR | 0.0361 | 0.119 |

${\mathit{R}}_{{\mathit{q}}_{\mathit{in}}}$ | ${\mathit{R}}_{{\mathit{q}}_{\mathit{out}}}$ | Distance | ${\mathit{R}}_{{\mathit{c}}_{\mathit{CFD}}}$ | ${\mathit{R}}_{{\mathit{c}}_{\mathit{SVR}}}$ | ${\mathit{R}}_{{\mathit{c}}_{\mathit{ANN}}}$ |
---|---|---|---|---|---|

1 | 0.333 | $15D$ | 0.519 | 0.516 | 0.520 |

0.5 | 0.333 | $15D$ | 0.342 | 0.323 | 0.329 |

3 | 0.333 | $5.6D$ | 0.812 | 0.810 | 0.833 |

3 | 3 | $15D$ | 0.823 | 0.775 | 0.850 |

1 | 2 | $10D$ | 0.565 | 0.577 | 0.578 |

1 | 0.5 | $10D$ | 0.535 | 0.546 | 0.555 |

2 | 0.5 | $15D$ | 0.702 | 0.699 | 0.710 |

1 | 3 | $15D$ | 0.540 | 0.472 | 0.527 |

0.5 | 3 | $10D$ | 0.360 | 0.327 | 0.333 |

0.5 | 0.333 | $5.6D$ | 0.354 | 0.335 | 0.362 |

2 | 2 | $10D$ | 0.769 | 0.807 | 0.756 |

0.5 | 3 | $15D$ | 0.341 | 0.290 | 0.336 |

2 | 0.5 | $10D$ | 0.718 | 0.714 | 0.707 |

2 | 1 | $10D$ | 0.741 | 0.736 | 0.718 |

0.5 | 2 | $10D$ | 0.360 | 0.334 | 0.357 |

3 | 1 | $15D$ | 0.800 | 0.800 | 0.807 |

1 | 0.333 | $10D$ | 0.529 | 0.545 | 0.546 |

3 | 3 | $10D$ | 0.868 | 0.749 | 0.911 |

0.333 | 1 | $15D$ | 0.246 | 0.267 | 0.257 |

0 | 0.5 | $15D$ | 0.344 | 0.326 | 0.333 |

0 | 0.5 | $5.6D$ | 0.360 | 0.343 | 0.361 |

1 | 1 | $15D$ | 0.530 | 0.545 | 0.556 |

2 | 2 | $15D$ | 0.730 | 0.751 | 0.729 |

${\mathit{R}}_{{\mathit{q}}_{\mathit{in}}}$ | ${\mathit{R}}_{{\mathit{q}}_{\mathit{out}}}$ | Distance | ${\mathit{R}}_{{\mathit{c}}_{\mathit{CFD}}}$ | ${\mathit{R}}_{{\mathit{c}}_{\mathit{SVR}}}$ | ${\mathit{R}}_{{\mathit{c}}_{\mathit{ANN}}}$ |
---|---|---|---|---|---|

2 | 1 | $7.5D$ | 0.770 | 0.624 | 0.742 |

0.5 | 3 | $7.5D$ | 0.362 | 0.456 | 0.371 |

2 | 1 | $12.5D$ | 0.728 | 0.562 | 0.712 |

0.333 | 1 | $12.5D$ | 0.245 | 0.447 | 0.245 |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).