You are on page 1of 33

Application of Genetic Algorithms to

CFD

Cameron McCartney
Introduction
define and describe genetic algorithms (GAs) and genetic
programming (GP)
propose possible applications of GA/GP to CFD

Application of Genetic Algorithms to CFD 2


Genetic Algorithms (GAs)
a highly parallel mathematical algorithm that uses evolution
operations to transform a population of data objects, each
with individual fitness values, into a new population with
higher average fitness values [Koza]
an optimization method analogous to biological evolution
and similar to simulated annealing
GAs provide a tool in areas that do not yield readily to
standard approaches [Holland]

Application of Genetic Algorithms to CFD 3


Genetic Algorithms (GAs)
generally applied to optimization problems where the
system dynamics are known but the optimal set of input
variables is not

Application of Genetic Algorithms to CFD 4


Genetic Algorithms (GAs)
goal is to determine values for the set of input variables
which, when processed by the system dynamics, most
closely match the output data
GA automatically determines the optimal values of the input
variables with minimal initial direction from the user

Application of Genetic Algorithms to CFD 5


Genetic Algorithms: Process
1.Generate a random initial population of potential solutions
as generation 0 (G0)
2. Evaulate the fitness of each member of G0 using the
known system dynamics and a fitness function
3.Apply genetic operations to members of G0, selecting based
on their fitness values, to produce a new set of potential
solutions (G1)
4.Continue to evaulate and apply genetic operations to each
generation until an optimization criteria has been satisifed

Application of Genetic Algorithms to CFD 6


Genetic Algorithms: Process

F 0=
i
F0
F 1=
i
F1
F 2=
i
F2
N0 N1 N2

F 0F 1F 2

Application of Genetic Algorithms to CFD 7


Population Members
population: a set of similar data objects, each describing a
complete combination of the input variables
each population member represents a potential solution to
the optimization problem
members typically express a combination of the input
variable values using a binary representaion

Application of Genetic Algorithms to CFD 8


Fitness: Defintion
a quantitative measure of how well a specific member
satisfies the optimization problem
a fitness function usually compares the output data from a
potential solution to the desired set of output data (i.e. error,
residual)
examples of fitness functions:
least squares error for curve fitting, other optimization
applications
minimum path length for topographical applications
lowest residual energy for protein synthesis applications
Application of Genetic Algorithms to CFD 9
Fitness: Importance to GA
fitness is the key driving force behind GA/GP; population
members with higher fitness are more likely to be 'copied' to
the next generation.
any factors not explicited included in the fitness measure
will not be optimized
GA generally increases the average fitness of the
population; successive iterations will continue to improve
the fitness of the population.

Application of Genetic Algorithms to CFD 10


Genetic Operations
two main genetic operations are performed on population
members in order to progressively improve their fitness
values:
crossover
mutation
analagous to biological evolutionary processes

Application of Genetic Algorithms to CFD 11


Genetic Operations

Application of Genetic Algorithms to CFD 12


Genetic Operations
crossover combines parts of two population members in
hopes of creating a new member with better fitness that
either contributing member
population members are selected for crossover based on
fitness values i.e. better members are copied into the next
generation more frequently
crossover is the main cause of improved average fitness
from generation to generation; mutation only serves to
restore diversity into populations which are too
homogeneous (i.e. local solution)

Application of Genetic Algorithms to CFD 13


GA vs. Simulated Annealing
simulated annealing (SA) is a multi-dimenaionsl
optimization technique bsaed on following local gradients to
a minima/maximum
main difference: SA requires the user to choose some
optimization parameters (e.g. transition probability function,
transition step size); GA requires less explict input by the
user
proposed: GA may be less efficient than SA for well-
behaved optimization problems, but may be better suited to
complex parameter spaces

Application of Genetic Algorithms to CFD 14


GA: General Optimization
GA has been shown to be a general optimization technique
with applications in engineering design
GA is well suited parallelization on computing clusters:
evaluation of each member's fitness is mutually
independant; only combined process is the application of the
genetic operations
the ability of GA to optimize multiple schemata (i.e.
combinations of input variables) at the same time leads to
inherent parallelism

Application of Genetic Algorithms to CFD 15


Genetic Programming (GP)
a specific application of GA techniques used to evolve
structured algorithms or computer programs rather than
static combinations of input variables

Application of Genetic Algorithms to CFD 16


GA vs. GP
GA determines the set of
input data which, when
transformed by a known
system dynamics
algorithm, most closely
matches a set of known
output data
GP determines the system
dynamics algorithm
which most closely
transforms a set of known
input data into a set of
known output data
Application of Genetic Algorithms to CFD 17
GP: Program Structure
GP algorithms are usually
represented as linked trees
tree elements are either program
flow control elements (IF, FOR,
etc.), input variable values (x1,
x2, etc.) or randomly generated
numerical constants.

