v0.14.0
Loading...
Searching...
No Matches
Textile_RVE.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
4cubit.cmd('new')
5
6W_wrap=0.3; H_wrap=0.1514; hgap_wrap=0.09
7W_weft=0.3; H_weft=0.0757; hgap_weft=1.2
8L_RVE=3.0; W_RVE=0.8; H_RVE=0.3;
9Vgap=0.012
10
11s_weft=hgap_weft+W_weft; s_wraf=hgap_wrap+W_wrap
12T=(H_weft/2+H_wrap/2)/2+Vgap
13
14L_RVE=2*s_weft; W_RVE=2*s_wraf; H_RVE=0.3;
15
16coordx=-22.5*s_weft; coordy=T; coordz=0;
17for i in range(0, 48):
18 if i % 2 == 0:
19 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ; coordx=coordx+s_weft;
20 cubit.cmd(str1)
21 if i % 2 == 1:
22 str1='create vertex ' + str(coordx) +' '+str(-coordy)+' '+str(coordz)+' color' ; coordx=coordx+s_weft;
23 cubit.cmd(str1)
24
25coordx=-22.5*s_weft; coordy=-T; coordz=s_wraf;
26for i in range(0, 48):
27 if i % 2 == 0:
28 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ; coordx=coordx+s_weft;
29 cubit.cmd(str1)
30 if i % 2 == 1:
31 str1='create vertex ' + str(coordx) +' '+str(-coordy)+' '+str(coordz)+' color' ; coordx=coordx+s_weft;
32 cubit.cmd(str1)
33
34coordx=-0.5*s_weft; coordy=-T; coordz=-22*s_wraf;
35for i in range(0, 48):
36 if i % 2 == 0:
37 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ; coordz=coordz+s_wraf;
38 cubit.cmd(str1)
39 if i % 2 == 1:
40 str1='create vertex ' + str(coordx) +' '+str(-coordy)+' '+str(coordz)+' color' ; coordz=coordz+s_wraf;
41 cubit.cmd(str1)
42
43coordx=0.5*s_weft; coordy=T; coordz=-22*s_wraf;
44for i in range(0, 48):
45 if i % 2 == 0:
46 str1='create vertex ' + str(coordx) +' '+str(coordy)+' '+str(coordz)+' color' ; coordz=coordz+s_wraf;
47 cubit.cmd(str1)
48 if i % 2 == 1:
49 str1='create vertex ' + str(coordx) +' '+str(-coordy)+' '+str(coordz)+' color' ; coordz=coordz+s_wraf;
50 cubit.cmd(str1)
51
52Tvertices=48;
53vertices=range(1,Tvertices+1); count1=0;
54for i in range(0, 4):
55 str1='create curve spline vertex '
56 for j in range(0, 48):
57 str1=str1+' '+ str(count1+vertices[j])
58 cubit.cmd(str1); count1=count1+48;
59
60cubit.cmd('create planar surface with plane normal to curve 1 distance 0 from vertex 1')
61str1='create curve location vertex 1 direction curve 8 length '+ str(W_wrap/2); cubit.cmd(str1)
62str1='create curve location vertex 1 direction curve 7 length '+str(H_wrap/2); cubit.cmd(str1)
63cubit.cmd('create surface ellipse vertex 198 200 1')
64cubit.cmd('sweep surface 2 along curve 1')
65
66cubit.cmd('create planar surface with plane normal to curve 2 distance 0 from vertex 49')
67str1='create curve location vertex 49 direction curve 17 length '+ str(W_wrap/2); cubit.cmd(str1)
68str1='create curve location vertex 49 direction curve 16 length '+str(H_wrap/2); cubit.cmd(str1)
69cubit.cmd('create surface ellipse vertex 208 210 49')
70cubit.cmd('sweep surface 6 along curve 2')
71
72cubit.cmd('create planar surface with plane normal to curve 3 distance 0 from vertex 97')
73str1='create curve location vertex 97 direction curve 24 length '+ str(W_weft/2); cubit.cmd(str1)
74str1='create curve location vertex 97 direction curve 23 length '+str(H_weft/2); cubit.cmd(str1)
75cubit.cmd('create surface ellipse vertex 218 220 97')
76cubit.cmd('sweep surface 10 along curve 3')
77
78cubit.cmd('create planar surface with plane normal to curve 4 distance 0 from vertex 145')
79str1='create curve location vertex 145 direction curve 33 length '+ str(W_weft/2); cubit.cmd(str1)
80str1='create curve location vertex 145 direction curve 32 length '+str(H_weft/2); cubit.cmd(str1)
81cubit.cmd('create surface ellipse vertex 228 230 145')
82cubit.cmd('sweep surface 14 along curve 4')
83
84cubit.cmd('delete vertex all')
85cubit.cmd('delete curve all')
86cubit.cmd('delete body 7 3 5 1')
87
88str1='brick x '+str(L_RVE)+' y '+str(H_RVE)+' z '+str(W_RVE); cubit.cmd(str1)
89str1='move Volume '+str(9)+' x '+str(0)+' y '+str(0)+' z '+str(s_wraf/2); cubit.cmd(str1)
90
91cubit.cmd('intersect volume all keep')
92cubit.cmd('delete volume 6 2 8 4')
93cubit.cmd('subtract volume 10 11 12 13 from volume 9 keep')
94cubit.cmd('delete volume 9')
95cubit.cmd('imprint volume 10 11 12 13 14')
96cubit.cmd('merge volume 10 11 12 13 14')
97
98
99### =============== Meshing ================
100cubit.cmd('group 1 add surface 42 27 24')
101cubit.cmd('group "g2" add surface 44 25 28')
102cubit.cmd('group "g3" add surface 39 30 33')
103cubit.cmd('group "g4" add surface 31 40 34')
104cubit.cmd('group "g5" add surface 43')
105cubit.cmd('group "g6" add surface 41')
106
107
108cubit.cmd('surface 42 27 24 size auto factor 6')
109cubit.cmd('surface 42 27 24 scheme trimesh')
110cubit.cmd('mesh surface 42 27 24')
111cubit.cmd('surface 28 25 44 scheme mirror source surface 27 24 42 source vertex 263 target vertex 262 nosmoothing')
112cubit.cmd('mesh surface 28 25 44')
113
114cubit.cmd('surface 39 30 33 size auto factor 5')
115cubit.cmd('surface 39 30 33 scheme trimesh')
116cubit.cmd('mesh surface 39 30 33')
117cubit.cmd('surface 31 34 40 scheme mirror source surface 30 33 39 source vertex 257 target vertex 262 nosmoothing')
118cubit.cmd('mesh surface 31 34 40')
119
120cubit.cmd('surface 43 scheme trimesh')
121cubit.cmd('mesh surface 43')
122cubit.cmd('surface 41 scheme mirror source surface 43 source vertex 259 target vertex 260 nosmoothing')
123cubit.cmd('mesh surface 41')
124
125##=============================================================
126##Mesh volume
127##=============================================================
128cubit.cmd('volume all scheme Tetmesh')
129cubit.cmd('mesh volume all')
130
131vol=['14', '10,11,12,13']
132mat=['MAT_ELASTIC_MATRIX','MAT_ELASTIC_FIBRES']
133Elastic=['5.0e3', '0.3', '5.0e3', '0.3'] #E in N/mm^2 for geometry dimensions in mm
134count=0;
135for i in range(0, 2):
136 cubit.cmd('set duplicate block elements on')
137 str1='block ' + str(i+1) +' volume '+vol[i]; cubit.cmd(str1)
138 str1='block ' + str(i+1) +' name "'+mat[i] + '"'; cubit.cmd(str1)
139 str1='block ' + str(i+1) +' attribute count 2'; cubit.cmd(str1)
140 str1='block ' + str(i+1) +' attribute index 1 '+str(Elastic[count]); cubit.cmd(str1)
141 str1='block ' + str(i+1) +' attribute index 2 '+str(Elastic[count+1]); cubit.cmd(str1)
142 count=count+2
143
144vol=['14', '10,11,12,13']
145mat=['MAT_MOISTURE','MAT_MOISTURE_LOW_DIFF']
146Diff=[0.01, 0.01]
147block_id=3
148for i in range(0, 2):
149 cubit.cmd('set duplicate block elements on')
150 str1='block ' + str(block_id) +' volume '+vol[i]; cubit.cmd(str1)
151 str1='block ' + str(block_id) +' name "'+mat[i] + '"'; cubit.cmd(str1)
152 str1='block ' + str(block_id) +' attribute count 1'; cubit.cmd(str1)
153 str1='block ' + str(block_id) +' attribute index 1 '+str(Diff[i]); cubit.cmd(str1)
154 block_id=block_id+1
155
156#Surfaces
157cubit.cmd('sideset 101 surface 41 31 34 40 42 27 24') # all -ve boundary surfaces for periodic boundary conditions
158cubit.cmd('sideset 102 surface 43 30 33 39 25 44 28') # all +ve boundary surfaces for periodic boundary conditions
159cubit.cmd('sideset 103 surface 41 31 34 40 42 27 24 43 30 33 39 25 44 28') # all boundary surfaces
160
161cubit.cmd('save as "/Users/zahur/Documents/moFEM/mofem-cephas/mofem_v0.2/users_modules/homogenisation/meshes/Textile_RVE.cub" overwrite')
162
163
164
165