2 #This scrip will create RVE including fibres and matrix, which can be used for all
3 #three type of boundary conditions including dispalcement, traction and periodic.
6 #=============================================================
7 #Geometry Input parametrs
8 #=============================================================
29 #=============================================================
30 #Create vartices for splines to create splines
31 #=============================================================
36 #---------------------
37 # Fill 1 path (14) top
38 #---------------------
41 for i in range(0, 751):
42 if (i<101) or (i>150 and i<351) or (i>400 and i<601) or (i>650):
46 coordz=a3/2*(math.sin(-math.pi*(coordy)/(2*a2)))+a3/2
47 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
51 #---------------------
52 # Fill 2 path (12) top
53 #---------------------
56 for i in range(0, 751):
57 if (i<101) or (i>150 and i<351) or (i>400 and i<601) or (i>650):
61 coordz=a3/2*(math.sin(math.pi*(coordy)/(2*a2)))+a3/2
62 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
65 #---------------------
67 #---------------------
70 for i in range(0, 751):
71 if (i<101) or (i>150 and i<351) or (i>400 and i<601) or (i>650):
75 coordz=a3/2*(math.sin(math.pi*(coordx)/(2*a1)))+a3/2
76 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
79 #---------------------
81 #---------------------
84 for i in range(0, 751):
85 if (i<101) or (i>150 and i<351) or (i>400 and i<601) or (i>650):
89 coordz=a3/2*(math.sin(-math.pi*(coordx)/(2*a1)))+a3/2
90 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
93 #=============================================================
94 #Joint vertices to create splines
95 #=============================================================
98 vertices=range(1,Tvertices+1); count1=0;
100 str1='create curve spline vertex '
101 for j in range(0, 751):
102 str1=str1+' '+ str(count1+vertices[j])
103 cubit.cmd(str1); count1=count1+751;
105 #=============================================================
106 #Creating yarns/inclusions with sinusoidal cross sections
107 #=============================================================
110 #-------------------------------------
111 # Fill 1 front surface top profile (1)
112 #-------------------------------------
114 coordx=-2*a1+ag1/2-dx_w
115 A_coef=-a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
116 B_coef=math.pi/(ag1-2*a1)
117 C_coef=-math.pi*(ag1-4*a1)/2/(ag1-2*a1)
118 D_coef=-a3/2*math.sin(math.pi*ag1/4/a1)+a3/2
119 for i in range(0, 201):
121 coordz=A_coef*math.sin(B_coef*coordx+C_coef)+D_coef
123 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
126 #----------------------------------------
127 # Fill 1 front surface bottom profile (2)
128 #----------------------------------------
130 B_coef=math.pi/(2*a1)
134 coordx=-2*a1+ag1/2-dx_w
135 for i in range(0, 201):
137 coordz=A_coef*math.sin(B_coef*coordx+C_coef)+D_coef
139 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
143 vertices=range(1,Tvertices+1); count1=3004;
144 for i in range(0, 2):
145 str1='create curve spline vertex '
146 for j in range(0, 201):
147 str1=str1+' '+ str(count1+vertices[j])
148 cubit.cmd(str1); count1=count1+201;
150 #-------------------------------------
151 # Fill 2 front surface top profile (5)
152 #-------------------------------------
156 B_coef=math.pi/(2*a1)
159 for i in range(0, 201):
161 coordz=A_coef*math.sin(B_coef*coordx+C_coef)+D_coef;
163 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
166 #----------------------------------------
167 # Fill 2 front surface bottom profile (6)
168 #----------------------------------------
171 A_coef=-a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
172 B_coef=math.pi/(ag1-2*a1)
173 C_coef=math.pi*(ag1-4*a1)/2/(ag1-2*a1)
174 D_coef=a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
175 for i in range(0, 201):
177 coordz=A_coef*math.sin(B_coef*coordx+C_coef)+D_coef;
179 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
183 vertices=range(1,Tvertices+1); count1=3406;
184 for i in range(0, 2):
185 str1='create curve spline vertex '
186 for j in range(0, 201):
187 str1=str1+' '+ str(count1+vertices[j])
188 cubit.cmd(str1); count1=count1+201;
190 #-------------------------------------
191 # Wrap 1 front surface top profile (9)
192 #-------------------------------------
195 coordy=-2*a2+ag2/2-dy_w
198 B_coef=-math.pi/(2*a2)
201 for i in range(0, 201):
203 coordz=A_coef*math.sin(B_coef*coordy+C_coef)+D_coef
205 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
207 #-----------------------------------------
208 # Warp 1 front surface bottom profile (10)
209 #-----------------------------------------
211 coordy=-2*a2+ag2/2-dy_w
212 A_coef=-a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
213 B_coef=-math.pi/(ag2-2*a2)
214 C_coef=math.pi*(ag2-4*a2)/2/(ag2-2*a2)
215 D_coef=a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
216 for i in range(0, 201):
218 coordz=A_coef*math.sin(B_coef*coordy+C_coef)+D_coef;
220 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
224 vertices=range(1,Tvertices+1); count1=3808;
225 for i in range(0, 2):
226 str1='create curve spline vertex '
227 for j in range(0, 201):
228 str1=str1+' '+ str(count1+vertices[j])
229 cubit.cmd(str1); count1=count1+201;
232 #-------------------------------------
233 # Wrap 2 front surface top profile (13)
234 #-------------------------------------
237 A_coef=-a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
238 B_coef=-math.pi/(ag2-2*a2)
239 C_coef=-math.pi*(ag2-4*a2)/2/(ag2-2*a2)
240 D_coef=-a3/2*math.sin(math.pi*ag2/4/a2)+a3/2
241 for i in range(0, 201):
243 coordz=A_coef*math.sin(B_coef*coordy+C_coef)+D_coef
245 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
248 #-----------------------------------------
249 # Warp 2 front surface bottom profile (14)
250 #-----------------------------------------
254 B_coef=-math.pi/(2*a2)
257 for i in range(0, 201):
259 coordz=A_coef*math.sin(B_coef*coordy+C_coef)+D_coef
261 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ;
265 vertices=range(1,Tvertices+1); count1=4210;
266 for i in range(0, 2):
267 str1='create curve spline vertex '
268 for j in range(0, 201):
269 str1=str1+' '+ str(count1+vertices[j])
270 cubit.cmd(str1); count1=count1+201;
273 # Create yarn cross-section and
274 # sweep along guideline/path to generate yarn volume
278 cubit.cmd('create surface curve 5 6')
279 cubit.cmd('create surface curve 7 8')
281 cubit.cmd('create surface curve 9 10')
282 cubit.cmd('create surface curve 11 12')
284 cubit.cmd('sweep surface 1 along curve 1')
285 cubit.cmd('sweep surface 2 along curve 2')
286 cubit.cmd('sweep surface 3 along curve 3')
287 cubit.cmd('sweep surface 4 along curve 4')
289 #=============================================================
290 #Deletion of remaining free vertices, curves and bodies
291 #=============================================================
293 cubit.cmd('delete vertex all')
294 cubit.cmd('delete curve all')
296 #=============================================================
297 #Create matrix and imprint and merge fibres and matrix to create common surfaces
298 #=============================================================
300 str1='brick x '+str(L_RVE)+' y '+str(W_RVE)+' z '+str(H_RVE); cubit.cmd(str1)
302 cubit.cmd('intersect volume all keep')
303 cubit.cmd('subtract volume 6 7 8 9 from volume 5 keep')
304 cubit.cmd('delete volume 1 2 3 4 5')
305 cubit.cmd('imprint volume 6 7 8 9 10')
306 cubit.cmd('merge volume 6 7 8 9 10')
308 #=============================================================
309 #Meshing negative x, y and z face of the RVE and coping the same to its positive faces
310 #=============================================================
313 cubit.cmd('group "g1" add surface 34 38 52')
314 cubit.cmd('group "g2" add surface 26 30 51')
315 cubit.cmd('group "g3" add surface 47')
316 cubit.cmd('group "g4" add surface 33 37 50')
317 cubit.cmd('group "g5" add surface 25 29 49')
318 cubit.cmd('group "g6" add surface 48')
323 cubit.cmd('surface 52 scheme trimesh')
324 str1='surface 52 size auto factor '+str(autofactor); cubit.cmd(str1)
325 cubit.cmd('mesh surface 52')
326 cubit.cmd('surface 50 scheme copy source surface 52 source vertex 4661 target vertex 4664 source curve 89 target curve 91 nosmoothing')
327 cubit.cmd('mesh surface 50')
329 cubit.cmd('surface 34 scheme trimesh')
330 str1='surface 34 size auto factor '+str(autofactor); cubit.cmd(str1)
331 cubit.cmd('mesh surface 34')
332 cubit.cmd('surface 33 scheme copy source surface 34 source vertex 4640 target vertex 4637 source curve 55 target curve 53 nosmoothing')
333 cubit.cmd('mesh surface 33')
335 cubit.cmd('surface 38 scheme trimesh')
336 str1='surface 38 size auto factor '+str(autofactor); cubit.cmd(str1)
337 cubit.cmd('mesh surface 38')
338 cubit.cmd('surface 37 scheme copy source surface 38 source vertex 4644 target vertex 4641 source curve 61 target curve 59 nosmoothing')
339 cubit.cmd('mesh surface 37')
345 cubit.cmd('surface 51 scheme trimesh')
346 str1='surface 51 size auto factor '+str(autofactor); cubit.cmd(str1)
347 cubit.cmd('mesh surface 51')
348 cubit.cmd('surface 49 scheme copy source surface 51 source vertex 4662 target vertex 4661 source curve 90 target curve 92 nosmoothing')
349 cubit.cmd('mesh surface 49')
351 cubit.cmd('surface 26 scheme trimesh')
352 str1='surface 26 size auto factor '+str(autofactor); cubit.cmd(str1)
353 cubit.cmd('mesh surface 26')
354 cubit.cmd('surface 25 scheme copy source surface 26 source vertex 4631 target vertex 4630 source curve 43 target curve 41 nosmoothing')
355 cubit.cmd('mesh surface 25')
357 cubit.cmd('surface 30 scheme trimesh')
358 str1='surface 30 size auto factor '+str(autofactor); cubit.cmd(str1)
359 cubit.cmd('mesh surface 30')
360 cubit.cmd('surface 29 scheme copy source surface 30 source vertex 4635 target vertex 4634 source curve 49 target curve 47 nosmoothing')
361 cubit.cmd('mesh surface 29')
366 cubit.cmd('surface 47 scheme trimesh')
367 str1='surface 47 size auto factor '+str(autofactor); cubit.cmd(str1)
368 cubit.cmd('mesh surface 47')
369 cubit.cmd('surface 48 scheme copy source surface 47 source vertex 4664 target vertex 4667 source curve 92 target curve 94 nosmoothing')
370 cubit.cmd('mesh surface 48')
372 #=============================================================
374 #=============================================================
376 cubit.cmd('volume all scheme Tetmesh')
377 cubit.cmd('mesh volume all')
379 #================================================================================
380 # Defining blocks for elastic, transversely-isotropic and potential flow problems
381 #================================================================================
383 vol=['10', '6,7,8,9', '6', '7', '8', '9']
384 mat=['MAT_ELASTIC_1','MAT_ELASTIC_TRANSISO_1','PotentialFlow_1','PotentialFlow_2','PotentialFlow_3','PotentialFlow_4']
385 for i in range(0, 6):
386 cubit.cmd('set duplicate block elements on')
387 str1='block ' + str(i+1) +' volume '+vol[i]; cubit.cmd(str1)
388 str1='block ' + str(i+1) +' name "'+mat[i] + '"'; cubit.cmd(str1)
390 #=============================================================
391 # Material properties for matrix part
392 #=============================================================
394 cubit.cmd('block 1 attribute count 2')
395 Em=3.4e3; Enu=0.35; #gig to mega as we used dimension in mm
397 Elastic=[str(Em), str(Enu)]
398 for i in range(0, 2):
399 str1='block 1 attribute index ' + str(i+1) +' '+Elastic[i]; cubit.cmd(str1)
401 #=============================================================
402 # Material properties for fibres
403 #=============================================================
406 #cubit.cmd('block 2 attribute count 5')
407 #Ep=Em; Ez=Em; nup=Enu; nupz=Enu; Gzp=Em/(2*(1+Enu));
409 cubit.cmd('block 2 attribute count 5')
410 Ep=20.865e3; Ez=58.397e3; nup=0.386; nupz=0.08611; Gzp=8.465e3;
412 TransIso=[str(Ep), str(Ez), str(nup), str(nupz), str(Gzp)]
413 for i in range(0, 5):
414 str1='block 2 attribute index ' + str(i+1) +' '+TransIso[i]; cubit.cmd(str1)
416 #=============================================================
417 # Material properties for interface between fibres and matrix
418 #=============================================================
421 cubit.cmd('set duplicate block elements on')
422 str1='block 7 surface 23 24 27 28 31 32 35 36'; cubit.cmd(str1)
423 str1='block 7 name "MAT_INTERF_1"'; cubit.cmd(str1)
424 cubit.cmd('block 7 attribute count 4')
425 str1='block 7 attribute index 1 '+str(alpha_interf); cubit.cmd(str1) #now we use 4 parameters for interface
426 str1='block 7 attribute index 2 '+str(0.0); cubit.cmd(str1)
427 str1='block 7 attribute index 3 '+str(0.0); cubit.cmd(str1)
428 str1='block 7 attribute index 4 '+str(0.0); cubit.cmd(str1)
430 #=============================================================
431 # Defining interfaces
432 #=============================================================
434 Interface=['23', '24','27','28', '31', '32','35','36']
435 for i in range(0, 8):
436 str1='sideset ' + str(i+1) +' surface '+Interface[i]; cubit.cmd(str1)
437 str1='sideset ' + str(i+1) +' name "interface'+str(i+1); cubit.cmd(str1)
439 #=============================================================
440 # Defining pressures for potential flow problem
441 #=============================================================
443 Pres=['25','26','29','30','33','34','37','38']; count=0; count1=len(Interface);
444 for i in range(0, 4):
445 str1='create pressure '+str(count+1)+' on surface '+str(Pres[count])+' magnitude 1'; cubit.cmd(str1)
446 str1='create pressure '+str(count+2)+' on surface '+str(Pres[count+1])+' magnitude -1'; cubit.cmd(str1)
447 str1='sideset '+str(count1+1)+' name "PressureIO_' + str(i+1) + '_1"'; cubit.cmd(str1)
448 str1='sideset '+str(count1+2)+' name "PressureIO_' + str(i+1) + '_2"'; cubit.cmd(str1)
449 count=count+2; count1=count1+2;
451 #=============================================================
452 # Definign zero proessrues for potential flow problem (This should be of the same order as PotentialFlow blocks )
453 #=============================================================
455 #zeroPressureNode=[545, 517, 30, 2]
456 #zeroPressureNode=[660, 618, 157, 115]
457 #zeroPressureNode=[561, 519, 44, 2]
458 # da3=0.003; H_RVE=2.28*a3
459 zeroPressureNode=[407, 389, 20, 2]
460 # da3=0.002; H_RVE=2.22*a3
461 #zeroPressureNode=[409, 391, 20, 2]
462 #zeroPressureNode=[331, 319, 14, 2]
463 for i in range(0, 4):
464 str1='nodeset ' + str(i+1) + ' node ' + str(zeroPressureNode[i]); cubit.cmd(str1)
465 str1='nodeset ' + str(i+1)+' name "ZeroPressure_' + str(i+1)+ '"'; cubit.cmd(str1)
467 #=============================================================
468 # Defining surfaces for dispacement, traction and periodic boundary conditions
469 #=============================================================
471 cubit.cmd('sideset 101 surface 33 37 50 25 29 49 48') # all -ve boundary surfaces for periodic boundary conditions
472 cubit.cmd('sideset 102 surface 34 38 52 26 30 51 47') # all +ve boundary surfaces for periodic boundary conditions
473 cubit.cmd('sideset 103 surface 34 38 52 26 30 51 47 33 37 50 25 29 49 48') # all boundary surfaces