Open access peer-reviewed chapter

Optimization Design by Coupling Computational Fluid Dynamics and Genetic Algorithm

Written By

Jong-Taek Oh and Nguyen Ba Chien

Submitted: 17 May 2017 Reviewed: 08 November 2017 Published: 14 February 2018

DOI: 10.5772/intechopen.72316

From the Edited Volume

Computational Fluid Dynamics - Basic Instruments and Applications in Science

Edited by Adela Ionescu

Chapter metrics overview

1,375 Chapter Downloads

View Full Metrics

Abstract

Nowadays, optimal design of equipment is one of the most practical issues in modem industry. Due to the requirements of deploying time, reliability, and design cost, better approaches than the conventional ones like experimental procedures are required. Moreover, the rapid development of computing power in recent decades opens a chance for researchers to employ calculation tools in complex configurations. In this chapter, we demonstrate a kind of modern optimization method by coupling computational fluid dynamics (CFD) and genetic algorithms (GAs). The brief introduction of GAs and CFD package OpenFOAM will be performed. The advantage of this approach as well as the difficulty that we must tackle will be analyzed. In addition, this chapter performs a study case in which an automated procedure to optimize the flow distribution in a manifold is established. The design point is accomplished by balancing the liquid-phase flow rate at each outlet, and the controlled parameter is a dimension of baffle between each channel. Using this methodology, we finally find a set of results improving the distribution of flow.

Keywords

  • computational fluid dynamics
  • VOF
  • optimization
  • OpenFOAM
  • genetic algorithm
  • open sourced

1. Introduction

Computational fluid dynamics (CFD)-based optimization approach has been growing rapidly in the past decades. The demand of optimizing the product designs with high reliability and the time constraints have promoted engineers and researchers to develop the frameworks tackling the problems, in which CFD simulation becomes one of the key roles. In addition, the computing power has raised the performance over 10,000 times in comparison with the point in the mid-1980s. Thus, the computing tasks now could adapt in much complex and bigger models. In other words, the computing century has changed the way engineers finding the solutions, and traditional approaches like experimental ones now are moving apart to modeling approaches.

In fact, the capability of CFD-based optimization has been early deployed in aerospace field to generate the wing profiles, which could reduce the drag force [1]. Jameson [2, 3, 4] firstly proposed a shape optimization method for aerodynamic design using the control theory. In this methodology, the authors used adjoint equations. The design space could be extended to the number of coordinate transformations or cost functions. It is also called as nonparametric method. Following that, several studies on shape optimization in this field have been published [5, 6, 7]. The other methodology, so-called the parametric method, was also successfully applied in this field such as the research of Eero Immonen [8], which investigated the CFD-based optimization framework for the NACA airfoil using response surface method (RSM).

In the branch of thermal design, CFD-based optimization is applied in various objects such as the optimization of chemical reactor [9], steam turbine blade cascade [10], or plate-fin heat exchanger [11]. Also, several CFD-based optimization studies on other fields were published in literature including ship hull [12], car [13, 14], vascular [15], or engine [16].

However, in this chapter, instead of describing all the above techniques, we introduce a parametric approach of CFD-based optimization that couples CFD and evolution algorithms since this approach could be applied in more complex systems of equations as well as the complex physical models. Although evolution algorithm tree has several branches, we are going to focus only on the popular type, genetic algorithm (GA). A general concept is illustrated to help readers to follow easily. Finally, a study case that uses CFD and single-objective genetic algorithm (SOGA) to optimize the uniformity of flow in the manifold is investigated.

Advertisement

2. A brief introduction about GAs

2.1. Definition of gas

Genetic algorithms are first proposed by John Holland in the 1960s and were continuously developed together with his students during the 70th decade. The idea of the generic algorithm is inspired by the natural selection and the famous Darwin’s law, survival of the fittest.

The characteristics of GAs show some advantages in comparison with the classical optimization method, especially when coupling them with CFD simulation. At first, GAs can generate the individuals (or chromosomes) of populations independently. In the complex systems, CFD solver may cost much time to reach to convergence. The simultaneous running takes advantage of modern computing power. Each job will be solved separately and then synchronized when GAs do their operators. Moreover, we could restart the work at interrupt point if there is any corruption, whereas this may be difficult when an individual is produced iteratively like the way gradient-based methods operate. Second, since the cost function in GAs is constant, GAs may overcome the numerical noise, which normally occurs in a CFD problem due to the limit of grid resolution or residual.

