Neural network for fractal dimension evolution

The coagulation/flocculation process is an essential step in drinking water treatment. The process of formation, growth, breakage and rearrangement of the formed aggregates is key to enhancing the understanding of the flocculation process. Artificial neural networks (ANNs) are a powerful technique, which can be used to model complex problems in several areas, such as water treatment. This work evaluated the evolution of the fractal dimension of aggregates obtained through ANN modeling in the coagulation/flocculation process conducted in high apparent color water (100± 5 PtCo), using alum as coagulant in dosages varying from 1 to 12 mg Al3þ L , and shear rates from 20 to 60 s 1 for flocculation times from 1 to 60 minutes. Based on raw data, the ANN model resulted in optimized condition of 9.5 mg Al3þ L 1 and pH 6.1, for color removal of 90.5%. For fractal dimension evolution, the ANN was able to represent from 95% to 99% of the results. doi: 10.2166/wst.2018.349 s://iwaponline.com/wst/article-pdf/78/4/795/487279/wst078040795.pdf Alessandra da Silva Oliveira (corresponding author) Verônica dos Santos Lopes André Luiz de Oliveira Faculdade de Engenharia Civil, Universidade Federal de Uberlândia (UFU), Uberlândia, Brazil E-mail: alessandrasilvaoliv@yahoo.com.br Ubirajara Coutinho Filho Faculdade de Engenharia Química, Universidade Federal de Uberlândia (UFU), Uberlândia, Brazil Rodrigo Braga Moruzzi Instituto de Geociências e Ciências Exatas, Universidade Estadual Paulista (UNESP), São Paulo, Brazil


INTRODUCTION
Humic substances (HS) constitute the major part of the organic matter dissolved in natural waters.They are derived from decomposed plant and animal biomass, and may have many adverse effects on water quality (Aftab & Hur ).To remove HS from water, coagulation/flocculation can be used, which is a simple, economically viable and widely used method of drinking water treatment (Ma et al. ).
Inorganic salts such as aluminum sulfate and ferric chloride are widely used coagulants in the treatment of drinking water through coagulation.The optimum coagulant dosage has traditionally been determined by the pH, turbidity, color and amount of organic matter dissolved in water (Aboubaraka et al. ; Aftab & Hur ).In addition to the traditional method, artificial neural networks (ANNs) can be used, which are inspired by the functioning of biological nervous systems.It is a powerful technique with a strong ability to learn and predict, and has been successfully applied to model complex nonlinear problems in several areas of knowledge (Khataee et al. ; Sahin et al. ).The ANNs are a viable method for modeling water treatment processes, even if the entire process mechanisms are not well known but only the main variables that interact with them (Kennedy et al. ).
The effect of flocculation is usually measured by the final resultant parameters, such as residual color or impurity removal rate after sedimentation.However, these parameters provide limited information about the flocculation process, so it is necessary to study the properties of the flocs to better understand the process (Sun et al. ; Oliveira et al. ).
The characteristics of the formed aggregates, such as size and structure, play an important role in flocculation, but change continuously during the process, significantly influencing the water treatment efficiency (Amjad et al. ; Moruzzi et al. ).The concept of fractal geometry became widely used in the study of the surface morphological structure of the flocs formed in the water treatment stages, and the degree of their compression is represented by the fractal dimension (Jarvis et al. a).
The supply of morphological parameters of the particles can be given by image analysis.According to Bushell et al. (), image analysis is robust and versatile, and able to perform complex analysis.One of the methods of image acquisition aimed at analyzing the flocculation process consists of producing a plane of light capable of crossing the jar to better visualize the flocs, and then capturing the image by digital camera.Because image analysis is a non-intrusive and non-destructive technique, it is better suited to the study of flocs when compared to intrusive techniques, such as the photometric dispersion analyzer (PDA).With the PDA, the flocs are subject to structural changes due to the rupture when passing the peristaltic pump system ( Jarvis et al. b).
Although ANNs are used in several areas of research, they are little employed in the study of the characterization of flocs in flocculation processes.Therefore, this paper studied ANNs as an alternative technique to both: i) determine the optimum dosage of alum, as coagulant for high color removal, and; ii) evaluate the fractal dimension evolution of the flocs using a non-intrusive image analysis method.

