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

« back to all changes in this revision

Viewing changes to examples/polyhedra/irregular.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
# gravity deposition, continuing with oedometric test after stabilization
 
2
# shows also how to run parametric studies with yade-batch
 
3
 
 
4
# The components of the batch are:
 
5
# 1. table with parameters, one set of parameters per line (ccc.table)
 
6
# 2. utils.readParamsFromTable which reads respective line from the parameter file
 
7
# 3. the simulation muse be run using yade-batch, not yade
 
8
#
 
9
# $ yade-batch --job-threads=1 03-oedometric-test.table 03-oedometric-test.py
 
10
#
 
11
 
 
12
 
 
13
# create box with free top, and ceate loose packing inside the box
 
14
from yade import plot, polyhedra_utils
 
15
from yade import qt
 
16
 
 
17
m = PolyhedraMat()
 
18
m.density = 2600 #kg/m^3 
 
19
m.Ks = 20000
 
20
m.Kn = 1E6 #Pa
 
21
m.frictionAngle = 0.6 #rad
 
22
 
 
23
O.bodies.append(utils.wall(0,axis=2,sense=1, material = m))
 
24
 
 
25
t = polyhedra_utils.polyhedra(m,size = (0.06,0.06,0.06),seed = 5)
 
26
t.state.pos = (0.,0.,0.5)
 
27
O.bodies.append(t)
 
28
 
 
29
def checkUnbalanced():   
 
30
   # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
 
31
   print "unbalanced forces = %.5f, position %f, %f, %f"%(utils.unbalancedForce(), t.state.pos[0], t.state.pos[1], t.state.pos[2])
 
32
        
 
33
   
 
34
 
 
35
O.engines=[
 
36
   ForceResetter(),
 
37
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
 
38
   InteractionLoop(
 
39
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
 
40
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
 
41
      [PolyhedraVolumetricLaw()]   # contact law -- apply forces
 
42
   ),
 
43
   #GravityEngine(gravity=(0,0,-9.81)),
 
44
   NewtonIntegrator(damping=0.5,gravity=(0,0,-9.81)),
 
45
   PyRunner(command='checkUnbalanced()',realPeriod=3,label='checker')
 
46
 
 
47
]
 
48
 
 
49
 
 
50
#O.dt=0.025*polyhedra_utils.PWaveTimeStep()
 
51
O.dt=0.00025
 
52
 
 
53
 
 
54
 
 
55
 
 
56
qt.Controller()
 
57
V = qt.View()
 
58
 
 
59
 
 
60
O.saveTmp()
 
61
#O.run()
 
62
#O.save('./done')
 
63
utils.waitIfBatch()