2.2. The genetic operators

In GAs, the population is generated toward the best solution by improving the quality of individuals. During the evaluation process, a population is generated through the three main generic operators including selection, crossover, and mutation. An individual could be alive, reproduced, or removed from population depending on its fitness value and the probability of randomly modifying itself, called mutation. The evaluation process of GAs is operated as follows:

  • Initializing the population—At the starting point, GAs will randomly produce a number of individuals.

  • Selection operator—In this step, the individuals are evaluated by a fitness function. The fitness value is the best answer according to the specific problem. The individuals then are sorted based on their fitness value. The purpose of selection operator is to determine the candidates to pass their characteristics to the next generation.

  • Crossover operator—This operator works in two selected individuals to generate two new individuals or offspring. The numbers of characteristics of an individual will be swapped to the other with the corresponding length. The new offspring created in this step will be put into the next generation of the population. By this way, the populations move toward the better solution.

  • Mutation operator—This is an important operator of GAs, which keeps the results of GAs away from local optima. A small probability of individual’s characteristics is modified randomly.

  • Stop condition—The selection, crossover, and mutation are looping in a number of evaluations. The quality of population is improved after each iteration, but there is no way to be sure that the present results are the best solutions. Thus, we need a strategy to stop GAs in the constraint of time of project or when population reaches to an approximation in which the result is placed around the best-known space.

The flow chart of the general GAs is shown in Figure 1.

Figure 1.

Flow chart of the general GAs.

Advertisement

3. CFD coupled GAs for shape optimization

In the present case, the procedure is deployed relying on the open-source software OpenFOAM in CFD block, the DAKOTA in algorithm block, and the interface script to connect two blocks. All programs run on Linux system. The flow chart of coupling GAs and CFD simulation is shown in Figure 2.

Figure 2.

Flow chart of coupled optimization framework.

The working flow of coupled procedure could be mainly described by the following five steps:

  1. Template declaration

  2. Geometry and grid generation

  3. Simulation

  4. Post-processing

  5. Genetic operator

3.1. Template declaration

Before running the coupled procedure, all the template files must be implemented. In CFD block, we create a geometry, a mesh file, boundary types, a solver, and a sampling template. The design parameters are declared in the templates as variables and can be changed during the evaluation of GA block. By this way, the evaluation can run in parallel. The simulation script copies the CFD templates for each separated job, inserts the values, and starts the solver. As mentioned before, since all individuals can be evaluated independently in each generation, this approach can adjust to adapt the scale of computing power. As a result, it can save the running time on the specific hardware. Moreover, there is no limit of license running on stations, so this structure shows the economy when deploying on the multi-node cluster.

3.2. Geometry and grid generation

In this step, the CFD block will generate geometry and grid. In the first cycle, GA block initializes the population and then triggers and parses control parameters to CFD block. The control parameters are selected depending on the objectives of problem. We can adjust boundary, geometry, and solver to adapt the purpose of simulation.

The geometry can be created by OpenSCAD or Salome, both are open-source software. In some cases, if the geometry is not so complex, OpenFOAM supports block-mesh and snappy-hex-mesh utilities, which can be used to generate the geometry and grid. For complex geometry, some commercial meshing programs such as Pointwise or ICEM CFD show their advantages. We may also consider other open-source meshing programs like cfMesh or Salome.

3.3. CFD simulation

After generating the grid, CFD solver will be triggered by batch command. Various solver types are implemented in OpenFOAM, and we need to choose an appropriate one for our problem. OpenFOAM also supports a simple way to create our boundary type or modifying solver for the specific models. However, we need to validate them with the experimental data, and then the configuration can be used as template.

3.4. Post-processing

For steady-state simulation, after convergence, the post-processing will export the selected raw data. A python script is then implemented to calculate the results. This approach is flexible in preparing the clean data. In the case of transient simulation, it is most important to choose the right collecting periods to warrant the correctness as of physical model.

3.5. Generic operator

When the post-processing completes, interface script will trigger and parse the data to GA block. GA block then does its operator as demonstrated. When GA block is completed, in turn, interface script triggers and parses data back to CFD block. The coupled procedure will stop if it finishes the predefined evaluation step. The best results and running history are finally archived. All steps are automatically driven by an interface script.

