← Back to team overview

yade-users team mailing list archive

Re: [Question #691171]: add uniform fibers to the cylinder-shape specimen

 

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

    Status: Answered => Open

onyourself is still having a problem:
Hi Jan,

sorry for the late reply.

> Do you want the directions to be random with uniform distribution, or
just "some randomness" is ok?

the former, random directions and uniform distribution. although i think
the difference between both may be not much.

> I check the links and this code is almost what i want.

 #########
def randomOrientation(): # most likely not very well random, but for this example it is ok
   from random import random as r
   return Quaternion((r(),r(),r()),2*pi*r())

# create loose spherical packing using makeCloud
sp = yade.pack.SpherePack()
mi,ma = (0,0,0),(20,20,20)
nCyls,nSphs = 40,30
sp.makeCloud(mi,ma,rMean=2,rRelFuzz=.5,num=nCyls) # makeCloud for cylinders
sp.makeCloud(mi,ma,rMean=1,rRelFuzz=.5,num=nSphs) # makeCloud for spheres
for i,(pos,radius) in enumerate(sp):
   if i < nCyls: # add cylinder
      ori = randomOrientation()
      extents = (radius,.1*radius,.1*radius)
      O.bodies.append(box(pos,extents,ori))
   else: # add sphere
      O.bodies.append(sphere(pos,radius))
##########

but there are still questions:
1)i try to increase the number of spheres and change cubic size, while error occurs "Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 15 spheres were added, although you requested 500." and box turns out to be different sizes, i mean two kinds of size with big difference, nothing about relFuzz.

2)it seems that cylinders(box actually) take up the whole cubic
space(depending on the longest edge) so that no sphere appears around
the cylinder within cubic space, this is not what i want.

i am still working on the "for" part of the code, its a little confusing
to me.

thanks a lot.
xxxe

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.