Welcome to ask.woodem.org. You may post when you login through your GitHub account.

Missing spheres when generating random-sized clumps

0 votes
asked Apr 17, 2017 by ElaineMun (220 points)

Hi Vaclav, 

I am trying to generate some random-sized clumps in a given BOX. The thickness of all clumps are 0.1m (radius of shpere is 0.025m, so there will be 2 layers of spheres for all clumps in the thickness-direction.) The width and length of clumps are "random". Here is a sketch of clumps I want to generate: 

I used PsdClumpGenerator(psdPts=.... in my script. Then I got warning for PsdSphereGenerator, and got NAN values. I noticed some spheres were missed in some clumps(there were gaps in clumps)

Do you have idea what caused this problem? Thanks!


Best regards,


1 Answer

0 votes
answered Apr 18, 2017 by eudoxos (49,030 points)

Hi Lei,

in fact everything is okay with the simulation. The NaN's are unbalanced force when compresisng the packing, that that is NaN as long as there are no contacts between particles -- later a valid value is there.

Spheres are not missing, but you change their radius for some reason:

for s in Scene.dem.par:
   if s.shape.__class__ == woo.dem.Sphere:
      s.shape.radius = sphereRad
   s.shape.color = 0.1

I tried with bigger slabs (changed the box dimensions) and get this:

In fact you see the rectangular patterns are there, but they have gaps in the middle -- because you changed radius. If you don't assign radius, you get what you probably wanted from the very start:

PsdClumpGenerator uses the geometries you provide as the basis, but scales both positions and radii of sphere, so you get particles which are scaled copies of each other, only with equivalent size distribution respecting the PSD.

As a remark, you are well advised to use the memoizeDir parameter to randomDensePack2, e.g. memoizeDir='.' (current directory). The compaction will be only done once for the same parameter set, which saves you time when you run the script over and over with small modifications.

As another tip, I took the challenge to simplify the code and this is the short variant of the grid generation:

import numpy
def mkClumpGeom(ijk,rad):
    return SphereClumpGeom(centers=(2*rad*numpy.mgrid[0:ijk[0],0:ijk[1],0:ijk[2]].reshape(3,-1).T).tolist(),radii=Vector3i(ijk).prod()*[rad])

# define clumps geometries by simply passing parameters

Hope this helps!


commented Apr 19, 2017 by ElaineMun (220 points)

Hi Vaclav,

Thank you for your help!

I re-assign radius in my script, because I find if I do not re-assign radius forcibly, the radius of sphere will be random, like this:
enter image description here

I want to generate clumps with same radius,like this:
enter image description here

Do you have any suggestion if I want clumps with same radius? Thanks a lot!

Best regards,

commented Apr 21, 2017 by eudoxos (49,030 points)

Eh, what else do you expect, when you assign smooth PSD, than smooth gradation of particle sizes? Read the docs at https://woodem.org/woo.dem.html#woo.dem.PsdClumpGenerator. What you can do is assign step-wise PSD, but spehres will nto be the same size, as equivalent diameters of particles (computed from the configuration) are what matters. If you need something spitting out clumps unscaled, please open an issue at https://github.com/woodem/woo/issues and give me a few days to do it. Cheers, v.

commented Apr 25, 2017 by ElaineMun (220 points)

thank you for your reply and sorry for my late reply(I did not get notifications in my email). I opened an issue here:

thank you so much!

commented May 1, 2017 by eudoxos (49,030 points)

I added in the commit https://github.com/woodem/woo/commit/0efedf297119322fd116e990fec1d3f1d27d3e75 the option to scale clumps by the first sphere's radius. See PsdClumpGenerator.scaleMethod doclumentation for details. I closed the issue report https://github.com/woodem/woo/issues/25 .

Change your code to say something like


(note the step-wise PSD function, which will make all clumps first spheres scale to 0.05m).

HTH, Vaclav


commented May 2, 2017 by ElaineMun (220 points)

Thank you ,I will try to use it!