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:
# define clumps geometries by simply passing parameters
Hope this helps!