← Back to team overview

yade-users team mailing list archive

[Question #702353]: Title : Error message : can only concatenate list (not "RotationEngine") to list

 

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

Hello everyone,

I am using a program in which particles rotate in a drum (by the rotation of the drum).

I would like to stop the rotation of the drum at a certain point and rotate with respect to the rotation axis of the drum , only the set of all the particles by a certain angle dtetab for a single time step, in order to get the image of the flow after this rotation( angle dtetab).



The code :

from __future__ import print_function
from yade import qt
from yade import plot
from yade import utils, plot, qt
#************************************************************************************************
#Unité de distance

#Diamètre d'une particule en m

d= 0.008

#Angular Velocity (rd/s)
angVel = 40* (2 * pi / 60)

# Diamètre du tambour 
rD = 0.5*(50*d)

# Diamètre du cylindre intérieur   
rcylint = 0.5*(10*d)

# Profondeur de la cellule 
rP = 10*d


#  hauteur couche supérieure
alpha=0
rh=alpha*(rD-rcylint) #Hauteur de l'empilement de particules ****

#Coefficient de restitution

e= 15/16


#Period (s)
TangVel = 2*pi/angVel

#*********************************************************************************
O.load('RD-make-packing-yade-cconfi1.gz')
#***************************************************************************************************

id_SphereMat= O.materials.append(ViscElMat(young=1*10**6,poisson=0.7,frictionAngle=0.61,en=15/16,et=1,density=2500))
SphereMat = O.materials[id_SphereMat]

id_BMat = O.materials.append(ViscElMat(young=1e5,poisson=0.37,frictionAngle=0.66,en=0.920,et=1,density=1190))
BMat = O.materials[id_BMat]

def unitSquare():
    """Return square composed of 2 facets in the xy plane, centered at zero with unit extents."""
    import gts
    vv = [gts.Vertex(1,1,0), gts.Vertex(1,-1, 0), gts.Vertex(-1,-1,0), gts.Vertex(-1,1, 0)]
    ee = [gts.Edge(vv[0], vv[1]), gts.Edge(vv[1], vv[2]), gts.Edge(vv[2], vv[3]), gts.Edge(vv[3], vv[0]), gts.Edge(vv[0], vv[2])]
    surf = gts.Surface()
    surf.add(gts.Face(ee[0], ee[1], ee[4]))
    surf.add(gts.Face(ee[2], ee[3], ee[4]))
    return surf

def unitCylinder(nDiv=24):
    
    import numpy
    from yade import pack
    thetas = numpy.linspace(0, 2 * pi, nDiv, endpoint=True)
    ptsBase = [Vector3(sin(th),cos(th), -1) for th in thetas]
    ptsTop = [p + Vector3(0,0,2) for p in ptsBase]
    return pack.sweptPolylines2gtsSurface([ptsBase, ptsTop])


from yade import pack, timing
cyl = unitCylinder()
sq1 = unitSquare()
sq1.translate(0,0,-1)
cyl.copy(sq1)
sq2 = unitSquare()
sq2.translate(0,0,1)
cyl.copy(sq2)

cyl.scale(rD,rD,rP)

cylint = unitCylinder()
cylint.scale(rcylint,rcylint,rP)

cylIds = O.bodies.append(pack.gtsSurface2Facets(cyl,material=BMat))
cylintIds = O.bodies.append(pack.gtsSurface2Facets(cylint,material=BMat))
O.dt = 0.95*PWaveTimeStep()

itround=int(TangVel/(O.dt))

O.engines = [
        ForceResetter(),
        InsertionSortCollider([
                Bo1_Sphere_Aabb(),
                Bo1_Facet_Aabb(),
        ]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
                
                [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
                [Law2_ScGeom_ViscElPhys_Basic()] ),
         
              
        RotationEngine(rotateAroundZero=True, zeroPoint=(0, 0, 0), rotationAxis=(0, 0,1), angularVelocity=angVel, ids=cylIds, label='rotor'),
        NewtonIntegrator(damping=0, gravity=(0,-10,0)),  

        PyRunner(command='checkUnbalanced()', realPeriod=2,label='checker'),
]

pi=3.141592654   
dtetab=pi/4
wtetab=dtetab/O.dt

def checkUnbalanced():
    if O.iter<1*itround :
        return
    
    else:
        RotationEngine.dead=True
        for b in O.bodies:
            if isinstance(b.shape,Sphere):
               
                O.engines=O.engines + RotationEngine(rotateAroundZero=True, zeroPoint=(0, 0, 0), rotationAxis=(0, 0,1), angularVelocity=wtetab, ids=[b.id], label='rotation')
                O.stopAtIter=1
                O.save('RDsave-yade-cconfiessai.gz')
                                   
yade.qt.View()               
O.run()



I get this error : can only concatenate list (not "RotationEngine") to list

Can you please help me to solve this error or suggest me another method ? Thanks for your help.

pegbehe



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