File: clump-facet.py

package info (click to toggle)
yade 2025.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,308 kB
  • sloc: cpp: 93,298; python: 50,409; sh: 577; makefile: 162
file content (33 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (3)
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
# -*- encoding=utf-8 -*-
O.engines = [
        ForceResetter(),
        InsertionSortCollider([
                Bo1_Sphere_Aabb(),
                Bo1_Facet_Aabb(),
        ]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]),
        NewtonIntegrator(),
]

s1 = sphere((2, 2, 0), 1)
s2 = sphere((-2, 2, 0), 1, fixed=True)
f1 = facet(((0, 0, -2), (0, 0, 2), (+5, 0, 0)), wire=False)
f2 = facet(((0, 0, -2), (0, 0, 2), (-5, 0, 0)), wire=False)
# needs to assign (any) nonzero mass and inertia to facets. Total mass and inertia of clump itself can be assigned independently
f1.state.mass = f2.state.mass = 1
f2.state.inertia = f2.state.inertia = (1, 1, 1)
O.bodies.append((s1, s2))
clumpId, facetsId = O.bodies.appendClumped((f1, f2))
s = O.bodies[clumpId].state
# now we can assign arbitrary inertia of the overall clump
s.mass = 5000
s.inertia = 10000 * Vector3(1, 1, 1)
s.blockedDOFs = 'xyzXY'
O.forces.setPermT(clumpId, (0, 0, 1e1))

O.dt = 5e-5
try:
	from yade import qt
	qt.View()
except:
	pass