polyhedra collison simulation did not work

Asked by lip on 2019-01-20

hello
i was tried to simulation polyhedra collison by many polyhedra in a box, my code is as below:

from yade import pack, polyhedra_utils,plot

polyMat = PolyhedraMat()
O.materials.append(polyMat)

sp=pack.SpherePack()
nSpheres=sp.makeCloud((0,0,0),(2,2,2),rMean=.1,periodic=True)

#replace the sphere with polyhedra
for center,radius in sp:
    # note: new polyhedron for each cycle
    t = polyhedra_utils.polyhedra(polyMat,(radius,radius,radius))
    t.state.pos = center # sets polyhedron position according to sphere position
    O.bodies.append(t)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),Ig2_Facet_Polyhedra_PolyhedraGeom()],
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
   # call the checkUnbalanced function (defined below) every 2 seconds
   PyRunner(command='checkUnbalanced()',realPeriod=2),
   # call the addPlotData function every 200 steps
   PyRunner(command='addPlotData()',iterPeriod=100)
]
O.dt=.5*PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy=True

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
   if unbalancedForce()<.05:
      O.pause()
      plot.saveDataTxt('bbb.txt.bz2')

def addPlotData():
   plot.addData(i=O.iter,unbalanced=unbalancedForce(),**O.energy)

plot.plots={'i':('unbalanced',None,O.energy.keys)}

# show the plot on the screen, and update while the simulation runs
plot.plot()

O.saveTmp()
##end
but when i click the start button, everything dissappear and send me a warn: WARN /usr/local/myYade/trunk/pkg/common/InsertionSortCollider.cpp:242 action: verletDist is set to 0 because no spheres were found. It will result in suboptimal performances, consider setting a positive verletDist in your script.
i don't where is wrong in my code. i would appreciate it if you can help me

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2019-01-20
Last reply:
2019-01-20
Jan Stránský (honzik) said : #1

Hello,
always try to read the very first problem/warning/error. In your case, the output show

WARN yade/pkg/dem/Shop_01.cpp:423 PWaveTimeStep: PWaveTimeStep has not found any suitable spherical body to calculate dt. dt is set to 1.0

so the time step is set to a very large value, making the simulation unstable.

The solution is to set suitable time step manually or using GlobalStiffnessTimeStepper (not sure if it works with polyhedra).

Also instead of clicking "play", you can try "step", which proceed only one time step. It may (or not :-) reveal the problem better.

cheers
Jan

Can you help with this problem?

Provide an answer of your own, or ask lip for more information if necessary.

To post a message you must log in.