Identifying clumps from a list of inputs to makeClumpCloud

Asked by Mark S. Bentley on 2020-11-23

Hi all,

I'm running a simulation in which I import a set of pre-defined aggregates (clumps). I use a list of these as input to makeClumpCloud. I would ideally like to check how many of each of these clump types is generated - is there a way to do this?

In concrete terms, I have read a bunch of aggregates using ymport.text() into agg_list and now make clumps from these:

clump_list = []
for agg in agg_list:
   clump = pack.SpherePack()
   [clump.add(sphere.state.pos,sphere.shape.radius) for sphere in agg]

and finally I want to make a cloud including all of these clumps:

numclumps = sp.makeClumpCloud((agg_size/2.,agg_size/2.,0), (xyextent,xyextent,zextent), clump_list, periodic=False, num=maxclumps)

but would like to confirm how many of each of the different aggregate types are being inserted.

Thanks in advance for your help!

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Jérôme Duriez
Last query:
Last reply:
Jérôme Duriez (jduriez) said : #1


Probably the creation of the cloud involves a given processing of your list of pre-defined aggregates, in a given order (browsing source code would help here). Then, knowing the final number of inserted aggregates in the cloud, and knowing that list of pre-defined aggregates, you should be able to sort out how many times each aggregate was inserted.

Note also that YADE Python objects may be added user-created attributes, eg:

b = Body()
b.someAttributeWhichDoesNotNormallyExist = 'SomeLabelWhichCouldBeUsefulToMeLaterOn' # useful maybe to distinguish between your different pre-defined aggregates ?

won't throw any error.
And you can re-catch b.someAttributeWhichDoesNotNormallyExist later on, checking which label is stored inside. I have no idea how such user-created attributes would survive through your workflow of cloud creation, but maybe that could be another idea to check

Mark S. Bentley (msbentley) said : #2

Hi Jérôme,

Thanks - I found, I think, the relevant part of the code: but my C++ is pretty much non-existent ;-)

Indeed when I create clumps I can give them a property, but as far as I can see this does not come out of makeClumpCloud again.

In any case I can probably "re-find" the identify after the simulation, by calculating some property like the average distance from the centre, which should be unique for each one, but it is more work than knowing it up front.

Best Jérôme Duriez (jduriez) said : #3

If your list of pre-defined aggregates include 3 elements, let say aggregates 0, 1 and 2, and if you define a cloud of clumps with 5 clumps, I would bet you eventually have:

- aggregate 0 two times
- aggregate 1 two times
- aggregate 2 just once.

(since I'm expecting the chronology of insertion to be 0 - 1 - 2 - 0 - 1)

Maybe you can check this

Mark S. Bentley (msbentley) said : #4

In the end I did some "post analysis" to compare the number of each aggregate in the simulation, resulting in:

149 aggregates match input agg
154 aggregates match input agg
159 aggregates match input agg
155 aggregates match input agg
162 aggregates match input agg
141 aggregates match input agg
152 aggregates match input agg
155 aggregates match input agg
165 aggregates match input agg
174 aggregates match input agg
171 aggregates match input agg
165 aggregates match input agg
145 aggregates match input agg
156 aggregates match input agg
148 aggregates match input agg
149 aggregates match input agg

So for now I have a solution. But when I have time I'll play more with the smal test case, as above, and report back.