~ubuntu-branches/ubuntu/trusty/yade/trusty

« back to all changes in this revision

Viewing changes to examples/polyhedra/ball.py

  • Committer: Package Import Robot
  • Author(s): Anton Gladky, cf3f8d9
  • Date: 2013-10-30 20:56:33 UTC
  • mfrom: (20.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20131030205633-1f01r7hjce17d723
Tags: 1.05.0-2
[cf3f8d9] Pass -ftrack-macro-expansion=0 only if gcc>=4.8. (Closes: #726009)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from yade import plot, polyhedra_utils
 
2
from yade import qt
 
3
 
 
4
m = PolyhedraMat()
 
5
m.density = 2600 #kg/m^3 
 
6
m.Ks = 20000
 
7
m.Kn = 1E6 #Pa
 
8
m.frictionAngle = 0.6 #rad
 
9
 
 
10
maxLoad = 3E6
 
11
minLoad = 1E3
 
12
 
 
13
O.bodies.append(utils.wall(0,axis=2,sense=1, material = m))
 
14
 
 
15
t = polyhedra_utils.polyhedralBall(0.025, 100, m, (0,0,0))
 
16
t.state.pos = (0,0,0.5)
 
17
O.bodies.append(t)
 
18
 
 
19
def checkUnbalanced():   
 
20
  print "unbalanced forces = %.5f, position %f, %f, %f"%(utils.unbalancedForce(), t.state.pos[0], t.state.pos[1], t.state.pos[2])
 
21
        
 
22
   
 
23
 
 
24
O.engines=[
 
25
   ForceResetter(),
 
26
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
 
27
   InteractionLoop(
 
28
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
 
29
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
 
30
      [PolyhedraVolumetricLaw()]   # contact law -- apply forces
 
31
   ),
 
32
   #GravityEngine(gravity=(0,0,-9.81)),
 
33
   NewtonIntegrator(damping=0.5,gravity=(0,0,-9.81)),
 
34
   PyRunner(command='checkUnbalanced()',realPeriod=3,label='checker')
 
35
]
 
36
 
 
37
 
 
38
#O.dt=0.025*polyhedra_utils.PWaveTimeStep()
 
39
O.dt=0.00025
 
40
 
 
41
 
 
42
qt.Controller()
 
43
V = qt.View()
 
44
 
 
45
 
 
46
O.saveTmp()
 
47
#O.run()