forked from bguest/ansys-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUCK.mac
396 lines (370 loc) · 13.4 KB
/
BUCK.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!BUCK.mac
! B.GUEST: benguest@gmail.com
!DESCRIPTION: This macro calculates the buckling failure
! criteria for a honeycomb sandwich structure.
!ASSUMPTIONS:
! Face sheet is the same on both sides of the sandwich
! Face sheet is Symmetric Balanced
! (P.181,Daniel & Ishai,2nd ed)
!PRECONDITIONS:
! ANSYS V11.0!
! OPTIONAL: run_BuckSettings.mac contains custome
! commands or settings for model
! Element types: SHELL181, SOLID185, SOLID186, SOLSH190,
! SHELL208, SHELL209, and SHELL281
! Layers Defined with SECDATA
! ARG1= Cell Size ELSE:
dc=3/8 !DEFAULT CELL SIZE (Largest)
! ARG2= RESULTS DISPLAY
! 0==> Highlight Failed Elements
! 1==> Show margin
! ARG3= Display Results from one type of analysis
! 0==> Minimum MS from all analises
! 1==> InterCellular Buckeling
! 2==> Face Wrinkling
! 3==> Shear Crimping (X-direction)
! 4==> Shear Crimping (Y-direction)
! 5==> Core Strength (X-direction)
! 6==> Core Strength (Y-direction)
!POST-CONDITIONS:
! See description
! -Units set to Radians (*AFUN,RAD Issued)
!NOTES:
! - run_BuckSettings will override settings in this
! file.
! - Needs numcmp,elem before this is run.
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
_SAVE
/post1
*AFUN,RAD !SET UNITS TO RADIANS
PI= ACOS(-1)
N = $ layMat= $ KK=
*IF,ARG1,NE,0,THEN !----Cell Size
dc=ARG1
*ENDIF
!==========USER SETTING DEFAULTS===============
SF =1.0 !SAFTEY FACTOR
MUF=1.0 !MODEL UNCERTAINTY FACTOR
flagAddReadLoads = 0
currentScale = 1.0
addLoadsScale = 1.0 !Factor by which added loads are scaled
flagWriteLoads = 0
run_BuckSettings !Over write any settings with folder
!------------------SAVE CURRENT SETUP
CM,temp_ELEM,ELEM
*GET,elmCount,ELEM,0,COUNT !Get Number of Elements
elmNum= $ *VGET,elmNum,ELEM,,ELIST !Get Element Numbers (V11.0)
elmFail= $ *DIM,elmFail,ARRAY,elmCount !Create Array For Failure Criteria.
*VFILL,elmFail,RAMP,0,0
*GET,elmMax,ELEM,0,NUM,MAX !GET High Element
*GET,elmMin,ELEM,0,NUM,MIN !GET Low Element
MaxFC=0 !SET Failure Criteria at 0
!Add additional loads if necessary
*if,flagWriteLoads,EQ,1,then
*cfopen,OUT_BuckLoads,out
*vwrite,elmCount
%I
*endif
*if,flagAddReadLoads,eq,1,then
! Get Data
addedLoads = $ *dim,addedLoads,,elmCount,10
*VREAD,addedLoads(1,1),OUT_BuckLoads,out,,JIK,10,elmCount,1,1
(E16.5,E16.5,E16.5,E16.5,E16.5,E16.5,E16.5,E16.5,E16.5,E16.5)
! Parse Data
elmDiff = elmMax
NxAdd = $ *dim,NxAdd ,array,elmDiff
NyAdd = $ *dim,NyAdd ,array,elmDiff
NxyAdd= $ *dim,NxyAdd,array,elmDiff
MxAdd = $ *dim,MxAdd ,array,elmDiff
MyAdd = $ *dim,MyAdd ,array,elmDiff
MxyAdd= $ *dim,MxyAdd,array,elmDiff
VxAdd = $ *dim,VxAdd ,array,elmDiff
VyAdd = $ *dim,VyAdd ,array,elmDiff
*do,i,1,elmCount,
eNumb = addedLoads(i,1)
NxAdd(eNumb)= addedLoads(i,2)
NyAdd(eNumb)= addedLoads(i,3)
NxyAdd(eNumb)= addedLoads(i,4)
MxAdd(eNumb)= addedLoads(i,5)
MyAdd(eNumb)= addedLoads(i,6)
MxyAdd(eNumb)= addedLoads(i,7)
VxAdd(eNumb)= addedLoads(i,8)
VyAdd(eNumb)= addedLoads(i,9)
*enddo
*endif
*DO,i,1,elmCount
secnType='NOT VALID'
*GET,secnNum,ELEM,elmNum(i),ATTR,SECN !GET SECTION
*GET,secnType,SHEL,secnNum,TYPE !Get section type
*IF,secnType,EQ,'SHEL ',THEN
!Get Number of Layers
*GET,numLay,SHEL,secnNum,PROP,NLAY !Get Number of Layers
!-----------------------FIND CORE LAYER
thick= $ *DIM,thick,ARRAY,numLay
*DO,j,1,numLay
*GET,thick(j),SHEL,secnNum,LAYD,j,THIC
*ENDDO
Tc=0 !Set thickest layer to 0
numCore=0 !SET thickest layer thickness to 0
*DO,j,1,numLay
*IF,thick(j),GT,Tc,THEN
Tc=thick(j)
numCore=j
*ENDIF
*ENDDO
numLay=numCore-1 !Set number of layers to only face sheet
!-------------------ALLOCATE ARRAYS
MS= $ *DIM,MS,ARRAY,6 !FOR MARGINS OF SAFTEY
S=
!Calculate ABBD Matrix and
BUCK_CalcABBD
!-------CALCULATE FACE SHEET PROPERTIES
Exf=(1/hh)*(A11-(A12**2/A22)) !Section 7.12.1 Daniel & Ishai, 2nd Ed.
Eyf=(1/hh)*(A22-(A12**2/A11))
Gf=A66/hh
Nuxy=A12/A22
Nuyx=A12/A11
tf=hh
!GET FAILURE CRITERIA---------------------------------
shouldGetAllFCData = 0
BUCK_GetFCData
Fcc=-Zc(numCore)
!-------Get Core Properites
*GET,layMat,SHEL,secnNum,LAYD,numLay+1,MAT !Material number of Ply
!*GET,E1(j),EX,layMat
*GET,Ecc,EZ,layMat !Compresive Modulus
dell=0.0025 !Initial Imprefections
*GET,Gcx,GXZ,layMat !Core Shear Modulus (X-Direction)
*GET,Gcy,GYZ,layMat !Core Shear Modulus (Y-Direction)
h=Tc+tf !Height to face sheet centroides
DD=Tc+2*Tf !Substrate depth
!=====================GET FORCES=================
*GET,Nx ,ELEM,elmNum(i),SMISC,1 $ Nx =abs(Nx )
*GET,Ny ,ELEM,elmNum(i),SMISC,2 $ Ny =abs(Ny )
*GET,Nxy,ELEM,elmNum(i),SMISC,3 $ Nxy=abs(Nxy)
*GET,Mx ,ELEM,elmNum(i),SMISC,4 $ Mx =abs(Mx )
*GET,My ,ELEM,elmNum(i),SMISC,5 $ My =abs(My )
*GET,Mxy,ELEM,elmNum(i),SMISC,6 $ Mxy=abs(Mxy)
*GET,Vx ,ELEM,elmNum(i),SMISC,7 $ Vx =abs(Vx )
*GET,Vy ,ELEM,elmNum(i),SMISC,8 $ Vy =abs(Vy )
! Write or Add Existing loads
*if,flagWriteLoads,eq,1,then
currentElemNum = elmNum(i)
*vwrite,currentElemNum,Nx,Ny,Nxy,Mx,My,Mxy,Vx,Vy
%16.5E%16.5E%16.5E%16.5E%16.5E%16.5E%16.5E%16.5E%16.5E%16.5E
*endif
*if,flagAddReadLoads,eq,1,then
Nx = currentScale*Nx + NxAdd(elmNum(i))*addLoadsScale
Ny = currentScale*Ny + NyAdd(elmNum(i))*addLoadsScale
Nxy= currentScale*Nxy+ NxyAdd(elmNum(i))*addLoadsScale
Mx = currentScale*Mx + MxAdd(elmNum(i))*addLoadsScale
Mxy= currentScale*Mxy+ MxyAdd(elmNum(i))*addLoadsScale
Vx = currentScale*Vx + VxAdd(elmNum(i))*addLoadsScale
Vy = currentScale*Vy + VyAdd(elmNum(i))*addLoadsScale
*endif
!-----FACE SHEET LOADS
Nxf=Nx/2+Mx/h
Nyf=Ny/2+My/h
Nxyf=Nxy/2+Mxy/h
!----Facesheet Stress Components
Fx=Nxf/tf
Fy=Nyf/tf
Fs=Nxyf/tf
!=====================InterCelluar Buckeling=====
*IF,ARG3,EQ,0,OR,ARG3,EQ,1,THEN
K=(ExF*Nuyx+2*Gf*(1-Nuxy*Nuyx))/(sqrt(Exf*Eyf))
Ktx=1+Eyf/Exf+2*K*sqrt(Eyf/Exf)
Kty=1+Exf/Eyf+2*K*sqrt(Exf/Eyf)
Fci_Xuni=(PI**2*Ktx*Exf)/(12*(1-Nuxy*Nuyx))*(Tf/Dc)**2
Fci_Yuni=(PI**2*Kty*Eyf)/(12*(1-Nuxy*Nuyx))*(Tf/Dc)**2
*IF,Dc/Tf,GE,15.63,THEN
n=3
*ELSE
n=2+(15.63/(dc/tf))**2
*IF,NINT(n-.5),NE,NINT(n),THEN !TRUNCATION (Conservative)
n=NINT(n-.5)
*ELSE
n=NINT(n)
*ENDIF
*ENDIF
Fci_Xbi=Fci_Xuni/((1+(Fy/Fx)**n)**(1/n)) !Intracell buckling allowable when in biaxial compression, X-direction
Fci_Ybi=Fci_Yuni/((1+(Fx/Fy)**n)**(1/n)) !Intracell buckling allowable when in biaxial compression, Y-direction
!----Compression load Ratio
*IF,(Fx*SF*MUF/Fci_xbi),GT,(Fy*SF*MUF/Fci_Ybi),THEN
Ra=Fx*SF*MUF/Fci_xbi
*ELSE
Ra=Fy*SF*MUF/Fci_Ybi
*ENDIF
!----Shear Load Allowable
*IF,Fci_Xuni,LE,Fci_Yuni,THEN
Fsi=0.8*Fci_Xuni
*ELSE
Fsi=0.8*Fci_Yuni
*ENDIF
Rs=(Fs*SF*MUF)/Fsi !Shear Load Ratio
MS(1)=((Ra+sqrt(Ra**2+4*Rs**2))/2) !Interaction formula for plate instability with biaxial compression and shear.
*ENDIF
!===================FACE WRINKLING===============
*IF,ARG3,EQ,0,OR,ARG3,EQ,2,THEN
KK=(dell*Ecc)/(Tc*Fcc)
Fcw_Xuni=(0.82*Sqrt((Ecc*Tf)/(Exf*Tc))*Exf)/(1+KK)
Fcw_Yuni=(0.82*Sqrt((Ecc*Tf)/(Eyf*Tc))*Eyf)/(1+KK)
Fcw_Xbi=Fcw_Xuni/((1+(fy/fx)**3)**(1/3)) !Face wrinkling allowable when in biaxial compression. X- direction
Fcw_Ybi=Fcw_Yuni/((1+(fx/fy)**3)**(1/3)) !Face wrinkling allowable when in biaxial compression. Y- direction
*IF,Fcw_Xuni,LT,Fcw_Yuni,THEN
Fsw=Fcw_Xuni
*ELSE
Fsw=Fcw_Yuni
*ENDIF
*IF,(Fx*SF*MUF/Fcw_Xbi),GT,(Fy*SF*MUF/Fcw_Ybi),THEN
Ra=fx*SF/Fcw_Xbi
*ELSE
Ra=fy*SF*MUF/Fcw_Ybi
*ENDIF
Rs=Fs*SF*MUF/Fsw
MS(2)=((Ra+Sqrt(Ra**2+4*Rs**2))/2) !Interaction formula for plate instability with biaxial compression and shear.
*ENDIF
!==================SHEAR Crimping================
*IF,ARG3,EQ,0,OR,ARG3,EQ,3,THEN
FcsX=Gcx*(Tc+2*Tf)/(2*Tf) !Shear crimping strength, X-direction
MS(3)=(Fx*SF*MUF)/FcsX !Shear crimping margin of safety for X-direction
*ENDIF
*IF,ARG3,EQ,0,OR,ARG3,EQ,4,THEN
FcsY=Gcy*(Tc+2*Tf)/(2*Tf) !Shear crimping strengty, Y-direction
MS(4)=(Fy*SF*MUF)/FcsY !Shear crimping margin of safety for Y-direction
*ENDIF
!==================Core Strength=================
*IF,ARG3,EQ,0,OR,ARG3,EQ,5,THEN
Tau_cx=Vx/h !Core Shear X-Direction
MS(5)=Tau_cx*SF*MUF/Sxz(NumCore)
*ENDIF
*IF,ARG3,EQ,0,OR,ARG3,EQ,6,THEN
Tau_cy=Vy/h !Core Shear Y-Direction
MS(6)=Tau_cy*SF*MUF/Syz(NumCore)
*ENDIF
!================FAILED DREAMS!==================
!---MAXIMUM Failure Criteria---------------------
*IF,ARG3,EQ,0,THEN
*IF,ARG2,EQ,0,THEN !DISPLAYED FAILED ELEMENTS
/TITLE, Failed Minimum Buckling Criteria
*DO,j,1,6
*IF,MS(j),GT,1,THEN
elmFail(i)=1
*ENDIF
*ENDDO
*ELSEIF,ARG2,EQ,1,THEN !SHOW Failure Criteria
/title, Maximum "Buckling Stress"
elmFail(i)=MS(1)
*DO,j,2,6
*IF,MS(j),GT,elmFail(i),THEN
elmFail(i)=MS(j)
*ENDIF
*ENDDO
*ENDIF
!---Report Maximum Failure Criteria
*DO,j,1,6
*IF,MS(j),GT,MaxFC,THEN
MaxFC=MS(j)
*ENDIF
*ENDDO
!-----Display IntraCelular Buckeling Criteria----
*ELSEIF,ARG3,EQ,1,THEN
/TITLE,IntraCelular Buckeling Criteria
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(1),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(1)
*ENDIF
*IF,MS(1),GT,MaxFC,THEN
MaxFC=MS(1)
*ENDIF
!-----Display Face Wrinkeling Criteria-----------
*ELSEIF,ARG3,EQ,2,THEN
/TITLE,Face Wrinkling Criteria
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(2),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(2)
*ENDIF
*IF,MS(2),GT,MaxFC,THEN
MaxFC=MS(2)
*ENDIF
!-----Display Shear Crimping (X-Direction)------
*ELSEIF,ARG3,EQ,3,THEN
/TITLE,Shear Crimping (X-Direction)
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(3),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(3)
*ENDIF
*IF,MS(3),GT,MaxFC,THEN
MaxFC=MS(3)
*ENDIF
!-----Display Shear Crimping (Y-Direction)-------
*ELSEIF,ARG3,EQ,4,THEN
/TITLE,Shear Crimping (Y-Direction)
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(4),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(4)
*ENDIF
*IF,MS(4),GT,MaxFC,THEN
MaxFC=MS(4)
*ENDIF
!-----Display Core Strength (X-Direction)--------
*ELSEIF,ARG3,EQ,5,THEN
/TITLE,Core Strength Criteria (X-Direction)
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(5),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(5)
*ENDIF
*IF,MS(5),GT,MaxFC,THEN
MaxFC=MS(5)
*ENDIF
!-----Display Core Strength (Y-Direction)--------
*ELSEIF,ARG3,EQ,6,THEN
/TITLE,Core Strength Criteria (Y-Direction)
*IF,ARG2,EQ,0,THEN !Display Failed Elements
*IF,MS(6),GT,1,THEN
elmFail(i)=1
*ENDIF
*ELSEIF,ARG2,EQ,1,THEN !Show Failure Criteria
elmFail(i)=MS(6)
*ENDIF
*IF,MS(6),GT,MaxFC,THEN
MaxFC=MS(6)
*ENDIF
*ENDIF
!------------------------------------------------
*ENDIF
*ENDDO
*cfclos
!======================DISPLAY RESULTS=================
ETABLE,plNum,CENT,X !CREATE STORAGE FOR *VPUT
*VGET,E_Table,ELEM,,ETAB,plNum
*VFILL,E_Table,RAMP,0,0
*DO,i,1,elmCount
E_Table(elmNum(i))=elmFail(i)
*ENDDO
*VPUT,E_Table,ELEM,,ETAB,plNum
PLETAB,plNum
!PLETAB,plNum,AVG
!DISPLAY MINIMUM MARGIN OF SAFTEY
MinMS=1/MaxFC-1
*MSG,UI,MinMS
MINIMUM SANDWICH BUCKLING MARGIN OF SAFETY = %G
!======THE--END========THE--END========THE--END========
!ITS THE END OF THE MACRO AS WE KNOW IT AND I FEEL FINE
arrayName = $ *dim,arrayName,array,arraySize