Positioning a cylinder

Asked by drasszkusz

Hi all!

I would like to make a rotary drum. My first idea was to make it with facet.Cylinder command.

My questions are:
1. How can I make that the center line of the drum to be parallel to the x-axis not z-axis?
2. I would like to lift one end, so the drum's axis close some angle with x-axis. How should I do it?
3. Should I use a different command for making a cylinder?

Thanks,
Daniel

Here is a simple code:

from yade import pack, qt

readParamsFromTable(n=1,dens=2092,frict=40.3,E=4e5,coh=1e4,eta=.05)
from yade.params.table import *

#szemcses anyag adatai
particlematerial=CohFrictMat(young=E,poisson=.2,density=dens,frictionAngle=radians(frict),normalCohesion=coh,shearCohesion=coh,momentRotationLaw=True,etaRoll=eta,etaTwist=eta)
O.materials.append(particlematerial)

#sampling
sampling=.01 #second

omega=2*pi*n

#rotary drum material
id_Mater=O.materials.append(FrictMat(young=200e9,poisson=.3,density=7750,frictionAngle=.7))
Mater=O.materials[id_Mater]

#rotary drum geometry
drum=O.bodies.append(geom.facetCylinder((0,0,0),radius=1,height=2,orientation=Quaternion((1,0,0),0),segmentsNumber=10,wallMask=4,color=(.3,.3,.3)))

#generating particles
sp=pack.SpherePack()
sp.makeCloud((-.1,-.1,.1),(.1,.1,.6),rMean=.02,rRelFuzz=0)
sp.toSimulation(material=particlematerial, color=(1,1,1))

#Engines
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(label="cohesiveIp")],
  [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(
   useIncrementalForm=True,
   always_use_moment_law=True,
   label='cohesiveLaw')]
 ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=.5),
   RotationEngine(rotateAroundZero=True,zeroPoint=(0,0,0),rotationAxis=(0,0,1),angularVelocity=omega, ids = drum),
   PyRunner(command='start()',realPeriod=2,label='checker'),

]

O.dt=.001*PWaveTimeStep()
O.step()

def start():
   if O.iter<1: return
   O.engines[2].lawDispatcher.functors[1].always_use_moment_law = True
   O.engines[2].physDispatcher.functors[1].setCohesionOnNewContacts = True
   checker.command='stop()'

def stop():
    if O.time<10: return
    O.pause()

O.saveTmp()
v=qt.View()
v.eyePosition=(0,-3,.5);v.upVector=(0,0,1);v.viewDir=(0,3,.5)

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
drasszkusz (drasszkusz) said :
#1

1. and 2. and 3. questions solved. Not really understood quaternion before.
drum=O.bodies.append(geom.facetCylinder((0,0,0),radius=1,height=2,orientation=Quaternion((1,0,0),pi/2),segmentsNumber=10,wallMask=4,color=(.3,.3,.3)))
RotationEngine(rotateAroundZero=True,zeroPoint=(0,0,0),rotationAxis=(0,1,0),angularVelocity=omega, ids = drum)

One question remained, if I use orientation=Quaternion((1,0,0),pi/4) then how to calculate the rotation axis of the Rotation engine?

Thanks,
Daniel

Revision history for this message
Best Jan Stránský (honzik) said :
#2

> One question remained, if I use orientation=Quaternion((1,0,0),pi/4) then how to calculate the rotation axis of the Rotation engine?

try (not tested)
quaternion * originalAxis
i.e.
Quaternion((1,0,0),pi/4) * Vector3(0,0,1)

cheers
Jan

Revision history for this message
drasszkusz (drasszkusz) said :
#3

Theory tested, thanks Jan! :)

Daniel

Revision history for this message
drasszkusz (drasszkusz) said :
#4

Thanks Jan Stránský, that solved my question.