Re: [Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-24 Thread zheng
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375

Status: Answered => Solved

zheng confirmed that the question is solved:
Thanks Robert Caulk, that solved my question.

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-23 Thread Robert Caulk
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375

Status: Open => Answered

Robert Caulk proposed the following answer:
Why don't you give that a shot and tell us where the difficulties lie?

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-23 Thread zheng
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375

Status: Answered => Open

zheng is still having a problem:
Thanks Caulk and Jan, this solved most of my question. However, deleting
particles by sizes may not be suitable for all cases. For example, how
to delete 10% of particles by number if I only have one particle size?
This time the "percentile(a,q)” may not work. Could you please give me
any clues? Thanks so much.

Best regards,
Zheng

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-23 Thread Jan Stránský
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375

Jan Stránský proposed the following answer:
Hello,

use PyRunner [1]:
###
def getSmallParticles():
   ret = []
   # fill ret with particles satisfying "10% percent of small particles"
   return ret

def deleteSmallParticles():
   for b in getSmallParticles():
  O.bodies.erase(b.id)

O.engines = [
   ...
   PyRunner(iterPeriod=100,command="deleteSmallParticles()"),
]
###

cheers
Jan

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

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-23 Thread Robert Caulk
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375

Status: Open => Answered

Robert Caulk proposed the following answer:
I guess it's a python question.

import numpy as np

def delBelowPercentile(a, q):
maxRad = np.percentile(a,q)
for b in bodyRadius:
   if b[0].shape.radius <= maxRad:
   O.bodies.erase(b[0].id)

bodyRadius = []
for b in O.bodies:
if isinstance(b.shape,Sphere):
bodyRadius.append([b,b.shape.radius])

bodyRadius.sort(key=lambda x: x[1])
delBelowPercentile(bodyRadius,10)

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #680375]: How to delete 10% percent of small particles?

2019-04-22 Thread zheng
New question #680375 on Yade:
https://answers.launchpad.net/yade/+question/680375

Dear all,

I am very new in Yade. In my simulation, I have a polydisperse particle size 
distribution, from size 0.2~1.0mm. Thanks to this poster: 
https://answers.launchpad.net/yade/+question/211937, I now know how to delete 
all particles with a certain diameter or position.

Now I need to delete 10% of the smallest particles (d=0.2mm) every 100 steps, 
but I cannot figure out how to realize this function? Could anyone please give 
me any clues? Thanks so much!

Best regards,
Zheng

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

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp