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

    Status: Answered => Open

onyourself is still having a problem:
>my randomOrientation most likely is not uniform, just "some randomness"

that works for me too(i didn't figure out way to achieve ‘random
directions and uniform distribution’ so…)

>cylinders (boxes) replaces spheres, so no sphere is generated within
spherical space (not cubic).

replaces?  i don't get it…the code below makes cloud of 40 spheres and
30 spheres first(not adding to simulation),then when i<40, add every box
to bodies,(where are those 40 spheres?),then add 30 spheres to bodies?
Why not adding all 70 spheres to bodies?

>>for i,(pos,radius) in enumerate(sp):
>>O.bodies.append(sphere(pos,radius))


#########
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
cylinder(length=0.012,radius=0.0008,color=[0,0,1],)
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))
##########

1)i need to simulate fiber so i changed a bit then it's not working, cylinders 
are out of space requested before. 
2)i set orientation=Quaternion ((r(),r(),r()),r()) but it turns out cylinders' 
orientation are not random.

my code is below.

#########

from random import random as r

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()),r())

# create loose spherical packing using makeCloud
sp = yade.pack.SpherePack()
mi,ma = (0,0,0),(0.08,0.08,0.08)
nCyls,nSphs = 1000,100000
sp.makeCloud(mi,ma,rMean=0.012,rRelFuzz=.003,num=nCyls) # makeCloud for 
cylinders
sp.makeCloud(mi,ma,rMean=0.0011,rRelFuzz=.0005,num=nSphs) # makeCloud for 
spheres
for i,(pos,radius) in enumerate(sp):
    if i < nCyls: # add cylinder
      
O.bodies.append(geom.facetCylinder(center=(r(),r(),r()),height=0.012,radius=0.0015,orientation=Quaternion(),segmentsNumber=10,wallMask=7))
    else: # add sphere
      #O.bodies.append(sphere())    
      O.bodies.append(sphere(pos,radius))    

##########

thank u soooo much
xxxe

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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to