-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodes_removethisextensiontoview.html
388 lines (362 loc) · 35.9 KB
/
codes_removethisextensiontoview.html
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
<!DOCTYPE html>
<html>
<link href ='style.css' rel = 'stylesheet'>
<head>
<title>Pyparam</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.btn {
background-color: DodgerBlue;
border: none;
color: white;
padding: 12px 30px;
cursor: pointer;
font-size: 20px;
}
/* Darker background on mouse-over */
.btn:hover {
background-color: RoyalBlue;
}
</style>
</head>
<body>
<nav>
<ul class='nav'>
<li ><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/codes">Codes</a></li>
<li><a href="/usefullinks">Useful Links</a></li>
</ul>
</nav>
<h1>Implementation of Periodic Boundary Conditions (PBCs) in 2D rectangle shaped RVE in Abaqus/CAE </h1><br>
<br>
<p> The script can be used to apply periodic boundary conditions in 2D Recatangle <br>
Representative Volume Element (RVE) of any size. One has to provide certain inputs,<br>
1. model name of the RVE and 2. height and 3. width of RVE, <br>
In order to use this script to your FEA model, you need to change the <em>modelkey</em> variable name to
a name of your model.
<!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:scroll;width:800px;height:600px;border:solid green;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 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</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-style: italic"># Applying Periodic Boundary Conditions in Abaqus/CAE</span>
<span style="color: #008800; font-style: italic"># Created by: Paramveer Sharma</span>
<span style="color: #008800; font-style: italic"># MS, Aerospace Engineering</span>
<span style="color: #008800; font-style: italic"># Indian Institute of Technology Madras</span>
<span style="color: #008800; font-style: italic"># PBC Constraints is generalised for any size of rve </span>
<span style="color: #008800; font-style: italic"># You can change the model name : Model-1 to whatever the name of your model and same apply for Instance, </span>
<span style="color: #008800; font-style: italic">#########################################</span>
modelkey <span style="color: #666666">=</span><span style="color: #BB4444">'Model-Name'</span>
instancekey <span style="color: #666666">=</span> mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>instances<span style="color: #666666">.</span>keys()[<span style="color: #666666">0</span>]
F<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>instances[instancekey]<span style="color: #666666">.</span>nodes
cornsetlist,setlabel<span style="color: #666666">=</span>[<span style="color: #BB4444">'Bottemleft'</span>,<span style="color: #BB4444">'Bottemright'</span>,<span style="color: #BB4444">'Topright'</span>,<span style="color: #BB4444">'Topleft'</span>],[<span style="color: #BB4444">'setlabelH'</span>,<span style="color: #BB4444">'consH'</span>,<span style="color: #BB4444">'setlabelV'</span>,<span style="color: #BB4444">'consV'</span>,<span style="color: #BB4444">'corn'</span>,<span style="color: #BB4444">'U'</span>,<span style="color: #BB4444">'V'</span>]
a,noj <span style="color: #666666">=</span> getInput(<span style="color: #BB4444">'length of RVE (x - coordinates)'</span>),<span style="color: #666666">0</span>
b <span style="color: #666666">=</span> getInput(<span style="color: #BB4444">'height of RVE (y - coordinates)'</span>)
a<span style="color: #666666">=</span> <span style="color: #AA22FF">float</span>(a)
b <span style="color: #666666">=</span> <span style="color: #AA22FF">float</span>(b)
<span style="color: #AA22FF; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(F)):
coor<span style="color: #666666">=</span>F[i]<span style="color: #666666">.</span>coordinates
column <span style="color: #666666">=</span> [<span style="color: #666666">0</span>,a,b]
<span style="color: #AA22FF; font-weight: bold">for</span> k <span style="color: #AA22FF; font-weight: bold">in</span> column:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==</span>k:
<span style="color: #AA22FF; font-weight: bold">for</span> m <span style="color: #AA22FF; font-weight: bold">in</span> column:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==</span>m:
<span style="color: #008800; font-style: italic">#print(str(F[i].coordinates))</span>
cornseti<span style="color: #666666">=</span>setlabel[<span style="color: #666666">4</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[i]<span style="color: #666666">.</span>label)
setsi<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>Set(cornseti, F[i:i<span style="color: #666666">+1</span>])
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==0.0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==0.0</span>:
cornsetlist[<span style="color: #666666">0</span>]<span style="color: #666666">=</span>cornseti
<span style="color: #AA22FF; font-weight: bold">elif</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==</span>a <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==0.0</span>:
cornsetlist[<span style="color: #666666">1</span>]<span style="color: #666666">=</span>cornseti
<span style="color: #AA22FF; font-weight: bold">elif</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==</span>a <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==</span>b:
cornsetlist[<span style="color: #666666">2</span>]<span style="color: #666666">=</span>cornseti
<span style="color: #AA22FF; font-weight: bold">elif</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==0.0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==</span>b:
cornsetlist[<span style="color: #666666">3</span>]<span style="color: #666666">=</span>cornseti
<span style="color: #AA22FF; font-weight: bold">if</span> noj<span style="color: #666666">==0</span>:
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq1'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">1</span>]))
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq2'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">2</span>]))
<span style="color: #AA22FF; font-weight: bold">if</span> noj<span style="color: #666666">==1</span>:
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq1'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">1</span>]))
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq2'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">2</span>]))
<span style="color: #AA22FF; font-weight: bold">if</span> noj<span style="color: #666666">==2</span>:
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq1'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">1</span>]))
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(<span style="color: #BB4444">'corneq2'</span>,([<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">2</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">2</span>]))
column <span style="color: #666666">=</span> [<span style="color: #666666">0</span>,a,b]
l1,l2,l3,l4<span style="color: #666666">=</span>[],[],[],[] <span style="color: #008800; font-style: italic">###l1,l2,l3,l4 is list of node index position which situated at Bottem, Top, Right and Left respectively.</span>
<span style="color: #AA22FF; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(F)):
coor<span style="color: #666666">=</span>F[i]<span style="color: #666666">.</span>coordinates
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==0</span>:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">!=0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">!=</span>a:
l2<span style="color: #666666">.</span>append(i);
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">==</span>b:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">!=0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">!=</span>a:
l1<span style="color: #666666">.</span>append(i);
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==0</span>:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">!=0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">!=</span>b:
l4<span style="color: #666666">.</span>append(i);
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">0</span>]<span style="color: #666666">==</span>a:
<span style="color: #AA22FF; font-weight: bold">if</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">!=0</span> <span style="color: #AA22FF; font-weight: bold">and</span> coor[<span style="color: #666666">1</span>]<span style="color: #666666">!=</span>b:
l3<span style="color: #666666">.</span>append(i);
<span style="color: #AA22FF; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(l1)):
coor1<span style="color: #666666">=</span>F[l1[i]]<span style="color: #666666">.</span>coordinates
<span style="color: #AA22FF; font-weight: bold">for</span> j <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(l2)):
coor2<span style="color: #666666">=</span>F[l2[j]]<span style="color: #666666">.</span>coordinates
<span style="color: #AA22FF; font-weight: bold">if</span> coor1[<span style="color: #666666">0</span>] <span style="color: #666666">==</span> coor2[<span style="color: #666666">0</span>]:
setlabeli<span style="color: #666666">=</span>setlabel[<span style="color: #666666">0</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l1[i]]<span style="color: #666666">.</span>label)
setlabelj<span style="color: #666666">=</span>setlabel[<span style="color: #666666">0</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l2[j]]<span style="color: #666666">.</span>label)
cequation1<span style="color: #666666">=</span>setlabel[<span style="color: #666666">1</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l1[i]]<span style="color: #666666">.</span>label)<span style="color: #666666">+</span>setlabel[<span style="color: #666666">5</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l2[j]]<span style="color: #666666">.</span>label)
cequation2<span style="color: #666666">=</span>setlabel[<span style="color: #666666">1</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l1[i]]<span style="color: #666666">.</span>label)<span style="color: #666666">+</span>setlabel[<span style="color: #666666">6</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l2[j]]<span style="color: #666666">.</span>label)
setsi<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>Set(setlabeli, F[l1[i]:l1[i]<span style="color: #666666">+1</span>])
setsj<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>Set(setlabelj, F[l2[j]:l2[j]<span style="color: #666666">+1</span>])
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(cequation1,([<span style="color: #666666">1</span>,setlabeli,<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,setlabelj,<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">1</span>]))
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(cequation2,([<span style="color: #666666">1</span>,setlabeli,<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,setlabelj,<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">3</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">2</span>]))
<span style="color: #AA22FF; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(l3)):
coor1<span style="color: #666666">=</span>F[l3[i]]<span style="color: #666666">.</span>coordinates
<span style="color: #AA22FF; font-weight: bold">for</span> j <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #AA22FF">len</span>(l4)):
coor2<span style="color: #666666">=</span>F[l4[j]]<span style="color: #666666">.</span>coordinates
<span style="color: #AA22FF; font-weight: bold">if</span> coor1[<span style="color: #666666">1</span>] <span style="color: #666666">==</span> coor2[<span style="color: #666666">1</span>]:
setlabeli<span style="color: #666666">=</span>setlabel[<span style="color: #666666">2</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l3[i]]<span style="color: #666666">.</span>label)
setlabelj<span style="color: #666666">=</span>setlabel[<span style="color: #666666">2</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l4[j]]<span style="color: #666666">.</span>label)
cequation1<span style="color: #666666">=</span>setlabel[<span style="color: #666666">3</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l3[i]]<span style="color: #666666">.</span>label)<span style="color: #666666">+</span>setlabel[<span style="color: #666666">5</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l4[j]]<span style="color: #666666">.</span>label)
cequation2<span style="color: #666666">=</span>setlabel[<span style="color: #666666">3</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l3[i]]<span style="color: #666666">.</span>label)<span style="color: #666666">+</span>setlabel[<span style="color: #666666">6</span>]<span style="color: #666666">+</span><span style="color: #AA22FF">str</span>(F[l4[j]]<span style="color: #666666">.</span>label)
setsi<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>Set(setlabeli, F[l3[i]:l3[i]<span style="color: #666666">+1</span>])
setsj<span style="color: #666666">=</span>mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>rootAssembly<span style="color: #666666">.</span>Set(setlabelj, F[l4[j]:l4[j]<span style="color: #666666">+1</span>])
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(cequation1,([<span style="color: #666666">1</span>,setlabeli,<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,setlabelj,<span style="color: #666666">1</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">1</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">1</span>]))
mdb<span style="color: #666666">.</span>models[modelkey]<span style="color: #666666">.</span>Equation(cequation2,([<span style="color: #666666">1</span>,setlabeli,<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,setlabelj,<span style="color: #666666">2</span>],[<span style="color: #666666">-1</span>,cornsetlist[<span style="color: #666666">1</span>],<span style="color: #666666">2</span>],[<span style="color: #666666">1</span>,cornsetlist[<span style="color: #666666">0</span>],<span style="color: #666666">2</span>]))
<span style="color: #008800; font-style: italic">####################################################################</span>
<span style="color: #008800; font-style: italic">#PBC Constraints end</span>
<span style="color: #008800; font-style: italic">###################################################################</span>
</pre></td></tr></table></div>
<button class="btn"><i class="fa fa-download"></i> Download This Script</button>
<h1>Extraction of nodel point information (node label, nodes X-Y Coordinates and Jacobian) in Abaqus/CAE using Python</h1><br>
<br>
<p> This script can be used to extract the nodel point information such as node label, X-Y coordinates of nodes<br>
jacobian of isoparametric transformation of elements deformation. All the information extracted can be saved into the text file generated by <br>
this script</p>
<!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:scroll;width:800px;height:600px;border:solid green;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 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</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-style: italic">#_________________________________________________________</span>
<span style="color: #008800; font-style: italic">#_____ Script for finding the nodal connectivity in abaqus</span>
<span style="color: #008800; font-style: italic">#_________________________________________________________ </span>
<span style="color: #008800; font-style: italic"># Paramveer Sharma</span>
<span style="color: #008800; font-style: italic"># MS, Aerospace Engineering</span>
<span style="color: #008800; font-style: italic"># Indian Institute of Technology Madras</span>
<span style="color: #008800; font-style: italic"># http://pyparam.github.io </span>
<span style="color: #008800; font-style: italic"># Email: paramveersharma9@gmail.com</span>
<span style="color: #AA22FF; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">part</span>
<span style="color: #AA22FF; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #AA22FF; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #AA22FF; font-weight: bold">for</span> ii <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #AA22FF">range</span>(<span style="color: #666666">4</span>):
liststring <span style="color: #666666">=</span> [<span style="color: #BB4444">'Glabel'</span>, <span style="color: #BB4444">'XCoor'</span>,<span style="color: #BB4444">'YCoor'</span>, <span style="color: #BB4444">'Jacobian'</span>]
<span style="color: #AA22FF">file</span> <span style="color: #666666">=</span> <span style="color: #AA22FF">open</span>(<span style="color: #BB4444">'/home/paramveer/'</span><span style="color: #666666">+</span>liststring[ii]<span style="color: #666666">+</span><span style="color: #BB4444">'.txt'</span>,<span style="color: #BB4444">'w+'</span>) <span style="color: #008800; font-style: italic"># path and filename you want to generate</span>
elemArr <span style="color: #666666">=</span> mdb<span style="color: #666666">.</span>models[<span style="color: #BB4444">'Model-1-2-1'</span>]<span style="color: #666666">.</span>parts[<span style="color: #BB4444">'Part-1'</span>]<span style="color: #666666">.</span>sets[<span style="color: #BB4444">'setsection2'</span>]<span style="color: #666666">.</span>elements <span style="color: #008800; font-style: italic"># pick the part you want to analyse</span>
<span style="color: #AA22FF">len</span>(elemArr)
<span style="color: #AA22FF; font-weight: bold">print</span> <span style="color: #AA22FF">len</span>(elemArr)
counter <span style="color: #666666">=</span> <span style="color: #666666">0</span>
<span style="color: #AA22FF; font-weight: bold">for</span> e <span style="color: #AA22FF; font-weight: bold">in</span> elemArr:
ktuple <span style="color: #666666">=</span> e<span style="color: #666666">.</span>getNodes()
length <span style="color: #666666">=</span> <span style="color: #AA22FF">len</span>(ktuple)
elabel <span style="color: #666666">=</span> e<span style="color: #666666">.</span>label
counter <span style="color: #666666">=</span> counter <span style="color: #666666">+1</span>
<span style="color: #AA22FF; font-weight: bold">if</span> length <span style="color: #666666">==4</span>:
klabel1 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>label
kcoor1 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>coordinates
klabel2 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">1</span>]<span style="color: #666666">.</span>label
kcoor2 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">1</span>]<span style="color: #666666">.</span>coordinates
klabel3 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">2</span>]<span style="color: #666666">.</span>label
kcoor3 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">2</span>]<span style="color: #666666">.</span>coordinates
klabel4 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">3</span>]<span style="color: #666666">.</span>label
kcoor4 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">3</span>]<span style="color: #666666">.</span>coordinates
s, t<span style="color: #666666">=</span> <span style="color: #666666">0</span> , <span style="color: #666666">0</span>
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>array([[kcoor1[<span style="color: #666666">0</span>], kcoor2[<span style="color: #666666">0</span>], kcoor3[<span style="color: #666666">0</span>], kcoor4[<span style="color: #666666">0</span>]]])
Y <span style="color: #666666">=</span> np<span style="color: #666666">.</span>transpose([[kcoor1[<span style="color: #666666">1</span>],kcoor2[<span style="color: #666666">1</span>],kcoor3[<span style="color: #666666">1</span>],kcoor4[<span style="color: #666666">1</span>]]])
guass_x <span style="color: #666666">=</span> (kcoor1[<span style="color: #666666">0</span>] <span style="color: #666666">+</span> kcoor2[<span style="color: #666666">0</span>] <span style="color: #666666">+</span>kcoor3[<span style="color: #666666">0</span>] <span style="color: #666666">+</span> kcoor4[<span style="color: #666666">0</span>])<span style="color: #666666">/4.0</span>
guass_y <span style="color: #666666">=</span> (kcoor1[<span style="color: #666666">1</span>] <span style="color: #666666">+</span> kcoor2[<span style="color: #666666">1</span>] <span style="color: #666666">+</span>kcoor3[<span style="color: #666666">1</span>] <span style="color: #666666">+</span> kcoor4[<span style="color: #666666">1</span>])<span style="color: #666666">/4.0</span>
r1 , r2 <span style="color: #666666">=</span> [<span style="color: #666666">0</span>, <span style="color: #666666">1-</span>t, t<span style="color: #666666">-</span>s, s<span style="color: #666666">-1</span>], [t<span style="color: #666666">-1</span>, <span style="color: #666666">0</span> , s<span style="color: #666666">+1</span>, <span style="color: #666666">-</span>s<span style="color: #666666">-</span>t]
r3 , r4 <span style="color: #666666">=</span> [s<span style="color: #666666">-</span>t, <span style="color: #666666">-</span>s<span style="color: #666666">-1</span>, <span style="color: #666666">0</span>, t<span style="color: #666666">+1</span>], [<span style="color: #666666">1-</span>s, s<span style="color: #666666">+</span>t, <span style="color: #666666">-</span>t<span style="color: #666666">-1</span>, <span style="color: #666666">0</span>]
isomatrix <span style="color: #666666">=</span> np<span style="color: #666666">.</span>array([r1,r2,r3,r4])
temp <span style="color: #666666">=</span> X<span style="color: #666666">.</span>dot(isomatrix)
jacobian <span style="color: #666666">=</span> (<span style="color: #666666">1.0/8.0</span>)<span style="color: #666666">*</span>(temp<span style="color: #666666">.</span>dot(Y))
area <span style="color: #666666">=</span> (<span style="color: #666666">1.0/2.0</span>)<span style="color: #666666">*</span>(kcoor1[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor2[<span style="color: #666666">1</span>]<span style="color: #666666">+</span>kcoor2[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor3[<span style="color: #666666">1</span>]<span style="color: #666666">+</span>kcoor3[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor4[<span style="color: #666666">1</span>]<span style="color: #666666">+</span>kcoor4[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor1[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor2[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor1[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor3[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor2[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor4[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor3[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor1[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor4[<span style="color: #666666">1</span>])
<span style="color: #AA22FF; font-weight: bold">if</span> area<span style="color: #666666"><0.0</span>:
area <span style="color: #666666">=</span> (<span style="color: #666666">-1.0</span>)<span style="color: #666666">*</span>area
listout <span style="color: #666666">=</span> [elabel, guass_x,guass_y,jacobian]
<span style="color: #AA22FF">file</span><span style="color: #666666">.</span>write(<span style="color: #BB4444">'</span><span style="color: #BB6688; font-weight: bold">%g</span><span style="color: #BB6622; font-weight: bold">\n</span><span style="color: #BB4444">'</span> <span style="color: #666666">%</span> (listout[ii]))
<span style="color: #AA22FF; font-weight: bold">else</span>:
klabel1 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>label
kcoor1 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>coordinates
klabel2 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">1</span>]<span style="color: #666666">.</span>label
kcoor2 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">1</span>]<span style="color: #666666">.</span>coordinates
klabel3 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">2</span>]<span style="color: #666666">.</span>label
kcoor3 <span style="color: #666666">=</span> ktuple[<span style="color: #666666">2</span>]<span style="color: #666666">.</span>coordinates
zeta1, zeta2, zeta3<span style="color: #666666">=</span> (<span style="color: #666666">1.0/3.0</span>) , (<span style="color: #666666">1.0/3.0</span>), (<span style="color: #666666">1.0/3.0</span>)
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>array([[kcoor1[<span style="color: #666666">0</span>], kcoor2[<span style="color: #666666">0</span>], kcoor3[<span style="color: #666666">0</span>]]])
Y <span style="color: #666666">=</span> np<span style="color: #666666">.</span>transpose([[kcoor1[<span style="color: #666666">1</span>],kcoor2[<span style="color: #666666">1</span>],kcoor3[<span style="color: #666666">1</span>]]])
guass_x <span style="color: #666666">=</span> kcoor1[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>zeta1 <span style="color: #666666">+</span>kcoor2[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>zeta2 <span style="color: #666666">+</span>kcoor3[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>zeta3
guass_y <span style="color: #666666">=</span> kcoor1[<span style="color: #666666">1</span>]<span style="color: #666666">*</span>zeta1 <span style="color: #666666">+</span>kcoor2[<span style="color: #666666">1</span>]<span style="color: #666666">*</span>zeta2 <span style="color: #666666">+</span>kcoor3[<span style="color: #666666">1</span>]<span style="color: #666666">*</span>zeta3
jacobian <span style="color: #666666">=</span> (<span style="color: #666666">1.0/2.0</span>)<span style="color: #666666">*</span>((kcoor2[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor3[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor2[<span style="color: #666666">1</span>]<span style="color: #666666">*</span>kcoor3[<span style="color: #666666">0</span>])<span style="color: #666666">+</span>(kcoor3[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor1[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor1[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor3[<span style="color: #666666">1</span>]) <span style="color: #666666">+</span>(kcoor1[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor2[<span style="color: #666666">1</span>]<span style="color: #666666">-</span>kcoor2[<span style="color: #666666">0</span>]<span style="color: #666666">*</span>kcoor1[<span style="color: #666666">1</span>]))
area <span style="color: #666666">=</span> jacobian
listout <span style="color: #666666">=</span> [elabel, guass_x,guass_y,jacobian]
<span style="color: #AA22FF">file</span><span style="color: #666666">.</span>write(<span style="color: #BB4444">'</span><span style="color: #BB6688; font-weight: bold">%g</span><span style="color: #BB6622; font-weight: bold">\n</span><span style="color: #BB4444">'</span> <span style="color: #666666">%</span> (listout[ii]))
<span style="color: #AA22FF">file</span><span style="color: #666666">.</span>close()
</pre></td></tr></table></div>
<button class="btn"><i class="fa fa-download"></i> Download This Script</button>
<h1>WARNING: This page is in Under Construction</h1>