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

    Status: Answered => Open

nobody is still having a problem:
Hi Robert,

I did as you mentioned.

here is the code:

############
from yade import ymport
from yade import pack,export,geom
import itertools
from numpy import *
import numpy as np
from yade import plot, export, utils
import math
target=0.12
young=4e8
finalcompFricDegree=19.5
rate = 10*(2*pi/60)
############################################# sphere particles material 
properties ########################
sphereMat=O.materials.append(CohFrictMat(young=young,poisson=0.3,frictionAngle=radians(finalcompFricDegree),isCohesive=False,alphaKr=0.2,alphaKtw=0,etaRoll=0.5,momentRotationLaw=True,density=2648))
#O.bodies.append(ymport.text("rotation.txt",material = sphereMat))
O.bodies.append([
        sphere((0.1,0.1,0.1),.03,color=(0,1,0)),
])
################################################ create the penetrator and 
shaft and the cylinder ##############################
facetMat=O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=radians(finalcompFricDegree),density=0))
O.materials.append(FrictMat(young=young,poisson=0.3,frictionAngle=0,density=0,label='walls'))

facets =
O.bodies.append(geom.facetCylinder((200e-3,200e-3,300e-3),200e-3,600e-3,wallMask=6,material='walls',segmentsNumber=100))

x0=0.2;y0=0.2;z0=0.39665
cylinderIDS= O.bodies.append(geom.facetCylinder((x0,y0,z0-0.02),
        radius=0.0125,height=0.15,orientation=Quaternion((0, 0, 1), 
0),wallMask=5,segmentsNumber=10, angleRange=None,material=facetMat))
coneIDS= O.bodies.append(geom.facetCone((x0,y0,z0-0.085825-0.02),
        
radiusTop=0.0125,radiusBottom=0.0,height=0.02165,orientation=Quaternion((0, 0, 
1), 0),wallMask=6,segmentsNumber=10, angleRange=None,material=facetMat))
conecheck=O.bodies[-1].id
################################################  set the global engine for the 
simulation##############################
O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
        InteractionLoop(
                        
[Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom()],
                        
[Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
                                        
[Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True,label='cohesiveLaw')]
        ),
        
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8),
        NewtonIntegrator(gravity=(0,0,-9.81),damping=0.7),
        
HelixEngine(angularVelocity=rate,linearVelocity=-0.05,rotateAroundZero=True,zeroPoint=(x0,y0,z0),rotationAxis=(0,0,1),ids=cylinderIDS,label
 ="cylinderRot"),
        
HelixEngine(angularVelocity=rate,linearVelocity=-0.05,rotateAroundZero=True,zeroPoint=(x0,y0,z0),rotationAxis=(0,0,1),ids=coneIDS,label
 = "coneRot"),
        PyRunner(command='stop_loading()',iterPeriod=10000),
        PyRunner (command ="ossillation_rotation()",iterPeriod = 1),
]

def ossillation_rotation():
        rotationAngle = O.bodies[cylinderIDS].state.rot().norm()
        #rotationAngle = cylinderRot.angleTurned
        #print  cylinderRot.angleTurned
        #if 0 < rotationAngle <= pi:
        if rotationAngle>0  and rotationAngle <=math.pi:
                #angularVelocity = rate
                cylinderRot.angularVelocity=rate
                coneRot.angularVelocity=rate
                #print cylinderRot.angularVelocity,coneRot.angularVelocity
                
O.bodies[cylinderIDS].state.refOri=O.bodies[cylinderIDS].state.ori
                O.bodies[coneIDS].state.refOri=O.bodies[coneIDS].state.ori
        #elif pi < rotationAngle <= 2*pi:
        elif rotationAngle>0 and rotationAngle <= math.pi:
                #angularVelocity = rate
                cylinderRot.angularVelocity=-1*rate
                coneRot.angularVelocity=-1*rate
                #rotationAngle += rate*O.time
                #print cylinderRot.angularVelocity, coneRot.angularVelocity
                #print rotationAngle
                
O.bodies[cylinderIDS].state.refOri=O.bodies[cylinderIDS].state.ori
                O.bodies[coneIDS].state.refOri=O.bodies[coneIDS].state.ori
########################## stop the simulation 
###################################################################
def stop_loading():
        if 
((O.bodies[conecheck].state.pos[2]-O.bodies[conecheck].state.refPos[2])*(-1))>target:
                O.pause()
#O.run()
#O.saveTmp()


But it gives me the error:
ArgumentError: Python argument types in
    BodyContainer.__getitem__(BodyContainer, list)
did not match C++ signature:
    __getitem__(pyBodyContainer {lvalue}, int)


it seems there is a problem for this line:  rotationAngle = 
O.bodies[cylinderIDS].state.rot().norm()

-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to