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#=============================================================
41for 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' ;
56for 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' ;
70for 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' ;
84for 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#=============================================================
98vertices=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#-------------------------------------
114coordx=-2*a1+ag1/2-dx_w
115A_coef=-a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
116B_coef=math.pi/(ag1-2*a1)
117C_coef=-math.pi*(ag1-4*a1)/2/(ag1-2*a1)
118D_coef=-a3/2*math.sin(math.pi*ag1/4/a1)+a3/2
119for 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#----------------------------------------
134coordx=-2*a1+ag1/2-dx_w
135for 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' ;
143vertices=range(1,Tvertices+1); count1=3004;
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#-------------------------------------
159for 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#----------------------------------------
171A_coef=-a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
172B_coef=math.pi/(ag1-2*a1)
173C_coef=math.pi*(ag1-4*a1)/2/(ag1-2*a1)
174D_coef=a3/2*math.sin(math.pi*ag1/4/a1)-a3/2
175for 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' ;
183vertices=range(1,Tvertices+1); count1=3406;
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#-------------------------------------
195coordy=-2*a2+ag2/2-dy_w
198B_coef=-math.pi/(2*a2)
201for 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#-----------------------------------------
211coordy=-2*a2+ag2/2-dy_w
212A_coef=-a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
213B_coef=-math.pi/(ag2-2*a2)
214C_coef=math.pi*(ag2-4*a2)/2/(ag2-2*a2)
215D_coef=a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
216for 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' ;
224vertices=range(1,Tvertices+1); count1=3808;
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#-------------------------------------
237A_coef=-a3/2*math.sin(math.pi*ag2/4/a2)-a3/2
238B_coef=-math.pi/(ag2-2*a2)
239C_coef=-math.pi*(ag2-4*a2)/2/(ag2-2*a2)
240D_coef=-a3/2*math.sin(math.pi*ag2/4/a2)+a3/2
241for 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#-----------------------------------------
254B_coef=-math.pi/(2*a2)
257for 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' ;
265vertices=range(1,Tvertices+1); count1=4210;
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
278cubit.cmd('create surface curve 5 6')
279cubit.cmd('create surface curve 7 8')
281cubit.cmd('create surface curve 9 10')
282cubit.cmd('create surface curve 11 12')
284cubit.cmd('sweep surface 1 along curve 1')
285cubit.cmd('sweep surface 2 along curve 2')
286cubit.cmd('sweep surface 3 along curve 3')
287cubit.cmd('sweep surface 4 along curve 4')
289#=============================================================
290#Deletion of remaining free vertices, curves and bodies
291#=============================================================
293cubit.cmd('delete vertex all')
294cubit.cmd('delete curve all')
296#=============================================================
297#Create matrix and imprint and merge fibres and matrix to create common surfaces
298#=============================================================
300str1='brick x '+str(L_RVE)+' y '+str(W_RVE)+' z '+str(H_RVE); cubit.cmd(str1)
302cubit.cmd('intersect volume all keep')
303cubit.cmd('subtract volume 6 7 8 9 from volume 5 keep')
304cubit.cmd('delete volume 1 2 3 4 5')
305cubit.cmd('imprint volume 6 7 8 9 10')
306cubit.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#=============================================================
313cubit.cmd('group "g1" add surface 34 38 52')
314cubit.cmd('group "g2" add surface 26 30 51')
315cubit.cmd('group "g3" add surface 47')
316cubit.cmd('group "g4" add surface 33 37 50')
317cubit.cmd('group "g5" add surface 25 29 49')
318cubit.cmd('group "g6" add surface 48')
323cubit.cmd('surface 52 scheme trimesh')
324str1='surface 52 size auto factor '+str(autofactor); cubit.cmd(str1)
325cubit.cmd('mesh surface 52')
326cubit.cmd('surface 50 scheme copy source surface 52 source vertex 4661 target vertex 4664 source curve 89 target curve 91 nosmoothing')
327cubit.cmd('mesh surface 50')
329cubit.cmd('surface 34 scheme trimesh')
330str1='surface 34 size auto factor '+str(autofactor); cubit.cmd(str1)
331cubit.cmd('mesh surface 34')
332cubit.cmd('surface 33 scheme copy source surface 34 source vertex 4640 target vertex 4637 source curve 55 target curve 53 nosmoothing')
333cubit.cmd('mesh surface 33')
335cubit.cmd('surface 38 scheme trimesh')
336str1='surface 38 size auto factor '+str(autofactor); cubit.cmd(str1)
337cubit.cmd('mesh surface 38')
338cubit.cmd('surface 37 scheme copy source surface 38 source vertex 4644 target vertex 4641 source curve 61 target curve 59 nosmoothing')
339cubit.cmd('mesh surface 37')
345cubit.cmd('surface 51 scheme trimesh')
346str1='surface 51 size auto factor '+str(autofactor); cubit.cmd(str1)
347cubit.cmd('mesh surface 51')
348cubit.cmd('surface 49 scheme copy source surface 51 source vertex 4662 target vertex 4661 source curve 90 target curve 92 nosmoothing')
349cubit.cmd('mesh surface 49')
351cubit.cmd('surface 26 scheme trimesh')
352str1='surface 26 size auto factor '+str(autofactor); cubit.cmd(str1)
353cubit.cmd('mesh surface 26')
354cubit.cmd('surface 25 scheme copy source surface 26 source vertex 4631 target vertex 4630 source curve 43 target curve 41 nosmoothing')
355cubit.cmd('mesh surface 25')
357cubit.cmd('surface 30 scheme trimesh')
358str1='surface 30 size auto factor '+str(autofactor); cubit.cmd(str1)
359cubit.cmd('mesh surface 30')
360cubit.cmd('surface 29 scheme copy source surface 30 source vertex 4635 target vertex 4634 source curve 49 target curve 47 nosmoothing')
361cubit.cmd('mesh surface 29')
366cubit.cmd('surface 47 scheme trimesh')
367str1='surface 47 size auto factor '+str(autofactor); cubit.cmd(str1)
368cubit.cmd('mesh surface 47')
369cubit.cmd('surface 48 scheme copy source surface 47 source vertex 4664 target vertex 4667 source curve 92 target curve 94 nosmoothing')
370cubit.cmd('mesh surface 48')
372#=============================================================
374#=============================================================
376cubit.cmd('volume all scheme Tetmesh')
377cubit.cmd('mesh volume all')
379#================================================================================
380# Defining blocks for elastic, transversely-isotropic and potential flow problems
381#================================================================================
383vol=['10', '6,7,8,9', '6', '7', '8', '9']
384mat=['MAT_ELASTIC_1','MAT_ELASTIC_TRANSISO_1','PotentialFlow_1','PotentialFlow_2','PotentialFlow_3','PotentialFlow_4']
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#=============================================================
394cubit.cmd('block 1 attribute count 2')
395Em=3.4e3; Enu=0.35; #gig to mega as we used dimension in mm
397Elastic=[str(Em), str(Enu)]
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));
409cubit.cmd('block 2 attribute count 5')
410Ep=20.865e3; Ez=58.397e3; nup=0.386; nupz=0.08611; Gzp=8.465e3;
412TransIso=[str(Ep), str(Ez), str(nup), str(nupz), str(Gzp)]
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#=============================================================
421cubit.cmd('set duplicate block elements on')
422str1='block 7 surface 23 24 27 28 31 32 35 36'; cubit.cmd(str1)
423str1='block 7 name "MAT_INTERF_1"'; cubit.cmd(str1)
424cubit.cmd('block 7 attribute count 4')
425str1='block 7 attribute index 1 '+str(alpha_interf); cubit.cmd(str1) #now we use 4 parameters for interface
426str1='block 7 attribute index 2 '+str(0.0); cubit.cmd(str1)
427str1='block 7 attribute index 3 '+str(0.0); cubit.cmd(str1)
428str1='block 7 attribute index 4 '+str(0.0); cubit.cmd(str1)
430#=============================================================
432#=============================================================
434Interface=['23', '24','27','28', '31', '32','35','36']
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#=============================================================
443Pres=['25','26','29','30','33','34','37','38']; count=0; count1=len(Interface);
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
459zeroPressureNode=[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]
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#=============================================================
471cubit.cmd('sideset 101 surface 33 37 50 25 29 49 48') # all -ve boundary surfaces for periodic boundary conditions
472cubit.cmd('sideset 102 surface 34 38 52 26 30 51 47') # all +ve boundary surfaces for periodic boundary conditions
473cubit.cmd('sideset 103 surface 34 38 52 26 30 51 47 33 37 50 25 29 49 48') # all boundary surfaces