Publisher’s version / Version de l'éditeur:
Proceedings of the 15th Conference of the Computational Fluid Dynamics Society of Canada, 2007-05-27
READ THESE TERMS AND CONDITIONS CAREFULLY BEFORE USING THIS WEBSITE.
https://nrc-publications.canada.ca/eng/copyright
Vous avez des questions? Nous pouvons vous aider. Pour communiquer directement avec un auteur, consultez la
première page de la revue dans laquelle son article a été publié afin de trouver ses coordonnées. Si vous n’arrivez pas à les repérer, communiquez avec nous à [email protected].
Questions? Contact the NRC Publications Archive team at
[email protected]. If you wish to email the authors directly, please see the first page of the publication for their contact information.
NRC Publications Archive
Archives des publications du CNRC
This publication could be one of several versions: author’s original, accepted manuscript or the publisher’s version. / La version de cette publication peut être l’une des suivantes : la version prépublication de l’auteur, la version acceptée du manuscrit ou la version de l’éditeur.
Access and use of this website and the material on it are subject to the Terms and Conditions set forth at
Development of a genetic algorithm-based solution algorithm for 1-D convection-diffusion analyses
McCartney, C. J.; Lien, F. S.
https://publications-cnrc.canada.ca/fra/droits
L’accès à ce site Web et l’utilisation de son contenu sont assujettis aux conditions présentées dans le site LISEZ CES CONDITIONS ATTENTIVEMENT AVANT D’UTILISER CE SITE WEB.
NRC Publications Record / Notice d'Archives des publications de CNRC:
https://nrc-publications.canada.ca/eng/view/object/?id=d777e995-2a89-492a-8463-6990372f20ea https://publications-cnrc.canada.ca/fra/voir/objet/?id=d777e995-2a89-492a-8463-6990372f20ea
Development of a Genetic Algorithm-Based
Solution Algorithm for 1-D Convection-Diffusion
Analyses
C. J. McCartney1, F. S. Lien1
1
Mechanical & Mechatronics Engineering Department, University of Waterloo, Waterloo, ON
Overview
● genetic algorithms (GAs): an introduction
● applying GAs to CFD
● development of a GA-based solution algorithm for 1-D
diffusion analyses
● extension of the GA-based solution algorithm to 1-D
convection-diffusion analyses
Introduction
● CFD solution algorithms must be:
– accurate
– robust
– efficient
● most existing algorithms are iterative in nature, apply different
Objectives
● can genetic algorithms be used as CFD solution algorithms?
Genetic Algorithms (GAs)
● multivariate optimization technique first proposed by
Holland [4]
● a complex solution space is iteratively searched to find
optimal values for the input variables based on a proscribed evaluation or fitness function
● main differences from existing matrix solution algorithms:
– multiple potential solutions during each iteration
– solutions improved via semi-random evolution operators
● members are 'copied' more often to the next generation if they
are more accurate i.e. GAs evolve progressively better solutions
Genetic Algorithms: Process
Generate initial population Evaluate members Crossover Selection MutationGenetic Algorithms: Evolution Operators
● two main classes of operators are used to improve solutions:
– Crossover: simulates biological reproduction
– Mutation: random changes to limited number of members
● wide variety of crossover and mutation operators exist, some
Genetic Algorithms: Crossover
φ φ φ xi x xi Crossover point Parent A Child Crossover● concatenate pieces of two parent
members to produce a child member
● purpose: combine two 'good' solutions
Genetic Algorithms: Mutation
φ xi Child Mutation φ xi Child● randomly alter single elements of a member e.g. a single
temperature value in the solution field
● purpose: prevent GA convergence to a sub-optimal solution
Genetic Algorithms: Parameters
● main GA parameters include:
– population size, N (i.e. the number of potential solutions
per generation)
– mutation rate, pmut
– number of points used in the crossover operator (1, 2, etc.)
● parameter values affect GA convergence efficiency,
robustness
● impact of these parameters on the performance of a GA-based
solution algorithm for 1-D diffusion analyses is described later
Overview
● genetic algorithms (GAs): an introduction
● applying GAs to CFD
● development of a GA-based solution algorithm for 1-D
diffusion analyses
● extension of the GA-based solution algorithm to 1-D
convection-diffusion analyses
Literature Review: 'Traditional' GA
● GAs have been applied as an optimization method in many
diverse areas of engineering design e.g. work path optimization, electronic circuit design [e.g. 7]
● GAs have been used in conjunction with CFD simulations to
optimize design parameters for thermofluid systems:
– turbomachinery design
– airfoil geometry optimization based on CFD predictions of
Literature Review: GAs as CFD Solvers
● GA-based CFD solution algorithms: relatively recent topic,
investigated by a limited number of researchers
● Bourisli and Kaminski [1 3] demonstrate that GAs are able to ‑
solve simple CFD analyses:
– potential, backstep and sudden contraction flows
– introduce the application of both domain decomposition
GA-Based Solution Algorithms for CFD
● each member defines one or more property fields (e.g.
temperatures, velocities, concentrations); represents a potential solution to the underlying conservation equation(s)
Member A: [T], [u], [φ]
● need a fitness function to evaluate each member; simplest
function calculates how accurately the solution represented by each member satisfies the discretized form of the underlying conservation equations i.e. error:
● members from each generation are 'copied' to the next
generation via crossover based on fitness
F raw=
∑
i
GA-Based Solution Algorithms for CFD
● evolving a solution using GA may offer a number of
advantages over traditional matrix solution techniques:
– since no special form for the coefficient matrix [A] is
assumed (i.e. block banded) GA-based solution algorithms can be directly applied to unstructured grids
– since the fitness function does not rely on a certain form
for the computational cell, higher-order discretization schemes may be more easily incorporated
– fitness is calculated on a row-by-row basis with regards to
[A]; lends itself to parallelization
● these and other potential benefits are discussed later in
Overview
● genetic algorithms (GAs): an introduction ● applying GAs to CFD
● development of a GA-based solution algorithm for 1-D
diffusion analyses
● extension of the GA-based solution algorithm to 1-D
convection-diffusion analyses
● solution of the 1-D diffusion equation is used as a first step in
developing a GA-based solution algorithm for more general thermofluids analyses
1-D Diffusion
qrad, qconv TB TA x 0 k, A q xLFigure 1. Diffusion of heat through a 1-D material.
k d 2
T
1-D Diffusion: Discretization
● discretize domain into 20 isometric control volumes, each
with a centrally-located node
● two additional nodes are located at the flow domain
boundaries to allow boundary conditions to be specified
● temperature gradients at control volume faces are expressed in
terms of nodal temperatures by applying second-order CDS
● resulting set of discretized equations:
1-D Diffusion: Implementation
● simple evolution operators:
– 1- and 2-point crossover
– mutation with a constant mutation distance, ΔTmut
● solution with highest fitness in each generation is copied to
the next generation without crossover or mutation applied (i.e. 'elitist selection'); speeds up convergence for simple analyses
1-D Diffusion: Test Case
● preliminary test case:
– Dirichlet boundary conditions: TA = 300 K, TB = 700 K
– k = 1 W/m-K
– xL = 1 m
– A = 1 m2
– internal heat generation; q = 2 000 W/m3
● theoretical solution defined by [8]:
● GA parameters: population size N = 100, mutation rate
T x =[ T B−T A
xL
q
1-D Diffusion: Results
0 250 500 750 1000 0.00 0.25 0.50 0.75 1.00 T [ K ] x [m] Sim ulation C-010 Theoretical 0 250 500 750 1000 0.00 0.25 0.50 0.75 1.00 T [ K ] x [m] Simulation C-010 Theoretical a) G = 1 000 a) G = 10 000Figure 2. Predicted temperature field for 1-D diffusion analysis vs. theoretical solution (Simulation C-010).
1-D Diffusion: Analysis
● high-frequency error preferentially dampened out
● 'final' solution for Generation 10 000 still requires further
convergence
1-D Diffusion: Sensitivity Study
● choosing GA parameter values affects convergence efficiency,
robustness
● identification of appropriate ranges for each of the main
parameters is critical for development of an efficient GA-based CFD algorithm
● a sensitivity study is conducted based on the 1-D diffusion test
case described above; vary three GA parameters:
– population size (N): 10, 50, 100
– mutation rate (pmut): 0.01, 0.1, 0.2
1-D Diffusion: Sensitivity Study
● raw fitness used as a measure of convergence; analogous with
error
● due to randomness in the roulette wheel selection process,
performance of a single simulation is not a reliable indicator; fitness trends are based on the average of thirty simulations
● total number of solutions evaluated in each simulation was
106, regardless of population size N; simulate a constant
1-D Diffusion: Sensitivity Study Results
100 1000 0 250000 500000 750000 1000000 A v e ra g e m in im u m r a w f it n e s s Total members C (N = 100, p_mut = 0.1, 1-point) A (N = 10, p_mut = 0.1, 1-point) F (N = 100, p_mut = 0.01, 1-point) I (N = 100, p_mut = 0.2, 1-point) L (N = 100, p_mut = 0.1, 2-point)Figure 3. Comparison of selected convergence trends for 1-D diffusion simulations.
● optimal convergence
trend: simulation set C
(N = 100, pmut = 0.1,
1-point crossover)
● other trends indicate
sub-optimal convergence behaviour:
– rapid convergence but
eventual stalling (A, I)
– more robust but
1-D Diffusion: Conclusions
● in general, the choice of values for GA parameters balance
two conflicting goals: rapid convergence (higher mutation rates, smaller populations and more aggressive evolution operators) and robustness
● identification of an optimal set of GA parameters for general
CFD applications is difficult, likely application-specific
● efficiency of GA-based CFD solution algorithms varies
inversely with number of nodes
– Bourisli and Kaminski [1] demonstrate a grid refinement
Overview
● genetic algorithms (GAs): an introduction ● applying GAs to CFD
● development of a GA-based solution algorithm for 1-D
diffusion analyses
● extension of the GA-based solution algorithm to 1-D
convection-diffusion analyses
1-D Convection-Diffusion
● extend algorithm to a more complex flow analysis: 1-D
convection-diffusion qrad, qconv TB TA x 0 k, A q xL u d ρ u dx =0 d dx ρ u T = d dx k dT dx
1-D C/D: GA Implementation
● GA-based solution algorithm for 1-D diffusion is modified to
include convection:
– nodal velocities ui added to each member
– continuity equation discretized using fourth-order CDS
– GA fitness function modified to include both the accuracy
of the temperature field (via heat equation) and velocity field (via continuity equation):
1-D Convection-Diffusion: Test Case
● simulations are performed using the following values:
TA = 0.9 K, TB = 0.1 K, k = 1 W/m-K, xL = 1 m, A = 1 m2,
u = 0.5 m/s
● following GA parameter values are selected based broadly on
the results of the 1-D diffusion sensitivity study:
1-D Convection-Diffusion: Results
0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 T [ K ] x [m ] Sim ulation TheoreticalFigure 5. Typical temperature field solution for 1-D convection diffusion analysis (G = 106).
1-D Convection-Diffusion: Results
Figure 6. Typical velocity field solution for 1-D convection diffusion analysis
0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 u [ m /s ] x [m] Simulation Theoretical
1-D Convection-Diffusion: Analysis
● temperature field requires further convergence
● velocity field exhibits chequerboard oscillations; replace CDS
with UDS, hybrid
● further research on improving GA for 1-D
Overview
● genetic algorithms (GAs): an introduction ● applying GAs to CFD
● development of a GA-based solution algorithm for 1-D
diffusion analyses
● extension of the GA-based solution algorithm to 1-D
convection-diffusion analyses
Proposed Research: Parallelization
● GA-based solution algorithms do not perform any matrix
inversion or decomposition on coefficient matrix [A]
● fitness is calculated on a row-by-row basis with no interaction
between rows; lends itself to parallelization
Fraw=
∑
i∣
[ A]i[]i−bi∣
Row 1 → CPU 1 Row 2 → CPU 2 Row 3 → CPU 3 [A],[φ]Proposed Research: Multigrid
● Bourisli and Kaminski [1] demonstrate how grid refinement
can significantly improve GA convergence behaviour
● GAs appear to be good smoothers
● a more formal multigrid (MG) approach to GA-based solution
Conclusions
● a GA-based algorithm for solving 1-D diffusion analyses has
been developed and has been shown to predict solutions with acceptable accuracies
● extension of this algorithm to 1 D convection-diffusion ‑
analyses is in progress
● GA convergence efficiency shown to be sensitive to GA
Acknowledgements
● financial support from Natural Sciences and Engineering
GA-Based Solution Algorithms for CFD
● main objective of most CFD analyses: solution of large matrix
equation based on discretized conservation equations to determine a field of values for one or more quantities
● existing solution algorithms for analyses of practical interest
are mainly iterative in nature (e.g. SIP, MG), rely on specific properties of these matrices in order to achieve improved convergence efficiency and/or robustness
● although highly efficient for a wide class of analyses, existing
algorithms still limited for certain 'tough' cases e.g. high localized gradients, non-linear processes such as radiation
1-D Diffusion: Governing Equation
● temperature field in the flow domain governed by the heat
equation [8]:
(2)
● thermal conductivity, k, and cross-sectional area of the
domain, A, are assumed constant
● source term q represents internal heat generation
● application of Dirichlet and/or von Neumann boundary
conditions at either end of the flow domain yield a variety of theoretical solutions [cf.8]
● convective and/or radiative heat transfer from the flow domain
surface may be included through appropriate modifications to
k d 2
T
1-D Diffusion: Implementation
● a GA-based algorithm to solve 1-D diffusion analyses is
implemented in C
● 'member' structure:
– floating point array representing nodal temperatures, Ti
– floating point array representing nodal x co-ordinates, xi
– raw (F) and normalized (Fnorm) fitness values for each
member
● 'population' structure:
– array of member structures
1-D Diffusion: Sensitivity Study Parameters
GA Parameter Set Crossover Type
A 10 0.1 1-point 62.9 B 50 0.1 1-point 48.6 C 100 0.1 1-point 47.3 D 10 0.01 1-point 91.5 E 50 0.01 1-point 86.6 F 100 0.01 1-point 86.3 G 10 0.2 1-point 68.4 H 50 0.2 1-point 76.4 I 100 0.2 1-point 66.2 J 10 0.1 2-point 55.4 K 50 0.1 2-point 53.4 L 100 0.1 2-point 48.1 M 10 0.01 2-point 90.5 N 50 0.01 2-point 78.8 O 100 0.01 2-point 85.0 P 10 0.2 2-point 62.9 Q 50 0.2 2-point 68.5 R 100 0.2 2-point 64.1 Population Size N Mutation Rate pmut Final Fitness Fraw,final
1-D Diffusion: Sensitivity Study Analysis
● 1-point crossover: final solution accuracy improves with
increasing population size; clear trend not evident for 2-point
– Bourisli and Kaminski [1] propose that small population
sizes are better suited to solution of simple CFD analyses; however, more complex flows may require larger population sizes to avoid convergence to local maxima
● mutation rate of p
mut = 0.1 performs better than 0.01 and 0.2
– Bourisli and Kaminski [1] recommend the use of relatively
high mutation rates for simple CFD analyses to improve convergence efficiency; risk of reduced robustness
1-D C/D: Governing Equations
● conservation equations describing the temperature and
velocity distribution in a 1-D domain due to convection and diffusion [8]:
(5) (6)
● the inclusion of convection introduces a second conversation
equation as well as a second field quantity (i.e. velocity, u)
● temperature field for the simplified case of constant ρ, u, A
and k is given by [8]: (7) d ρ u dx =0 T x =T AT B−T A exp ρ u x / k −1 exp ρ u xL/ k −1 d dx ρ u T = d dx k dT dx
Proposed Research: GA-based Solvers
● above examples and results of Bourisli and Kaminski [1-3]
demonstrate that GA-based algorithms are able to solve simple CFD analyses
● GA-based solution algorithms have substantially different
behaviours than traditional matrix solution algorithms
● may offer advantages for 'tough' CFD analyses where
traditional algorithms do not perform well:
– Stiff matrices: multiple timescales
Proposed Research: Genetic Programming
● perhaps the most interesting new research area related to
GA-based CFD algorithms involves similar algorithms developed using genetic programming (GP)
● GP: optimization technique closely related to GAs but which
evolves solutions in a functional form (i.e. φ = f(x,y,z,t)) rather than a nodal form
● functional solutions require less memory; may improve the
efficiency of parallel implementations since less information must be communicated to each cluster node
● lack of a predefined computational grid in a GP-based CFD
algorithm may also allow for some interesting applications with grid refinement and/or unstructured grid techniques
Future Research
● demonstrate the benefit of GA-based solution algorithms for
'tough' CFD analyses which cannot be solved efficiently using existing solution algorithms
● implement a multigrid version of a GA-based solution
algorithms
1. Bourisli, R., Kaminski, D. A. Solving fluid flow problems using a real-coded genetic algorithm with uniform refinement. Fifth International Conference on Advances in Fluid Mechanics (Lisbon, Portugal) v.40:63-72. 2004. 2. Bourisli, R. I., Kaminski, D. A. Evolutionary optimization techniques as versatile solvers for hard-to-converge
problems in computational fluid dynamics. International Journal for Numerical Methods in Fluids 52:321-354. 2006.
3. Bourisli, R. I., Kaminski, D. A. Solution of the incompressible Navier-Stokes equations via real-valued evolutionary algorithms. WIT Transactions on Engineering Sciences - Advances in Fluid Mechanics VI v.52:13-20. 2006.
4. Holland, J. H. Adaptation in natural and artificial systems : an introductory analysis with applications to biology, control, and artificial intelligence. University of Michigan Press. 1975.
5. Howard, D., Kolibal, J. Solution of differential equations with Genetic Programming and the Stochastic Bernstein Interpolation. BDS-TR-2005-001. 2005.
6. Koza, J. R. Genetic programming: on the programming of computers by means of natural selection. Massachusetts Institute of Technology Press. 1992. ISBN 0-262-11170-5.
7. Lienig, J. A parallel genetic algorithm for performance-driven VLSI routing. IEEE Transactions on Evolutionary Computation, 1(1):29-39. 1997.
8. Versteeg, H. K., Malalasekera, W. An introduction to computational fluid dynamics - the finite volume method. 1995.
9. Zhang, F., Chen, S., Khalid, M. Inverse problem study of isolated wing by genetic algorithm. Proc. of the 12th