forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BOLT.mac
303 lines (265 loc) · 5.91 KB
/
BOLT.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
/PMACRO
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!BOLT.MAC
!DESCRIPTION: THIS MACRO CREATES A "BOLT" LINE ELEMENT
! THAT TIES TOGETHER TOO SURFACES.
!CAUTIONs:
! BOLT MATNUM = BOLT DIA * 10000
!PRECONDITIONS:
! ARG1=DIAMETER OF BOLT
! ELSE DIAMETER=BOLTD (SEE BELOW)
! ARG2=BOLT PRELOAD
! ELSE PRELOAD=0.8*Sty*PI*D^2/4 !Juvinal,p420
! ARG3=SURFACE GAP
! ELSE GAP = 0
!POSTCONDITIONS:
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SAVE,saved,db,,ALL
FINISH
/PREP7
!------------------SAVE CURRENT SETUP
CM,temp_VOLU,VOLU
CM,temp_AREA,AREA
CM,temp_LINE,LINE
CM,temp_KP,KP
CM,temp_NODE,NODE
CM,temp_ELEM,ELEM
!-------------------------------------------------OPTIONS
*IF,ARG1,EQ,0,THEN !Bolt Diameter
BoltD=0.19
*ELSE
BoltD=ARG1
*ENDIF
!-------------------------------STAINLESS_STEEL_A286
Sty=95000 !Yeild Strength
BoltA=9.20E-06 !Bolt CTE
BoltE=2.91E+07 !Bolt Modulus of Elasticity
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!MATERIALS
!======================================================
!998.BEAM4: Temp Beam
!======================================================
!3-D Elastic Beam: WIMPY BEAM
MatNum = 998
!-------------CUSTOM CROSS-SECTION----------------
TKZ = .1
TKY = 0.1
AA = 10e-3 !AREA
IYY = 10e-3
IZZ = 10e-3
IXX = 10e-3
TH = 0 !Theata
ISTRN = 0 !INITIAL STRAIN
SHEARZ = 0
SHEARY = 0
SPIN = 0
ADDMAS = 0
!-------------------------------------------------
ET,MatNum,BEAM4
R,MatNum,AA, IZZ, IYY, TKZ, TKY, TH
RMORE,ISTRN, IXX, SHEARZ, SHEARY, SPIN, ADDMAS
!------------Material Definition: WIMPY----------------
MP,EX,MatNum,1
MP,PRXY,MatNum,0.33
MP,DENS,MatNum,0 !NO DENSITY
!======================================================
!899.BEAM4: BOLT
!======================================================
!3-D Elastic Beam
MatNum = BOLTD*10000
!---------Options: Circular X-Section-------------
D=BoltD
TKZ=D
TKY=D
AA=PI/4*D**2
IYY=1/64*PI*D**4
IZZ=1/64*PI*D**4
IXX=IYY+IZZ
TH = 0 !Theata
ISTRN = 0 !INITIAL STRAIN
SHEARZ = 0
SHEARY = 0
SPIN = 0
ADDMAS = 0
!-------------------------------------------------
ET,MatNum,BEAM4
R,MatNum,AA, IZZ, IYY, TKZ, TKY, TH
RMORE,ISTRN, IXX, SHEARZ, SHEARY, SPIN, ADDMAS
!-------Material Definition: STAINLESS_STEEL_A286------ !REF:PRO_E
MP,EX,MatNum,BOLTE
MP,PRXY,MatNum,3.10E-01
MP,DENS,MatNum,2.87E-01/G
MP,ALPX,MatNum,BOLTA
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*GET,KP_max,KP,0,NUM,MAXD !GET MAX KP NUMBER
!-----------SELECT AREAS-------------
*MSG,UI !FIRST AREA
SELECT FIRST SET OF AREAS
ASEL,S,P
CM,A1_Area,AREA
CMSEL,S,temp_AREA
*MSG,UI !SECOND AREA
SELECT SECOND SET OF AREAS
ASEL,S,P
CM,A2_Area,AREA
*ASK,ANS,ENTER 0 TO STOP,1
*IF,ANS,EQ,0,THEN
*GO,:END
*ENDIF
!================FOR FIRST SET OF AREAS=================
CMSEL,S,A1_Area !SELECT AREAS
LSLA
KSLL !GET KP associated with AREAS
*GET,KP_high,KP,,NUM,MAX !GET HIGHEST KP NUMBER IN SEL
!-------GET KP CENTROID LOCATION
KSUM !GET KP INFO
*GET,centX1,KP,0,CENT,X
*GET,centY1,KP,0,CENT,Y
*GET,centZ1,KP,0,CENT,Z
!-------Create New KP at KP Centroid Location
KP1=KP_max+1
K,KP1,centX1,centY1,centZ1
LSEL,NONE
L,KP_High,KP1,1 !Create Line To KP centroid
LATT,998,998,998
LMESH,ALL
CM,A1_Line,LINE
CM,A1_ELEM,ELEM
CM,A1_NODE,NODE
!-------CREATE "ARIG"
KSEL,S,,,KP1 !GET NODE AT KP1
NSLK
*GET,Master,NODE,,NUM,MAX
nsla,a,1
CERIG,Master,ALL,ALL
CM,A1_KP,KP
!================FOR 2nd SET OF AREAS=================
CMSEL,S,A2_Area !SELECT AREAS
LSLA
KSLL !GET KP associated with AREAS
*GET,KP_high,KP,0,NUM,MAX !GET HIGHEST KP NUMBER IN SEL
!-------GET KP CENTROID LOCATION
KSUM !GET KP INFO
*GET,centX2,KP,0,CENT,X
*GET,centY2,KP,0,CENT,Y
*GET,centZ2,KP,0,CENT,Z
!-------Create New KP at KP Centroid Location
KP2=KP_max+2
K,KP2,centX2,centY2,centZ2
LSEL,NONE
L,KP_High,KP2,1 !Create Line To KP centroid
LATT,998,998,998
LMESH,ALL
CM,A2_Line,LINE
CM,A2_ELEM,ELEM
CM,A2_NODE,NODE
!-------CREATE "ARIG"
KSEL,S,,,KP2 !GET NODE AT KP2
NSLK
*GET,Master,NODE,,NUM,MAX
nsla,a,1
CERIG,Master,ALL,ALL
CM,A2_KP,KP
!=======================CREATE BOLT======================
LSEL,NONE
ESEL,NONE
KSEL,S,,,KP1,KP2
L,KP1,KP2,1 !Create Line To KP centroid
LATT,MatNum,MatNum,MatNum
LMESH,ALL
CM,Bolt_Line,LINE
CM,Bolt_elem,ELEM
!-----------------------------------------------SOLUTION
/SOLU
Bolt_Area=PI/4*BoltD**2 !BOLT AREA
Lx=centX1-centX2 !X distance
LY=centY1-centY2 !Y distance
Lz=centZ1-centZ2 !Z distance
BoltL=sqrt(Lx**2+Ly**2+Lz**2) !"BOLT LENGTH"
*IF,ARG2,EQ,0,THEN !---------PRELOAD CALC
PreLoad=0.8*Bolt_Area*Sty
*ELSE
PreLoad=ARG2
*ENDIF !---------------------------------
*IF,ARG3,EQ,0,THEN !---------"SURFACE GAP"
delG=0
*ELSE
delG=ARG3
*ENDIF !---------------------------------
DelT=delG/BoltA/BoltL + PreLoad/Bolt_Area/BoltE/BoltA
CMSEL,S,Bolt_Elem
BFE,ALL,TEMP,1,-DelT
/PREP7
:END
!=======================CLEAN UP=========================
!--RESUME TEMPORARY COMPONENTS
CMSEL,S,temp_VOLU
CMSEL,S,temp_AREA
CMSEL,S,temp_LINE
cMSEL,S,temp_KP
CMSEL,S,temp_NODE
CMSEL,S,temp_ELEM
CMSEL,S,temp_NODE
CMSEL,A,A1_LINE
CMSEL,A,A1_KP
CMSEL,A,A1_ELEM
CMSEL,A,A1_NODE
CMSEL,A,A2_LINE
CMSEL,A,A2_KP
CMSEL,A,A2_ELEM
CMSEL,A,A2_NODE
CMSEL,A,Bolt_Line
CMSEL,A,Bolt_elem
!--DELETE TEMPORARY COMPONENTS
CMDELE,temp_VOLU
CMDELE,temp_AREA
CMDELE,temp_LINE
CMDELE,temp_KP
CMDELE,temp_ELEM
CMDELE,temp_NODE
CMDELE,A1_LINE
CMDELE,A1_KP
CMDELE,A1_ELEM
CMDELE,A1_NODE
CMDELE,A2_LINE
CMDELE,A2_KP
CMDELE,A2_ELEM
CMDELE,A2_NODE
CMDELE,Bolt_Line
CMDELE,Bolt_elem
*SET,AA
*SET,Bolt_Area
*SET,BoltL
*SET,centX1
*SET,centY1
*SET,centZ1
*SET,centX2
*SET,centY2
*SET,centZ2
*SET,delG
*SET,KP_MAX
*SET,KP_HIGH
*SET,KP1
*SET,KP2
*SET,LX
*SET,LY
*SET,LZ
*SET,Master
*SET,TKZ
*SET,TKY
*SET,IXX
*SET,IYY
*SET,IZZ
*SET,TH
*SET,ISTRN
*SET,SHEARZ
*SET,SHEARY
*SET,SPIN
*SET,Sty
*SET,ADDMAS
*SET,BOLTD
*SET,BOLTA
*SET,BOLTE
*SET,D
!======THE--END========THE--END========THE--END=========
!ITS THE END OF THE MACRO AS WE KNOW IT, AND I FEEL FINE