Is something going on in the background when pack.randomDensePack() is used?

Asked by Hashir Ahmad

I have written the following code to display a box of particles with walls surrounding it:

walls = aabbWalls([(0,0,0), (3,2,2)], thickness = .1, material = 'walls')
pred = pack.inAlignedBox((0,0,0), (3,2,2))
sp = pack.randomDensePack(pred, spheresInCell = 100, radius = 1.5e-2, rRelFuzz = 0.5/1.5, color = (1, 0.917, 0.659), returnSpherePack=False)
O.reset()
O.bodies.append(sp)
O.bodies.append(walls)

When I execute this and open the 3D model, it displays it but after some time, the window freezes (i.e, it turns black and white). It seems like some thing is happening in the background, because I am not using any simulations right now and just displaying the geometry.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

a working example please :-) I am getting KeyError: "No material labeled `walls'."
thanks
Jan

Revision history for this message
Hashir Ahmad (hash.ir) said :
#2

Sorry for that.

Here you go:
O.materials.append(FrictMat(young=5e6,poisson=0.5,frictionAngle=0,density=0,label='walls'))

Revision history for this message
Jan Stránský (honzik) said :
#3

Thanks,
I think it has nothing to do with randomDensePack, but again with number of particles. Around 500k particles is relatively high number. In my case, e.g. when I rotate the view, the window "shadows", but after a while it turns OK again.
Does it recover also in your case, or does it freeze forever?
Jan

Revision history for this message
Hashir Ahmad (hash.ir) said :
#4

It recovers in my case as well.

But when I play around with spheresInCell, radius or dimension of the predicates, I get an error:
"Unable to shring cell due to maximum body size"

Regards
Hashir

Revision history for this message
Best Jan Stránský (honzik) said :
#5

spheresInCell parameter (despite its name) is irrelevant here (I can elaborate more if you are interested).
What is important is absolute number of particles in the simulation, which is given ba particle radius and predicate size.

the window shadows for the time needed for rendering the scene, which is not negligible for this amount of particles
Jan

Revision history for this message
Hashir Ahmad (hash.ir) said :
#6

Yeah sure!
I would like to know more about it.

Thanks
Hashir

Revision history for this message
Jan Stránský (honzik) said :
#7

randomDensePack has two "modes"

1) (without spheresInCell)
generates randomly all needed spheres compress them around predicate and crop them.
For small number of particles it works ok, but for increasing number it take more and more time and becomes practically impossible to use. I would not like to use it for 500k particles :-)

2) spheresInCell = someValue
uses just relatively few particles (someValue).
Compress this limited number using periodic contact detection resulting in a periodic cube
the resulting compressed packing is periodic, if you copy it by one period to any (axis) direction, the pieces fit together
copy such periodic cube wherever necessary to fill the predicate, and crop to final shape
So it uses (almost) the same time for any predicate size

cheers
Jan

Revision history for this message
Hashir Ahmad (hash.ir) said :
#8

Thanks Jan Stránský, that solved my question.