Você está na página 1de 13

12/2/13 Design Optimization Tutorial

www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 1/13
Tutorial Application of Design Optimization
Problem Description
Two 1000N point loads will be applied perpendicularly in the middle of two different faces of a rectangular solid steel
beam. It is necessary to find the cross sectional dimensions of the beam in order to minimize the weight of the beam.
The maximum stress anywhere in the beam cannot exceed 200 MPa. The beam is to be made of steel with a modulus
of elasticity = 200 MPa.
Tutorial Goals
The purpose of this tutorial is to introduce a method of solving design optimization problems using ANSYS. This will
involve creating a command file utilizing parameters for all the variables in the problem, deciding which variables to use
as design, state and objective variables and setting the correct tolerances for the problem to obtain an accurately
converged solution in a minimal amount of time.

Figure 1: Problem Description
Table of Contents
Preprocessor: Defining the Problem
Entering Initial Guesses for Variables
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 2/13
Element Type
Element Geometric Properties
Element Material Properties
Nodes
Elements
Meshing
Plotting Elements
Saving Your Job
Solution
Analysis Type
Constraints
Loading
Solving the System
Postprocessing: Viewing the Results
Extracting Information as Parameters
Design Optimization
Writing the Command File
Assigning the Command File to the Optimization
Defining Variables and Tolerances
Defining the Optimization Method
Running the Optimization
Viewing the Results of an Optimization Problem
Problem Solution
Preprocessor: Defining the Problem
Entering Initial Guesses for Variables:
To solve an optimization problem in ANSYS, parameters need to be defined for all design variables.
1. From the Parameters section of the Utility Menu, select the Scalar Parameters option.
2. In the window that appears, in the Selection section, type in W=20
3. Click Accept or press Enter.
4. In the Selection section, also type in H=30.
5. Click Accept or press Enter.
6. Click Close in the Scalar Parameters window.
Element Type:
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 3/13
Within ANSYS there are numerous predefined elements that have constant uniaxial properties. These elements allow
the user to solve even complicated 3D structures using only points to define vertices and lines connecting the points for
elements.
Proper care must be taken when selecting element types. Some elements have only enough degrees of freedom
(DOFs) at their vertices to only permit 2D structures. Other elements have additional constants to define such
properties as spring constants. Choosing the correct element type will simplify the information that the user will need to
supply but also increase the speed of finding the necessary solution.
For this problem we will use the BEAM4 element. This element has 6 degrees of freedom (translation along the X, Y
and Z axiss, and rotation about the X,Y and Z axiss). With 6 degrees of freedom, the BEAM4 element can be used
in 3D analysis.
1. Select 'Element Type' in the 'Preprocessor' menu.
2. Select 'Add/Edit/Delete...'
3. Click on the 'Add...' button in the 'Element Types' window.
4. Under the 'Structural Mass' section, in the middle of the dialog box, Select Beam.
5. Then in the next box to the right, select 3D Elastic 4. This specifies an elastic straight beam element.
6. Finally click on OK You should see Type 1 BEAM4 in the 'Element Types' window.
7. Click on 'Close' in the 'Element Types' dialog box.
8. Close the 'Element Type' menu.
Element Geometric Properties:
Each type of element has its own set of constants defining such things as geometry and initial loading of each element
type.
1. Select 'Real Constants...' in the 'Preprocessor' menu.
2. Click on 'Add...'
3. Select 'Type 1 BEAM4' (actually it is already selected). Click on 'OK'.
4. In the 'Real Constants for BEAM4 window, enter the following geometric properties:
a. Cross-sectional area AREA: W*H
b. Area moment of inertia IZZ: W*H*H*H/12
c. Area moment of inertia IYY: H*W*W*W/12
d. Thickness along Z axis TKZ: W
e. Thickness along Y axis TKY: H
5. Click 'OK'
6. Click on 'Close' in the 'Real Constants' window.
NOTE: It is important to use independent variables to define dependent variables such as the moment of inertia.
During the optimization, the width and height will change for each iteration. As a result, the other variables must be
defined in relation to the width and height in order to be correct for each iteration.
Element Material Properties:
You then need to specify material properties:
1. Select 'Material Props' in the 'Preprocessor' menu.
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 4/13
2. Select 'Isotropic...' under '-Constant-'
3. Click 'OK' in the 'Isotropic Material Properties' window to select material number 1.
4. In the window that appears, there are many properties that may be specified. We are going to give the
properties of Steel. Change the following field:
a. Young's modulus EX: 200000
5. Click on 'OK'.
6. Close the 'Material Props' menu.
Nodes:
The overall geometry is defined in ANSYS using nodes which specify various principal coordinates to define the body.
1. Start the preprocessor by selecting 'Preprocessor' in the 'ANSYS Main Menu'.
2. From the 'Preprocessor' menu, select 'Create' (under the '-Modeling-' title).
3. Then select 'Nodes' from this 'Create' menu.
4. Select 'In Active CS...' on the 'Nodes' menu. This permits you to define nodes in the active Coordinate System.
5. We are going to define 3 nodes for this beam as given in the following table (the second node is necessary to
define as the location where the forces act):
Node Coordinates (x,y,z)
1 (0,0,0)
2 (500,0,0)
3 (1000,0,0)
Elements:
1. First close the last menu that was used to create the nodes by double clicking in the upper left-hand corner of
the Nodes menu'. This will return you to the 'Create menu'.
2. Select the Elements item.
3. We will first define the pipe elements. Click Elem Attributes.
4. In the Element Attributes window, ensure that the Element type number, TYPE = 1, the Material number,
MAT = 1 and the Real constant set no., REAL = 1.
5. Select Auto Numbered Thru Nodes.
6. Enter the numbers from the Node #1 and #2 columns in the following table into the ANSYS Input table. You
must press enter once after Node #1 and twice after Node #2.
Element Node #1 Node#2
1 1 2
2 2 3
1. Click OK in the Elements from Nodes window.
Meshing:
Because we have defined our model using nodes and elements, we do not need to mesh our model. If we initially
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 5/13
defined our model using keypoints and lines, we would have had to create elements in our model by meshing the lines.
ANSYS can only solve models consisting of elements.
Plotting Elements:
1. Select 'Numbering' in the 'PlotCtrls' Menu.
2. Turn off Keypoint numbering so that the plot does not become confusing.
3. Click on the 'Elem & Attrib numbering' box, and select 'Element numbers'.
4. Click on 'OK'.
5. From the 'Plot' menu, select 'Elements' and you will then see the elements plotted in multiple colours, with their
element numbers.
Figure 2: Model in ANSYS
Saving Your Job:
Save the model at this time, so if you make some mistakes later on, you will at least be able to come back to this
point. To do this, select 'Utility Menu Bar'/'File'/'Save As Jobname.db'. Your model will be saved in a file called
'jobname.db', where 'jobname' is the name that you specified in the 'Launcher' when you first started ANSYS.
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 6/13
It is a good idea to save your job at different times throughout the building and analysis of the model to backup your
work in case of a system crash or what have you.
Solution
You have now defined your model. It is now time to apply the load(s) and constraint(s) and solve the resulting system
of equations.
Close the 'Preprocessor' menu and open up the 'Solution' menu (from the same 'ANSYS Main Menu').
Analysis Type:
First you must tell ANSYS how you want it to solve this problem:
1. Select 'New Analysis'.
2. Ensure that 'Static' is selected; i.e. you are going to do a static analysis on the frame as opposed to a dynamic
analysis, for example.
3. Click 'OK'.
Now you must apply some loads and constraints:
Constraints:
It is necessary to apply constraints to the model otherwise the model is not tied down or grounded and a singular
solution will result. In mechanical structures, these constraints will typically be fixed, pinned and roller-type
connections.
1. Select 'Apply >' under '-Loads-' title.
2. We will start with constraints, so select 'Displacement >' under the '-Structural-' title.
3. Select 'On Nodes' for this example. As you recall, these nodes were defined at the vertices and the midpoint of
the beam.
4. Use the mouse to pick the first node defined (just above the x,y,z triad)
5. Click on 'Apply' in the 'Apply U,ROT' window.
6. Now we select what degrees of freedom are to be constrained. In this example, we will pin this location which
means that all translational DOF's are constrained.
7. Select 'UX', 'UY' and 'UZ' by clicking on them.
8. Enter '0' in the Value field and click on 'APPLY'.
9. You will see some blue triangles in the graphics window indicating the displacement constraints.
10. For the next constraint, we will pick the node at the other end of the beam and constrain that point to only the
UY and UZ direction.
11. Follow Steps 4 to 9 but for Step 7 only select UY and UZ.
12. Make sure that the value field is still set to '0'.
13. Select 'OK'
14. Note the blue triangles at these points indicating their fixed directions.
15. Close the 'Displacement' menu.
Note: Different element types have different constraints that can be applied to them. Refer to the element manual in
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 7/13
the ANSYS help file for specific details on any element type.
Loading:
It's time to apply some loads. We will apply a vertical point load of 5000N at node #7.
1. If you still have the 'Apply' menu open, select Force/Moment >. (If you don't have 'Apply' open, its under '-
Loads-' in the 'Solution' menu.)
2. Choose On Nodes
3. Click node #2 in the Graphics Window.
4. Click on OK in the 'Apply F/M' window.
5. In the next dialog box to appear:
6. Click on the button at the top and select FY. This indicates that we will be applying the load in the 'y' direction.
7. Enter a value of "-1000" in the box below.
8. Click on 'Apply'. The force will appear in the graphics window as a red arrow.
9. Click node #2 in the Graphics Window.
10. Click on OK in the 'Apply F/M' window.
11. In the next dialog box to appear:
12. Click on the button at the top and select FZ. This indicates that we will be applying a load in the 'z' direction.
13. Enter a value of "1000" in the box below.
14. Close the 'Force/Moment' menu and the 'Apply' menu.
The applied loads and constraints should now appear as shown in the figure below.
Note: To have the constraints and loads appear each time you select Replot in the Plot section of the Utility
Menu, you must change some settings in Symbols under the PlotCtrls section of the Utility Menu. In the
window that appears when you select Symbols', click Applied B.C.s in the Boundary Condition Symbol section.
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 8/13
Figure 3: Plot with Constraints
Solving the System:
We now tell ANSYS to find the solution:
1. In the 'Solution' menu under the '-Solve-' title, select 'Current LS' This indicates that we desire the solution
under the current Load Step (LS).
2. Click on 'OK' in the window that comes up after a few seconds. You may close the solution 'STAT window'
that has appeared from the solution phase.
3. Close the 'Solution' menu.
Postprocessing: Viewing the Results
You will now want to view the results. To do this you must enter the post-processor and select the desired solution:
Extracting Information as Parameters:
In this problem, we would like to find the maximum stress in the beam and the volume as a result of the width and
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 9/13
height variables. We will do this using element tables and the GET command.
1. Select General Postproc from the ANSYS Main Menu.
2. Type the following lines in the ANSYS Input window. Each line is to be followed by Enter.
ETABLE,evol,VOLU,
ssum
*GET,vsum,SSUM, ,ITEM,EVOL
ETABLE,stress,nmisc,1
ESORT,ETAB,STRESS,0,0, ,
*GET,STR,SORT, ,max
To see the values of the parameters that we defined select Scalar Parameters from the Parameters section of the
Utility Menu. Based on the initial values of W=20 and H=30 we should see the volume equal 600000 mm^3 and
maximum stress equal 208.3 MPa (much too high).
Design Optimization
Now that we have parametrically set up our problem in ANSYS based on our initial width and height dimensions, we
can now solve the optimization problem.
Writing the Command File:
It is necessary to write the outline of our problem to an ANSYS command file. This is so that ANSYS can iteratively
run solutions to our problem based on different values for the variables that we will define.
1. From the File section of the Utility Menu select Write DB Log File.
2. In the window that appears type a name for the command file such as optimize.txt.
3. Click OK.
If you open the command file in a text editor such as Notepad, it should like this:
/PREP7
w=20
h=30
ET,1,BEAM4
R,1,w*h,w*h*h*h/12,h*w*w*w/12,w,h, ,
UIMP,1,EX, , ,200000
N,1,0,0,0
N,2,500,0,0
N,3,1000,0,0
E,1,2
E,2,3
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 10/13
/SOLU
D,1,UX,0
D,1,UY,0
D,1,UZ,0
D,3,UY,0
D,3,UZ,0
F,2,FY,-100000
F,2,FZ,1000
SOLVE
/POST1
ETABLE,evol,VOLU
ssum
*GET,vsum,SSUM, ,ITEM,EVOL
ETABLE,stress,nmisc,1
ESORT,ETAB,STRESS,0,0
*GET,STR,SORT,,max
FINISH
Assigning the Command File to the Optimization:
1. From the ANSYS main menu select Design Opt >
2. In the Design Opt menu select -Analysis File- Assign.
3. In the file list that appears, select the filename that we created when we wrote the command file.
4. Click OK.
Defining Variables and Tolerances:
ANSYS needs to know which variables are critical to the optimization. To define variables, we need to know which
variables have an effect on the variable to be minimized. In this example our objective is to minimize the volume of a
beam which is directly related to the weight of the beam.
ANSYS categorizes three types of variables for design optimization:
1. Design Variables (DVs) Independent variables that directly effect the design objective. In this example, the
width and height of the beam are the DVs. Changing either variable has a direct effect on the solution of the
problem.
2. State Variables (SVs) Dependent variables that change as a result of changing the DVs. These variables are
necessary to constrain the design. In this example, the SV is the maximum stress in the beam. Without this SV,
our optimization will continue until both the width and height are zero. This would minimize the weight to zero
which is not a useful result.
3. Objective Variable (OV) The objective variable is the one variable in the optimization that needs to be
minimized. In our problem, we will be minimizing the volume of the beam.
NOTE: None of the variables defined in ANSYS are allowed to have negative values.
Now that we have decided our design variables, we need to define ranges and tolerances for each variable. For the
width and height, we will select a range of 20 to 30 mm for each. Because a small change in either the width or height
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 11/13
has a profound effect on the volume of the beam, we will select a tolerance of 0.001mm. Tolerances are necessary in
that they tell ANSYS the largest amount of change that a variable can experience before convergence of the problem.
For the stress variable, we will select a range of 190 to 200 MPa with a tolerance of 0.001MPa. Because the volume
variable is the objective variable, we do not need to define an allowable range. We will set the tolerance to 200mm3.
This tolerance was chosen because it is significantly smaller than the initial magnitude of the volume of 600000mm3
(20mm x 30mm x 1000mm).
To define the design variables in ANSYS:
1. Click Design Variables from the Design Opt menu.
2. In the Design Variables window click Add.
3. Click on H in the Parameter Name section.
4. Enter: Minimum Value (MIN = 20)
Maximum Value (MAX = 30)
Convergence Tolerance (TOLER = 0.001)
5. Click Apply
6. Click on W in the Parameter Name section.
7. Enter: Minimum Value (MIN = 20)
Maximum Value (MAX = 30)
Convergence Tolerance (TOLER = 0.001)
8. Click OK
9. Click Close on the Design Variables window.
To define the state variables:
1. Click State Variables from the Design Opt menu.
2. In the State Variables window click Add.
3. Click on STR in the Parameter Name section.
4. Enter: Lower Limit (MIN = 190)
Upper Limit (MAX = 200)
Feasibility Tolerance (TOLER = 0.001)
5. Click OK
6. Click Close on the State Variables window.
To define the objective variable:
1. Click Objective from the Design Opt menu.
2. Click on VSUM in the Parameter Name section.
3. For the Convergence Tolerance, enter 200.
4. Click OK
Defining the Optimization Method:
There are several different methods that ANSYS can use to solve an optimization problem. To ensure that you are not
finding a solution at a local minimum, it is advisable to use different solution methods. If you have trouble with getting a
particular problem to converge it would be a good idea to try a different method of solution to see what might be
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 12/13
wrong.
For this problem we will use a First-Order Solution method.
1. From the Design Opt menu select Method / Tool.
2. In the Specify Optimization Method window select First-Order
3. Click OK
4. Enter: Maximum iterations (NITR = 30)
Percent step size SIZE = 100
Percent forward diff. DELTA = 0.2
5. Click OK.
NOTE: For help on the significance of each variable (NITR, SIZE or DELTA) click Help in the Controls for First-
order Optimization window.
Running the Optimization:
1. From the Design Opt menu select Run.
2. In the Begin Execution of Run window, confirm that the analysis file, method/type and maximum iterations are
correct.
3. Click OK.
The solution of an optimization problem can take a while before convergence. This problem will take about 10 minutes
and run through 27 iterations.
Viewing the Results of an Optimization Problem:
After the solution converges, it is necessary to see the results of the solution.
To see the exact values of the final width and height of the beam, click Scalar Parameters from the Parameters
section of the Utility Menu. In the Scalar Parameters window, we see that Width=24.5mm, Height=24.8mm,
Volume=608453mm3 and Stress=199.9MPa.
To see graphical results of each variable during the solution:
1. From the PlotCtrls section of the Utility Menu select Style and then Graphs.
2. In the Graph Controls window, enter Number of Iterations for the X-axis label section. Also, enter Width
and Height (mm) for the Y-axis label.
3. Click OK.
4. From the Design Opt menu select Graphs / Tables.
5. For the X-variable parameter select Set number.
6. For the Y-variable parameter select H and W.
7. Click OK
In the graphics window, you will see a graph of width and height throughout the optimization. You can print the plot by
selecting Hard Copy from the PlotCtrls section of the Utility Menu.
12/2/13 Design Optimization Tutorial
www.csa.ru/CSA/CADS/docs/ansys/tut2/optimization.html 13/13
Figure 4: Plot of Graph
You can plot graphs of the other variables in the design by following the above steps. Instead of using width and height
for the y-axis label and variables, use whichever variable is necessary to plot.

Você também pode gostar