Genetic algorithm in the design of soybean silos for airflow homogenization

HIGHLIGHTS: The Darcy-Forchheimer model was parameterized for airflow in bulk soybeans. Genetic algorithms were developed to optimize the grain storage bin dimensions and air inlet configuration. The developed genetic algorithm increased the airflow homogeneity for the studied case. ABSTRACT One of the main processes used to maintain grain quality in large storage bins is aeration. An optimization model that considers the limited and discrete nature of the air inlets, in addition to the geometric characteristics of the storage bin, could produce results more easily applicable results for the design of new grain storage bins. The objective of this study was to parameterize and to apply the Darcy-Forchheimer model for simulating airflow in soybean grain mass as function of grain layer height, and develop an artificial intelligence method based on genetic algorithm for optimizing grain storage bin dimensions and air inlet configurations to obtain a more homogeneous airflow in the grain mass. The parameterization considered the effect of grain compaction and the OpenFOAM simulations showed good agreement with the experimental data. The proposed genetic algorithm was able to increase the airflow homogenization when compared to the grain storage bin used as reference.


Introduction
One of the main processes used to maintain grain quality in large storage bins is aeration.Aeration systems are very important in hot climates (Lopes & Steidle Neto, 2019;Panigrahi et al., 2019), where chilled aeration systems can be used (Morales-Quiros et al., 2019).Aeration systems can also be used do dry grains during storage (Coradi & Lemes, 2018).A uniformly distributed airflow is efficient in controlling the moisture of grain masses, preventing the development of fungi (Khatchatourian & Savicki, 2004) and proliferation of insects (Morrison III et al., 2020;Silva et al., 2020;Capilheira et al., 2019).Khatchatourian & Savicki (2004), Binelo et al. (2019), Panigrahi et al. (2020), and Nwaizu & Zhang (2021) studied the problem of non-uniform airflows and point out the possible causes for this phenomenon, such as the presence of impurities inside the granular mass, the compaction of the grains, and the physical characteristics of grain bins.An efficient heat transfer must aim for uniformity, as in regions with very low airflow it will be difficult to reduce the grain temperature.Heat transfer in granular mass using aeration was studied by Khatchatourian et al. (2017) and Binelo et al. (2019), who proposed an optimization model; however, two important assumptions were made: the air inlet is the entire floor of the storage bin, and the pressure distribution is continuous.
Current grain storage bin design methodology does not optimize airflow distribution.The objective of this study was to parameterize and apply the Darcy-Forchheimer model for simulating airflow in soybean grain mass as a function of grain layer height, and develop an artificial intelligence method based on genetic algorithm (GA) for optimizing the grain storage bin dimensions and air inlet configurations to obtain a more homogeneous airflow in the grain mass.

