← Back to team overview

yade-users team mailing list archive

Re: [Question #255437]: Periodic random packing of spheres in a cube

 

Question #255437 on Yade changed:
https://answers.launchpad.net/yade/+question/255437

    Status: Answered => Open

skonda2 is still having a problem:
Hi Jan,

There was no indentations in your previous reply, i guess in this forum it is difficult to do it. If possible, you can possibly mail me the script at "skonda2@xxxxxxxxxxx". 
I did run the script with proper indentations  and got some output. So, i believe the pos and radius that is generated is of the spheres that are on the edges with their periodic images.
I generated script for y direction and have attached the script below, do you think there is anything wrong?

#script for edge particles in y-direction
from yade import pack
pack.randomPeriPack(1,(10,10,10)).toSimulation()
O.step() # to initialize bounding boxes
yImages = [] # list of "edge" particles
for b in O.bodies:
	ymin,ymax = O.cell.wrap(b.bound.min)[1], O.cell.wrap(b.bound.max)[1] # wrap is important as physically the particles can be anywhere
	if ymin > ymax: # this means that bounding box crosses pariodic cell. You can define various different conditions..
		yImages.append(b)
pr = [[O.cell.wrap(b.state.pos),b.shape.radius] for b in yImages] # list or [pos,radius] of "edge" particles. Now pos is always inside the cell

for i,(pos,r) in enumerate(pr):
	shift = Vector3(0,O.cell.size[1],0) * (1 if pos[1]<.5*O.cell.size[1] else -1) # determine shift to create a periodic image. +y... direction if particles is near -y face and vice versa
	pr[i][0] += shift

# saves images into a file
f = open("/home/konda/yimages_1.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()

Similarly, i generated script for z direction. So now, i have position and radius of all spheres near the boundaries in x,y,z directions. Now, i also exported the pos n radius of spheres which are already in simulation. So in total, there are pos and radius of all the "spheres in simulation" and "ghost" spheres.
I tried to visualize the whole packing, and found that there are some overlapping spheres, may there is something wrong with the program am using for y and z directions. Let me know, what you think.

I guess am beginning to understand the periodic conditions, being from
FEM background i was under the impression that periodic random packing
would mean it would generate packing including those close to the edges
with their periodic images. I was also working on molecular dynamics
based hard sphere packing, which includes those spheres on the edges and
the copy of them. Thanks for your detailed explanation.

So, in "yade" post- processing we see those "ghost" particles which is
the sort of packing am looking for and very similar to what we have it
in FEM and molecular dynamics simulation. Just to put in perspective, am
trying to carry out high level CFD calculations on that sort of packing
structures. So for now, my objective is to get packing structure
(including "ghost" spheres) in yade  and export there position and
radius.

-Shailesh

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.