← Back to team overview

yade-users team mailing list archive

Re: [Question #702505]: How to solve particle overlap?

 

Question #702505 on Yade changed:
https://answers.launchpad.net/yade/+question/702505

    Status: Needs information => Open

孙灿 gave more information on the question:
I didn't make myself clear. In a two-dimensional rectangular plane composed of particles, I need to delete particles in a circular range first,
And fix the remaining particles. I use b.state blockedDOFs='zxy',b.state. vel=(0,0,0),b.state. Angvel= (0,0,0) to fix. In the second step, you need to add some particles, using o.bodies Append adds some particles.

>the particles to be deleted were not completely removed
I observed it through the 3D rendering in the console. When there are many deleted particles, and after adding new particles, the deleted particles are still not completely deleted.

The code is as follows:
from yade import pack,plot

O.bodies.append(geom.facetBox((0.05, 3, 4), (0.1, 3, 4), wallMask=63))
sp = pack.SpherePack()
sp.makeCloud(Vector3(0.05,0,0),Vector3(0.05,6,8), rMean=0.05, rRelFuzz=0)

sp.toSimulation()


for b in O.bodies:
   if isinstance(b.shape,Sphere):
       b.state.blockedDOFs='ZxY'
       b.shape.color=(0.,0.,1.)
       
circleRadius=0.52
circleCenter = Vector3(0.05,1.5,2)
circleRadius1=0.52
circleCenter1 = Vector3(0.05,4.5,2)
   
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 = 0.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')
                for b in O.bodies:
		    if isinstance(b.shape,Sphere):
                        b.state.blockedDOFs='zxy'
                        b.state.vel=(0,0,0)
                        b.state.angVel=(0,0,0)
                        
                    d = (b.state.pos - circleCenter).norm() # distance of circleCenter and center of "b"
                    d1 = (b.state.pos - circleCenter1).norm() # distance of circleCenter and center of "b"
                    if d < circleRadius :
                   
                       O.bodies.erase(b.id)
                       qiyong()
                       
                       qiyong1()
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)
def qiyong():
                           
        O.bodies.append(sphere(center=(0.05,1.5,2.451), radius=.049, fixed=True,color=(1.,1.,1.)))
        O.bodies.append(sphere(center=(0.05,1.5,1.549), radius=.049, fixed=True,color=(1.,1.,1.)))
        O.bodies.append(sphere(center=(0.05,1.049,2), radius=.049, fixed=True,color=(1.,1.,1.)))
        O.bodies.append(sphere(center=(0.05,1.951,2), radius=.049, fixed=True,color=(1.,1.,1.)))
                  
        O.bodies.append(sphere(center=(0.05,1.9423,2.0880), radius=.049, fixed=True,color=(1.,1.,1.)))
        O.bodies.append(sphere(center=(0.05,1.9167,2.1726), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.8750,2.2506), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.8189,2.3189), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.7506,2.3750), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.6726,2.4167), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.5880,2.4423), radius=.049, fixed=True,color=(1.,1.,1.)))
def qiyong1():
        O.bodies.append(sphere(center=(0.05,1.0577,2.0880), radius=.049, fixed=True,color=(1.,1.,1.)))
        O.bodies.append(sphere(center=(0.05,1.0833,2.1726), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.1250,2.2506), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.1811,2.3189), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.2494,2.3750), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.3274,2.4167), radius=.049, fixed=True,color=(1.,1.,1.))) 
        O.bodies.append(sphere(center=(0.05,1.4120,2.4423), radius=.049, fixed=True,color=(1.,1.,1.)))   
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()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.