Particle size distribution curve after particle breaking
Hi ,
This is my last question about particle crushing https:/
I use fragment replace method to simulate particle breaking (the new generation of smaller particles that replace the disappearing broken particle), but I must to observe the evolving of particle size distribution and changing between initial PSD curve and ultimate one.
The x-axis of particle size distribution curve is particle size(Logarithmic coordinates) and y-axis is mass percentage less than a certain particle size.
So how can I plot this curve ?
Thanks
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:
Revision history for this message
|
#1 |
Hello,
I guess you want something like this:
def getRadiusArray():
radii=[]
for b in O.bodies:
if isinstance(
getRadiusArray()
values, base = np.histogram(data, bins=40)
cumulative = np.array(
perc = cumulative/
plt.semilogx(
Cheers,
Robert
Revision history for this message
|
#2 |
**noticed it was missing some stuff**
def getRadiusArray():
....
return radii
radii = getRadiusArray()
values,
Revision history for this message
|
#3 |
Hi Robert:
Thank you for your reply !! But I meet some problems:
I added the code you provided to mine, there seems to be some conflict between plt.show() and plot.plot(), Or my understanding is wrong. Help me plz..
This is my whole code:
readParamsFromT
from yade.params.table import *
from yade import pack, plot
O.bodies.
sp=pack.
sp.makeCloud(
sp.toSimulation()
O.engines=[
ForceResetter(),
InsertionSor
InteractionLoop(
[
[
[
),
NewtonIntegr
PyRunner(
PyRunner(
#PyRunner(
]
O.dt=.5*
#######
def selectBodiesToC
stresses = bodyStressTensors() # e.g. based on overall particle stress
ret = []
for i,stress in enumerate(
if stress[0,0] > 50: # Particle breakage criterion
return ret
def createChildren(b):
p = b.state.pos
r = b.shape.radius
# Particle replacement mode
s1 = sphere(
s2 = sphere(
return s1,s2
def replace():
bodiesToDelete = selectBodiesToC
for i in bodiesToDelete:
if isinstance(
b = O.bodies[i]
#######
#import matplotlib.pyplot as plt
#import numpy as np
#def getRadiusArray():
# radii=[]
# for b in O.bodies:
# if isinstance(
# radii.append(
# return radii
#
#radii=
#values, base = np.histogram(radii, bins=40)
#cumulative = np.array(
#perc = cumulative/
#plt.semilogx(
#plt.show()
#######
def checkUnbalanced():
if O.iter<5000: return
if unbalancedForce
O.bodies.
global plate
plate=
plate.
O.engines=
checker.
def unloadPlate():
if abs(O.forces.
plate.
checker.
def stopUnloading():
if abs(O.forces.
plot.
O.pause()
def addPlotData():
if not isinstance(
plot.
Fz=O.
plot.
plot.plots=
plot.plot()
O.run()
#from yade import utils
#binsSizes, binsProc, binsSumCum= utils.psd(bins=5, mass=True)
waitIfBatch()
Revision history for this message
|
#4 |
This is a good python teaching moment. Good luck ;-)
Le mar. 6 nov. 2018 à 04:43, yangjunjie <
<email address hidden>> a écrit :
> Question #675926 on Yade changed:
> https:/
>
> yangjunjie posted a new comment:
> Hi Robert:
>
> Thank you for your reply !! But I meet some problems:
> I added the code you provided to mine, there seems to be some conflict
> between plt.show() and plot.plot(), Or my understanding is wrong. Help me
> plz..
>
> This is my whole code:
>
> readParamsFromT
> from yade.params.table import *
>
> from yade import pack, plot
> O.bodies.
> sp=pack.
> sp.makeCloud(
> sp.toSimulation()
>
> O.engines=[
> ForceResetter(),
>
> InsertionSortCo
> InteractionLoop(
>
> [Ig2_Sphere_
> [Ip2_FrictMat_
> [Law2_ScGeom_
> ),
> NewtonIntegrato
> PyRunner(
> PyRunner(
> #PyRunner(
>
> ]
> O.dt=.5*
> #######
> def selectBodiesToC
> stresses = bodyStressTensors() # e.g. based on overall particle stress
> ret = []
> for i,stress in enumerate(
> if stress[0,0] > 50: # Particle breakage criterion
> ret.append(i)
> return ret
>
> def createChildren(b):
> p = b.state.pos
> r = b.shape.radius
> # Particle replacement mode
> s1 = sphere(
> s2 = sphere(
> return s1,s2
>
> def replace():
> bodiesToDelete = selectBodiesToC
> for i in bodiesToDelete:
> if isinstance(
> smallest particles that can break
> b = O.bodies[i]
> children = createChildren(b)
> O.bodies.erase(i)
> O.bodies.
>
> #######
> #import matplotlib.pyplot as plt
> #import numpy as np
> #def getRadiusArray():
> # radii=[]
> # for b in O.bodies:
> # if isinstance(
> # radii.append(
> # return radii
> #
> #radii=
> #values, base = np.histogram(radii, bins=40)
> #cumulative = np.array(
> #perc = cumulative/
> #plt.semilogx(
> #plt.show()
> #######
>
> def checkUnbalanced():
> if O.iter<5000: return
> if unbalancedForce
> O.bodies.
> O.bodies if isinstance(
> global plate
> plate=O.bodies[-1]
> plate.state.
> O.engines=
> checker.
>
> def unloadPlate():
> if abs(O.forces.
> plate.state.vel*=-1
> checker.
>
> def stopUnloading():
> if abs(O.forces.
> plot.saveDataTx
> O.pause()
>
> def addPlotData():
> if not isinstance(
> plot.addData(); return
> Fz=O.forces.
>
> plot.addData(
>
> plot.plots=
> plot.plot()
>
> O.run()
> #from yade import utils
> #binsSizes, binsProc, binsSumCum= utils.psd(bins=5, mass=True)
>
> waitIfBatch()
>
> --
> You received this question notification because you are subscribed to
> the question.
>
Revision history for this message
|
#5 |
Thanks Robert Caulk, that solved my question.
Revision history for this message
|
#6 |
I'm sorry, I disagree with your choice to edit the thread after you received help from the community. It may come as a surprise to you, but others will want to use this thread in the future. Therefore, I am going to go ahead and re-post the response that you removed:
>>>>>>>
Hi Robert:
Thank you for your reply !! But I meet some problems:
I added the code you provided to mine, there seems to be some conflict between plt.show() and plot.plot(), Or my understanding is wrong. Help me plz..
This is my whole code:
readParamsFromT
from yade.params.table import *
from yade import pack, plot
O.bodies.
sp=pack.
sp.makeCloud(
sp.toSimulation()
O.engines=[
ForceResetter(),
InsertionSor
InteractionLoop(
[
[
[
),
NewtonIntegr
PyRunner(
PyRunner(
#PyRunner(
]
O.dt=.5*
#######
def selectBodiesToC
stresses = bodyStressTensors() # e.g. based on overall particle stress
ret = []
for i,stress in enumerate(
if stress[0,0] > 50: # Particle breakage criterion
return ret
def createChildren(b):
p = b.state.pos
r = b.shape.radius
# Particle replacement mode
s1 = sphere(
s2 = sphere(
return s1,s2
def replace():
bodiesToDelete = selectBodiesToC
for i in bodiesToDelete:
if isinstance(
b = O.bodies[i]
#######
#import matplotlib.pyplot as plt
#import numpy as np
#def getRadiusArray():
# radii=[]
# for b in O.bodies:
# if isinstance(
# radii.append(
# return radii
#
#radii=
#values, base = np.histogram(radii, bins=40)
#cumulative = np.array(
#perc = cumulative/
#plt.semilogx(
#plt.show()
#######
def checkUnbalanced():
if O.iter<5000: return
if unbalancedForce
O.bodies.
global plate
plate=
plate.
O.engines=
checker.
def unloadPlate():
if abs(O.forces.
plate.
checker.
def stopUnloading():
if abs(O.forces.
plot.
O.pause()
def addPlotData():
if not isinstance(
plot.
Fz=O.
plot.
plot.plots=
plot.plot()
O.run()
#from yade import utils
#binsSizes, binsProc, binsSumCum= utils.psd(bins=5, mass=True)
waitIfBatch()
>>>>>>>
Revision history for this message
|
#7 |
Yes, please, yangjunjie, don't re-write the history of discussions.
I'm also curious why the first part of the question was removed: "This is my last question about particle crushing".
It seems last question on crushing ends up as first question on the additivity of python codes. ;)
Please think twice _before_ posting, not after posting.
Bruno
Revision history for this message
|
#9 |
Turns out, Yade might have a nice built in function for this[1]. I haven't used it myself, but it could be worth trying.
[1]https:/