After deletion of particles, why the output of particle number remains unchanged
Hi all,
In my case, I want to simulate the progressive loss of fine particles in the soil assembly, the code for this case is attached as follows. After running 1000 steps, we can see the fines indeed get lost from the visualization. However, when using command "len(O.bodies)" in the terminal, we get the particle number remains unchanged. i.e. n=400. How can I monitor and output the instaneous particle number during simulation? Thanks very much!
Best,
Zheng
################# the code as follows #######
from yade import pack,plot,qt,export
import matplotlib.pyplot as plt
import numpy as np
import random
#O.materials.
O.materials.
sigmaIso=-1e5
sp = pack.SpherePack()
size =0.24
sp.makeCloud(
#sp.makeCloud(
# if minCorner[
sp.toSimulation()
O.cell.hSize = Matrix3(size,0,0, 0,size,0, 0,0,.1) # used for periodic boundaries.
#print len(O.bodies)
for p in O.bodies:
p.state.
p.state.mass = 2650 * 0.1 * pi * p.shape.radius**2 # 0.1 = thickness of cylindrical particle
inertia = 0.5 * p.state.mass * p.shape.radius**2
p.state.inertia = (.5*inertia,
O.dt = utils.PWaveTime
print O.dt
O.engines = [
ForceResetter(),
InsertionSor
InteractionLoop(
[
[
[
),
PeriTriaxCon
dynCell=True,
goal=
stressMask=3,
relStress
maxUnbala
maxStrain
doneHook=
label='biax'
),
NewtonIntegr
PyRunner(
PyRunner(
#PyRunner(
#PyRunner(
#PyRunner(
]
plot.live=True
plot.plots=
def addPlotData():
plot.addData(
iter=
sxx=
exx=
Z=avgNumInt
Zm=
poro=
unbalanced=
t=O.time
)
plot.
"""
# delete fines by percent
def delBelowPerc():
bodyRadius=[]
for b in O.bodies:
if b.shape.
#if isinstance(
bodyRadiu
bodyRadius.
if len(bodyRadius)>1:
maxRad=
for b in bodyRadius:
if b[0].shape.
O.
"""
def delByNum():
setContactFr
bodyRadius=[]
for b in O.bodies:
if b.shape.
#if isinstance(
bodyRadiu
bodyRadius.
l=len(
perc=0.1
delNum=
list=
for b in list:
O.bodies.
print 'delete fines'
#biax.
"""
def deleteFines():
#new added here by Zheng 0422
bodiesToBeDe
for b in O.bodies:
if b.shape.
bodiesToBe
for b in bodiesToBeDeleted:
O.bodies.
#new added here by Zheng 0422
def term0():
print getStress()
biax.
biax.
def term1(): # delete a determined percent of fines after consolidation and then reconsolidation
bodyRadius=[]
for b in O.bodies:
if b.shape.
#if isinstance(
bodyRadiu
bodyRadius.
l=len(
perc=0.3
delNum=
list=
for b in list:
O.bodies.
# output PSD
psd = utils.psd(
print psd[0],psd[1] # lists of bins' sizes; cumulative percent of material
plt.
#plt.show()
plt.
fpsd=
fpsd.
fpsd.
fpsd.close()
biax.
"""
def coh():
O.engines[
print 'add cohesion'
biax.
# for biaxial shear below:
def shear():
print getStress()
#setContactF
# set the current cell configuration to be the reference one
O.cell.
biax.
biax.
# strain rate along y-axis is 0.01, use a larger x-axis strain rate to better maintian stresses
biax.
biax.
biax.
print 'shearing'
biax.
def biaxFinished():
print 'Biaxial Test Finished'
O.pause()
"""
def term():
O.engines = O.engines[
print len(O.bodies)
print getStress()
print O.cell.hSize
setContactFr
O.cell.
O.cell.
for p in O.bodies:
p.state.vel = Vector3.Zero
p.
p.
p.
O.save(
O.pause()
"""
O.run(1000)
O.wait()
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Robert Caulk
- Solved:
- Last query:
- Last reply: