← Back to team overview

yade-users team mailing list archive

[Question #230139]: clumps generating randomly in 2D simulation

 

New question #230139 on Yade:
https://answers.launchpad.net/yade/+question/230139

Dear Jan Stránský and Bruno Chareyre and all users:
     Thanks for helping me yesterday, so there are two methods now for me to get a correct clumps generation in 2D simulation. The first one is that making a generation using PFC2D and then importing the information.txt to YADE. But I failed to get a correct simulation in this way and gave the reason yesterday. So the other way is to generate the clumps directly in YADE with "itertools" in Python. I use the commands below and sucessfully get a 2D clumps in YADE.

from yade import utils,pack,export,qt
import gts,os,random,itertools
from numpy import *

clumpColor=(0, 1, 0)
for k,l in itertools.product(arange(0,40),arange(0,20)):
    clpId,sphId=O.bodies.appendClumped([\
          utils.sphere([k-0.15,l-0.15,0],material=dfltSpheresMat,color=clumpColor,radius=0.15),\
          utils.sphere([k+0.15,l-0.15,0],material=dfltSpheresMat,color=clumpColor,radius=0.15),\
          utils.sphere([k+0.15,l+0.15,0],material=dfltSpheresMat,color=clumpColor,radius=0.15),\
          utils.sphere([k-0.15,l+0.15,0],material=dfltSpheresMat,color=clumpColor,radius=0.15)\
    ])

Of course, there are two steps for generating in this way. The first steps is to define a "unit cell of clumps", which can be comprised by a number of spheres with specific coordinates and radii that can be determined as required(just like that I employed four spheres to form this cell in script).The second steps is to do a loop operation for generate clumps using the orders "for k,l in itertools.product(arange(0,40),arange(0,20)):". The number of generation in X Direction is 40 and in Y Direction is 20.

I think this method can be sucessfully used but is not suitable for me for this is a rule generation method but I wanna get a random generation.

My expectation can described as that: after the "unit cell" defination finished, I want to get all clumps with random positions in specific region, just like that "SpherePack in cellbox". In other words, I want to employ some other ways just in my second steps working to replace the rule generation into the random generation. As you know, I tested the class "sp.makeClumpCloud" to do this but failed(this class can only be used in 3D simulation).How can I do this. Seeking your help!



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