Material and Methods
The research was developed at the Regional University of Northwestern Rio Grande do Sul (Unijui) from 2019 to 2022.The experimental data used to parameterize the Darcy-Forchheimer method was obtained from Khatchatourian & Savicki (2004), and the data for the grain storage bin considered in the study was obtained from Binelo et al. (2019).
The airflow in the grain mass depends on the geometric characteristics of the storage bin: position, size, and pressure in the air inlets.The optimal airflow is the most homogeneous one.The airflow optimization requires airflow simulation for each storage bin configuration that is explored in the search space; thus, simulations were performed using the OpenFOAM software and the Darcy-Forchheimer model given by Eq. 1: ρ -fluid density; u -fluid velocity; μ -fluid dynamic viscosity; and, S i -source term.
The source term (S i ), given by the Darcy-Forchheimer model (Eq.1), is composed of two terms: the first is the viscous loss that associates the fluid dynamic viscosity (μ) with the viscous loss coefficient (D), and the second is the inertial loss that associates de fluid density (ρ) with the fluid velocity (u) and the inertial loss coefficient (F).In homogeneous cases, when the medium properties are constant along the domain, S i is defined by Eq. 2: where: p -fluid pressure; t -time; γ -domain porosity; where: D -viscous loss coefficient; and, F -inertial loss coefficient.
The relationship between fluid pressure (p) drop and fluid velocity (u) is parabolic, according to the Darcy-Forchheimer Eq. 3: where: L -length across fluid flow; Δp -pressure drop; k 1 -linear coefficient; and, k 2 -quadratic coefficient.
According to the Bachmat method (Bachmat, 1965;Vasconcellos et al., 2011), with experimental data of pressure drop (Δp) in relation to the velocity (u) in a porous medium of length (L), the curve fit can be obtained according to Eq. 4: In the present study, the experimental data of airflow in the soybean grain mass were obtained from Khatchatourian & Savicki (2004), who detailed the experimental procedure.
The Darcy-Forchheimer equation can be rewritten according to Eq. 5: and the parameters D and F can be obtained by Eqs. 6 and 7: (2) The application of this procedure results in obtaining coefficients for different depths of soybean grains.Considering that the porosity changes according to the grain layer height, due to the compaction effect, the coefficients D and F were estimated for depths of 1, 10, 20, 30, and 50 m, using experimental data from Khatchatourian & Savicki (2004).These parameters were used to obtain the correlation between height (H) and coefficients D and F by least-squares curve fitting.
An optimization model that considers the limited and discrete nature of air inlets and the geometric characteristics of the storage bin could produce results more easily applicable for the design of new grain bins.The OpenFOAM software can import meshes created in other software tools, or create them with the Blockmesh utility, for generating domain meshes and defining boundary conditions.The domain and boundary conditions need to be generated dynamically; thus, a Python script was created for generating the Blockmesh definition file, according to the parameters defined by the genetic algorithm (GA).
An important aspect to consider is that the OpenFOAM software uses constant D and F coefficients for each porosity zone, thus, the script creates different porosity zones with the coefficients adjusted according to the grain layer depth.
The parameters obtained with the Darcy-Forchheimer model were applied in a GA.A GA is an analogy of the natural process of selection and adaptation of living beings.In the developed GA, the phenotype is the airflow simulation in a grain storage bin with specific characteristics, and the genotype, i.e., the genetic representation, is the codification of the parameters that define the grain storage bin and the aeration system.
Another fundamental aspect is the fitness function, which is the objective function of the optimization problem, in this case, the airflow homogeneity.A population is formed by a set of possible answers from the search space, and for each iteration of the method (generation), a new population is generated based on the best individuals of the current generation.As each individual defines a different configuration of the storage bin, it is necessary to perform an airflow simulation for each individual at each generation until the end of the iterative process.A limit of 200 generations was used as the stopping criteria.The GA was developed in Python language and its diagram is shown in Figure 1.
A sequence for two genetic algorithms was used in the present study (Figure 1).The first GA (GA a ) optimizes the position of the side air inlet and the airflow rate distribution between the side and central inlets.The second GA (GA b ) optimizes the position of the side air inlet, the airflow rate distribution between the side and central inlets, the storage bin width, the configuration of air inlets (only side, only center, or both), storage bin base width, and storage bin sidewall height; the depth of the storage bin was calculated to maintain the same cross-sectional area of 420.1927 m² as the reference storage bin.GA a optimizes only two variables and, thus, it could be compared with the results of an exhaustive search for validation of the method.In the exhaustive search, all possible combinations of values of the parameter are tested, but they must be sampled, considering that the parameters are continuous variables.One hundred regular samples for the parameters k (air inlet position) and Q d (airflow distribution) were taken, resulting in 10 4 simulation cases, i.e., a search space of size 10 4 .All 10 4 simulations were executed to validate the method, and the best result of the exhaustive search was compared to the reference storage bin configuration and to the GA a result.
The GA b is more complete, optimizing both continuous and discrete variables and, as it has six variables, an exhaustive search to compare the results is not possible due to the number of possible combinations.
In the stage of creation of the initial population, 50 individuals are generated with random genotypes.An individual genotype is a Python list of genes, each gene is a list of six decimal digits, and each digit is an integer that can hold a value from zero to nine.Each gene has a certain semantics in the phenotype and encodes the value of one of the parameters to be optimized.Each parameter can assume one million different values within the limits established for each parameter, and the translation of the genotype code into its phenotype value occurs according to the fitness function, for both continuous and discrete variables.Figure 2 shows the genotype.
In a GA, the fitness function classifies individuals in the selection process and defines the best answer.The fitness function is computed according to the phenotype p, which is given by Eq. 8, for GA a : For example, when Q d = 0.3, it means that 30% of the airflow comes from the side inlet and 70% from the central air inlet.The phenotype p for GA b is given by Eq. 9: where: V i (p) -velocity (m s -1 ) at point i from the velocity field computed for the phenotype p; and, V(p) -mean velocity field (m s -1 ).
The fitness function f, used to classify the individuals, must be an increasing function, i.e., the GA solves a maximization problem.This is solved by multiplying the minimization problem function by -1, therefore, f(p) is given by Eq. 11: The parameter c ranges from 0 to 1, and when c < 1/3, only the central air inlet exists.When 1/3 ≤ c < 2/3 only the side air inlet exists, and when c ≥ 2/3 both inlets exist.The schematic of the simulated storage bin is shown in Figure 3, and its development was based on the grain storage bin described in Binelo et al. (2019).
The optimization problem aims to minimize the variation of airflow rate along the grain mass, which can be measured by the mean absolute deviation (MAD), considering velocity samples (N) along the velocity field V(p), computed by the OpenFOAM software, according to the phenotype p.Therefore, the optimization problem can be expressed by Eq. 10:   ( ) The genotype (g) was transformed into the phenotype (p); each g i gene, composed of six decimal digits, was transformed into a number from 0 to 999999 and, then, transformed to the scale of the p i parameter of the (k, Q d , c, L, L b , h) set, according to Eq. 12: ( ) where: p i min and p i max -minimum and maximum values of parameter p i , according to Table 1.
The discrete variable (c) could be represented by only one digit; however, as the highest computational cost lies in the execution of airflow simulations, and not in operations with genes, it was considered more convenient to maintain the uniform format of genes.
In the selection process, a subset of the population whose genotypes will generate the next generation of the population is chosen.This choice is based on the fitness function f(p), but it  does not necessarily consist of choosing only individuals with the highest f(p) values.One of the interesting aspects of GA is its ability to escape from local maxima, and it is best achieved when there is higher diversity in the genetic pool.One of the strategies to increase genetic diversity is the use of a selection method that, although more likely to choose elements with higher fitness, allows the choice of elements with lower fitness.One of those is the tournament method (Prayudani et al., 2020), which also has the advantage of being simple to implement.Fifteen, among the 50 elements of the population, are chosen to generate the next generation through 15 tournaments.Six members of the population are chosen randomly for each tournament, and the winner is the element with the highest f(p) value.
A new generation is created through the processes of crossing and mutation for each iteration of the method.The crossing consists of creating a new genotype by combining two others.Crossing at multiple points, which are defined by the gene limits, was used in the present study.The semantic integrity of the genes is maintained because each gene represents a parameter of the optimization problem.Two genotypes are randomly chosen from the group of 15 elements that went through the selection process to be the parents of the new genotype, and each gene of the new child genotype is chosen randomly among the parent genotypes.In addition, each child digit can be altered randomly, simulating the natural mutation process, to increase genetic diversity.A mutation probability of 0.05 was used in the present study.This process is repeated 50 times until the new generation is completed.

