Two concentric cylinders but subtracting out the inner cylinder

Asked by Kevin on 2020-01-30

I am still having trouble filling in the outer cylinder while leaving inner cylinder empty. I searched the Yade book for usage in predicates but I do not understand how to implement this in my code (specifically Pages 50 and 51 using Boolean algebra to deduct the inner volume from the outer volume leaving an image similar to Image 4.4 but instead of a cylinder-shaped void in a box, I want to have a cylinder -shaped void inside a larger cylinder. I am pretty basic at this and any direction would be greatly appreciated!

Here is the code they gave in the Yade manual...

pred=pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1)
spheres=pack.randomDensePack(pred,spheresInCell=2000,radius=.1,rRelFuzz=.4)

Now the problem I have is how to correctly format my Cylinder_In and Cylinder_Out to allow for the above code to work?

from yade import pack, qt, export

cylinder_outer=O.bodies.append(geom.facetCylinder(center=(0,0,125),radius=70,height=200,segmentsNumber=20,wallMask=7,closeGap=True))

cylinder_inner=O.bodies.append(geom.facetCylinder(center=(0,0,125),radius=30,height=200,segmentsNumber=20,wallMask=7,closeGap=True))

sp=pack.SpherePack()

#These are taken from another code so I commented them out for now...

#diameter=[3.600,3.640,3.680,3.720,3.760,3.800,3.840,3.880,3.920,3.960,4.000,4.040,4.080,4.120,4.160,4.200,4.240,4.280,4.320,
          #4.360,4.400,4.440,4.480,4.520,4.560,4.600,4.640,4.680,4.720,4.760,4.800,4.840,4.880,4.920,4.960,5.000,5.040,5.080,
          #5.120,5.160,5.200,5.240,5.280,5.320,5.360,5.400]

#cum=[0.001,0.002,0.003,0.005,0.007,0.010,0.014,0.019,0.027,0.036,0.048,0.063,0.081,0.103,0.129,0.159,0.193,0.232,0.274,
         #0.320,0.369,0.421,0.473,0.527,0.579,0.631,0.680,0.726,0.768,0.807,0.841,0.871,0.897,0.919,0.937,0.952,0.964,0.973,
         #0.981,0.986,0.990,0.993,0.995,0.997,0.998,1.000]

sp.makeCloud((-10,-10,155),(10,10,195),rMean=2.5,rRelFuzz=2,distributeMass=False)

sp.toSimulation()

yade.qt.Controller()
yade.qt.View()

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
        #HarmonicMotionEngine(A=[0,1.5,0],f=[0,0.3,0],ids=cylinder_inner),
 NewtonIntegrator(gravity=(0,0,-9.81),damping=0.5),
 PyRunner(command='iterations()',realPeriod=2)
]
O.dt=.5*PWaveTimeStep()

#I commented out the Harmonic Motion Engine at the moment

def iterations():
   O.stopAtIter=80000
   export.text('pack.txt')

Thank you in advance!

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2020-01-30
Last reply:
2020-01-30
Jan Stránský (honzik) said : #1

pack.randomDensePack has predicate as a parameter.
You are using makeCloud, which is only initiated in a "box". You need to filter the packing to "crop" particles you don't want:
###
sp=pack.SpherePack()
sp.makeCloud(...)
predicate = pack.inCylinder(paramsOuter) - pack.inCylinder(paramsInner)
sp = pack.filterSpherePack(predicate,sp,returnSpherePack=True) # [1]
sp.toSimulation()
###

cheers
Jan

[1] https://yade-dem.org/doc/yade.pack.html#yade.pack.filterSpherePack

Can you help with this problem?

Provide an answer of your own, or ask Kevin for more information if necessary.

To post a message you must log in.