Advertisement

4. Optimization of the maldistribution of flow in a manifold

4.1. Introduction

In designing air-cooled heat exchanger, nonuniformity of flow in manifolds is one of the common issues. The maldistribution of flow could significantly affect to the performance and efficiency of heat exchanger. Thus, analyzing the behavior of flow in manifolds or header is necessary to improve the design.

In practical design, flow maldistribution in manifolds can be induced by the geometry and operating conditions [17]. Jiao et al. [18] investigated experimentally the effect of various geometry parameters including the inlet pipe diameter, the first header’s diameter, and the second header’s diameter. The authors reported that the flow distribution can be significantly improved by optimum design of header configuration. The study of Wen and Li [19] showed a serious flow maldistribution problem in heat exchanger using conventional header. They recommended to install a baffle with small-sized holes to improve the uniform of flow. Wang et al. [20] presented five modified inlet headers to enhance the uniform of liquid flow distribution in the compact heat exchangers.

Besides of using experiments, various studies used modeling approaches to analyze the flow distribution. Tonomura et al. [21] demonstrated a CFD approach to discover the effect of design header on the uniform of flow. The results in this study showed that the shape of manifolds, the length and location of inside fins, and the inlet flow rate significantly affected the flow uniformity. The authors also proposed a CFD-based optimization method to find the optimal design of plate-fine microdevices. Wang et al. [22] proposed a different computational approach. The authors presented a Lattice Boltzmann method for shape optimization of distributor. Recently, Facão [23] developed a correlation model to improve the uniform of flow in solar collector. The model was then validated by the CFD simulation.

In this chapter, we demonstrated another approach to optimize the flow distribution by coupling the CFD simulation and a genetic algorithm. It comes from the fact that the uniform of flow could depend on various parameters and has no general form for specific applications. Hence, combination of GA and CFD would be a good solution to save time and design cost.

4.2. Numerical model

4.2.1. Mathematical model

In this study, two-phase flow of refrigerant is simulated using OpenFOAM software. The working fluid is R134a. Since the experimental test was taken under the adiabatic condition, the simulation will only solve the continuity and momentum equations. VOF method, therefore, has been implemented. VOF solver in OpenFOAM calculates one momentum and one continuity equation for both liquid and gas phases of R134a. The physical properties of one phase are determined based on the volume fraction, α, of two phases in a cell. The continuity equation is defined as follows:

·U=0E1

The momentum equation is determined as follows:

ρUt+·ρUU·µUρg=pFsE2

where Fs is the surface tension force at free surfaces and is defined as

Fs=σκxnE3

where κ is the curvature of the interface and n is a unit vector normal to the interface. κ and n are calculated as follows:

κx=·nE4

and

n=ααE5

Volume fraction, α, in a cell is 0 if it is completely filled by vapor phase, and, on the contrary, volume fraction equals 1 if a cell is completely filled by liquid phase. Volume fraction is calculated by a transport equation as follows:

αt+·αU=0E6

The compression of the surface in OpenFOAM is defined as follows:

αt+·αU+α1αUr=0E7

where Ur is a suitable velocity field to compress the interface.

The properties of two-phase flow of R134a are obtained in REFPROP 8 and are listed in Table 1.

Inlet length (mm)Inlet diameter (mm)Body length (mm)Body height (mm)Outlet dimension (mm)
1209.530525.48.8

Table 1.

Dimension of genetic manifold.

4.2.2. Geometry and grid

The dimensions of manifold are referred from a report of Fei and Hrnjak [24]. In the first phase, we set up a model to validate with the experiment. A three-dimensional model was then created. To reduce the computational cost as well as enhance the accuracy and stability of simulation, the grid was manually generated with hexahedral meshes. In addition, to validate the independence of grid, three types of mesh with the total elements of 377,540, 415,644, and 453,748 were also made, and the last mesh was chosen for the simulation in this study. The detailed dimension of manifold is illustrated in Table 2. The sample of grid is shown in Figure 3.

Saturation temp. (°C)Pressure (kPa)Density of liquid (kg/m3)Density of vapor (kg/m3)Viscosity of liquid (Pa.s)Viscosity of vapor (Pa.s)
24.4736651208.731.8411.96E−41.17E−5

Table 2.

Properties of R134a.

Figure 3.

The 3D model: (a) geometry and (b) sample of grid.