Materials
Aluminum sulphate (Al 2 (SO 4 ) 3 •16H 2 O), from Labsynth Products for Laboratory Ltd, was used as a chemical coagulant, prepared with a concentration of 46.7 g L À1 , so that each 1.0 mL of solution contained ca.2.0 mg of alum (Al 3þ ), dosed in a 2 L jar.In addition, commercial humic acid extracted from turf (Sigma-Aldrich) was used to add color to the water, and stock solutions of HCl and NaOH (0.1, 0.5 and 1.0 M) were used to set the pH of the study water.
The synthetic water was prepared using ultrapure water and a stock solution of 4% humic acid (Sigma-Aldrich), filtered to add color in order to achieve an apparent color of 100 ± 5 PtCo.The color was determined by spectrophotometry using the UV-Vis DR 5000 spectrophotometer (Hach) at a wavelength of 455 nm, and following the procedure described by the APHA/AWWA/WEF ().

Coagulation experiments
Sixty-four coagulation experiments were performed using a standard jar-test (Nova Ética), with six jars, each with a capacity of 2 L. The relation between impeller speed (rps) and velocity gradients was previously taken by torque assays.The experiments were conducted as follows.Initial rapid stirring at velocity gradient of 600 s À1 for 10 s was started after the addition of the solution to adjust the pH (from 4 to 9, depending on the specific assay), and then for 10 s after addition of the coagulant, followed by slow mixing at velocity gradient of 20 s À1 for 20 min.At the end of the flocculation time, the jar-tester was turned off for sample collection for measuring the remaining apparent color at a time corresponding to the settling velocity of 1 cm min À1 .
The color removal efficiency was calculated according to Equation (1) (Ma et al. ).
where C i is the initial apparent color before coagulation and C e is the apparent color of water at the end of the flocculation time, after sedimentation.
Color measurements were performed in triplicate, and results presented in this paper represent the mean of the replicates.

Flocs formation
The formation of flocs was monitored based on the methods described in studies by Oliveira et al. () and Moruzzi et al. ().An image processing obtained by a digital camera (Nikon D5500) with a resolution of 6,000 pixels × 4,000 pixels was used.Records of flocs visualized in a plane of light, generated by a laser source with nominal power of 98,000 mW and green wavelength of 532 nm, were taken.A laser sheet makes it possible to contrast and to define a spatial position to acquire the images, as in the scheme shown in Figure 1.
Coagulation/flocculation monitoring was performed in the optimum condition obtained by the neural network: that is, the condition where alum dosage and coagulation pH favored the best percentage of apparent color removal for the sedimentation rate of 1 cm min À1 for the first phase of the study, shown later in results.The velocity gradient for the flash mixing and the mixing time were 600 s À1 and 10 s, respectively, while the flocculation velocity gradients (G f ) were 20, 30, 40, 50 and 60 s À1 and the flocculation times (T f ) were 1, 3, 5, 10, 15, 20, 25, 30, 40, 50 and 60 min.Two tests were performed to evaluate the two-dimensional (2D) fractal dimension evolution in terms of time and shear rate.The first experiment was carried out in a single jar, applied to one sample only, so that fractal aggregates were formed from previous formed aggregates.For example, at the end of the flash mixing, the flocculation was started from G f equal to 20 s À1 and a T f of 60 min was maintained.After this period, G f was gradually increased to 30, 40, 50 and 60 s À1 , and the T f of 60 min was maintained for each.It is important to emphasize that this assay amounted to 300 min of flocculation, and that the particles formed during the first mixing intensity were imposed under conditions of higher intensities every 60 min.The second experiment was carried out in separate jars, i.e., applied to different samples, each one starting from dosing and flash mixing and finishing after 60 min of flocculation, so that fractal aggregates were formed from primary particles.For instance, at the end of the flocculation test at G f of 20 s À1 , the sample was discarded and the coagulation step was repeated using a new sample for the flocculation test at G f of 30 s À1 , and so on.
For each T f , images were obtained at a frequency of 4 Hz, where the camera was triggered through the CCP 2.0 management program, thus totaling 440 images for each evaluated G f .The image processing was performed with ImageJ 1.51 software, used for the binarization process, feature detection and measurement of fractal aggregate attributes during flocculation (Figure 2).

