← Back to team overview

yade-users team mailing list archive

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

 

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

Fu zuoguang gave more information on the question:
Dear Christian Jakob:
     My whole script is as follow:

##/home/fzg/fu/2D-simulation.py### fundamental details of application ###
# unicode: UTF-8 
Filename='2D-simulation-vertex'
from yade import pack,os,utils
import random
from numpy import arange

################################# preprocessing for simulation ##########################################  
### prescribing variables and functions for simulation controller ###
# material defination
clumpsmat = O.materials.append(FrictMat(poisson=0.5,density=2500,young=1e10,frictionAngle=0.5))
wallmat = O.materials.append(FrictMat(poisson=0.5,density=0,young=1e10,frictionAngle=0))
# walls defination
mn,mx=Vector3(0,0,0),Vector3(0.07,0.07,0.1)
wallids=O.bodies.append(utils.aabbWalls([mn,mx],thickness=.00001,material=wallmat))
# ThreeDTriaxialEngine defination for initial-state determination(the first calculation step)
triax01=TriaxialStressController(
	wall_bottom_id=wallids[2],wall_top_id=wallids[3],
	wall_left_id=wallids[0],wall_right_id=wallids[1],
	wall_back_id=wallids[4],wall_front_id=wallids[5],
	wall_front_activated = False,wall_back_activated = False,
	internalCompaction=False,   
	stressMask=7,
        goal1=30000,
        goal2=30000,
        goal3=30000,
        max_vel=5,
)
# ThreeDTriaxialEngine defination for triaxial compression(the second calculation step)
triax02=TriaxialStressController(
	wall_bottom_id=wallids[2],wall_top_id=wallids[3],
	wall_left_id=wallids[0],wall_right_id=wallids[1],
	wall_back_id=wallids[4],wall_front_id=wallids[5],
	wall_front_activated = False,wall_back_activated = False,
	internalCompaction=False, 
	stressMask = 5,
        goal2=-100,
        goal1=30000,
        goal3=30000,
)
################################# control flow for simulation ##########################################  
# particles generation
def Parameters():  # input some basic parameters for clumps generation
    
    global q,mn,mx,lengX,lengY
    q = (input( "the number of clumps " ) )  
  
    [lengX,lengY] = [(mx[0] - mn[0]),(mx[1] - mn[1])]

def Radius():  # assign radius according to the size of pack area
    
    global NX,NY,radius
    
    if lengX > lengY :

       NX = int ( pow ( 2 * q , 0.5 ) )
       NY = int ( ( lengY / lengX ) * NX )
       rx = lengX / NX ; ry = lengY / NY

       if rx > ry :
          radius = ry * 0.22
       else :
          radius = rx * 0.22

    else:

       NY = int ( pow ( 2 * q , 0.5) )
       NX = int ( ( lengX / lengY ) * NY )
       rx = lengX / NX ; ry = lengY / NY

       if rx > ry :
          radius = ry * 0.22
       else :
          radius = rx * 0.22

    print ('The X-direction is equally divided into {0}'.format(NX) )
    print ('The Y-direction is equally divided into {0}'.format(NY) )
    print ('The radius of clumps desired is {0}'.format(radius) )

def Coor():  # determine the coordinations of each point for generating

    global coorint,coordes
    coorint = [] 
    coordes = [] 

    for i in xrange(q): 
        coorX = lengX / NX * random.randint( 0, NX ) 
        coorY = lengY / NY * random.randint( 0, NY ) 
        coorint.append( [coorX , coorY] )   

        if not coorint[i] in coordes:        
           coordes.append (coorint[i])

    a = len(coorint); b = len(coordes)
    print ('There are {0} clumps desired'.format(a) )
    print ('There are {0} clumps generated'.format(b) ) 

def Unitcells(): # define unitcell for clumps

    global sphereList
    sphereList = []

    for b in coordes:
        coors1 = [ b[0] - radius , b[1] - radius , 0 ]
        coors2 = [ b[0] + radius , b[1] - radius , 0 ]
        coors3 = [ b[0] + radius , b[1] + radius , 0 ]
        coors4 = [ b[0] - radius , b[1] + radius , 0 ]        
        spherepara1 = sphere ( coors1 , radius  )
        spherepara2 = sphere ( coors2 , radius  )
        spherepara3 = sphere ( coors3 , radius  )
        spherepara4 = sphere ( coors4 , radius  )    
        sphere1 = O.bodies.append ( spherepara1 )
        sphere2 = O.bodies.append ( spherepara2 )
        sphere3 = O.bodies.append ( spherepara3 )
        sphere4 = O.bodies.append ( spherepara4 )
        sphereList.append ([sphere1 , sphere2 , sphere3 , sphere4])

def Clumps(): # generate the clumps desired

    for b in sphereList:    
        clump_ids = O.bodies.clump (b)

def material():
   
    for b in O.bodies:
        if b.isClumps:
           O.bodies[b].material = O.material[clumpsmat]

def DOF(): # of course, DOF condition only for 2D simulation

    for b in O.bodies:
        if b.isClump:
           b.state.blockedDOFs = 'zXY'
           
# control flows 
Parameters()
Radius()
Coor()
Unitcells()
Clumps()
DOF()

O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
	triax01,
	NewtonIntegrator(damping=.1),
	PyRunner(command='resultfirst()',iterPeriod=1000)
]
# first step of simulation startting with a correct inheriting for the next step
O.dt = 5e-6

O.run(30000,True)
################################################################################

Now I still have no idea about what you just said some small modifications because there is nothing
wrong when only the gravity condition is supplied. Seeking your help!

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