Beruflich Dokumente
Kultur Dokumente
To my family
Contents
Contents
Preface
vii
1 Introduction
1.1 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 The Vortex Particle Method . . . . . . . . . . . . . . . . . . . .
1.3 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Optimization Algorithms
2.1 Classification . . . . . . . . . . . . . .
2.2 Local Optimization . . . . . . . . . . .
2.2.1 Golden Section Algorithm . . .
2.2.2 Nelder-Mead Simplex Algorithm
2.3 Gradinet-based Algorithms . . . . . . .
2.4 Global Optimization . . . . . . . . . . .
2.4.1 Genetic Algorithm . . . . . . . .
1
1
2
4
.
.
.
.
.
.
.
5
5
8
9
12
15
16
16
3 Shape Optimization
3.1 Black-Box Optimization . . . . . . . . . . . . . . . . . . . . . . .
3.2 Parametrization . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Objective Functions . . . . . . . . . . . . . . . . . . . . . . . . .
17
18
19
20
4 VXFlow
4.1 Input File (*.in13) . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.1 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Output File (*.o3) . . . . . . . . . . . . . . . . . . . . . . . . . .
21
22
24
26
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Contents
4.3 Other Output Files . . . . . . . . . . . . . . . . . . . . . . . . .
5 OptiFlow
5.1 CFD Model . . . . . .
5.2 Parameter File (*.opt) .
5.3 Objective File (*.m) . .
5.4 Pre-Run Optimization .
5.5 Run-Time Optimization
26
.
.
.
.
.
29
30
30
32
33
34
6 Optimization Models
Examples
6.1 M4 Neath Viaduct Wind Shield . . . . . . . . . . . . . . . . . . .
6.2 Vertical-Axis Wind Turbine (VAWT) . . . . . . . . . . . . . . . .
35
37
43
7 Final Remarks
7.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 Future Research . . . . . . . . . . . . . . . . . . . . . . . . . .
53
53
54
Bibliography
55
59
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
vi
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Contents
Preface
vii
Contents
The contents of this paper are organized starting with a small introduction into
optimization and the basics of the Vortex Particle Method as the numerical approach used for wind simulation. Then in Chapter 2 theory surrounding optimization algorithms, mainly the difference between Local and Global Optimization is explored. In Chapter 3 Shape Optimization and Black-Box Optimization (3.1) are the main topics, and present the problems involving these kind
of optimizations and the appropriate steps to take in order to solve them. In
Chapter 4 concerns VXFlow, which is the CFD program of choice for the wind
simulation and the Black-Box Function. Chapter 5 is about OptiFlow which is
the program developed for this research, explaining its main features and how
it works. Then in Chapter 6 some optimization examples are presented and
their results. Finally, in Chapter 7 some concluding remarks are made about
the outcome of this research and some insights are given on future research
ideas and scientific trends in this area.
Acknowledgements
I want to thank Prof. Guido Morgenthal , his guidance and experience were
invaluable. His work with VXFlow is fundamental for the wind simulations.
I will also like to thank M.Sc. Khaled Ibrahim for his enormous dedication to this
research. His knowledge on computer sciences has contributed considerably
to the improvement of this work.
Special thanks go to M.Sc. Benjamin Bendig for his help in building the simulation models. His work on the VXFlow GPU version of the program has significantly reduced simulation time. Also his work with VXviz, a VXFlow visualization
program, has been of great help.
Many thanks to Shanmugam Narayanan for his help in debugging the program.
His interest and involvement on the use of the program are greatly appreciated.
viii
Contents
ix
Chapter 1
Introduction
1.1 Optimization
Generally speaking, optimization consists in the process of finding the best solution to a given problem, from a given set of available and feasible solutions.
Examples of this can be, finding the lightest superstructure for a bridge, decide which is the most profitable business plan, or it could be to obtain the best
geometrical shape that minimizes wind-induced pressure on a vehicle. These
problems usually involve minimizing or maximizing something within the problem, and thats what optimization basically is, to obtain the best possible solution
to a problem.
Mathematically, the optimization problem can be expressed by, [4] [5]
minimize f (x)
x
(
gi (x) 0, i = 1, . . . , m
subject to
hi (x) = 0, i = 1, . . . , n
(1.1)
Chapter 1. Introduction
where,
f (x) :
Chapter 1. Introduction
Vortex Methods have attracted considerable attention in recent years mainly for
applications in Bluff Body Aerodynamics. This is due to very good results which
can at least for 2D cases be obtained at a fraction of the computational cost
of other numerical methods, e.g. Finite Volume or Finite Element methods.
The grid-free Vortex Particle Method VXFlow is utilised for this Thesis. It is
used to discretize the Navier-Stokes equations and to evolve the fluid flow in
time. The main features of the code are as follows [1]:
Utilisation of the Boundary Element Method for the enforcement of the nopenetration boundary condition on solid surfaces.
Surface circulation discretisation by means of elements of linearly varying
vorticity.
Smooth Gaussian kernel for mutual vortex interactions.
A fast P3 M algorithm for the computation of the velocity field by Morgenthal and Walther based on the utilisation of Fast Fourier Transforms for the
solution of the underlying Poisson equation and a local Particle-Particle
correction algorithm.
A partial particle remeshing strategy developed by Morgenthal and Walther
The random walk method for diffusion modelling.
Chapter 1. Introduction
1.3 Software
A list of popular and readily available software used for solving optimization
problems is presented here, along with a small description of each.
MATLAB [3]: is a high-level language and interactive environment for numerical computation, visualization, and programming.
TOMLAB [8]: is a powerful optimization platform and modeling language
for solving applied optimization problems in MATLAB.
OpenOpt [9]: Free Python-written numerical optimization software suite.
NOMAD [10]: is a C++ software designed to solve problems of Black-box
Optimization. The minimal requirement from the user is to provide the objective and constraints.
CONDOR [11]: Algorithm using parallel, direct and constrained optimization for high-computing-load objective functions.
Chapter 2
Optimization Algorithms
In this chapter we will make a brief overview on the most commonly known
optimization algorithms. We first talk about the different types of classification
we can have for an optimization problem, and the algorithms that can be used
for solving them. We focus our efforts in the classification of local and global
algorithms and discuss some of the algorithms that exist in these areas in further
detail.
2.1 Classification
Optimization problems can be classified by linearity, modality, constraints and
objectives, in which cases they can be either linear or nonlinear, uni-modal or
multi-modal, constrained or unconstrained and single or multi-objective optimization, listed respectively. We already noted the importance of understanding
each type of optimization, so we will introduce them briefly here and broaden
on the subject on the following chapters.
An important special case of local optimization is the one know as convex optimization which is the one where all local solutions are global solutions.
[14]
a+b a 1+ 5
=
= =
= 1.6180339887...
a
b
2
[15]
10
Algorithm
1. Initialization: Determine interval [x0 , x3 ] which contains the minimum
Calculate intermediate points x1 and x2 using the golden ratio
where,
x1 = a + c
x2 = a c
c=
51
(x3 x0 )
2
f (x1 ) f (x2 )
If
x0 = x0
x0 = x2
x3 = x1
x2 = x1
x1 = x2
x3 = x3
x2 = x3 c
x 1 = x0 + c
x3 + x0
2
= f (xmin )
xmin =
fmin
11
[20]
This algorithm requires that an initial guess be provided to start searching for
the minimum, from this an initial simplex is created. The algorithm evaluates
the objective function at each vertices of the simplex and carries out a series
of movements, which include: reflection, expansion, contraction and shrinkage.
This movements shift and modify the original simplex updating and converging
it to the minimum on each step.
12
13
[21] [22]
Algorithm
Algorithm 1: Downhill simplex of (Nelder and Mead, 1965).
input : the cost function f : Rn R
{xi }ni=0 an initial simplex
output: x , a local minimum of the cost function f .
1 begin
2
k0
3
while STOP - CRIT and (k < kmax ) do
4
h arg max f (xi )
i
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
x (1 + )
x xh
where > 0 is the reflection coefficient
if f (x ) < f (xl ) then
x (1 + )x x
where > 1 is the expansion coefficient
if f (x ) < f (xl ) then
xh x
else
xh x
/* expansion */
/* reflection */
/* reflection */
x xh + (1 )
x
where 0 < < 1 is the contraction coefficient
if f (x ) > f (xh ) then
l
xi xi +x
i J0, nK
2
else
xh x
/* multiple contraction */
/* contraction */
else
xh x
/* reflexion */
k k+1
return xl
[13]
Table 2.2: Nelder-Mead Simplex Algorithm
14
[5]
The actual methods differ from one another by how the Search Direction pi and
the Step Length i are calculated. The calculation of the Step Length i is know
as Line Search, which usually consists of an inner iterative loop.
The most popular gradient-based optimization algorithms are:
Newton
Gradient Descent
Quasi-Newton
Conjugate Gradient
15
16
Chapter 3
Shape Optimization
Shape Design is vital in the field of Wind Engineering. We just need to take a
look at the Tacoma Narrows Bridge Collapse [24] to see how important shape
design can be. With the trends on materials engineering, lighter and slender
structures are being built and this structures are usually very sensitive to wind
loading, therefore it is very important for these structures to have aerodynamic
shapes.
Shape optimization has been used extensively in the areas of wind energy and
aerospace engineering, in which shape design is critical for the efficiency and
correct operation of the structure.
Shape optimization consists on finding the optimal shape to minimize a certain objective function, also known as cost function, while satisfying given constraints. This is in contrast to topology optimization, which is concerned with
the optimization of components and parts of which the structure is made of, like
the number of holes to use in a component or the floor layout in a building.
Mathematically, a shape optimization problem can be posed as follows, [25]
minimize f ()
(
gi () 0, i = 1, . . . , m
subject to
hi () = 0, i = 1, . . . , n
17
(3.1)
[6]
[27]
Black-Box processes are usually only known from their inputs and outputs, with
little or no knowledge of how it works internally. Black-Box Functions can be
originating from diverse sources, like the running of computer code, solution
of system of Partial Differential Equations or even real-life experiments. The
optimization involving this type of functions is usually known as Black-Box Optimization or Simulation-based Optimization. [28]
18
Derivate-
based optimization algorithms are illsuited for this type of problems, because calculation of derivatives most
of the time is not possible.
Some
3.2 Parametrization
This is a fundamental step in performing Shape Optimization. It consists on the
definition of variables in the geometric model that we wish to optimize. Traditionally in the analysis process, all dimensions of a structure are kept constant
in the geometrical numerical model. Now in order for us to perform simulationbased optimization we need to have parametrized dimensions, so instead of
taking a constant value they now can be modified by the optimization routine,
attaching it to the optimization process and making it converge to the optimum
shape.
Please refer to Section 5.2 to see how parametrization is implemented in OptiFlow.
19
20
Chapter 4
VXFlow
VXFlow is a flow solver based on the Vortex Particle Method. It allows very
efficient simulation of two-dimensional flows around bodies of arbitrarily complex geometry and arrangements of such. Main areas of application is in Wind
Engineering of structures, Aerodynamics, Aerospace Engineering and Offshore
Engineering. Coupled fluid-structure interaction analysis is possible, enabling
simulation of vortex-induced vibrations (VIV), flutter or galloping. [1]
In this Chapter we will discuss our Black-Box Simulation Program VXFlow. Our
purpose here is to explain the basics on the usage of the program, mainly the inputs and outputs of the program. We will only discuss subjects that are relevant
to the usage OptiFlow. For detailed explanation on the usage of the program
please refer to VXFlow Primer [1] and for more information on the numerical
method used on the program please refer to the Ph.D. Thesis by Morgenthal
[7].
21
Chapter 4. VXFlow
22
Chapter 4. VXFlow
Item (default)
NSLICES (none)
OptiFlow
Nothing
Description
Number of Slices of the Structure. This affects the number of
columns for the output file, because forces and displacements
are dumped into it for each slice
and each section of a slice.
NSTEPS (10000)
Nothing
Number of timesteps to be performed; if NSTEPS=0 then calculation is performed until user interruption. In the case of optimization
it is important to have a value that
provides accurate results in a reasonable amount of time.
NUMSEC (1)
Read
GEOMROT (0.0)
23
Chapter 4. VXFlow
4.1.1 Geometry
The last values in the input file are the polygonal x-y coordinates of each section
for each slice of the model. The first point given is the leading edge (corner)
and the number of panels given is inserted on the edge running from this point
to the one in the next line. The last line contains the point on the circumference
and panel information for the edge which closes the section.
24
Input
parame- Description
Chapter
4. VXFlow
ter (default)
Here follow num.cornerpoints lines with the following format, providing information
on row
howhas
to discretise
the surface
of the section, running in an anti-clockwise manner
Each
the following
format:
around the section. The rst point given is the leading edge (corner) and the
ID CX
CY N MX MY
number of panels given is inserted on the edge running from this point to the one
An explanation
of each
these
provided
in the
Table
4.2.
in the next line.
The of
last
line values
containsisthe
point on
circumference
and panel
information for the edge which closes the section. Rows look like:
ID CX CY N MX MY
ID
Edge shape identier: (1)=linear edge; (2/3)=arc edge
CX
X-coodinate of corner point
CY
Y-coodinate of corner point
N
Number of panels to be created on this edge
MX
X-coordinate of the centre of the circle part of which this edge
is. MX and MY are only provided for arc edges, i.e. ID=2 or
3. The edge is constructed through the rst point and around
the center given, where ID=2 provides a forward and ID=3
a backward pointing arc. The user has to ensure that this
arc actually goes through the second point (geometrically the
problem is overdetermined).
MY
Y-coordinate of centre, cf. also MX
example:
p 1x , p 1y
N4
p 4x , p 4y
N1
M x3 ,M y3
N3
p2x , p 2y
N2
p3x , p 3y
19
25
[1]
Chapter 4. VXFlow
*.vx2
SKFL (0)
*.sk2
FVFL (0)
*.fv2
PRFL (0)
*.pr1
RSTFL (0)
*.rst
Restart File
VIZFL (0)
*.mvxb
26
27
tN ST EP S
t1
..
.
Time
DRAG
..
.
DRAG
F orces(j)
LIFT MOMENT
..
..
.
.
LIFT MOMENT
H.DISPL
..
.
H.DISPL
Sect.(i)(j)
R.DISPL
..
.
R.DISPL
Sect.(i)(j + 1)
. . . Sect.(i)(NUMSEC)
...
...
..
.
...
Displ.(j)
V.DISPL
..
.
V.DISPL
Slice(i)
Slice(i + 1)
Sect.(i + 1)(j)
. . . Slice(N SLICES)
...
...
...
...
..
.
...
Chapter 4. VXFlow
Chapter 5
OptiFlow
OptiFlow is the Optimization Tool developed for this Thesis. It is written in MATLAB and has a user-friendly GUI Environment. MATLAB built-in functions are
used for File Manipulation, Data-Fitting and Optimization.
An optimization model is required to be built before the use of OptiFlow. This
optimization model consists of three main components:
CFD Model *.in13 File
Parametrization *.opt File
Objective Function *.m File
A Computational Fluid Dynamics (CFD) Model is required by OptiFlow to be
used for the optimization. This model needs to be parametrized in order for it
to be used in the optimization process. This is done with the Parameter file
an *.opt file. The Objective Functions control the flow of the optimization by
establishing the objectives desired to achieve.
The following sections discuss each of this components further.
29
Chapter 5. OptiFlow
Basically we use this ability to define our optimization variables and replace their
values with the ones obtained from the optimization algorithm.
M4-scripting is also capable of basic arithmetics, but a definition of a function
(calc in our case) is required. We assign Perls Math and Trig functions to this,
and we do this with the following code:
d e f i n e ( c a l c , [ esyscmd ( p e r l e use Math : : Trig ; p r i n t f (\ $1 ) ) ] )
30
Chapter 5. OptiFlow
For example if we have:
define (a ,4)
# T r i a n g l e base
define (b , 3 )
# Triangle height
d e f i n e ( c , c a l c ( s q r t ( a **2 + b**2 ) )
# a **b s t a n d s f o r a^b ( a to the power o f b )
The hypotenuse i s : c
Take note that it is very important to define unique variables names in the M4
script, so that they do not conflict with the rest of the text in the file.
Finally, to build our M4-script File and generate our desired output file we type
in the terminal:
m4 vxf_model . m4 > vxf_model . i n 1 3
31
Chapter 5. OptiFlow
You can generate this M4-Files manually, but you can also use OptiFlows GUI to
help you in this task. Follow the sequence Build Parameter File (*.opt) from
the Menu Bar, to get a template to write your own Parameter File. With this utility
you can open a text-based file and a *.opt Template File will be auto-generated
from this file, taking it as if it were the CFD Model. This template has some
basics definitions and commands commonly used in optimization problems.
The parameter file contains the information about the variables to be used in
the optimization and the parametrization of the file. All variables are enclosed
between the [begin{variables}] and [end{variables}], and are defined inside
the define( ) command. An example is shown below:
# Variables Definitions :
[ begin { v a r i a b l e s } ]
d e f i n e ( x1 , @)
# Comment 1
d e f i n e ( x2 , @)
# Comment 2
#. . . others ...#
[ end{ v a r i a b l e s } ]
To build the Parameter File you can use Build Parameter File (*.opt) from
the Menu.
32
Chapter 5. OptiFlow
Function
Description
VXF_DERIV
VXF_GEO
To build the Objective Function File you can use Build Objective File (*.m)
from the Menu.
33
Chapter 5. OptiFlow
34
Chapter 6
Optimization Models
Examples
The purpose of this chapter is to show some optimization examples using the
program OptiFlow. Two optimization examples are presented, a Wind Shield for
vehicular protection of the M4 Neath Viaduct and a Vertical-Axis Wind Turbine
(VAWT) based on the savonius rotor.
An overview of each example is given and the motivation for optimizing them.
35
M4 Neath Viaduct
Wind Shield
6.1 M4 Neath Viaduct Wind Shield
This bridge is located in South Wales and crosses the River Neath [7]. A section
of the bridge is very exposed in flat topography, therefore a wind shielding system is desired for reducing the overturning forces on vehicles. The CFD model
used here is the same as the one used on the VXFlow tutorial.
Four small sections were placed in the freeway just to obtain the interior drag
forces in this region, as shown in the Figure 6.1.
37
Parameters
The parameter h is defined in the *.opt file, all coordinates of the Wind Shield
are made dependent of this parameter, this is known as parametrization. This
is shown in the following code:
38
Then in the CFD model part of the Parameter File we place the corresponding
coordinates variables. These will be replaced when the m4-macro is called on
each iteration of the optimization algorithm.
4 //num c o r n e r p o i n t s **SCREEN3(SCHEME3)
0 . 3 0 . 0 // r e l e a s e d i s t a n c e * s p a c i n g h u l l
0 . 0 2 0 . 0 0 1 0 . 0 0.1 // merg1*merg2*merg3*merg4
4 3 1 3 1 // s e c t i o n c o l o r coding : drag * l i f t *moment* d i s p l * r o t a t i o n
1 x2 y1 n1
1 x1 y1 n2
1 x1 y2 n1
1 x2 y2 n2
Objectives
For this optimization problem our objective is to minimize the drag force for
vehicle passing by, therefore we placed four small sections on the freeway just to
obtain the drag force on this points. Our Objective is to Minimize the Maximum
of these Drags.
The Objective Function File is shown below:
f u n c t i o n [ Drag ] = M4_Neath_ViaductWS(X)
%%
M4_Neath_ViaductWS O b j e c t i v e Function
steps = 500;
Drag ( 1 ) = VXF_FORCES(X, DRAG , MAX , s t e p s , SECTION , 1 1 ) ;
39
Results
In the pre-run optimization procedure we collected data from 0 to 1.5 at steps of
0.1 for the value of h. The collected points and the smoothing data fit is shown
on Figure 6.3
40
A summary of the optimization results obtained from each run type is shown on
Table 6.1
Run Type
Drag
pre-run
0.2
87.43
run-time
0.23607 61.109
The Final Shape of the Optimized Wind Shield is shown on Figure 6.5
41
42
43
The variables are bounded to the shaded area shown on Figure 6.6, which are:
ex = [0 0.5]
ey = [0 0.5]
For the solution of this problem three types of optimization models were prepared, they are:
Static Model
pseudo-Static Model
Dynamic Model
Each of this models differ from one another in the way they obtain the desired
objective, this will be discussed on the Objectives Section.
44
Parameters
Again the parameters are defined in the *.opt file, between the brackets [begin{variables}] and [end{variables}]. This time we have two variables and all
coordinates of the Turbine need to be parametrized to them. This is done with
code shown below:
# Variables Definitions :
[ begin { v a r i a b l e s } ]
d e f i n e ( ex , c a l c (0.1+ Imper ) ) # E c c e n t r i c i t y i n XDir
d e f i n e ( ey , c a l c (0.1+ Imper ) ) # E c c e n t r i c i t y i n YDir
[ end{ v a r i a b l e s } ]
# Rotor Dimensions :
d e f i n e (D1 , 0 . 5 7 2 ) # Rotor I n s i d e Diameter
d e f i n e (D2 , 0 . 5 8 4 ) # Rotor Outside Diameter
d e f i n e ( t , c a l c (D2D1) ) # Rotor Thickness
# Coord . C a l c u l a t i o n s :
# Section 1
d e f i n e ( x1 , c a l c ( ( ex / 2 ) ) )
d e f i n e ( y11 , c a l c (D1(ey / 2 ) ) )
d e f i n e ( y12 , c a l c ( y11D1 ) )
d e f i n e ( y13 , c a l c ( y12t ) )
d e f i n e ( y14 , c a l c ( y11+t ) )
d e f i n e ( xc1 , c a l c ( ( ex / 2 ) ) )
d e f i n e ( yc1 , c a l c ( y11D1/ 2 ) )
# Section 2
d e f i n e ( x2 , c a l c ( ex / 2 ) )
d e f i n e ( y21 , c a l c (D1+(ey / 2 ) ) )
d e f i n e ( y22 , c a l c ( y21+D1) )
d e f i n e ( y23 , c a l c ( y22+t ) )
d e f i n e ( y24 , c a l c ( y21t ) )
d e f i n e ( xc2 , c a l c ( ex / 2 ) )
d e f i n e ( yc2 , c a l c ( y21+D1/ 2 ) )
45
The Dynamic Model requires additional parameters to be set on the CFD model,
these are:
DYNAMIC=1
STRCMODEL=1
DAMPRATIO=1.0
RAYLA0=0.0
RAYLA1=0.0
ASEC0=5E3
ASEC1=5E3
MASS11=0.0
MASS12=0.0
MASS21=0.0
MASS22=1.0
STIFF11=9E9
STIFF12=0.0
STIFF21=0.0
STIFF22=0.0
Objectives
The Objective Function for the static model is the following:
46
The Dynamic Model is the most accurate model and has the following objective
function:
f u n c t i o n [ Power ] = rotor_dyna (X)
%% rotor_dyna O b j e c t i v e Function
V a r i a b l e s = getappdata ( 0 , V a r i a b l e s ) ; % V a r i a b l e s Data
modelPATH = getappdata ( 0 , modelPATH ) ; % Model Path
% Savonious Rotor Data
D = 0.578;
m = 10;
% Mass [ kg ]
% C a l c u l a t e Arm v e c t o r
Arm = [ X( 1 ) / 2 , X( 2 ) / 2 ] + [ ( 4 / 6 ) *D/ pi , D/ 2 ] ;
Arm = norm (Arm ) ;
% C a l c u l a t e I n e r t i a l Mass
47
Results
Static Analysis
Data collected from a static model were smoothed by using cubic interpolation
to get the surface shown below:
48
ey = 0.3.
Pseudo-Dynamic Analysis
This approach yielded better results than the previous one. Again as in the
previous analysis, data was collected from the model and was smoothed using
cubic interpolation to get the surface shown below:
With this, we decide to adopt the values for the eccentricities as ex = 0.075 and
This analysis gave us faster and more conclusive results, because it approaches
closer to reality.
We summarize the optimization results obtained from each model type on Table 6.2
Model Type
ex
ey
Static
0.1
0.3 12.33
Dynamic
0.15
0.1
Mo
22.93
The Final Shape of the Optimized Savonius Turbine is shown on Figure 6.10
50
51
Chapter 7
Final Remarks
7.1 Conclusions
The relatively low computational costs and the highly accurate simulations of
the Vortex Particle Method used in this Thesis are great reasons for using this
CFD program for simulation-based optimization. In addition it is a mesh-free
numerical method, which allows for easier and faster parametrization of the
models, in contrast to meshing methods whose geometry is defined within its
discretization, which needs to be changed and checked at each simulation.
However, it is very important to address the issue of noisiness produced from
the simulation-based optimization. It is important to address this issue in an
efficient manner. Some recommendation are:
Tweak Local Optimization Algorithms: A stochastic analysis of the simulation program is recommended, as well as using this data for tweaking current optimization algorithms for robust and efficient convergence behavior.
The Nelder-Mead Simplex method is a convenient gradient-free algorithm
for this purpose.
Run-Time Smoothing: This involves smoothing the noisy objective function by implementation of a smoothing routine at run-time of the algorithm.
53
54
References
[1] Guido Morgenthal. VXFlow v0.994. Weimar, Germany, September 2011. VXFlow Primer.
http://www.morgenthal.org/vxflow.
[2] David Gutirrez Rivera. OptiFlow v0.6.1a. Weimar, Germany, March 2014. OptiFlow
Userguide.
[3] The MathWorks Inc. MATLAB v7.10.0 (R2010a). Natick, Massachusetts, 2010. User
Documentation, GUIDE, Curve Fitting Toolbox, Optimization Toolbox, Global Optimization
Toolbox, Parallel Computing Toolbox. http://www.matlab.com/.
[4] Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University
Press, The Edinburgh Building, Cambridge, CB2 8RU, UK, 2004. Pages: 1-11, 455-496.
http://www.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf.
[5] Jorge Nocedal and Stephen J. Wright. Numerical Optimization. Springer, 175 Fifth Avenue,
New York, NY 10010, USA, 1999. Pages: 2-3, 4-7, 10-30.
[6] Igor Griva, Stephen G. Nash, and Ariela Sofer. Linear and Nonlinear Optimization. Siam,
3600 Market Street, 6th Floor, Philadelphia, PA 19104-2688 USA, 2nd edition, 2009.
Pages: 35-40, 54-58, 355-450.
[7] Guido Morgenthal. Aerodynamic Analysis of Structures Using High-resolution Vortex Particle Methods. University of Cambridge, Ph.D. Thesis, October 2002. Pages: 21-31,
121-142.
[8] Tomlab Optimization. TOMLAB, 2013. http://tomopt.com/tomlab/.
[9] OpenOpt. OpenOpt. National Academy of Sciences of Ukraine, 2013. http://openopt.
org/Welcome.
[10] M.A. Abramson, C. Audet, G. Couture, J.E. Dennis, Jr., S. Le Digabel, and C. Tribes. The
NOMAD project, March 2013. http://www.gerad.ca/nomad.
55
References
[11] Frank Vanden Berghen.
Universite Libre
http://theses.ulb.ac.be/ETD-db/collection/
available/ULBetd-04142004-190105/unrestricted/thesis_optimization_frank.pdf,
http://www.applied-mathematics.net/CONDORManual/CONDORManual_1.0.pdf.
[12] David G. Luenberger and Yinyu Ye. Linear and Nonlinear Programming. Springer, 233
Spring Street, New York,NY 10013, USA, 3rd edition, 2008. Pages: 2-7, 183-257.
[13] Florent Brunet. Contributions to Parametric Image Registration and 3D Surface Reconstruction. Universite dAuvergne, Ph.D. Thesis, November 2010. Chapter 2, Pages: 27-44.
http://www.brnt.eu/publications/brunet2010phd.pdf.
[14] Valentin Haenel, Emmanuelle Gouillart, and Gal Varoquaux. Python Scientific lecture
notes. EuroScipy tutorial team, November 2013. Chapter 13, Pages: 251-265. http:
//scipy-lectures.github.io/_downloads/PythonScientific-simple.pdf.
[15] Wikipedia. Golden ratio. The Wikimedia Foundation, 2014. http://en.wikipedia.org/
wiki/Golden_ratio.
[16] Wikipedia.
http://en.
wikipedia.org/wiki/Golden_section_search.
[17] Wikipedia. Simplex. The Wikimedia Foundation, 2014. http://en.wikipedia.org/wiki/
Simplex.
[18] Wikipedia. Simplex algorithm. The Wikimedia Foundation, 2014. http://en.wikipedia.
org/wiki/Simplex_algorithm.
[19] Wikipedia.
Nelder-Mead Method.
http://en.
wikipedia.org/wiki/Nelder-Mead_method.
[20] E. G. Romero-Blanco and J. F. Ogilvie. Optimization with sequential simplex of variable
size. Maplesoft, 2002. http://www.maplesoft.com/applications/view.aspx?SID=4289&
view=html.
[21] Design Decisions Wiki. Downhill simplex. Design Decisions Laboratory, 2008. http:
//wiki.ece.cmu.edu/ddl/index.php/Downhill_Simplex.
[22] Sasa Singer and John Nelder. Nelder-Mead algorithm. Scholarpedia, 2009. http://www.
scholarpedia.org/article/Nelder-Mead_algorithm.
56
References
[23] Prof. DK Chaturvedi.
YouTube,
57
OptiFlow v0.6.1a
61
--------------Version history
---------------
0.4.7a
0.4.6a
0.4.5a
0.4.4a
0.4.3a
0.4.2a
0.4.1a
0.4.0a
31/Jan/2014
30/Jan/2014
28/Jan/2014
19/Jan/2014
08/Jan/2014
18/Dec/2013
12/Dec/2013
09/Dec/2013
0.3.0a - 04/Dec/2013 -
0.2.0a - 25/Nov/2013 -
Windows Support
Portability Fixes
Release
63
-------------Future Release
--------------
64
Chapter 1
Introduction
1.1
About OptiFlow
3. Data Gathering
At the end of this Guide we provide some simple tutorial examples to help you
get started in modeling optimization problems.
65
1.2
System Requirements
1.3
Installation
OptiFlow requires VXFLOW, as the Fluid Dynamic Solver, to generate data and
run the optimization algorithms with. For the VXFLOW installation, it is recommended to follow the instructions in the VXFLOW Primer.
The m4 macro Language is already provide in the package of file with OptiFlow,
so there is no need to search an install it.
Perl is usually already provided in Linux distributions, but you might need to install it for Windows. You can download it from http://www.perl.org/get.html.
OptiFlow is made up by several MATLAB functions, the main program file is
optiflow.m. To run OptiFlow just type:
>> optiflow
66
Chapter 2
OptiFlow GUI
2.1
Main Window
This is OptiFlows Main Window, here is where we will be navigating through the
main options of the program. You should take special attention to the title of the
window, where the program will be updating with the names of the Models and
Data Files loaded in to the program, if any. Also a -S will be appended when
the Remote Server is activated and/or a -P when parallel computing is active,
check out the Preferences Menu 2.2.2 for more information. We now proceed to
explain each of the elements of the OptiFlow Main Window.
67
2.2
Menu Bar
Copy File As
Lets you select a file and copy it with another name or different file type. This
might be helpful to start generating the optimization model files, if a verbatim
copy of a file is desired.
Load
Used to Load the Optimization Model. It will first ask for the Model Folder and
then for the Parameter File(*.opt) and then the Objective Function File (*.m)
Load Data
Loads a previously saved Data File. Compatible files have *.dat extensions,
and have tab delimited values. In order to use a data file, a optimization model
requires to be loaded.
Exit
Closes the Program.
68
69
You will be asked for a passphrase. This is your personal passphrase, this is
NOT the servers password. So type in your preferred passphrase and dont forget it. Also take note to the location where the keys are saved.
Now we need to add the generate public-key to the remote server. To do this
type in the terminal:
$ sshcopyid i /.ssh/id rsa.pub user@remote.server.ip
Now you will be asked for the remote servers password, type it in and you are
done. From now on you will be asked for your personal passphrase in order to
access the remote server.
But we still cant run automated scripts without being asked for the passphrase
To avoid this we make use of ssh-agent. Any commands which require access
to your OpenSSH private-keys will be intercepted and answered by ssh-agent.
So now we only need to supply ssh-agent with your keys, we do so by typing:
$ sshadd
Just provide your passphrase one last time and you are done. Now you are able
to run automated scripts on the server, therefore we are able to automate the
optimization process using OptiFlow and the Remote Server.
70
Use this to build the Parameter File. You will be asked to select a file to convert
to a parametrized format.
Objective File (*.m)
Use this to build your Objective Function File. A default template will be loaded
which you can modify.
Run Macro
This lets you run a built Macro File (*.opt File) so that you can check if the output
file is generated correctly.
Hermite
Smoothing
Polynomial
Settings
This sets the settings for the data fitting. Here you will be able to set the interval
and mesh size for the data fitting.
71
Hold On
If checked, all plots will be overlapped. If unchecked, plots will not overlap each
other.
Clear
Clear the Plot Window.
72
Run ...
After choosing the Optimization Algorithm you need to select Run to bring up
the Optimization Run Window. Here you have the option of configuring the Optimization Run, by choosing an Initial guess, Lower and Upper Bounds, Tolerance
and the Type of Run you wish to run, which can be:
pre-run: This requires a previously loaded Data File, refer to Section 5.1
for details.
run-time: Optimization is made on-the-fly, you just need to set-up the Optimization Model and load it to OptiFlow, for more information refer to Section 5.2.
over-time: As in the previous one you just need to load an Optimization
Model for this to work. The optimization is made on each time step of the
simulation. The optimization will end when the simulation ends. Refer to
Section ?? for details. Not yet Implemented.
73
2.3
Output Windows
74
Chapter 3
3.1
optiflow.ini File
This is OptiFlows Initialization Input File. This file can be modified without using
the GUI to run OptiFlow with the parameters define in this file. The file is formatted in such a way in which we define the variable name first and make it equal to
a value for this variable (Example: Algorithm=simplex); No spaces are allowed.
The program automatically detects the following types of variables:
bool
int8
double
function
array
string
Loaded=false
Dim=2
Tol=1e-3
Function=@(x)20 x. 2 + 55
Values=[0 0.1 1; 0 0.5 3]
PATH= /optiflow/simple.vxf/
Each item of the file is assigned a Category and built in to a single Struct Data
Type (called OFDATA) at the initialization of the Program. The format is as follows:
<CATEGORY(1) >
NAME(1)=value(1)
NAME(2)=value(2)
... the rest of the variables for CATEGORY(1) ...
... the rest of the CATEGORIES and Variables ...
75
We explain now each of the possible entries in the optiflow.ini file and the values
they can be assigned to.
Table 3.1: optiflow.ini File Items
Item (default)
Data Type
Description
File
Load (false)
Boolean
Saved (false)
Boolean
ini (true)
Boolean
txt (false)
Boolean
FILE
String
PATH
String
Preferences
BoundOffset (0.02)
Cores (1)
Server (false)
int8
int8
Boolean
SrvIp
SrvProg
SrvProgFlag
String
String
int8
SrvFldr
PROG PATH
String
String
Model
Loaded (false)
FILE
PATH
Boolean
String
String
76
Item (default)
Data Type
Description
Variables
N
Names
Values
int8
Array
Array
FILE
String
Number of Variables
Array of Names of the Variables
Stores Array of values for each variable. It
has the form: [Initial Step Final].
File Name of the Parameter File (*.opt)
int8
Array
String
Number of Objectives
Array of Names of the Objectives
File Name of the Objective File (*.m)
Loaded (false)
FILE
Values
Boolean
String
Array
PATH
String
Objectives
N
Names
FILE
Data
DataFit
Run (false)
Boolean
Function
Method (smoothing)
Function
String
Type (linear)
Function2
Method2 (smoothing)
Type2 (linear)
String/int8
Function
String
String/int8
Range
Array
Options
Struct
Boolean
Boolean
Struct
Plot
Plot (false)
HoldOn (true)
Options
77
Item (default)
Data Type
Description
Optimization
Run (false)
Boolean
Algorithm (simplex)
String
RunType (pre-run)
String
Values
Array
Constraint (false)
Boolean/String
Tol (1e-3)
Double
Options
Struct
78
Chapter 4
Data
4.1
This is a text-based tab-delimited file which contains data points from the variables and the evaluation of the objective function on this points.
Variable#1
Variable#1
..
.
Variable#1
Variable#2
Variable#2
..
.
Variable#2
...
...
..
.
...
Variable#n
Variable#n
..
.
Variable#n
Objective#1
Objective#1
..
.
Objective#1
...
...
..
.
...
Objective#m
Objective#m
..
.
Objective#m
This data file must be used for the pre-run optimization procedure only. A fit
function must be generated first from this data in order to apply the optimization.
Then this data can be plotted and viewed on the OptiFlow GUI Window.
4.2
Data Generation
Data generation is automated by using the Optimization Model Files, please refer to Chapter ??. Data can also be generated in several runs and append the
new data to a previously generated file.
To start generating the data file you will first need to load an optimization model.
You can do this by going to File Load ... .
After an Optimization Model has been loaded, you can proceed to gather data
by following the menu sequence Build Data File (*.dat). After selecting this,
another window appears, like the one shown in Fig. 2.8, asking for values of the
variables. The number of rows here depend on the number of variables defined
in the Parameter File. Proceed to assign your desired values for your variables.
79
This window asks for the Initial Value, Step Size and Final Value for the variables. After this, the program asks your for a filename for your data file to be
save with, assign it an appropriate name and save it. Then the program starts
to generate the data file by iteratively changing the values of the variables and
proceeding with the next ones, until all combinations are evaluated and the data
file is complete, attaching the evaluated values of the objective function on each
iteration to the generated file.
80
Chapter 5
Optimization
5.1
Pre-Run Optimization
For this optimization procedure we need both a data file and the corresponding
optimization model, which are used to make a fit function. Then we use this
function as the objective function of the optimization and run the algorithm to
find the optimization value. We explain the step-by-step procedure, using the
GUI, below:
1. Load Model: Go to File Load ... Search for the Model Folder and
load it. Then load the corresponding Parameter File and Objective File for
this model.
2. Load Data File: Go to File Load Data ... Search for the data file and
open it.
3. Generate Fit Function: Choose a Data Fit method from the Data Fit
menu. Once a Data Fit method has been chosen, the data fitting procedure
will run and plot the generated function automatically.
4. Settings: Check the Data Fit Settings if you want to further customize
or change the settings of the data fitting.
5. Choose Algorithm: Choose an optimization algorithm from Optimization menu.
6. Run Optimization: Choose Optimization Run ... and a new window
should appear. Fill in the required information correctly and press Run to
run the Optimization. The program will start searching for the Optimization
Value, printing results on each step on the output window and on a results
*.dat file in the optiOUT Folder.
81
5.2
Run-Time Optimization
For this Optimization Procedure we only need the Optimization Model, please refer to Chapter ?? for more information on how to create this Optimization Model.
Optimization here is made on-the-fly, there is no need to generate a data file
nor a fit function, you just need to set-up the Optimization Model and load it to
OptiFlow. The program will search for the Optimization Value running the CFD
Program in Tandem. The step-by-step procedure, using the GUI, is as follows:
1. Load Model: Go to File Load ... Search for the Model Folder and
load it. Then load the corresponding Parameter File and Objective File for
this model.
2. Choose Algorithm: Choose an optimization algorithm from Optimization menu.
3. Run Optimization: Choose Optimization Run ... and a new window
should appear. Fill in the required information correctly and press Run to
run the Optimization. The program will start searching for the Optimization
Value, printing results on each step on the output window and on a results
*.dat file in the optiOUT Folder.
82
Tutorials
83
Example I
We placed 4 small sections in the freeway just to obtain the interior drag forces
in this region.
85
We define the optimization variable as h, which is the height of the Wind Shield.
The other parameters of the simulation are also shown in the figure.
Optimization Model
Parameter File
The following are the contents of the Parameter File (M4 Neath ViaductWS.opt):
divert(1)
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# M4 Macro to Build the Model File
# Build by typing in terminal:
# m4 M4 Neath ViaductWS.opt > M4 Neath ViaductWS.in13
changequote([,]) # Changes quoting
# Detect OS
define(OS, [esyscmd([perl e 'print($O)'])])
# calc Function Definition
# This Function is used for making calculation
ifelse(OS,linux,[#]) define(calc,[esyscmd(perl e printf($1))])
define(calc, [esyscmd(perl e 'printf($1)')])
# Definition of Useful Functions and Constants
define(tan, [(sin($1))/(cos($1))]) # Tan Function
define(PI, 3.14159265359)
# Pi Constant
# Variables Definitions:
86
[begin{variables}]
define(h, @)
# Height of Wind Screen
[end{variables}]
define(L, 3.00)
define(t, 0.15)
87
WINMAXX=220.0
WINMINY=60.0
WINMAXY=60.0
OUTSTEP=20
OUTFLGRID1=0
NORMDSPL=0.2
NORMLIFT=1.0
PRFL=0
PRSTEP=1
SKFL=0
SKSTEP=5
FVFL=0
FVSTEP=5
VXFL=0
VXSTEP=5
VIZFL=0
ISOMINX=14.0
ISOMAXX=26.0
ISOMINY=9.0
ISOMAXY=11.0
ISODIMX=200
ISODIMY=100
GRFL=0
GRSTEP=100
RSTFL=0
RSTSTEP=250
!!
NUMSEC=14
GEOMROT=0.0
GRIDMINX=20.0
GRIDMAXX=220.0
GRIDNX=511
GRIDMINY=59.883
GRIDMAXY=59.883
GRIDNY=255
CORER=1.2
SLCOLORDRAG=2
SLCOLORLIFT=4
SLCOLORMOMENT=1
SLCOLORDSPL=2
SLCOLORROT=5
!!
68 //num cornerpoints****MAIN2
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 13.2 0.27 2
1 13.2 0.66 1
1 13.08 0.66 1
1 13.08 0.86 3
1 12.39 0.83 8
88
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
12.18 2.33 5
11.21 2.293 8
11.0 0.785 3
10.44 0.764 8
10.23 2.256 5
9.26 2.219 8
9.05 0.711 3
8.49 0.690 8
8.28 2.182 5
7.31 2.145 8
7.1 0.637 3
6.54 0.616 8
6.33 2.108 5
5.36 2.071 8
5.15 0.563 3
4.59 0.541 8
4.38 2.034 5
3.41 1.997 8
3.2 0.489 3
2.64 0.467 8
2.43 1.960 5
1.46 1.923 8
1.25 0.415 3
0.69 0.393 8
0.48 1.885 5
0.49 1.848 8
0.7 0.340 3
1.26 0.319 8
1.47 1.811 5
2.44 1.774 8
2.65 0.266 3
3.21 0.245 8
3.42 1.737 5
4.39 1.700 8
4.6 0.192 3
5.16 0.171 8
5.37 1.663 5
6.34 1.626 8
6.55 0.118 3
7.11 0.097 8
7.32 1.589 5
8.29 1.552 8
8.5 0.044 3
9.06 0.023 8
9.27 1.515 5
10.24 1.478 8
10.45 0.030 3
11.01 0.051 8
11.22 1.44 5
12.18 1.40 8
12.39 0.11 3
89
1 13.08 0.14 1
1 13.08 0.34 1
1 13.2 0.34 2
1 13.2 0.73 3
1 12.7 0.71 3
1 12.1 0.46 53
1 1.5 0.0 1
1 1.5 0.1 15
1 1.5 0.01 1
1 1.5 0.11 53
1 12.1 0.46 3
1 12.7 0.25 3
4 //num cornerpoints**PARA1UPSTREAM
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.8 0.02 2
1 12.7 0.02 1
1 12.7 0.07 2
1 12.8 0.07 1
4 //num cornerpoints**PARA2UP
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.8 0.34 2
1 12.7 0.34 1
1 12.7 0.39 2
1 12.8 0.39 1
4 //num cornerpoints**PARA3UP
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.8 0.66 2
1 12.7 0.66 1
1 12.7 0.71 2
1 12.8 0.71 1
4 //num cornerpoints**PARA1DOWN
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.7 0.98 2
1 12.8 0.98 1
1 12.8 1.03 2
1 12.7 1.03 1
4 //num cornerpoints**PARA2DOWN
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.7 1.30 2
1 12.8 1.30 1
1 12.8 1.35 2
90
1 12.7 1.35 1
4 //num cornerpoints**PARA3DOWN
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 12.7 1.62 2
1 12.8 1.62 1
1 12.8 1.67 2
1 12.7 1.67 1
4 //num cornerpoints** PARA MID DESIGN2 LEFT
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 0.23 0.63 3
1 0.08 0.6 3
1 0.08 0.8 3
1 0.23 0.77 3
4 //num cornerpoints** PARA MID DESIGN2 RIGHT
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 0.08 0.6 3
1 0.23 0.63 3
1 0.23 0.77 3
1 0.08 0.8 3
4 //num cornerpoints**SCREEN3(SCHEME3)
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 x2 y1 n1
1 x1 y1 n2
1 x1 y2 n1
1 x2 y2 n2
4 //num cornerpoints** CM VEHICLES 1UP
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 9.05 0.25
2
1 8.95 0.25
2
1 8.95 0.35
2
1 9.05 0.35
2
4 //num cornerpoints** CM VEHICLES 2UP
0.3 0.0 //release distance*spacing hull
0.02 0.001 0.0 0.1 //merg1*merg2*merg3*merg4
4 3 1 3 1 //section color coding:drag*lift*moment*displ*rotation
1 4.55 0.450
2
1 4.45 0.450
2
1 4.45 0.550
2
1 4.55 0.550
2
4 //num cornerpoints**CM VEHICLES 1DOWN
0.3 0.0 //release distance*spacing hull
91
Objective Function
For this optimization problem our objective is to minimize the drag force for vehicle passing by, therefore we have placed 4 small sections on the freeway just
to obtain the drag force on this points. Our Objective will be to Minimize the
Maximum of these Drags.
The Objective Function File is as follows:
function [Drag] = M4 Neath ViaductWS(X)
%% M4 Neath ViaductWS Objective Function
steps = 500;
Drag(1)
Drag(2)
Drag(3)
Drag(4)
=
=
=
=
VXF
VXF
VXF
VXF
FORCES(X,'DRAG','MAX',steps,'SECTION',11);
FORCES(X,'DRAG','MAX',steps,'eval',false,'SECTION',12);
FORCES(X,'DRAG','MAX',steps,'eval',false,'SECTION',13);
FORCES(X,'DRAG','MAX',steps,'eval',false,'SECTION',14);
[Drag,Lane] = max(Drag(:))
% Call optiOUT to generate Plots and Output Data
optiOUT(X, [Drag]);
end
92
Data Gathering
1. First we need to Load the Optimization Model. To do this go to File
Load, a search window will ask you for the model folder location. After
choosing the folder, it will ask for both the parameter file (*.opt) and the
objective function file (*.m).
2. Now go to Data Make ..., and set the Targets Values as shown. After
this, assign a name to the Data File to save it.
93
3. Now we will generate our Data Fit Function. For this example we will
choose Data Fit Smoothing.
After all this you should the Main Window should look the figure below:
94
pre-run Optimization
1. Choose the Golden Section Optimization Algorithm through Optimization
Local Golden Section.
2. Then run the Optimization by going to Optimization Run ... . A new
window will appear, fill the values as shown and press run.
95
run-time Optimization
1. First Load the Optimization using File Load.
2. Then Choose the Golden Section Algorithm from the Optimization Menu.
3. Then run the Optimization by going to Optimization Run ... . A new
window will appear, fill the values as shown and press run.
96
Results Summary
We summarize the optimization results obtained from each run type on the table
below:
Table I.1: Results Summary
Run Type
pre-run
run-time
h
0.2
0.23607
Drag
87.43
61.109
97
Example II
For this model we have bounded the variables to the shaded area shown above,
which are:
ex = [0 0.5]
e y = [0 0.5]
99
Optimization Model
For the Solution of this Optimization problem we used 2 types of CFD Models:
Static Model
Dynamic Model
Parameter File
The following are the contents of the Parameter File (savonius.opt):
divert(1)
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# M4 Macro to Build the Model File
# Build by typing in terminal:
# m4 rotor static m.opt > rotor static m.in13
changequote([,]) # Changes quoting
# Detect OS
define(OS, [esyscmd([perl e 'print($O)'])])
# calc Function Definition
# This Function is used for making calculation
ifelse(OS,linux,[#]) define(calc,[esyscmd(perl e printf($1))])
define(calc, [esyscmd(perl e 'printf($1)')])
# Small Imperfection
# Eccentricity in XDir
# Eccentricity in YDir
# Rotor Dimensions:
define(D1, 0.572) # Rotor Inside Diameter
define(D2, 0.584) # Rotor Outside Diameter
define(t, calc(D2D1)) # Rotor Thickness
# Coord. Calculations:
# Section 1
define(x1, calc((ex/2)))
100
define(y11,
define(y12,
define(y13,
define(y14,
calc(D1(ey/2)))
calc(y11D1))
calc(y12t))
calc(y11+t))
define(xc1, calc((ex/2)))
define(yc1, calc(y11D1/2))
#define(yc12, calc(y13+D2/2))
# Section 2
define(x2, calc(ex/2))
define(y21,
define(y22,
define(y23,
define(y24,
calc(D1+(ey/2)))
calc(y21+D1))
calc(y22+t))
calc(y21t))
define(xc2, calc(ex/2))
define(yc2, calc(y21+D1/2))
#define(yc22, calc(y23D2/2))
# Mesh Handler:
# Here control the Mesh of the Model to be Adequate.
define(ms, 0.05)
# Avg. Mesh Size
define(nd1, calc(int(D1/ms)+1)) # Panels for D1
define(nd2, calc(int(D2/ms)+1)) # Panels for D2
define(nt, calc(int(t/ms)+1))
# Panels for Thickness
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# End of M4 definitions
divert(0)dnl
NSLICES=1
U0X=5
DENSTY=1.2
VISCTY=0.000015
DIFFU=1
DELTAT=1
NSTEPS=500
NPANELFACT=1
PRFL=0
PRSTEP=1
SKFL=0
SKSTEP=5
101
FVFL=0
FVSTEP=5
VXFL=0
VXSTEP=5
VIZFL=0
ISOMINX=2
ISOMAXX=2
ISOMINY=1
ISOMAXY=1
ISODIMX=200
ISODIMY=100
!!
NUMSEC=2
GEOMROT=0
GRIDMINX=4
GRIDMAXX=4
GRIDNX=255
GRIDMINY=2
GRIDMAXY=2
GRIDNY=127
CORER=1.2
AVGPRESS=1
!!
4 //num cornerpoints
0.2 0.0 //release distance*spacing hull
0.0 0.002 0.0 0.02 //merg1*merg2*merg3*merg4
4 4 1 3 1 //section color coding:drag*lift*moment*displ*rotation
3
x1
y11
nd1
xc1
yc1
1
x1
y12
nt
2
x1
y13
nd2
xc1
yc1
1
x1
y14
nt
4 //num cornerpoints
0.2 0.0 //release distance*spacing hull
0.0 0.002 0.0 0.02 //merg1*merg2*merg3*merg4
4 4 1 3 1 //section color coding:drag*lift*moment*displ*rotation
3
x2 y21
nd1
xc2
yc2
1
x2
y22
nt
2
x2
y23
nd2
xc2
yc2
1
x2
y24
nt
102
For the Dynamic Model the only difference is the addition of the Dynamic Parameters to the CFD input data of the Parameter File (savonius.opt), which are
the following:
DYNAMIC=1
STRCMODEL=1
DAMPRATIO=1.0
RAYLA0=0.0
RAYLA1=0.0
ASEC0=5E3
ASEC1=5E3
MASS11=0.0
MASS12=0.0
MASS21=0.0
MASS22=1.0
STIFF11=9E9
STIFF12=0.0
STIFF21=0.0
STIFF22=0.0
Objective Function
Our Objective Function for this Optimization Problem is to find the Maximum
Moment of the Parametrized Savonius Turbine, expressed as Max(Mo(x)).
The Objective Function for the static model is the following:
function [Mo] = rotor static(X)
%% rotor static Objective Function
Mo = VXF FORCES(X,'MOMENT');
% Call optiOUT to generate Plots and Output Data
optiOUT(X, [Mo]);
end
103
104
Results Summary
We summarize the optimization results obtained from each model type on the
table below:
Table II.1: Results Summary
Model Type
Static
Pseudo-Dynamic
Dynamic
ex
0.1
0.075
0.15
ey
0.3
0.1
0.1
Mo
12.33
4.524
-
P
22.93
105