Abstract

The one-dimensional continuous genetic algorithm (CGA) previously developed by the principal author is extended and enhanced to deal with two-dimensional spaces in this paper. The enhanced CGA converts the partial differential equations into algebraic equations by replacing the derivatives appearing in the differential equation with their proper finite difference formula in 2D spaces. This optimization methodology is then applied for the solution of steady-state two-dimensional Stokes and nonlinear Navier Stokes problems. The main advantage of using CGA for the solution of partial differential equations is that the algorithm can be applied to linear and nonlinear equations without any modification in its structure. A comparison between the results obtained using the 2D CGA and the known Galerkin finite element method using COMSOL is presented in this paper. The results showed that CGA has an excellent accuracy as compared to other numerical solvers.

1. Introduction

Computational fluid dynamics (CFD), which has been commercialized for few decades, is the science of predicting the effect of different phenomena on the overall performance of the processes through solving sets of mathematical equations that govern these processes using numerical techniques. There are many CFD commercial codes available today, which have been originated by the 80s and 90s, such as Fluent, CFX, Fidap, Polyflow, Phoenix, Star CD, Flow 3D, ESI/CFDRC, and SCRYU [1].

The methodology of CFD is, briefly, applying numerical method (called discretization) to develop approximations of the governing equations of fluid mechanics in the fluid region of interest. This discretization involves the governing differential equations expressed algebraically and the collection of cells (the grid). These sets of equations are solved simultaneously for the flow field variables at each node or cell, which enormously contributes.

The discretized conservation equations are solved iteratively. A number of iterations are usually required to reach a converged solution. The convergence is reached when the changes in solution variables from one iteration to the next are negligible; in other words, the residuals provide a mechanism to help monitor this trend [1]. The major advantage of CFD is the relatively low cost that is continuing to decline as computers and software become more powerful and sophisticated. Moreover, CFD simulations can be executed in a short period of time. It has also the ability of simulating real conditions.

The principle methods currently used in CFD are finite difference method (FDM), finite element method (FEM), the Galerkin method, spectral method (SM), filter scheme methods (FSM), and boundary integral equation methods (BIEM) [1]. The first four methods mentioned above are applicable in principle to all types of fluid flow problems (hyperbolic, parabolic, elliptic, and mixed) whereas (BIEM) method has more restrictions and is usually valuable for elliptic type problems [1].

Fluid flows are encountered in the daily life applications including environmental hazards (air pollution, transport of contaminants, etc.), ventilation and air conditioning applications, combustion in automobile engines, complex flows in furnaces, heat exchangers, chemical reactors, and the human body processes (blood flow, breathing, drinking, etc.) [2]. These fluid flow applications are expressed mathematically in sets of partial differential equations that represent the conservation principle of mass, momentum, and energy.

The Navier Stokes equations are the basic governing equations for viscous fluid flow. These equations are obtained by applying Newton’s law of motion to a fluid element; alternatively these equations are called the momentum equations. These equations are usually supplemented by the mass conservation equation, also called continuity equation. A combination of both momentum equation and continuity equation is usually termed as Navier Stokes equations. The viscous incompressible Navier Stokes equations (INSE) were firmly established in the 19th century as a system of nonlinear partial differential equations that describe the motion of most fluids. As a result, finding a solution with reasonable accuracy of INSE set of equations has attracted the research interest of many scientists around the world [1].

Genetic algorithm (GA) was invented by Holland in the 1960s at the University of Michigan [3]. In contrast to evolution strategies and programming, Holland’s original objective was not to design algorithms that solve specific problems but rather to formally study the phenomenon of adaptation as it occurs in nature and to develop ways in which the mechanisms of natural adaptation might be imported into computer systems [4].

GA was recently reviewed by Goldberg [5], Davis [6], and others. In general, GA is implemented using computer simulations in which an optimization problem is specified. A genetic algorithm begins with a population of typically random parents in which members of a space of candidate solutions called individuals are represented using abstract representations called chromosomes [4]. In each generation, multiple individuals are randomly selected from the current population based upon some application of fitness and then using crossover and modified through mutation to form a new population. And finally it reaches the fit population with the exact one.

There is no rigorous definition of “genetic algorithm” accepted by all in the evolutionary computation community that differentiates GA from other evolutionary computation methods. However, it can be said that most methods called “GA” have at least the following elements in common: populations of chromosomes, selection according to fitness, crossover to produce new offspring, and random mutation of new offspring [7].

