File: facet-sphere.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 (51 lines) | stat: -rw-r--r-- 1,392 bytes parent folder | download | duplicates (2)
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
# -*- encoding=utf-8 -*-
# © Václav Šmilauer <eudoxos@arcig.cz>
#
# Test case for sphere-facet interaction.
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        #SpatialQuickSortCollider(),
        InteractionLoop(
                [Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()],
        ),
        NewtonIntegrator(damping=0.01, gravity=[0, 0, -10]),
]

O.bodies.append([facet([[-1, -1, 0], [1, -1, 0], [0, 1, 0]], fixed=True, color=[1, 0, 0]),
                 facet([[1, -1, 0], [
                         0,
                         1,
                         0,
                 ], [1, .5, .5]], fixed=True)])

import random
for i in range(0, 100):
	s = sphere([random.gauss(0, 1), random.gauss(0, 1), random.uniform(1, 2)], random.uniform(.02, .05))
	s.state.vel = Vector3(random.gauss(0, .1), random.gauss(0, .1), random.gauss(0, .1))
	O.bodies.append(s)

O.dt = PWaveTimeStep()
O.run()
O.saveTmp('init')

if 0:
	from yade import qt
	renderer = qt.Renderer()
	renderer['Interaction_geometry'] = True
	qt.Controller()
#except ImportError: pass
O.saveTmp()
O.loadTmp()

if 0:
	O.timingEnabled = True
	from yade import timing
	for i in range(4):
		timing.reset()
		O.loadTmp('init')
		O.run(100000, True)
		timing.stats()
	quit()