Figure 4 shows a time history of the simulation for volume fraction at the outlets. In this case, the total mass flow rate of two-phase is 10 g/s, and the vapor quality is 0.2. The trend shows that volume fraction in the first outlet firstly raises and quickly drops when the pattern of flow is formed. The liquid phase is then accumulated in the second outlet. The volume fraction in the fifth outlet increases steeply from the sixth to ninth second since the flow bouncing back from the ending wall almost returns to this channel. The fourth outlet, in consequent, has the lowest volume fraction. It turns out that the mass flow rate and the body shape of header are strongly influent to the uniform of flow. The contour of liquid fraction is illustrated in detail in Figure 5.

Figure 4.

Liquid fraction at the outlets.

Figure 5.

Contour of liquid fraction.

The result demonstrates that the maldistribution is difficult to avoid within the conventional design of manifold. This problem could be overcome by modifying the inlet type, changing the body shape of manifolds or adding the baffles. In this work, we modified the inside of the conventional manifold by generating the baffles between each outlet channel. The ideal is that supplied fluid is enough for all outlets, and the flow would be uniform. Hence, we created five subsections inside the manifold. Each subsection works as a liquid pool to accumulate and to distribute liquid. However, the baffle height needs to be designed carefully to archive the purpose of optimization. The work can be tackled by using GA in which the design space is the height of baffles, and the object is the average mean difference of liquid flow rate at the outlet. The cost function, therefore, can be determined as follows:

J=i=1kṁf,iṁ¯fkE8

where ṁf is the mass flow rate (kg/s) of liquid phase and k is the number of outlet.

4.2.3. Optimization

In the second phase, we proposed a new geometry with the baffles between each outlet channel. Since the baffles divide the header to subsections, the geometry now can be reduced to 2D problem. A geometry and grid now are generated using C code. The schematic of proposed header and sample of grid are shown in Figure 6.

Figure 6.

Schematic of proposed model: (a) geometry and (b) sample of grid.

In this study, a single-objective genetic algorithm (SOGA) was implemented. The purpose of algorithm is to minimize the mean difference between the flow rate in each outlet and the average mass flow rate of liquid phase. The fitness type was set as the domination count. The crossover was 80%, the mutation scale was 10%, and the number of evaluation was set as 500. SOGA script automatically generates baffle dimension and updates the boundary conditions as described in the previous part. In addition, another script drives the CFD code run and exports the results for the next evaluation in SOGA.

Figure 7 illustrates the variation of baffle height and the mean difference of flow rate during the evaluation of GA. The height of baffle is ranged from 0.1 to 7.9 mm, and 16 populations were created. The optimal point is found at evaluation 372nd with the baffle height of 7.52 mm.

Figure 7.

Evaluation history.

The improvement factor is shown in Figure 8. The results show that the optimal design improves the mean difference of liquid flow rate about 6 and 15 times in comparison with the general manifold without baffle and the worst case of manifold with baffles, respectively.

Figure 8.

Improvement of optimal design.

Advertisement

5. Conclusions

In this chapter, we demonstrated a CFD-based optimization framework that couples a CFD block and a GA block. In addition, a CFD simulation and the optimization of two-phase flow distribution of R134a in a manifold were also investigated. The optimal design shows much improvement in comparison with the general case. Although only single object is produced, this framework can easily expand to multi-objects.

Advertisement

Acknowledgments

This research was supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education, Science and Technology (NRF-2016R1D1A1A09919697).

