yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #13722
Re: [Question #404190]: force chain between polyhedrons
Question #404190 on Yade changed:
https://answers.launchpad.net/yade/+question/404190
Status: Open => Answered
Jan Stránský proposed the following answer:
Hi Weimin,
please always specify what does not work. "I tried the code below, however,
it doesn't work" is completely useless information :-) especially without a
complete script..
I tried the following script and it works as expected
######################################################################
from yade import plot, polyhedra_utils
O.materials.append(PolyhedraMat())
mat = O.materials[0]
O.bodies.append(wall(0,axis=2,sense=1))
O.bodies.append(wall(0,axis=1,sense=1))
O.bodies.append(wall(0,axis=0,sense=1))
O.bodies.append(wall(0.3,axis=1,sense=-1))
O.bodies.append(wall(0.3,axis=0,sense=-1))
polyhedra_utils.fillBox((0,0,0),
(0.3,0.3,0.3),mat,sizemin=[0.05,0.05,0.05],sizemax=[0.1,0.1,0.1],seed=4)
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Wall_Polyhedra_PolyhedraGeom(),
Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),
Ig2_Facet_Polyhedra_PolyhedraGeom()],
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
),
NewtonIntegrator(damping=0.3,gravity=(0,0,-9.81)),
PyRunner(iterPeriod=100,command="print O.iter"),
]
O.dt = 1e-3
O.run(2000,True)
from yade import export
export.VTKExporter('/tmp/exportpoly-all').exportInteractions() # ids='all'
is default
intrs = []
for i in O.interactions:
b1 = O.bodies[i.id1]
b2 = O.bodies[i.id2]
if isinstance(b1.shape,Polyhedra) and isinstance(b2.shape,Polyhedra):
intrs.append((i.id1,i.id2))
export.VTKExporter('/tmp/exportpoly-poly').exportInteractions(ids=intrs)
######################################################################
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.