Results and Discussion
The airflow optimization requires airflow simulations according to the grain storage bin dimensions and air inlet positions.The first results presented are from the parameterization of the Darcy-Forchheimer model, considering the soybean grain layer height (H).
The functions obtained for the parameters D and F of the Darcy-Forchheimer model are shown in Figures 4 and 5.
Both parameters have a nonlinear dynamic, and both curve-fitting procedures obtained a R² above 0.95.Liu et al. (2022) used a different method to estimate the parameters D and F, based on Discrete Element Method (DEM), and obtained D in the range from 17740438 to 47576815, and F in the range from 382 to 659.These parameters were not obtained as function of grain layer height, therefore, a direct comparison cannot be possible; but there is an intersection for the parameter D in both studies, whereas the range of the parameter F in Liu et al. ( 2022) is smaller and outside the range of these results.One possible explanation is the difference in soybean grains: the equivalent particle diameter used by Liu et al. (2022) to represent the soybean as a sphere was 7.24 mm, whereas in Brazil, a typical equivalent diameter would range from 5.40 to 6.40 mm (Lorenzoni et al., 2020).
Figure 6 shows the comparison of the OpenFOAM simulations using the Darcy-Forchheimer model with experimental data from Khatchatourian & Savicki (2004).The experimental data showed that the relationship between airflow velocity and airflow pressure drop depends on the grain layer height (H); it happens because of the compaction in the lower regions, which decreases the porosity, as evidenced by Liu et al. (2022) and Nwaizu & Zhang (2021).The prediction from the OpenFOAM software using Darcy-Forchheimer model shows good agreement with the experimental data.
The simulations of the present study were based on the grain storage bin described in Binelo et al. (2019), whose dimensions are described in Table 2.
Figure 7 shows the pressure distribution and streamlines resulting from the OpenFOAM simulation for this reference case, with MAD(V(p)) = 0.0215 m s -1 .The streamlines pattern   Khatchatourian & Savicki (2004) and the pressure gradient are the same presented by Binelo et al. (2019), who used the Khatchatourian model; it denotes that the results obtained by using OpenFOAM with Darcy-Forchheimer model are compatible with results obtained by using a model already validated for simulating airflow in soybean grains.This result shows the current airflow condition in the storage bin and is the baseline for airflow optimization.
For the validation of the optimization method, an exhaustive search was performed, whose best result was the configuration with k = 15.275m and Q d = 0.4772, resulting in MAD(V(p)) = 0.0174 m s -1 .This result shows that the reference storage bin configuration is not optimal.The exhaustive search obtained a configuration with a side air inlet at a lower position (the reference configuration has k = 18.475 m) and with higher airflow at the side inlet (the reference configuration has Q d = 0.330), resulting in a more homogeneous airflow distribution (the reference configuration has MAD(V(p)) = 0.0216 m s -1 .This indicates that the reference configuration has areas with low airflow rate between central and side inlets.
The first genetic algorithm (GA a ), which optimizes the two parameters, generated a better result: k = 14.7866 m, Q d = 0.484376, and MAD(V(p)) = 0.01652 m s -1 .GA a provided a better result than the exhaustive search because it operates on a much larger search space, as each parameter can assume 10 6 different values, and the search space has a size of 10 12 .The pressure distribution and streamlines (Figure 8) shows that GA a placed the side air inlet at a lower position than the reference and the exhaustive search configurations.
The second genetic algorithm (GA b ) operates on six parameters p = (k, Q d , c, L, L b , and h), and the results are shown in Table 3.
GA b resulted in MAD(V(p)) = 0.0164 m s -1 , which is lower than the previous results, thus indicating a more homogeneous airflow.The size of the GA b search space is 10 36 .The pressure distribution and streamlines (Figure 9) shows that GA b generated a storage bin with smaller width and higher depth.GA a and GA b indicated a higher airflow for the side inlet than the reference configuration.Moreover, the parameter c confirms the need for side and central air inlets.
The summary of results (Table 4) shows that the genetic algorithms were able to reduce the MAD of the velocity field, making the airflow more homogeneous by changing the storage bin dimensions and the air inlet configurations, maintaining the same total airflow rate and cross-sectional area.The decreasing in the distance between the central and lateral air inlets by the genetic algorithms is consistent with results of Panigrahi (2020), who found areas with low airflow rate between the air inlets at the bottom of the silo.Panigrahi (2020) also suggests simulations with different air inlet configurations to optimize the aeration system; it can be achieved autonomously by the genetic algorithms presented in this study, with no need for manual configuration processes and analysis of different simulations.

Conclusions
1.The Darcy-Forchheimer model in the OpenFOAM software was successfully parameterized when considering the effect of compaction caused by grain layer height, and the results show that it can be used to simulate airflow in soybean grain bins.
2. The reference grain storage bin configuration considered for this study did not have an optimal configuration for airflow homogeneity.
3. The proposed genetic algorithm was able to optimize storage bin dimensions and air inlet configurations, resulting in a more homogeneous airflow, reducing the mean absolute deviation of the velocity field from 0.0216 to 0.0164 m s -1 .
Figure 1.Genetic algorithm diagram

Figure 2 .
Figure 2. Genotype composition for genetic algorithm a (GA a ) and genetic algorithm b (GA b )

Figure 3 .
Figure 3. Storage bin schematic k -Side air inlet position; Q d -Airflow rate distribution; c -Air inlet configuration; L -Storage bin width; L b -Storage bin base width; h -Storage bin sidewall height p i -Parameter; k -Side air inlet position; Q d -Airflow rate distribution; c -Air inlet configuration; L -Storage bin width; L b -Storage bin base width; h -Storage bin sidewall height

Figure 4 .
Figure 4. Estimation and curve fitting of the parameter D (R 2 = 0.9586) of the Darcy-Forchheimer model

Figure 5 .Figure 6 .
Figure 5. Estimation and curve fitting of the parameter F (R 2 = 0.9957) of the Darcy-Forchheimer model