Continuous genetic algorithms (CGAs) were developed by Abo-Hammour as an efficient method for finding the global solutions of smooth functions [7]. In CGAs, the smoothness of the solution curve is achieved. Their novel development has opened a wide venue for different engineering and mathematical applications. In the numerical field, CGAs have been applied for the numerical solution of boundary value problems [813], Laplace equations [14], differential-algebraic systems [15], fuzzy differential equations [16], and the solution of Stokes and nonlinear Navier Stokes problems [17]. CGAs have been also applied in robotics [18, 19] and optimal control problems [20, 21].

When using GA in optimization problems, there are two vital points that should be considered: firstly, seeking the interrelation between parameters of optimization and secondly whether there is some restriction on the smoothness of the resulting curve or not [8]. In the case of uncorrelated parameters or nonsmooth solution curves, the conventional genetic algorithm (GA) performs well and there is no need of the CGA. On the other hand, if the parameters are interrelated or if the smoothness of the solution curve is a must, then the continuous genetic algorithm (CGA) is preferable [18].

In summary, CGA has many advantages compared with conventional GA especially when it is applied to problems where smooth solution curve is a need and when more than one parameter is used [7].(1)CGA needs smaller memory than what GA needs, because GA uses genotype and phenotype representations of the population’s individuals while CGA utilizes only the phenotype data. This makes CGA more suitable to problems with larger number of parameters.(2)Execution time for CGA is smaller than time needed by GA because there are no encoding/decoding processes in CGA.(3)The conventional GA cannot be used in applications where the optimal solution is required.The novel application of the (CGA) possesses several advantages: (i) it guarantees the smoothness of the solution curves, (ii) the results obtained using CGA are found to be in good agreement with the analytical solutions, and (iii) it can be applied to linear and nonlinear problems without any modification in the algorithm.

In this paper, the novel method based on continuous genetic algorithms is applied to solve two problems modeled by the steady state Navier Stokes equations in two-dimensional rectangular regions [17]. These problems varied in terms of linearity, that is, linear and nonlinear problems of Dirichlet boundary conditions. The main objective of this work is to solve algebraic equations that result from finite differencing of the partial differential equations (PDE) by CGA as a global optimization technique. The efficiency of CGA method is demonstrated by comparing its results to the results of other well-known methods. Furthermore, the exact solutions for both cases are already known, which make the judgment of the CGA method results possible. The usage of exact solutions here is only to reveal the efficiency of CGA in solving problems.

2. Theory of Continuous Genetic Algorithm

Continuous genetic algorithms (CGAs) were firstly developed to avoid the sharp jumps in the parameter values which can be resulted by using conventional genetic algorithm (GA) form in some optimization problems. That can be shown when the parameters of the optimization problem are correlated with each other or if the smoothness of the solution curve is a must [8]. Continuous genetic algorithm (CGA) mainly depends on the evolution of curves in one-dimensional space, surfaces in two-dimensional space, and volumes in three-dimensional space [18].

The CGAs are of global nature; consequently, the operators of CGA result in smooth transitions but the results of the traditional GA are a step-function-like jump in the parameter values [8]. As discussed by Abo-Hammour et al. [14], the solution of two-dimensional equation in the Cartesian coordinates was found using continuous genetic algorithm (CGA). Following Laplace equation other equations such as Stokes type can be discretized in the same way [8].

The central difference discretization form of two-dimensional equations is The nodal residue for node is defined as The overall residue for equation is the sum of squares of the nodal residues and is stated as where is the number of unknown nodes along the -direction and is the number of unknown nodes along the -direction.

Then, an appropriate fitness function can be given as [7] This means that the larger the residues value the smaller the fitness one. For the exact solution and .

The CGAs consist of general steps as discussed by [8] and are followed during solving problems and these steps are shown in Figure 1.

(1) Initialization. This step is just like an initial guess for the solution curve that modified functions can be used to randomly generate the initial population or parents [22]. In general, the initialization functions used in the algorithm should satisfy the following conditions.(1)It should be smooth from one side and should satisfy any problem-specific constraints, if such constraints exist, from the other side [7]. That is, any smooth function that is close enough to the expected solution curve and satisfies the boundary values can be used.(2)It should result in an information-rich initial population based on the population diversity, which is split into two main types.(a)Smooth Functions Diversity. This is the diversity due to using a mixture of smooth functions in the initialization phase instead of one function. The expected solution curves are not known and correspondingly a mixture of smooth functions that satisfy the given boundary values will be beneficial to result in a diverse initial population.(b)Parameters Diversity. This is the diversity due to the random generation of the initialization parameters, and in order to make the initial population as much diverse as we can, randomness should be there to remove any bias toward any solution.It is to be noted that the closer the initialization function to the final solution, the faster the convergence speed [813]. However, this convergence speed improvement is minor. This means that the initialization functions have minor effect on the convergence speed of the algorithm because usually the effect of the initial population dies after few tens of generations and the convergence speed after that is governed by the selection mechanism, crossover, and mutation operators.

