v0.14.0
Cube_RVE_with_reinforcement.jou
Go to the documentation of this file.
1 #!python
2 #To create RVE for all the three type of boundary conditions, i.e. (Linear dispacemet, traction and periodic)
3 
4 cubit.cmd('new')
5 
6 autofactor=7;
7 
8 #=============================================================
9 #Geometry
10 #=============================================================
11 
12 cubit.cmd('brick x 1 y 1 z 1')
13 
14 cubit.cmd('brick x 1 y 0.4 z 0.4')
15 
16 cubit.cmd('subtract volume 2 from volume 1 keep')
17 cubit.cmd('delete volume 1')
18 cubit.cmd('imprint volume 2 3')
19 cubit.cmd('merge volume 2 3')
20 
21 #=============================================================
22 #Periodic mesh
23 #=============================================================
24 
25 cubit.cmd('surface 20 scheme trimesh')
26 str1='surface 20 size auto factor '+str(autofactor); cubit.cmd(str1)
27 cubit.cmd('mesh surface 20')
28 cubit.cmd('surface 22 scheme copy source surface 20 source vertex 27 target vertex 26 source curve 47 target curve 48 nosmoothing')
29 cubit.cmd('mesh surface 22')
30 
31 cubit.cmd('surface 10 scheme trimesh')
32 str1='surface 10 size auto factor '+str(autofactor); cubit.cmd(str1)
33 cubit.cmd('mesh surface 10')
34 cubit.cmd('surface 12 scheme copy source surface 10 source vertex 11 target vertex 10 source curve 23 target curve 24 nosmoothing')
35 cubit.cmd('mesh surface 12')
36 
37 cubit.cmd('surface 17 scheme trimesh')
38 str1='surface 17 size auto factor '+str(autofactor); cubit.cmd(str1)
39 cubit.cmd('mesh surface 17')
40 cubit.cmd('surface 18 scheme copy source surface 17 source vertex 26 target vertex 29 source curve 38 target curve 44 nosmoothing')
41 cubit.cmd('mesh surface 18')
42 
43 cubit.cmd('surface 19 scheme trimesh')
44 str1='surface 19 size auto factor '+str(autofactor); cubit.cmd(str1)
45 cubit.cmd('mesh surface 19')
46 cubit.cmd('surface 21 scheme copy source surface 19 source vertex 28 target vertex 27 source curve 45 target curve 47 nosmoothing')
47 cubit.cmd('mesh surface 21')
48 
49 str1='volume all size auto factor '+str(autofactor); cubit.cmd(str1)
50 cubit.cmd('volume all scheme tetmesh')
51 cubit.cmd('mesh volume all')
52 
53 
54 #=============================================================
55 #Defining blocks for elastic, transversely-isotropic and potential flow problems
56 #=============================================================
57 
58 vol=['3', '2','2']
59 mat=['MAT_ELASTIC_1','MAT_ELASTIC_TRANSISO_1','PotentialFlow_1']
60 for i in range(0, 3):
61  cubit.cmd('set duplicate block elements on')
62  str1='block ' + str(i+1) +' volume '+vol[i]; cubit.cmd(str1)
63  str1='block ' + str(i+1) +' name "'+mat[i] + '"'; cubit.cmd(str1)
64 
65 
66 #=============================================================
67 #Material properties for matrix part
68 #=============================================================
69 
70 cubit.cmd('block 1 attribute count 2')
71 Em=3.5e3; Enu=0.3; #giga to mega as we used dimension in mm
72 
73 Elastic=[str(Em), str(Enu)]
74 for i in range(0, 2):
75  str1='block 1 attribute index ' + str(i+1) +' '+Elastic[i]; cubit.cmd(str1)
76 
77 #=============================================================
78 #Material properties for fibres
79 #=============================================================
80 
81 #to use as isotropic
82 #cubit.cmd('block 2 attribute count 5')
83 #Ep=Em; Ez=Em; nup=Enu; nupz=Enu; Gzp=Em/(2*(1+Enu));
84 
85 cubit.cmd('block 2 attribute count 5')
86 #Ep=40e3; Ez=230e3; nup=0.26; nupz=0.26; Gzp=24e3;
87 Ep=10*Em; Ez=20*Em; nup=0.26; nupz=0.26; Gzp=5*Em;
88 #Ep=2*Em; Ez=5*Em; nup=0.26; nupz=0.26; Gzp=2*Em;
89 
90 TransIso=[str(Ep), str(Ez), str(nup), str(nupz), str(Gzp)]
91 for i in range(0, 5):
92  str1='block 2 attribute index ' + str(i+1) +' '+TransIso[i]; cubit.cmd(str1)
93 
94 #=============================================================
95 #Material properties for interface between fibres and matrix
96 #=============================================================
97 
98 alpha_interf=500
99 cubit.cmd('set duplicate block elements on')
100 str1='block 7 surface 23 26 29 32'; cubit.cmd(str1)
101 str1='block 7 name "MAT_INTERF_1"'; cubit.cmd(str1)
102 cubit.cmd('block 7 attribute count 4')
103 str1='block 7 attribute index 1 '+str(alpha_interf); cubit.cmd(str1) #now we use 4 parameters for interface
104 str1='block 7 attribute index 2 '+str(0.0); cubit.cmd(str1)
105 str1='block 7 attribute index 3 '+str(0.0); cubit.cmd(str1)
106 str1='block 7 attribute index 4 '+str(0.0); cubit.cmd(str1)
107 
108 
109 #=============================================================
110 #Defining interfaces
111 #=============================================================
112 
113 Interface=['7', '8','9','11']
114 for i in range(0, 4):
115  str1='sideset ' + str(i+1) +' surface '+Interface[i]; cubit.cmd(str1)
116  str1='sideset ' + str(i+1) +' name "interface'+str(i+1); cubit.cmd(str1)
117 
118 #=============================================================
119 #Defining pressures for potential flow problem
120 #=============================================================
121 
122 Pres=['10', '12']; count=0; count1=len(Interface);
123 for i in range(0, 1):
124  str1='create pressure '+str(count+1)+' on surface '+str(Pres[count])+' magnitude 1'; cubit.cmd(str1)
125  str1='create pressure '+str(count+2)+' on surface '+str(Pres[count+1])+' magnitude -1'; cubit.cmd(str1)
126  str1='sideset '+str(count1+1)+' name "PressureIO_' + str(i+1) + '_1"'; cubit.cmd(str1)
127  str1='sideset '+str(count1+2)+' name "PressureIO_' + str(i+1) + '_2"'; cubit.cmd(str1)
128  count=count+2; count1=count1+2;
129 
130 #=============================================================
131 #Definign zero proessrues for potential flow problem (This should be of the same order as PotentialFlow blocks )
132 #=============================================================
133 
134 zeroPressureNode=[1]
135 for i in range(0, 1):
136  str1='nodeset ' + str(i+1) + ' node ' + str(zeroPressureNode[i]); cubit.cmd(str1)
137  str1='nodeset ' + str(i+1)+' name "ZeroPressure_' + str(i+1)+ '"'; cubit.cmd(str1)
138 
139 #=============================================================
140 #Defining surfaces for dispacement, traction and periodic boundary conditions
141 #=============================================================
142 
143 cubit.cmd('sideset 101 surface 20 10 19 18') # all -ve boundary surfaces
144 cubit.cmd('sideset 102 surface 21 17 22 12') # all +ve boundary surfaces
145 cubit.cmd('sideset 103 surface 20 10 19 18 21 17 22 12') # all boundary surfaces
146 
147 cubit.cmd('save as "/Users/zahur/Documents/moFEM/mofem-cephas/mofem_v0.2/users_modules/homogenisation/meshes/Cube_RVE_with_reinforcement.cub" overwrite')