yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #10265
Re: [Question #255437]: Periodic random packing of spheres in a cube
Question #255437 on Yade changed:
https://answers.launchpad.net/yade/+question/255437
Status: Open => Answered
Jan Stránský proposed the following answer:
Hi Shailesh
> What i got is a reasonable packing structure with around 108 spheres and
> also i was able to export the data in the file "konda1". The problem is, i
> do not see any spheres on the boundaries the periodic images in the primary
> view window.
However, when i check the periodic cell in the inspect window or click the
> play button, am able to see the (extra) spheres on the boundaries with
> their periodic images on the opposite sides (wire frame view for spheres
> near boundaries). That is the sort of packing am trying to get.
> I am not sure how to export the position and radii for these set of
> spheres.? I feel am very close to the final objective which is get to
> periodic dense packing of non-overlapping spheres in a cube.
>
the visualization of "edge particles" is some kind of postprocessing. The
particles, whose bounding boxes are close to the edge (I am not sure about
actual implementation) of periodic cell are rendered also as the periodic
images.
If you want to export this, you can try something like (example of images
in x direction):
from yade import pack
pack.randomPeriPack(1,(10,10,10)).toSimulation()
O.step() # to initialize bounding boxes
xImages = [] # list of "edge" particles
for b in O.bodies:
xmin,xmax = O.cell.wrap(b.bound.min)[0], O.cell.wrap(b.bound.max)[0] # wrap
is important as physically the particles can be anywhere
if xmin > xmax: # this means that bounding box crosses pariodic cell. You
can define various different conditions..
xImages.append(b)
pr = [[O.cell.wrap(b.state.pos),b.shape.radius] for b in xImages] # list or
[pos,radius] of "edge" particles. Now pos is always inside the cell
for i,(pos,r) in enumerate(pr):
shift = Vector3(O.cell.size[0],0,0) * (1 if pos[0]<.5*O.cell.size[0] else
-1) # determine shift to create a periodic image. +x direction if particles
is near -x face and vice versa
pr[i][0] += shift
# saves images into a file
f = open("/tmp/ximages.dat","w")
f.write("x y z r\n")
f.writelines("%g %g %g %g\n"%(pos[0],pos[1],pos[2],r) for pos,r in pr)
f.close()
I don't know how well you know Python, so if you found something unclear
(code itself or its meaning), just ask :-)
cheers
Jan
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.