3
""" THIS SCRIPT IS NOT WORKING!
6
Running script ResetRandomPosition.py
7
Traceback (most recent call last):
8
File "/home/me/YADE/YADE3041/bin/yade-bzr3041", line 182, in runScript
9
execfile(script,globals())
10
File "ResetRandomPosition.py", line 31, in <module>
11
plnIds=O.bodies.append(pack.gtsSurface2Facets(pln.faces(),material=facetMat,color=(0,1,0)))
12
File "/home/me/YADE/YADE3041/lib/yade-bzr3041/py/yade/pack.py", line 179, in gtsSurface2Facets
13
return [utils.facet([v.coords() for v in face.vertices()],**kw) for face in surf.faces()]
14
AttributeError: 'tuple' object has no attribute 'faces'
17
from yade import utils,pack,export,qt
20
def Plane(v1,v2,v3,v4):
21
pts = [ [Vector3(v1),Vector3(v2),Vector3(v3),Vector3(v4)] ]
22
return pack.sweptPolylines2gtsSurface(pts,capStart=True,capEnd=True)
25
tc=0.001# collision time
26
en=0.3 # normal restitution coefficient
27
es=0.3 # tangential restitution coefficient
28
frictionAngle=radians(35)#
30
kw=utils.getViscoelasticFromSpheresInteraction(tc,en,es)
31
params=utils.getViscoelasticFromSpheresInteraction(tc,en,es)
33
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,**params))
34
# default spheres material
35
dfltSpheresMat=O.materials.append(ViscElMat(density=density,frictionAngle=frictionAngle,**params))
37
O.dt=.2*tc # time step
39
Rs=0.02 # mean particle radius
40
Rf=0.01 # dispersion (Rs±Rf*Rs)
41
nSpheres=1000# number of particles
44
pln=Plane( (-.5, -.5, 0), (.5, -.5, -.05), (.5, .5, 0), (-.5, .5, -.05) );
45
plnIds=O.bodies.append(pack.gtsSurface2Facets(pln,material=facetMat,color=(0,1,0)))
47
fct=Plane( (-.25, -.25, .5), (.25, -.25, .5), (.25, .25, .5), (-.25, .25, .5) );
48
fctIds=O.bodies.append(pack.gtsSurface2Facets(fct,material=facetMat,color=(1,0,0),noBound=True))
52
sp.makeCloud(Vector3(-.5, -.5, 0),Vector3(.5, .5, .2), Rs, Rf, int(nSpheres), False)
53
spheres=O.bodies.append([utils.sphere(s[0],s[1],color=(0.929,0.412,0.412),material=dfltSpheresMat) for s in sp])
58
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
60
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
61
[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
62
[Law2_ScGeom_ViscElPhys_Basic()],
64
NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),
65
ResetRandomPosition(virtPeriod=0.01,factoryFacets=fctIds,velocity=(0,0,-2),subscribedBodies=spheres,point=(0,0,-.5),normal=(0,0,1),maxAttempts=100),
68
renderer = qt.Renderer()