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

« back to all changes in this revision

Viewing changes to examples/rotationalResistance.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
#!/usr/bin/env python
 
2
# encoding: utf-8
 
3
from yade import utils, plot
 
4
o = Omega()
 
5
fr = 0.5;rho=2000
 
6
tc = 0.001; en = 0.7; et = 0.7; o.dt = 0.0002*tc
 
7
 
 
8
r = 0.002
 
9
 
 
10
param = getViscoelasticFromSpheresInteraction(tc,en,et)
 
11
 
 
12
mat1 = O.materials.append(ViscElMat(frictionAngle=fr,mR = 0.05, mRtype = 1, density=rho,**param))
 
13
mat2 = O.materials.append(ViscElMat(frictionAngle=fr,mR = 0.05, mRtype = 2, density=rho,**param))
 
14
 
 
15
oriBody = Quaternion(Vector3(1,0,0),(pi/28))
 
16
 
 
17
id1 = O.bodies.append(sphere(center=[0,0,2*r],radius=r,material=mat1))
 
18
id2 = O.bodies.append(geom.facetBox(center=(0,-16.0*r,-2*r),orientation=oriBody,extents=(r,17.0*r,0), material=mat1,color=(0,0,1)))
 
19
 
 
20
id3 = O.bodies.append(sphere(center=[10*r,0,2*r],radius=r,material=mat2))
 
21
id4 = O.bodies.append(geom.facetBox(center=(10*r,-16.0*r,-2*r),orientation=oriBody,extents=(r,17.0*r,0), material=mat2,color=(0,0,1)))
 
22
 
 
23
o.engines = [
 
24
  ForceResetter(),
 
25
  InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
 
26
  InteractionLoop(
 
27
    [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
 
28
    [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
 
29
    [Law2_ScGeom_ViscElPhys_Basic()],
 
30
  ),
 
31
  NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),
 
32
  PyRunner(command='addPlotData()',iterPeriod=10000, dead = False, label='graph'),
 
33
]
 
34
 
 
35
def addPlotData(): 
 
36
  f1 = [0,0,0]
 
37
  s1 = O.bodies[id1].state.pos[1]
 
38
  s2 = O.bodies[id3].state.pos[1]
 
39
  plot.addData(sc=O.time, fc1=s1, fc2=s2)
 
40
  
 
41
  
 
42
 
 
43
plot.plots={'sc':('fc1','fc2')}; plot.plot()
 
44
 
 
45
from yade import qt
 
46
qt.View()