Properties evaluated
The morphological structure of aggregates was characterized using the fractal dimension, which is defined, in twodimensional terms, by a potential relation between the area of a particle (A S ), the characteristic length of the aggregates (l ) and the fractal area dimension (D f ), according to Equation (2): (2) The fractal dimension, calculated globally for the entire population of flocs for each T f and G f , is represented by the slope coefficient of the line that best fits the distribution of points, using the log-log plot of Equation (2).For objects with Euclidean geometry, D f is usually an integer number.However, for fractal objects, it presents fractional values between 1 and 2 in the 2D space.In other words, the  projected area of the floc varies from open (D f ¼ 1) to compact strutures (D f ¼ 2).

Computational details
The neural network model used in this paper was the backpropagation (Figure 3) with the number of neurons in the hidden layer adjusted for the best performance of the ANN.The ANN was implemented in R language by the AMORE toolbox (http://cran.r-project.org/web/packages/AMORE/).In order to obtain the model, Equation (3) was used to normalize the data and Equations ( 4) and ( 5) were used for the hyperbolic tangent (tansig) and linear (purelin) transfer functions in the hidden and output layers, respectively.
where x i represents the experimental data, w i are the coded data, a and b are the maximum and minimum experimental data corresponding to each variable, respectively.
where f(x) is the output of the hidden neuron.The optimal conditions were obtained using a genetic algorithm (GA) with fixed parameters n, q and p (n ¼ 600, q ¼ 0.8 crossover, p ¼ 0.1 mutation) associated with the neural network model with the GA package of R language (Scrucca ), where n represents the population of solutions, and p and q represent the probabilities of crossover and mutation, respectively.The values q ¼ 0.8 and p ¼ 0.1 are usual for GA and can be modified as cited in the literature (Eiben & Smit ).In this context, considering that each variable to be optimized represents a chromosome, we have that q represents the probability of combining chromosomes (known as crossover) and the probability p represents a mechanism to maintain the diversity of the parameters during the search of the optimal parameters.The program code is available as supplementary material with the online version of this paper.

RESULTS AND DISCUSSION
Figure 4 shows the apparent color removal experimental results for the 64 experimental conditions of pH and coagulant dosage.Raw data are available in the online supplementary material.It can be observed that there is a large variability of the data with low color removal (less than 40%) for pH greater than 7.5 and lower than 4.5.The best experimental conditions of color removal (greater than 80%) were observed for pH between 5.5 and 6.5 and coagulant dosage between 8.0 and 10.0 mg L À1 of Al 3þ .
Figure 5 describes the optimization model in threedimensional form and with a contour map.It can be observed that pH values between 5.5 and 6.5 and coagulant dosage greater than 6.0 mg L À1 of Al 3þ favored the color removal, which was greater than 75%.In the regions where pH values were lower than 5.0 and greater than 7.0, low color removal is observed.The results of this study are in agreement with Moruzzi et al. () and Wei et al. () who obtained greater color removal in regions with pH between 6.5 and 6.8 and alum dosage between 1.6 and 7.6 mg L À1 .
The optimization of the neural network model using the GA method provided results for the maximum color removal.The different coagulant dosage and pH values were able to optimize the largest color removal, and the optimized condition was with the values of 9.5 mg Al 3þ L À1 and pH 6.1, for a color removal of 90.5%.The color removal percentage was experimentally validated by the coagulation and flocculation in-jar test, and indicated an 89% removal.
The optimized condition in the coagulation/flocculation tests (9.5 mg L À1 of Al 3þ and pH 6.1), graphically viewed by means of the neural network (Figure 5), was used in the flocculation tests conducted at different G f for obtaining and analyzing images of flocs.Figures 6 and 7 show the bi-dimensional fractal dimension evolution over time, obtained using the neural network model, for the tests conducted in the single jar (Figure 6) and in separate jars (Figure 7), with different shear rates (G f ).It can be observed that the neural network with 10 neurons in the hidden layer was able to represent 99% of fractal aggregates evolution in single jar and 95% of fractal aggregates evolution in separate jar.The number of neurons was determined by trial and error, so that it resulted in a better determination coefficient (R 2 ).
In general, bi-dimensional fractal dimension values were found in the range of 1.3 to 1.9, which are in agreement with results reported by Chang et al.   density.Thus, it may be assumed that there is an increase in the erosive effect for the flocs as the G f and T f increase, and, consequently, an increase in less compact particles.According to Jarvis et al.  to the increase of G f and, according to the study, this was probably related to an aggregation mechanism of particles with a low G f , seeing that the number of primary particles was still significant.However, such behavior contradicts the results obtained by Chakraborti et al. () and Li et al. (), who reported the occurrence of floc surface erosion when conditioned in higher flocculation gradients.
The fractal dimension of particles during the flocculation test in separate jars, i.e., with the G f imposed on separate samples, was higher when compared to flocculation in a single jar (gradual increase of shearing stress), especially in the first minutes and under higher shear rates.Moreover, in the tests performed in separate jars, the fractal dimension depended strongly on the initial energy imposed on the system, where higher G f values resulted in lower D f values, implying flocs with more irregular morphology.
Figure 8 shows the decrease of D f with the increase of G f applied at the flocculation time of 60 min.Because of the evident negative relationship between the fractal dimension and the flocculation time, the floc morphology was probably related to the shear rate.This may be because, according to Deng & Davé (), the initial speeds influenced the fractal dimension value; i.e., a larger G f imposed in the system generated flocs with a more irregular morphology.However, as the slope was less evident in the separate jars (À0.0029), the organization degree of the system, the rupture/reaggregation dynamic, and the re-flocculation capacity of aggregates were also related to the morphological characteristics.

CONCLUSIONS
This work evaluated the evolution of the aggregates' fractal dimension obtained through neural network modeling (ANN) in the coagulation/flocculation process conducted in high color water (100 ± 5 PtCo), using alum as a coagulant, and varying shear rates, expressed as average velocity gradients, and flocculation time.
Based on 64 experiments, the ANN model resulted in an optimized condition of 9.5 mg Al 3þ L À1 and pH 6.1, for color removal of 90.5%.
For fractal dimension evolution, two experiments were performed and optimal conditions were obtained using GA associated with the ANN model with the GA package of R language.
The first, focused on one jar, developed with increasing G f and flocculation time.For the second experiment focused on multiple jars, G f values were kept constant, while flocculation times were varied.
In general, the 2D fractal dimension showed more compact structures at the beginning of flocculation (c.1.88), and when the shear rate was increased in the system, the erosive effect was intensified, resulting in aggregates with more open structures (ca.1.45).The neural network with 10 neurons in the hidden layer was able to represent 99% of fractal aggregates evolution in the single jar and 95% of fractal aggregates evolution in separate jars.
The results presented here may provide information to assist future application of ANNs in water research.

Figure 1 |
Figure 1 | Floc formation record: front view (left) and top view of experimental apparatus (right).

Figure 2 |
Figure 2 | Image of flocs in 24 bits (left), binarized matrix (center), and matrix in process of counting and measurement by ImageJ 1.51 software (right).

Figure 3 |
Figure 3 | Flow chart of neural network: (a) color removal; (b) evolution of D f .
(), Li et al. () and Moruzzi et al. ().Several authors, such as Liu et al. () and Xu et al. (), claim that aggregates with higher fractal dimension values are usually more compact; i.e., they are denser and closer to the circular shape (2D).On the other hand, smaller fractal dimension values indicate flocs with structures that are more linear and of lower

Figure 4 |
Figure 4 | Experimental results for percentage removal of apparent color.The best region is circled.
Figure 6 | Time evolution of fractal dimension for flocculation in single jar: three-dimensional (left) and contour map (right).Arrows indicate Df reduction under Gf and time variations.(R 2 ¼ 0.99; 10 neurons in the hidden layer).

Figure 7 |
Figure 7 | Time evolution of fractal dimension for flocculation in separate jars: three-dimensional (left) and contour map (right).Arrows indicate D f reduction under G f and time variations.(R 2 ¼ 0.95; 10 neurons in the hidden layer).