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

hi,
I am a new user of yade and i am going to model a box in which some particles 
deposit. then I delete particles upper than a predefined elevation and add some 
fine particles. then I delete these fines upper than that elevation too. after 
that, I  add a plate on top and define a velocity up to a specific load. set 
the  velocity of the plate to zero (fix place) and then let sidewalls to rotate 
around the Y axis with a fixed angVel.
here is my problem,
when I use "plate.state.vel" it says that "Nonetype object has no  attribute 
state"
and when I use rotationengine and translationengine it shows an error and do 
not proceed.
as I am not so experienced in running yade, changing the script in many ways 
made me frustrated. I will be so grateful if anyone helps me.
furthermore, It sometimes stops running with this error
"segmentation fault (core dumped)" what is the reason
here is my script


overburden=10
from yade import pack,plot,qt
idmat=O.materials.append(FrictMat(density=2700,young=1e6,poisson=0.5,frictionAngle=0))
O.bodies.append(utils.wall(position=0,axis=2,sense=1))
O.bodies.append(utils.wall(position=0,axis=1,sense=1))
O.bodies.append(utils.wall(position=0.01,axis=1,sense=-1))
O.bodies.append(utils.wall(position=0,axis=0,sense=1))
LW=O.bodies[-1]
O.bodies.append(utils.wall(position=0.01,axis=0,sense=-1))
RW=O.bodies[-1]
sp=pack.SpherePack()
sp.makeCloud((0,0,0.001),(0.01,0.01,0.02),rMean=.0008,rRelFuzz=0)
sp.toSimulation(color=(0,0,1)) # blue

O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Wall_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        GravityEngine(gravity=(0,0,-9.81)),
        NewtonIntegrator(damping=0.4),
        qt.SnapshotEngine(fileBase='3d-',iterPeriod=100000,label='snapshot'),
        PyRunner(command='unbalancedData()',iterPeriod=30000),
        PyRunner(command='checkUnbalanced()',realPeriod=1,label='checker'),
]

O.dt=1e-6

def checkUnbalanced():
        if O.iter<500000: return
        if utils.unbalancedForce()>.08: return
        for b in O.bodies:
                if isinstance(b.shape,Sphere):
                        if (b.state.pos[2]+b.shape.radius)>0.007: 
O.bodies.erase(b.id)
        fines=pack.SpherePack()
        fines.makeCloud((0,0,0.007),(0.01,0.01,0.01),rMean=.0004,rRelFuzz=0)
        fines.toSimulation()
        O.engines=O.engines+[GravityEngine(gravity=(0,0,-9.81),mask=-1)]
        checker.command='addfines()'

def addfines():
        if O.iter<650000: return
        if utils.unbalancedForce()>.08: return
        for b in O.bodies:
                if isinstance(b.shape,Sphere):
                        if (b.state.pos[2]+b.shape.radius)>0.007: 
O.bodies.erase(b.id)
        posi=O.bodies[5].state.pos[2]+O.bodies[5].shape.radius
        m=5
        while m in range(len(O.bodies)):
                b=O.bodies[m]
                try:
                        if isinstance(b.shape,Sphere):
                                posi2=b.state.pos[2]+b.shape.radius
                                if posi2>=posi: posi=posi2
                                m=m+1
                except: m=m+1
        O.bodies.append(utils.wall(position=posi,axis=2,sense=-1)) 
        global plate
        plate=O.bodies[-1]
        
O.engines=O.engines[:4]+[TranslationEngine(ids=plate,translationAxis=(0,0,1),velocity=0.002,label="transEngine")]+O.engines[4:]
   #here is the problem
        checker.command='shearing()'
        O.materials[0].frictionAngle=.5 
        for i in O.interactions: i.phys.tangensOfFrictionAngle=tan(.5)

def shearing():
        if abs(O.forces.f(plate.id)[2])<overburden: return
        transEngine.velocity=0
        
O.engines=O.engines[:5]+[RotationEngine(ids=[LW,RW],angularVelocity=0.005,rotationAxis=(0,1,0),label="rotEngine")]+O.engines[5:]
      #and here too
        checker.command='stopShearing()'

def stopShearing():
        if O.bodies[3].state.rot<(0,0.005,0): return
        O.pause()
        utils.makeVideo(snapshot.snapshots,'3dshear.mpeg',fps=10,bps=10000)
        print 'Finished'

def unbalancedData():
        plot.addData(itperi=O.iter,unbalanced=utils.unbalancedForce())
        
plot.plots={'itperi':('unbalanced',)}
plot.plot() 

Gl1_Sphere.stripes=True
qt.View()

rr=yade.qt.Renderer()
rr.shape=True
O.saveTmp()


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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to