It is also worth mentioning that the population size is kept constant throughout the evolution process of the algorithm. This population size affects the convergence speed, the average fitness, and the corresponding errors of CGA [715]. Small population sizes suffer from larger number of generations required for convergence and the probability of being trapped in local minima, while large population sizes suffer from larger number of fitness evaluations that means larger execution time. Previous studies and analysis performed showed that a compromise population size for similar problems with similar number of unknown nodes is about 500 individuals [712].

The initial population in this case will be divided into four equal segments; each of them generated using a different set of smooth functions to obtain a diverse initial population. The first part of the initial population is generated using two-dimensional Gaussian functions, , the second segment of the initial population is generated using a correlated two-dimensional tangent hyperbolic function, , and the third part is generated using an uncorrelated two-dimensional tangent hyperbolic, while the last segment is generated using a mixture of the above three functions. The four functions are given as follows [22]: where is a random in the range and is the number of unknown nodes in the grid. , are a random number in the range and is a random number in the range . is a random number in the range . is a random number in the range . is a random number in the range . is a random number in the range . is a random number in the range . , are random numbers in the range and in , , for both and .

The upper functions are then rescaled within the range representing the expected minimum and maximum initial nodal values.

It is to be noted that the parameter “ ” appearing in and as given in (5) is chosen between −0.5 and +0.5 based on the second term of the argument of the exponential or the tangent hyperbolic function which is related to the dual effect of both coordinates . The coefficient of that term is “ ” and in order to have a contribution for that term within the range , then the range of the “ ” values should be within the range .

(2) Fitness Evaluation. In this step, the measure of goodness of each individual in the population is calculated. Fitness will be applied to all populations until reaching the maximum criteria which is around one. This step is applied according to (2)–(4) [7].

(3) Selection. Selection process is to choose the individuals according to their relative fitness in order to enter the devotion process to create the new individuals for the next generation. This step ensures that the overall quality of the population increases from one generation to the next [7].

(4) Crossover. Crossover is a major operation that really empowers the GA. It operates on two randomly selected highly fitted individuals at a time and generates offspring by combining both parent individuals’ features [14].

In two-dimensional cases, crossover function will also be expanded into the two-dimensional following form [14]: where , are the two children resulted from the crossover of the two parents and . is the mixing function in the range .

Four types of mixing function can be used: the first three types are tangent hyperbolic-related functions, while the last one is of Gaussian shape [14]: where , are chosen such that the tangent hyperbolic function achieves its complete transition from −1 to 1 within the given ranges of both and . , have values +1, −1 randomly. is random number in the range . represents the number of crossing points and it is chosen in the range . is a random number within the range .

(5) Mutation. Mutation introduces random variations into the population. It is applied to a single chromosome only. It is usually performed with low probability. Genetic diversity of the population must be maintained so in order to guard against premature convergence, mutation is usually taken into consideration [14].

Two-dimensional mutation processes can be governed by the following formula [14]: where represents the child produced from the crossover process. is the mutated child. is the mutation function. is a random number in the range and is average overall residue of the population. There are three types of mutation functions [7, 8]: where is a random number in the range . is a random number in the range . is a random number in the range . is a random number in the range . , have values , −1 randomly. is random number in the range . , are some random offset values within the range . is a random number within the range . is a random number within the range .

There are three methods for selecting the value of that is usually used in the mutation process [8].(1)Random method: in this method is randomly selected as given in the crossover step.(2)Lamarckian method: this method depends on the value of residuals at certain mesh point that is the larger residual value at that point then the probability of choosing this point as a mutation center.(3)Deterministic manner: in this method the mesh point with the maximum residual is chosen as the mutation center.CGA also used “extinction and immigration” operator. This operator is applied when all individuals in the population are identical or when the improvement in the fitness value of the best individual over a certain number of generations is less than some threshold value. This means that no new information will be obtained through crossover process [7]. The CGA thus tends to stagnate; “extinction and immigration” operator is used to bypass this difficulty. This operator, as indicated by its name, consists of two stages; the first stage is the extinction process where all of the individuals in the current generation are removed except the best of generation individual [7]. The second stage is the mass-immigration process, where the extinct population is filled out again by generating individuals to keep the population size fixed. The generated population is divided into two equal segments each of size; the first segment, with , is generated as in the initialization phase, while the other segment is generated by performing continuous mutations to the best-of-generation individual as given by the following formula [14]: where is the th parent generated using immigration operator. is the best of generation individual. is a random number in the range , where is the overall residue of the best individual and is one of the following functions [14]: , have values , −1 randomly. is random number in the range . are some random offset values within the range . is a random number within the range . is a random number within the range .

