Debian Codegraph @

examples/granular_gouge.py

raw
1 #############################################################
2 ## ##
3 ## Copyright (c) 2007-2017 by The University of Queensland ##
4 ## Centre for Geoscience Computing ##
5 ## http://earth.uq.edu.au/centre-geoscience-computing ##
6 ## ##
7 ## Primary Business: Brisbane, Queensland, Australia ##
8 ## Licensed under the Open Software License version 3.0 ##
9 ## http://www.apache.org/licenses/LICENSE-2.0 ##
10 ## ##
11 #############################################################
12
13 from __future__ import division
14 from gengeo import *
15
16 def generate_upper_tri_rough_block(NT, G, xt, yt, zt, y0, nr, yr):
17 min = Vector3(0.0,y0,0.0)
18 min_2 = Vector3(0.0,y0+yr,0.0)
19 max = Vector3(xt,y0+yt,zt)
20 xr = xt/(1.0*nr)
21
22 top_plane = Plane (max, Vector3(0,-1,0))
23 bottom_plane_1 = Plane(min, Vector3(0,1,0))
24 bottom_plane_2 = Plane(min_2, Vector3(0,1,0))
25 front_plane = Plane(min, Vector3(0,0,1))
26 back_plane = Plane(max, Vector3(0,0,-1))
27
28 diff = Vector3(1,0,0)
29
30 Box = BoxWithPlanes3D (min_2-diff,max+diff)
31
32 Box.addPlane(top_plane)
33 Box.addPlane(bottom_plane_2)
34 Box.addPlane(front_plane)
35 Box.addPlane(back_plane)
36
37 G.generatePacking(Box,NT,0)
38
39 for i in range(0,nr):
40 x1 = (1.0*i)*xr
41 x2 = (1.0*i+1.0)*xr
42
43 lmin = Vector3(x1,y0,0.0)
44 lmax = Vector3(x2,y0+yr,zt)
45
46 left_plane = Plane (lmin+Vector3(xr/2.0,0.0,0.0), (Vector3(yr,-0.5*xr,0.0)).unit())
47 right_plane = Plane (lmax, Vector3(-1.0*yr,-0.5*xr,0.0).unit())
48
49 RBox = TriBox (lmin,lmax,True)
50 RBox.addPlane(front_plane)
51 RBox.addPlane(back_plane)
52 RBox.addPlane(left_plane)
53 RBox.addPlane(right_plane)
54
55 G.generatePacking(RBox, NT, 0)
56
57 # NT.tagParticlesAlongPlane(top_plane,0.5,3,0)
58 NT.tagParticlesAlongPlane(top_plane,yt,3,0)
59
60 def generate_lower_tri_rough_block(NT, G, xt, yt, zt, y0, nr, yr):
61 min = Vector3(0.0,y0,0.0)
62 max_2 = Vector3(xt,y0+(yt-yr),zt)
63 max = Vector3(xt,y0+yt,zt)
64 xr = xt/(nr)
65
66 top_plane = Plane (max, Vector3(0,-1,0))
67 top_plane_2 = Plane(max_2, Vector3(0,-1,0))
68 bottom_plane = Plane(min, Vector3(0,1,0))
69 front_plane = Plane(min, Vector3(0,0,1))
70 back_plane = Plane(max, Vector3(0,0,-1))
71
72 diff = Vector3(1,0,0)
73
74 Box = BoxWithPlanes3D (min-diff,max_2+diff)
75
76 Box.addPlane(top_plane_2)
77 Box.addPlane(bottom_plane)
78 Box.addPlane(front_plane)
79 Box.addPlane(back_plane)
80
81 G.generatePacking(Box,NT,0)
82
83 for i in range(0,nr):
84 x1 = (1.0*i)*xr
85 x2 = (1.0*i+1.0)*xr
86
87 lmin = Vector3(x1,y0+(yt-yr),0.0)
88 lmax = Vector3(x2,y0+yt,zt)
89
90 left_plane = Plane (lmin, Vector3(yr,-0.5*xr,0).unit())
91 right_plane = Plane (lmax-Vector3(xr/2.0,0.0,0.0), Vector3(-1.0*yr,-0.5*xr,0.0).unit())
92
93 RBox = TriBox (lmin,lmax,False)
94 RBox.addPlane(front_plane)
95 RBox.addPlane(back_plane)
96 RBox.addPlane(left_plane)
97 RBox.addPlane(right_plane)
98
99 G.generatePacking(RBox, NT, 0)
100
101 # NT.tagParticlesAlongPlane(bottom_plane,0.5,4,0)
102 NT.tagParticlesAlongPlane(bottom_plane,yt,4,0)
103
104 def generate_granular_gouge(NT, G, Pmin, Pmax, grmin, grmax, gntry):
105 T_aux = MNTable3D (Pmin, Pmax, 2.1*grmax, 1)
106 G_aux = InsertGenerator3D (grmin, grmax, gntry, 1000, 1.0e-5)
107 V_aux = BoxWithPlanes3D (Pmin, Pmax)
108
109 G_aux.generatePacking(V_aux, T_aux, 0)
110
111 sphere_list = T_aux.getSphereListFromGroup(0)
112
113 ngr = len(sphere_list)
114 NT.GrowNGroups(1+ngr)
115 ggid = 1
116 for ss in sphere_list:
117 S = SphereVol(ss.Centre(), ss.Radius())
118 G.generatePacking(S,NT,ggid)
119 NT.generateBonds(ggid,1.0e-5,1)
120 ggid += 1