3
from yade import utils, plot
8
tc = 0.001; en = 0.3; et = 0.3; o.dt = 0.02*tc
10
param = getViscoelasticFromSpheresInteraction(tc,en,et)
11
mat1 = O.materials.append(ViscElMat(frictionAngle=fr, density=rho,**param))
13
spheresID = O.bodies.append(pack.regularHexa(pack.inCylinder((0,0,-2.0),(0,0,2.0),2.0),radius=0.2,gap=0.1,color=(0,1,0),material=mat1))
15
idWalls = O.bodies.append(geom.facetCylinder(center=(0.0,0.0,0.0),radius = 2.05, height = 4.0, wallMask=6, material=mat1, segmentsNumber = 20, color=(0,0,1)))
16
idTop = O.bodies.append(geom.facetCylinder(center=(0.0,0.0,0.0),radius = 2.05, height = 4.0, wallMask=1, material=mat1, segmentsNumber = 5, color=(1,0,0), wire=False))
21
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()],verletDist=1.0,label='collider'),
23
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
24
[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
25
[Law2_ScGeom_ViscElPhys_Basic()],
27
NewtonIntegrator(damping=0,gravity=[0,0,-9.81],label='newtonInt'),
28
TranslationEngine(translationAxis=[0,0,1],velocity=-2.0,ids=idTop,dead=False,label='translat'),
30
CombinedKinematicEngine(ids=idTop,label='combEngine',dead=True) +
31
ServoPIDController(axis=[0,0,1],maxVelocity=2.0,iterPeriod=1000,ids=idTop,target=1.0e7,kP=1.0,kI=1.0,kD=1.0) +
32
RotationEngine(rotationAxis=(0,0,1), angularVelocity=10.0, rotateAroundZero=True, zeroPoint=(0,0,0)),
33
PyRunner(command='addPlotData()',iterPeriod=1000, label='graph'),
34
PyRunner(command='switchTranslationEngine()',iterPeriod=45000, nDo = 2, label='switchEng'),
43
fMove = Vector3(0,0,0)
46
fMove += O.forces.f(i)
48
plot.addData(z=O.iter, pMove=fMove[2], pFest=fMove[2])
50
def switchTranslationEngine():
51
print "Switch from TranslationEngine engine to ServoPIDController"
53
combEngine.dead = False
57
plot.plots={'z':('pMove','pFest')}; plot.plot()