How to remove particles from a packing?

Asked by 孙灿

A cuboid with X-axis direction of 0.1, Y-axis direction of 10 and z-axis direction of 10 is filled with particles, and the radius of the particles is 0.05. It is stable under the action of self weight. How to dig out a circle in the stable structure? This circle is required to be on the Y-Z plane?
The code is as follows:
from yade import pack,plot

O.bodies.append(geom.facetBox((0.05, 5, 5), (0.05, 5, 5), wallMask=63))
sp = pack.SpherePack()
sp.makeCloud((0.05, 0, 0), (0.05, 10, 10), rMean=0.05, rRelFuzz=0)
sp.toSimulation()

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                # handle sphere+sphere and facet+sphere collisions
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        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 = 2 * 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')
  # plot.saveGnuplot('bbb') is also possible

# collect history of data which will be plotted
def addPlotData():
 # each item is given a names, by which it can be the unsed in plot.plots
 # the **O.energy converts dictionary-like O.energy to plot.addData arguments
 plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)

# define how to plot data: 'i' (step number) on the x-axis, unbalanced force
# on the left y-axis, all energies on the right y-axis
# (O.energy.keys is function which will be called to get all defined energies)
# None separates left and right y-axis
plot.plots = {'i': ('unbalanced', None, O.energy.keys)}

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

O.saveTmp()

# to see it
from yade import qt
qt.Controller()
qt.View()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said (last edit ):
#1

Hello,

> How to dig out a circle in the stable structure? This circle is required to be on the Y-Z plane?

What does "dig out" mean? Just remove? or some excavation simulation? ... ?

Cheers
Jan

Revision history for this message
孙灿 (suncan) said :
#2

Remove a circle from the stable structure

Revision history for this message
Jan Stránský (honzik) said :
#3

What is "a circle"? How should it be removed (what should be the result)?

To get a good answer, please provide a good question..

Cheers
Jan

Revision history for this message
孙灿 (suncan) said :
#4

First of all, my simulation is that all particles are in a plane, in the Y-Z plane, that is, a layer structure. I want to remove a circle in the middle of the plane and make the particles in the middle of the circle disappear.

Revision history for this message
Best Jan Stránský (honzik) said :
#5

Thanks for clarification.

To remove particles / use only some particles, you have several options.

One is to extract particles and use only those you need in reset simulation or a new simulation.

Another option is to use O.bodies.erase [1].
###
circleCenter = Vector3(1,2,3)
circleRadius = 123
for b in O.bodies:
    d = (b.state.pos - circleCenter).norm() # distance of circleCenter and center of "b"
    if d < circleRadius:
        O.bodies.erase(b.id)
###

Cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BodyContainer.erase

Revision history for this message
孙灿 (suncan) said :
#6

Thank you, Jane

Revision history for this message
孙灿 (suncan) said :
#7

Thanks Jan Stránský, that solved my question.