File: flat-collider.py

package info (click to toggle)
yade 2026.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,448 kB
  • sloc: cpp: 97,645; python: 52,173; sh: 677; makefile: 162
file content (29 lines) | stat: -rw-r--r-- 1,181 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
# -*- encoding=utf-8 -*-
# this script demonstrates how to benchmark using timingEnabled: how to measure how much time each module takes.
from yade import pack, timing
#O.bodies.append([	sphere((0.2,0,0),.5,fixed=True), sphere((0.2,0.0,1.01),.5), ])
O.bodies.append(pack.regularHexa(pack.inAlignedBox((0, 0, 0), (10, 10, 1)), radius=.5, gap=0, fixed=True))
O.bodies.append(pack.regularOrtho(pack.inAlignedBox((3, 3, 3), (7, 7, 4)), radius=.05, gap=0))
O.engines = [
        ForceResetter(),
        FlatGridCollider(step=.2, aabbMin=(0, 0, 0), aabbMax=(10, 10, 5), verletDist=0.005),
        # InsertionSortCollider([Bo1_Sphere_Aabb()],sweepLength=0.005),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()],
        ),
        NewtonIntegrator(damping=0.4, gravity=[0, 0, -10]),
]
O.dt = .6 * PWaveTimeStep()
O.saveTmp()
#O.step()
#while True:
#	O.step()
#	if len(O.interactions)>0 or O.bodies[1].state.pos[2]<.97: break
print('This will take a while, drink a coffee ;)')
O.timingEnabled = True
O.run(5000, True)
timing.stats()
import sys
#sys.exit(0)