-
Notifications
You must be signed in to change notification settings - Fork 2
/
anglemod.mac
304 lines (304 loc) · 6.57 KB
/
anglemod.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/nopr
!
! anglemod.mac a macro which creates a parametric model of a
! stepped cantilever beam with the variables being
! the angle between steps, element size, and meshing
! style, element order, fillet radius, element
! density.
!
! usage: anglemod,angle,size,meshkey,eorder,rad,enumrad,parmkey
!
! where: angle=angle between 0 and 90 degrees
! size=average element size (used if rad=0)
! meshkey=0 for mapped, 1 for free
! eorder=0 for 42, 1 for 82
! rad=optional radius in corner
! enumrad=number of elements along radius (used when rad > 0)
! parmkey=keep parameters after running (0=no, 1=yes)
!
!
! parameter definitions
!
! enum_=number of elements in model
! nnum_=number of nodes in model
! lfil_=length of fillet, if one is used
! etype_=element type being used (42 or 82)
! delsig_=difference between avg and unavg stresses
! esize_=element size
! plnsmx_=averaged max von mises stress
! avgmaxc_=max upper bound of averaged von mises stress (corner region)
! plesmx_=unaveraged max von mises stress
! uvgmaxc_=max upper bound of unaveraged von mises stress (corner region)
! avgmaxm_=max upper bound of averaged von mises stress (entire model)
! uvgmaxm_=max upper bound of unaveraged von mises stress (entire model)
! sdsg_=SDSG value in corner region
! lineid_=fillet line ID number
! filstat_=fillet radius status number 0 if fillet created, 3 if not created
!
! transfer the input arguments to parameters so we can display the
! results again after the macro has run by setting parmkey to 1
!
! remove any trailing underscore parameters
*del,,prm_
!
ang_=arg1
*if,arg2,le,0,then
size_=1
*else
size_=arg2
*endif
meshkey_=arg3
eorder_=arg4
rad_=arg5
enumrad_=arg6
parmkey_=arg7
!
! check angle input, make sure it's between zero and 135 degrees
*if,ang_,ge,0,then
*if,ang_,le,90,then
!
! clean up the database
!
! remove annotations
/anno,dele
! reset graphics settings
/reset
! use full graphics so we can get the SMNB values later on
/graphics,full
! erase anything that happens to be on the screen
erase
! turn off the info column
/plopt,info,0
! make sure we're in /prep7
/prep7
! remove any pre-existing geometry
*if,vlinqr(0,13),gt,0,then
vclear,all
vdel,all
*endif
*if,arinqr(0,13),gt,0,then
aclear,all
adel,all
*endif
*if,lsinqr(0,13),gt,0,then
ldel,all
*endif
*if,kpinqr(0,13),gt,0,then
kdel,all
numc,kpoi
*endif
*if,elmiqr(0,13),gt,0,then
edel,all
*endif
*if,ndinqr(0,13),gt,0,then
ndel,all
*endif
! compress all ID numbers
numc,all
! make a dummy plot to clear the screen
nplo
!
! establish default arguments
*if,enumrad_,le,0,then
enumrad_=1
*endif
!
*afun,deg
! make the geometry
k,1,6,1
k,2,6,2
k,3,18,2
k,6,11,1
l,1,2
l,2,3
l,6,1
*if,ang_,eq,0,then
k,4,18,1
l,4,6
l,3,4
*else
*if,11+1/tan(ang_),gt,18,then
k,4,18,1-7*sin(ang_)
l,4,6
l,3,4
lineid_=6
*else
k,4,18,0
k,5,11+1/tan(ang_)
l,5,6
l,3,4
l,4,5
lineid_=7
*endif
! if rad>0 then create line fillet
l1=999
*if,rad_,gt,0,then
lfil,3,4,rad_
filstat_=_status
!
lesize,lineid_,,,enumrad_
! calculate default element size
*get,lfil_,line,lineid_,leng
esize_=lfil_/enumrad_
*else
! if we don't have a radius, then set the keypoint mesh
! size and global element size to size_
esize_=size_
kesize,6,esize_
*endif
esize,esize_
*endif
!
! create the area
al,all
! define element type
*if,eorder_,eq,1,then
et,1,82
etype_=82
*else
et,1,42
etype_=42
*endif
! set default element attributes
type,1
mat,1
real,1
! enter some material properties
ex,1,30e6
nuxy,1,.3
! either free mesh or map mesh the area
*if,meshkey_,eq,1,then
amesh,1
*else
amap,1,1,2,3,4
*endif
!
! apply boundary conditions
!
! displacements on keypoints
dk,3,all,,,1
dk,4,all,,,1
! select the keypoints at the free end of the beam
ksel,s,kp,,1,2
! select the line contained by these keypoints
lslk,s,1
! select the nodes on this line
nsll,s,1
! apply a total force of 100 lbs to these nodes
f,all,fy,100/ndinqr(0,13)
! select everything
allse
!
/solu
eqslv,pcg
solve
! enter the postprocessor
/post1
!
! begin by getting the max stress values and bounds for
! plns,s,eqv and ples,s,eqv
!
! if we only have a corner, then
*if,rad_,le,0,then
! select the node at the corner and it's associated elements
nsel,s,node,,node(kx(6),ky(6),kz(6))
esln
! if we have a fillet then
*else
! select the fillet line
lsel,s,line,,lineid_
! if there is only one element we will pick it's end nodes
*if,enumrad_,eq,1,then
nsll,s,1
! otherwise only pick the interior nodes on the line
*else
nsll,s
*endif
esln
*endif
! plot averaged von mises stress
plns,s,eqv
! get max stress and max bound stress
*get,plnsmx_,plnsol,,max
*get,avgmaxc_,plnsol,,bmax
! plot unaveraged von mises stress
ples,s,eqv
! get max stress and max bound stress
! (getting ples data like this isn't documented but seems to work)
*get,plesmx_,plnsol,,max
*get,uvgmaxc_,plnsol,,bmax
! get sdsg value
ples,sdsg
*get,sdsg_,plnsol,,max
allse
/erase
! set up 3 windows
/win,1,-1,1.666,.333,1
/win,2,-1,1.666,-.333,.333
/win,3,-1,1.666,-1,-.333
!
/win,1,on
/win,2,off
/win,3,off
!
! get the number of element and nodes in the model
enum_=elmiqr(0,13)
nnum_=ndinqr(0,13)
!
/tspec,,.7,,,5
/tlab,-.1,.29,Max Averaged Von Mises Stress At Corner Is %nint(plnsmx_)%
/tlab,-.1,.25,Max Upper Bound (SMXB) In Corner Is %nint(avgmaxc_)%
/tlab,-.1,-.37,Max Unaveraged Von Mises Stress At Corner Is %nint(plesmx_)%
/tlab,-.1,-.41,Max Upper Bound (SMXB) In Corner Is %nint(uvgmaxc_)%
/tlab,-.9,.95,Model Generated with Angle= %ang_% ESIZE= %esize_%
/tlab,.43,.95,RAD= %rad_% ENUMRAD= %enumrad_% ELEMENT TYPE= PLANE%etype_%
!
*if,meshkey_,eq,0,then
/tlab,-.9,.9,Mapped Meshing Yields %enum_% Elements %nnum_% Nodes
*else
/tlab,-.9,.9,Free Meshing Yields %enum_% Elements %nnum_% Nodes
*endif
/tlab,.43,.9,Nominal Stress Value with Kt=1.0 is 3000 PSI
! calculate the difference between avg and unavg stresses
delsig_=plnsmx_/plesmx_
/tlab,-.9,.4,Ratio of PLNSMAX/PLESMAX = %delsig_%
/tlab,-.9,.44,SDSG In Corner Region Is = %nint(sdsg_)%
erase
/noer
/win,1,on
/win,2,off
/win,3,off
eplo
/win,1,off
/win,2,on
/win,3,off
plns,s,eqv
*get,avgmaxm_,plnsol,,bmax
/tlab,-.1,.21,Max Upper Bound (SMXB) In Model Is %nint(avgmaxm_)%
/win,1,off
/WIN,2,off
/WIN,3,on
ples,s,eqv
*get,uvgmaxm_,plnsol,,bmax
/tlab,-.1,-.45,Max Upper Bound (SMXB) In Model Is %nint(uvgmaxm_)%
!
/win,all,on
/erase
!
*if,filstat_,eq,3,then
*msg,ui
LFIL COULD NOT BE DONE. DECREASE FILLET RADIUS AND TRY AGAIN
*endif
!
*endif
!
*if,parmkey_,eq,0,then
*del,,prm_
*endif
!
*else
*msg,ui
Angle Must Be Between 0 and 90 Degrees
*endif
!
/gopr