References

  1. 1. Mohammadi B, Pironneau O. Applied shape optimization for fluids. Oxford University Press, 2009
  2. 2. Jameson. Aerodynamic design via control theory. Journal of Scientific Computing. 1988;3:233-260
  3. 3. Jameson A. Automatic design of transonic airfoils to reduce the shock induced pressure drag. 31st Israel Annual Conference on Aviation and Aeronautics, Tel Aviv, February 21-22, 1990
  4. 4. Jameson. Optimum aerodynamic design via boundary control. In: AGARD-VKI Lecture Series, Optimum Design Methods in Aerodynamics. von Karman Institute for Fluid Dynamics; 1994
  5. 5. Jameson A. Re-engineering the design process through computation. Journal of Aircraft. 1999;36(1):36-50
  6. 6. Reuther J, Jameson A, Alonso JJ, Remlinger MJ, Saunders D. Constrained multipoint aerodynamic shape optimisation using and adjoint formulation and parallel computers, Part 1. Journal of Aircraft. 1999;36(1):51-60
  7. 7. Reuther J, Jameson A, Alonso JJ, Remlinger MJ, Saunders D. Constrained multipoint aerodynamic shape optimisation using and adjoint formulation and parallel computers, Part 2. Journal of Aircraft. 1999;36(1):61-74
  8. 8. Sun H, Lee S. Response surface approach to aerodynamic optimization design of helicopter rotor blade. International Journal for Numerical Methods in Engineering. 2005;64:125-142
  9. 9. Ortega-Casanova J. Application of CFD on the optimization by response surface methodology of a micromixing unit and its use as a chemical microreactor. Chemical Engineering and Processing: Process Intensification. 2017;117:18-26. ISSN: 0255-2701
  10. 10. Noori Rahim Abadi SMA, Ahmadpour A, Abadi SMNR, Meyer JP. CFD-based shape optimization of steam turbine blade cascade in transonic two phase flows. Applied Thermal Engineering. 2017;112:1575-1589. ISSN: 1359-4311
  11. 11. Liu C, Weiyang B, Dong X. Multi-objective shape optimization of a plate-fin heat exchanger using CFD and multi-objective genetic algorithm. International Journal of Heat and Mass Transfer. 2017;111:65-82. ISSN: 0017-9310
  12. 12. Kim H, Yang C. A new surface modification approach for cfd-based hull form optimization. Journal of Hydrodynamics, Series B. 2010;22(5):520-525
  13. 13. Papoutsis-Kiachagias E, Magoulas JMN, Othmer C, Giannakoglou K. Noise reduction in car aerodynamics using a surrogate objective function and the continuous adjoint method with wall functions. Computers and Fluids. 2015;122:223-232
  14. 14. Gilkeson CA, Toropov VV, Thompson HM, Wilson MCT, Foxley NA, Gaskell PH. Dealing with numerical noise in CFD-based design optimization. Computers & Fluids. 2014;94:84-97. ISSN: 0045-7930
  15. 15. Javid Mahmoudzadeh Akherat SM, Cassel K, Boghosian M, Hammes M, Coe F. A predictive framework to elucidate venous stenosis: CFD & shape optimization. Computer Methods in Applied Mechanics and Engineering. 2017;321:46-69. ISSN: 0045-7825
  16. 16. Jafari M, Parhizkar MJ, Amani E, Naderan H. Inclusion of entropy generation minimization in multi-objective CFD optimization of diesel engines. Energy. 2016;114:526-541. ISSN: 0360-5442
  17. 17. Shah RK, Sekuli DP. Fundamentals of heat exchanger design, John Wiley & Sons, Inc., Hoboken, NJ, USA, 2003
  18. 18. Jiao A, Zhang R, Jeong S. Experimental investigation of header configuration on flow maldistribution in plate-fin heat exchanger. Applied Thermal Engineering. 2003;23:1235-1246
  19. 19. Wen J, Li Y. Study of flow distribution and its improvement on the header of plate-fin heat exchanger. Cryogenics (Guildf). 2004;44:823-831
  20. 20. Wang CC, Yang KS, Tsai JS, Chen IY. Characteristics of flow distribution in compact parallel flow heat exchangers, part II: Modified inlet header. Applied Thermal Engineering. 2011;31:3235-3242
  21. 21. Tonomura O, Tanaka S, Noda M, Kano M, Hasebe S, Hashimoto I. CFD-based optimal design of manifold in plate-fin microdevices. Chemical Engineering Journal. 2004;101:397-402
  22. 22. Wang L, Fan Y, Luo L. Lattice Boltzmann method for shape optimization of fluid distributor. Computers and Fluids. 2014;94:49-57
  23. 23. Facão J. Optimization of flow distribution in flat plate solar thermal collectors with riser and header arrangements. Solar Energy. 2016;120:104-112
  24. 24. Fei P, Hrnjak PS. Adiabatic developing two-phase refrigerant flow in manifolds of heat exchangers, ACRC Technical Report 225, University of Illinois at Urbana-Champaign. 2004

Written By

Jong-Taek Oh and Nguyen Ba Chien

Submitted: 17 May 2017 Reviewed: 08 November 2017 Published: 14 February 2018