Identifying clumps from a list of inputs to makeClumpCloud

Asked by Mark S. Bentley

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]
   clump_list.append(clump)

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

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

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

Revision history for this message
Mark S. Bentley (msbentley) said :
#2

Hi Jérôme,

Thanks - I found, I think, the relevant part of the code: https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/SpherePack.cpp 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.

Revision history for this message
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

Revision history for this message
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 BAM2.256.1.targ.xyz
154 aggregates match input agg BAM2.256.2.targ.xyz
159 aggregates match input agg BAM2.256.3.targ.xyz
155 aggregates match input agg BAM2.256.4.targ.xyz
162 aggregates match input agg BAM2.256.5.targ.xyz
141 aggregates match input agg BAM2.256.6.targ.xyz
152 aggregates match input agg BAM2.256.7.targ.xyz
155 aggregates match input agg BAM2.256.8.targ.xyz
165 aggregates match input agg BAM2.256.9.targ.xyz
174 aggregates match input agg BAM2.256.10.targ.xyz
171 aggregates match input agg BAM2.256.11.targ.xyz
165 aggregates match input agg BAM2.256.12.targ.xyz
145 aggregates match input agg BAM2.256.13.targ.xyz
156 aggregates match input agg BAM2.256.14.targ.xyz
148 aggregates match input agg BAM2.256.15.targ.xyz
149 aggregates match input agg BAM2.256.16.targ.xyz

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.