Application of Genetic Algorithms to CFD 18


GP: Genetic Operations
GP crossover exchange branches of two trees

Generation i Generation i+1

Source: Koza
Application of Genetic Algorithms to CFD 19
GP: Genetic Operations
GP mutation changes a single tree element:
IF(x1 < x2) IF(x1 > x2)
(x1 + x2 x3) (x1 + 2.324 x3)

Application of Genetic Algorithms to CFD 20


GP: Applications
GP is well-suited to problems involving unknown system
dynamics:
financial forecasting
electronic filter design
curve-fitting (symbolic regression)

Application of Genetic Algorithms to CFD 21


GA/GP Research
GAs initially developed by Holland (1975)
GP developed by Koza (~1992)
GA/GP applied to problems in many different disciplines:
engineering design (e.g. airfoil optimization, control
system tuning, artificial vision systems)
financial forecasting
biological system modeling

Application of Genetic Algorithms to CFD 22


GA/GP Application to CFD
GA/GP may be applied to CFD simulations in two different
ways:
act as an optimization technique driving CFD software
(external)
allow more efficient solution of CFD problems (internal)

GA/GP may also facilitate research into CFD turbulence


modeling

Application of Genetic Algorithms to CFD 23


GA/GPCFD: Optimization Driver
CFD is often used as an evaluation method for optimization
designs:
heat sinks
airfoils
etc.
current optimization methods driving the CFD software
include:
Markov chains
Bayesian inference
simulated annealing
Application of Genetic Algorithms to CFD 24
GA/GPCFD: Source Determination
one CFD application is the determination of particulate
source 2D locations and strengths based on limited
measurements
involves searching a large parameter space (x, y, S(t)) with
moderate nonlinearity
GA may represent a feasible alternative to Bayesian
inference

Application of Genetic Algorithms to CFD 25


GA/GPCFD: Airfoil Design
Zhang, Chen and
Khalid at the
National Research
Council Canada
have successfully
used GA to optimize
airfoil geometries

Application of Genetic Algorithms to CFD 26


GA/GPCFD: Zone Model Solution
zone models are simple two-zone CFD approximations used
for modeling heat and smoke transport through buildings
solving zone model simulations of a few compartments is
trivial; as the number of compartments reaches 50, 100,
1000, the underlying set of ODEs become difficult to solve
due to their stiffness
GA may be used to evolve a set of functions for each
compartment which satisfies the ODEs and constraints

Application of Genetic Algorithms to CFD 27


GA/GPCFD: Matrix Solvers
can GA be used as a more efficient matrix solution
technique for CFD?
instead of backsolving a large set of linearized equations,
guess and interatively improve a solution field using GA.
if forward calculation of error requires substantially less
computational power than current matrix solution
techniques, improvements in computational efficiency may
result

Application of Genetic Algorithms to CFD 28


GA/GPCFD: Turbulence Modeling
many current tuirbulence models have functional forms and
parameter values derived via correlation with experimental
or DNS data e.g. (k,) = (C,k,,C1,C2)
GA may be used to tune the parameter values to produce a
better correlation
GP may be used to derive new functional forms which are
of higher complexity i.e. highly non-linear
derivation of new functionl forms for tubulence models may
lead to new understanding of complex parameter
relationships

Application of Genetic Algorithms to CFD 29


Research Directions
review literature for exisiting application of GA/GP to CFD
review literature for uses of GA/GP in related applications
(e.g. solution of sets of ODEs, symbolic regression)
determine suitability of various research topics using simple
benchmark problems (e.g. 1-D Fourier equation, Euler's
equation)

Application of Genetic Algorithms to CFD 30


References
Holland, J. H. Adaptation in natural and artificial systems
(2nd ed.). Massachusettes Institute of Technology Press.
1992. ISBN 0-262-08213-6.
Koza, J. R. Genetic programming: on the programming of
computers by means of natural selection. Massachusettes
Institute of Technology Press. 1992. ISBN 0-262-11170-5.
Zhang, F., Chen, S., Khalid, M. Inverse problem study of
isolated wing by genetic algorithm. Proc. of the 12th Annual
Conference of the CFD Soc. of Canada. 2004.

Application of Genetic Algorithms to CFD 31


Contact
cjmccart@engmail.uwaterloo.ca

Application of Genetic Algorithms to CFD 32


Application of Genetic Algorithms to CFD 33