You are on page 1of 5

Assignment: Optimization

Name: Muhammad Nabeel


Roll # 16-MS-FT-AMD-08

Sr # COMMAND SYNTAX COMMENTS


1 /prep7 Preprocessor phase.
2 od=2000 Specify parametric variables (od, or, pt, fs, etc.) in main
or=od/2 memory and assigns them values.
pt=30
fs=500
hw=190
hf=32
ww=14
wf=160
n=0
3 ET,1,SHELL63 Select Element Type as shell 63 (Elastic Shell Element).
4 Assigns Real Constants Sets
R,1,pt 1st set for planking thickness.
R,2,ww, 2nd set for web width.
R,3,hf, 3rd set for flange height.
5 MPTemp,1,0 Defines a temperature table for material properties.

MPDATA,EX,1,,2.05e5 Defines a table of property data to be associated with the


MPDATA,PRXY,1,,0.28 temperature table. In this case it is assigning the Youngs
Modulus in the X direction and the Poisson Ratio in XY.
6 k,1,0,or Define key point number 1 at (0,Parameter or).
k,2,fs,or Define key point number 2 at (Parameter fs,
Parameter or).
L,1,2 Define a line joining key point numbers 1 and 2.
7 *do,n,0,12 Initiates a DO loop with dummy variable n with range
going from 0 to 12.
8 k,,fs+(fs*n),or Creates key point at (Parameter fs, Parameter (n x fs))
k,,fs+(fs*(n+1)),or and then creates another key point at (Parameter fs,
Parameter ((n+1) x fs)).
9 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
10 L,DD,DD-1 Draw Line from key point number DD to DD-1.
11 *enddo Restart DO loop with n = n + 1.
12 nummrg,all Merge duplicated key points, lines, area numbers and
volume numbers etc.
numcmp,all Compress key points, lines, areas numbers and volume
numbers etc.
13 k,,0,0 Define key points at (0,0) and
k,,12000,0 Define another key point at (12000,0).
14 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
15 Arotate,all,,,,,,DD,DD-1 Create Area by rotating all lines around axis defined by
key points DD and DD-1.
16 *do,n,0,12 Start second DO loop with n from 0 to 12.
17 k,,fs+(fs*n),or Define 2 key points as per parametric coordinates given.
k,,fs+(fs*n),or-hw
18 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
19 L,DD,DD-1 Draw Line from key point number DD to DD-1.
20 *get,EE,Line,,num,max Assign value to dummy parameter EE by getting the
value of the maximum line number.
21 k,,0,0 Define key point at (0,0) and
k,,12000,0 Define another key point at (12000,0).
22 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
23 Arotate,EE,,,,,,DD,DD-1 Create Area by rotating line number EE around axis
defined by key points DD and DD-1.
24 *enddo Restart DO loop with n = n + 1.
25 nummrg,all Merge duplicated key points, lines, area numbers and
volume numbers etc.
numcmp,all Compress key points, lines, areas numbers and volume
numbers etc.
26 *do,n,0,12 Start third DO loop with n from 0 to 12
27 k,,fs+(fs*n),or-hw Define 3 key points as per parametric coordinates given.
k,,fs+((fs*n)+wf/2),or-hw
k,,fs+((fs*n)-wf/2),or-hw
28 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
29 L,DD,DD-2 Draw Line from key point number DD to DD-2.
L,DD-2,DD-1 Draw Line from key point number DD-2 to DD-1.
30 *get,EE,Line,,num,max Assign value to dummy parameter EE by getting the
value of the maximum line number.
31 k,,0,0 Plot key points at (0,0) and
k,,12000,0 Plot another key point at (0,12000).
32 *get,DD,kp,,num,max Assign value to dummy parameter DD by getting the
value of the maximum key point number.
33 Arotate,EE,EE-1,,,,,DD,DD-1 Create Area by rotating line EE and EE-1 around axis
defined by key points DD and DD-1.
34 *enddo Restart DO loop with n = n + 1.
35 nummrg,all Merge duplicated key points, lines, area numbers and
volume numbers etc.
numcmp,all Compress key points, lines, areas numbers and volume
numbers etc.
36 WPSTYLE,,,,,,,,1 Toggle working plane visibility on.
37 wpro,,,90 Rotate the Working plane by 90 around Z axis.
38 CSWPLA,11,1,1,1 !(To create local cylindrical coordinate system at
workplane x=r)
39 ASEL,S,LOC,X,od/2 Select all Areas at location X = od/2
40 Aplot Plot Selected Areas.
41 AAtt,,1 Assign selected areas the Real Constant Set 1 (Planking
Thickness).
42 CM,Plank,AREA Create a component group called plank and assign it to
hold areas.
43 CMSEL,A,Plank Select component called plank and add the selected
areas into it.
44 ALLSEL,ALL Select Everything.
45 ASEL,S,LOC,X,od/2-190 Select all those areas which areas are at X = (od/2
190).
46 Aplot Plot selected areas.
47 AAtt,,3 Assign selected areas the Real Constant Set 3 (i.e Flange
Thickness).
48 CM,Flange,AREA Create a component group called Flange and assign it to
hold areas.
49 CMSEL,A,Flange Select component called Flange and add the selected
areas into it.
50 ALLSEL,ALL Select Everything.
51 ASEL,S,LOC,X,od/2,od/2- Select all those areas which areas are at X = (od/2
190 190) AND Select those areas which are at X = (od/2)
52 ASEL,INVE Select inverse of current selection.
53 Aplot Plot selected areas.
54 AAtt,,2 Assign selected areas the Real Constant Set 2 (i.e the
Web Thickness)
55 CM,WEB,AREA Create a component group called Web and assign it to
hold areas.
56 CMSEL,A,WEB Add current areas to component Web
57 ALLSEL,ALL Select Everything.
58 !MESH(_Y1: 'Component' to These are some comments that are inserted into the
be replaced by "ALL" code. I have no idea where they came from or why this
!Commands Starting from has been included.
Underscore(_) are ANSYS
internal Commands
!And cant be accessed
59 LESIZE,ALL,200,,,,,,,0 Set global element size as 200
60 MSHKEY,0 Specifies Free Meshing
61 MSHAPE,0,2D Mesh with 2D Quadrilaterals
62 AMESH,ALL Mesh all areas.
63 ASEL,S,LOC,X,or Select new set of Areas at location X = or
64 !CMSEL,A,Plank This command has been deactivated.
65 /solu Enters the Solutions Processor
66 SFA,all,1,PRES,3 Apply Surface Load Pressure to all selected elements at
a value of 3 MPa
67 LSel,S,LOC,Z,0 Select a new set of lines at location z = 0
68 *SET,ol,fs+(fs*(n+1)) Create a dummy variable ol, and sets its value equal to
the defined parametric equation. (to find length of
cylinder)
69 LSEL,A,LOC,Z,ol Select a new set of lines at location z = ol
70 LPLOT Plot selected lines.
71 /solu Enters the Solutions Processor
72 DL,all,,ALL Constrains all selected lines in all DOF.
73 Allsel,all Select Everything.
74 SOLVE Execute Solution
75 /POST1 Enters the Post Processor
76 AVPRIN,0,, This is some kind of internal numerical methodology
selection.
77 ETABLE,EVOLUME,VOLU, !post1/Element Table/Define Table/Geometry/
Generate and Display a table which contains all the
Element Volumes. Label it EVolume.
78 SSUM !Element Table/Sum of each item
Sum the Element Volumes in the Element Table and
displays them.
79 *Get,SEV,SSUM,,ITEM,EVO !parameter/Get Scalar Data
LUME Define a dummy variable SEV (sum of element volume)
and assign it the value of the SSUM of Element Volume.
80 AVPRIN,0,, This is some kind of internal numerical methodology
selection.
81 ETABLE,VMSTRESS,S,EQV !Element Table/Define Table/stress/vonmises
, Generate and Display a table which contains all the Von
Mises equivalent Stresses, and Label it VMSTRESS.
82 SET,FIRST Defines the first data set to be read from the file.
83 ESORT,ETAB,VMSTRESS,0 !List Result/Sorted Listing/Sort Element
,0,Smax, Sorts the Element Table VMSTRESS according to the
real value in descending order.
84 *GET,Smax,SORT,,MAX !Parameter/get scalar data/result data/Other Operation
Returns the maximum value and assigns it to parameter
Smax
85 !OPTIMIZATION LOOP Comment showing start of optimization section.
86 /OPT Enters the Optimization Processor
87 OPANL,'Opt_int','mac',' ' Defines the analysis file to be used for optimization
looping.
88 !Defining Optimization The optimization variables are defined as under.
Variables
89 OPVAR,PT,DV,29,33,1, Sets PT as a design variable from 29 to 33 in 1 steps.
90 OPVAR,HF,DV,30,34,1, Sets HF as a design variable from 30 to 34 in 1 steps.
91 OPVAR,WF,DV,140,180,4, Sets WF as a design variable from 140 to 180 in 4 steps.
92 OPVAR,HW,DV,180,210,3, Sets HW as a design variable from 180 to 210 in 3 steps.
93 OPVAR,WW,DV,13,16,1, Sets WW as a design variable from 13 to 16 in 1 steps.
94 OPVAR,SMAX,SV,202,276,2 Sets SMAX as a state variable with limits from 202 to
, 276 with tolerance 2
95 OPVAR,SEV,OBJ,,,2.54e8, Sets SEV as the Objective variable.
96 !OPVAR,def,SV,1,8.2,0.05, Command has been commented out. It optionally sets
SV as a state variable with limits from 1 to 8.2 with
tolerance of 0.05
97 OPDATA,,, Identifies the file where optimization data is to be saved.
98 OPLOOP,TOP,IGNO,SCAL Specifies some optimization parameters
99 OPPRNT,OFF Turns off detailed optimization summary display.
100 OPKEEP,OFF Turns off saving best optimization file.
101 !Defining optimization
Method
102 OPTYPE,SUBP Sets optimization method as Sub Problem
103 OPSUBP,30,7 Sets number of optimization trial runs.
104 OPEQN,0,0,0,0,0, Sets optimization parameters to default values.
(Optimization Equation is treated as Quadratic)

You might also like