(6) Replacement. Applying the genetic operators to the parent’s population generates the offspring’s population and then the parents’ population is totally replaced by the offspring’s population. This is called nonoverlapping, generational, or replacement. In this step the “life cycle” of the population can be completed [7].

(7) Termination. When some convergence criterion is met, the GA is terminated. The convergence criteria are as follows: (i) the fitness of the best individual so far found exceeds a threshold value, (ii) the maximum number of generations is reached or the progress limit, and (iii) the improvement in the fitness value of the best member of the population over a specified number of generations is less than some predefined threshold. The best solution of the problem is found after the termination of the algorithm [7].

3. Numerical Results for Stokes Equations

The general forms of Stokes equations are shown in the following: in which the right hand side is the shear stress term and the left hand side is the external force applied on the fluid, with continuity equation Dennis and Hudson [23] tried to solve the nonlinear form of Navier Stokes equations but with no pressure term as shown in the following equations: Continuity equation is as follows: within the range of and .

Wang et al. [24] tried to solve Stokes equation using finite element method within the region , ; the authors used the following boundary conditions: The exact solutions as given by Wang et al. [24] are as follows: The right hand sides for (14) were given by Wang et al. [24] in the following forms: This right hand sides are resulted by substituting the exact solutions shown in (20) into (14). The nodal values of the exact solutions are shown in Tables 1 and 2.

Moreover, the graphical representations of those actual values are shown in Figures 3(a) and 3(b).

The boundary values are known from the main problems but the other nodal values are unknown values of and must be solved. These nodes can be represented in the ( ) mesh of 100 elements, as shown in Figure 2.

With the same previous conditions COMSOL solution was obtained and the nodal values of and variables are shown in Tables 3 and 4. Moreover, the graphical representations for and COMSOL solutions are shown in Figures 3(c) and 3(d).

Appling (22) and using the errors between the exact and COMSOL values, it is found that norm error equals to for variable and about for variable with average time for solving the problem of about 0.045:

3.1. Solution of Stokes Equations Using Continuous Genetic Algorithm

All steps of CGA are applied here and they are repeated till the convergence criterion is met (fitness = 0.99), where the best unknown values of nodes are reached. The central difference discretization form of Stokes equation was shown in (23) but for both and separately; also (24) and (25) are used in order to define the unknown residual nodal and values: where is the step size in which is the step size in the -direction and is the step size in the -direction. And in this case and , again the problem is defined over the rectangular region , .

Then, after rearrangement, one has The nodal residue for node is defined as Then, the overall residues were solved for (25) as the sum of squares of the nodal residues, as stated in (3); after that the appropriate fitness function resulted from (4).

The obtained solution for Stokes equation [Dirichlet boundary conditions] using continuous genetic algorithms (CGAs) are shown in Tables 5 and 6, including the nodal values of the boundaries which are equal to zero. And the graphical representations of these values are shown in Figures 3(e) and 3(f).

By calculating the errors between the actual nodal values and CGA one, the norm error is found to be equal for variable and for variable. The time needed to reach solution in CGA was about 7523 seconds.

Wang et al. [24] used finite element method with a mesh size of for solving Stokes equations and then reported as norm error of the solution.

Comparing the error values which resulted by applying CGA with the errors given by finite element method by Wang, it is found that the error for solution obtained by CGA is close to that error for solution obtained by finite element. On the other hand, norm error for using COMSOL is less, that was about for variable and about for values and even these errors are less than the errors of CGAs method.

The average number of generations was 1139, and the average residual value was about . Then, the average fitness according to (4) is very close to the maximum fitness value of 1.

The convergence state of nodal values of the nodes was presented along all generations such as an example for [ , , and ] nodes excluding the boundary values as shown in Figures 4, 5, and 6, respectively. It is concluded from the figures that steady state is reached for nodes much earlier than that for and . The reason for that is that the node location is closer to the boundaries compared with the other nodes locations. For the same reason, the convergence for node is faster than for .

