Question #689434 on Yade changed: https://answers.launchpad.net/yade/+question/689434
Status: Answered => Open weijie is still having a problem: Hi Vasileios, and thank you again. I zoomed in and found that some of the converted particles have some overlapping parts, which seems to be a problem with the conversion. I changed the size of the particles generated in makeCloud and found that the smaller the particles, the more serious the problem. Could you please help to see what went wrong? Best regards, Jie ################## from yade import polyhedra_utils,pack,plot,utils,qt import random import numpy as np #------------------------------------------- #Material n = PolyhedraMat(young=7.2e7,poisson=.2,density=2.5e3) O.materials.append(FrictMat(young=-1,poisson=-1,frictionAngle=radians(0.0),density=2500,label='frictionless')) #------------------------------------------- #Dimensions meanSize = 0.05 wallThickness = 0.5*meanSize distanceToCentre = 0.01 lengthOfBase = 5*meanSize heightOfBase = 12*meanSize #------------------------------------------- #Make Cloud sp=pack.SpherePack() mn,mx=Vector3(-0.5*(lengthOfBase-wallThickness),0.5*meanSize,-0.5*(lengthOfBase-wallThickness)),Vector3(0.5*(lengthOfBase-wallThickness),0.5*heightOfBase,0.5*(lengthOfBase-wallThickness)) #R=sqrt(3.0)*distanceToCentre #sp.makeCloud(mn,mx,R,0,-1,False) sp.makeCloud(mn,mx,psdSizes=[distanceToCentre,2*distanceToCentre],psdCumm=(0.1,1),num=200) def dvalue(vecn1,pp1): dd1=1*(vecn1[0]*pp1[0]+vecn1[1]*pp1[1]+vecn1[2]*pp1[2]) return dd1 for center,radius in sp: # Generate polyhedra color=Vector3(random.random(),random.random(),random.random()) b=polyhedra_utils.polyhedra(material=n,size=(2*radius,radius,radius),color=color) b.state.pos = center #s[0] stores center b.state.ori = Quaternion((random.random(),random.random(),random.random()),random.random()) #s[2] O.bodies.append(b) # Generate PBs aa=[] bb=[] cc=[] dd=[] vs=b.shape.v face2=b.shape.GetSurfaces() id1=0 while id1<len(face2): face11=face2[id1] if len(face11)>2: vec1=vs[face11[2]]-vs[face11[1]]; vec1.normalize() vec2=vs[face11[0]]-vs[face11[1]]; vec2.normalize() #Normalize this object in-place. vects=vec1.cross(vec2); vects.normalize() dvalue2=dvalue(vects,vs[face11[0]]) aa.append(vects[0]) bb.append(vects[1]) cc.append(vects[2]) dd.append(dvalue2) id1=id1+1 chosenR=min(dd)/2 bbb=Body() bbb.aspherical=True wire=False highlight=True bbb.shape=PotentialBlock(k=0.0, r=chosenR, R=0.0, a=aa, b=bb, c=cc, d=np.array(dd)-chosenR, color=b.shape.color) utils._commonBodySetup(bbb, bbb.shape.volume, bbb.shape.inertia,material='frictionless', pos=bbb.shape.position, fixed=False) bbb.state.ori= b.state.ori bbb.state.pos = b.state.pos+Vector3(lengthOfBase,0,0) O.bodies.append(bbb) # Count number of bodies with b.shape=Polyhedra countPol=0 for b in O.bodies: if isinstance(b.shape,Polyhedra): countPol=countPol+1 print("number of Polyhedra = ", countPol) # Count number of bodies with b.shape=PotentialBlock countPBs=0 for b in O.bodies: if isinstance(b.shape,PotentialBlock): countPBs=countPBs+1 print("number of PotentialBlocks = ", countPBs) from yade import qt v=qt.View() v.ortho=True # I activate orthotropic projection, to make visual comparisons easier O.saveTmp() -- 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