-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpacking_generate.py
executable file
·144 lines (122 loc) · 6.33 KB
/
packing_generate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
from geotaichi import *
init(arch='gpu', log=False, debug=False, device_memory_GB=3.8)
lsdem = DEM()
lsdem.set_configuration(domain=ti.Vector([26.,26.,32.]),
scheme="LSDEM",
gravity=ti.Vector([0., 0., -9.8]),
search="HierarchicalLinkedCell",
visualize=True)
lsdem.memory_allocate(memory={
"max_material_number": 2,
"max_rigid_body_number": 200000,
"levelset_grid_number": 64155,
"surface_node_number": 127,
"max_plane_number": 6,
"body_coordination_number": [25, 1],
"wall_coordination_number": [3, 6],
"verlet_distance_multiplier": [0.1, 0.3],
"point_coordination_number": [3, 2],
"hierarchical_level": 2,
"hierarchical_size": [0.14155, 14.155],
"compaction_ratio": [0.32, 0.1, 0.17, 0.015],
"wall_per_cell": [3, 6]
})
lsdem.set_solver({
"Timestep": 1e-4,
"SimulationTime": 3.,
"SaveInterval": 0.15
})
lsdem.add_attribute(materialID=0,
attribute={
"Density": 2650,
"ForceLocalDamping": 0.2,
"TorqueLocalDamping": 0.2
})
lsdem.add_template(template={
"Name": "Template1",
"Object": polyhedron(file='/assets/mesh/LSDEM/sand.stl').grids(space=5, extent=4),
"WriteFile": True})
lsdem.add_body_from_file(body={
"FileType": "TXT",
"Template":[{
"Name": "Template1",
"BodyType": "RigidBody",
"File":'BoundingSphere.txt',
"GroupID": 0,
"MaterialID": 0,
"InitialVelocity": ti.Vector([0.,0.,0.]),
"InitialAngularVelocity": ti.Vector([0.,0.,0.])
}]
})
lsdem.create_body(body={
"BodyType": "RigidBody",
"Template":[{
"Name": "Template1",
"GroupID": 0,
"MaterialID": 0,
"InitialVelocity": ti.Vector([0., 0., 0.]),
"InitialAngularVelocity": ti.Vector([0., 0., 0.]),
"BodyPoint": ti.Vector([12.5, 12.5, 11.5]),
"Radius": 10,
"BodyOrientation": [1, 1, -1],
"FixMotion": ["Fix", "Fix", "Fix"]
}]
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([13, 13, 0.]),
"OuterNormal": ti.Vector([0., 0., 1.])
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([13, 13, 32.]),
"OuterNormal": ti.Vector([0., 0., -1.])
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([26, 13, 16]),
"OuterNormal": ti.Vector([-1., 0., 0.])
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([0., 13, 16]),
"OuterNormal": ti.Vector([1., 0., 0.])
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([13, 0., 16]),
"OuterNormal": ti.Vector([0., 1., 0.])
})
lsdem.add_wall(body={
"WallType": "Plane",
"MaterialID": 1,
"WallCenter": ti.Vector([13, 26, 16]),
"OuterNormal": ti.Vector([0., -1., 0.])
})
lsdem.choose_contact_model(particle_particle_contact_model="Linear Model",
particle_wall_contact_model="Linear Model")
lsdem.add_property(materialID1=0,
materialID2=0,
property={
"NormalStiffness": 1e6,
"TangentialStiffness": 1e6,
"Friction": 0.5,
"NormalViscousDamping": 0.05,
"TangentialViscousDamping": 0.05
})
lsdem.add_property(materialID1=0,
materialID2=1,
property={
"NormalStiffness": 1e7,
"TangentialStiffness": 1e7,
"Friction": 0.0,
"NormalViscousDamping": 0.05,
"TangentialViscousDamping": 0.05
})
lsdem.select_save_data(particle=True, surface=True)
lsdem.run()