The nodal residues in this case were less than for values as shown in Table 7 and were less than for values as shown in Table 8. It can be concluded from these values that the solution is close to the exact solution.

Maximum fitness was reached with smooth increasing toward the maximum value along all generations and this assures how much the solution of CGA is close to the true solution. This behavior is shown in Figure 7(a).

4. Numerical Results for Nonlinear Navier Stokes Equations

The following conditions were taken into consideration while solving the problem.Boundary conditions are as follows: The exact solutions are as follows: The second terms in the right hand side of (16) and (17) are defined in (28) and they were obtained by substituting the exact solutions given in (27) into (16) and (17): The actual nodal values of both and variables are shown in Tables 9 and 10. The graphical representations of those actual values are shown in Figures 8(a) and 8(b).

Tables 11 and 12 show the obtained nodal values of and variables as a result of applying COMSOL. Moreover, Figures 8(c) and 8(d) show the graphical representations of these solution values.

For solution obtained by COMSOL, the norm error was found to be about 1.6258 for variable values and about 0.5845 for variable. And the time needed to solve this problem was about 0.546 second. For the nonlinear Navier Stokes, the results of using COMSOL to solve variable for different sizes of meshes are shown in Table 13.

4.1. Solution of Nonlinear Navier Stokes Using Advanced Continuous Genetic Algorithm

Firstly, the discretization of (16) is and is the same for the second equation. Then, for residues, one has Overall residues are the summation for both first and second equations residues:

A solution using continuous genetic algorithm (CGA) for case 2 (nonlinear Navier Stokes equation [Dirichlet boundary conditions]) is shown in Tables 14 and 15, including the nodal values of the boundaries. And the graphical representation of these values is shown in Figures 8(e) and 8(f).

The results of applying CGA can be summarized in calculating the norm error that was found to be about for variable values and about for variable values. The time that CGA needed to solve such kind of problems was about 7456 seconds.

It can be concluded from the results that solving nonlinear equations using finite element method in COMSOL application have a low accuracy. On the other hand, the trend of accuracy for CGA method is the same for both linear and nonlinear cases.

The CGAs process for solving nonlinear Navier Stokes equations in visual basic tools about 7456 seconds, in which the average number of generations was 1127 generations. Moreover, the average residual value was about . Then, the average fitness values according to the equation are very close to the maximum fitness value of unity.

The convergence state of nodal values of the nodes was presented along all generations such as an example for [ , , and ] nodes excluding the boundaries values as shown in Figures 4, 5, and 6, respectively. It is concluded from the figures that steady state is reached for nodes much earlier than that for and . The reason for that is that the node location is much closer to the boundaries compared with the other nodes locations. For the same reason, the convergence for node is faster than for .

The nodal residues in this case were less than for values as shown in Table 16 and were less than for values as shown in Table 17. Maximum fitness was reached with smooth increasing toward the maximum value along all generations and this assures how much the solution of CGA is close to the true solution. This behavior is shown in Figure 7(b).

Table 18 summarizes the overall performance of the used solvers solutions for the selected cases of Navier Stokes equations. As shown in the table, the CGA method has good results in solving both linear and nonlinear problems. It is worth mentioning that in the Stokes case the accuracy of COMSOL was higher than that of CGA and Wang et al. results. However, in the nonlinear case, COMSOL results’ errors were higher than those of the CGA results.

As a result, it can be concluded that COMSOL software has good predictions and small errors for the linear cases but not for nonlinear problems since its accuracy dramatically deceased. This makes CGA technique advantageous over the COMSOL technique because of its adaptability to the nonlinear nature of the problems with reasonable and consistent errors. However, it should be mentioned that the CGA method requires longer time periods than COMSOL in solving the problems. This is a new challenge for CGA, which could be overcome through the continuous development of the CGA algorithm or the computer hardware. However, it is worth mentioning that CGA has good accuracy even in the first run of solving such kind of problems.

5. Conclusions

In this paper, two-dimensional CGA was applied for the solution of steady-state two-dimensional Stokes and nonlinear Navier Stokes problems. The proposed CGA for the solution of partial differential equations has the following advantages: first, it does not require any modification while switching from the linear to the nonlinear case, only the discretization of the problem will be changed, while the solution procedure using CGA will be the same; second, the algorithm requires minimal knowledge about the aimed problem that is the discretized form of the partial differential equation in the residual form; third, the method is found to be simple, efficient, and attractive with great potential in engineering applications. The resulting solutions provided good accuracy for Stokes case and excellent accuracy as compared to other commercial packages for the nonlinear case.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.