How to create a regular prism in Yade

Asked by Huang peilun on 2020-01-21

Hi, I just begin to learn Yade.

I'm wondering if there is a function or method to create a regular prism without calculate the coordinates of each vertexes by myself.
And if there is a method to create a cylinder(not a round cylinder).

Thanks in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Huang peilun
Solved:
2020-01-23
Last query:
2020-01-23
Last reply:
2020-01-23
Robert Caulk (rcaulk) said : #1

Hello,

Welcome to yade :-)

I think you will need to be a bit more specific. Are you trying to create a prism to fill with spheres? Or body shaped as a prism?

Same question with the cylinder. Except what exactly is a "not round cylinder"?

Cheers,

Robert

Huang peilun (hpl16) said : #2

I want to create a body shaped as a prism.
By "not round cylinder" I mean not the cylinder for yade.gridpfacet module, I see from the yade book that there is a class yade.wrapper.Cylinder. However, I tried couple of times, I can't create a body shaped as a cylinder by this class.

Thanks.

Jan Stránský (honzik) said : #3

> I want to create a body shaped as a prism.

use box [1]

> I tried couple of times, I can't create a body shaped as a cylinder by this class.

next time please post also what you have tried and why/how it went wrong.
E.g. you can try something like:
###
b=Body()
b.shape=Cylinder()
b.shape.length=1
b.shape.radius=1
O.bodies.append(b)
###

What do you want to do with the cylinder? just that Yade currently (AFAIK) is not able to work reasonably with "pure" cylinders..

cheers
Jan

[1] https://yade-dem.org/doc/yade.utils.html#yade.utils.box

Huang peilun (hpl16) said : #4

Thank you, Jan!
That solved my problem.

I'll post what I have tried and why/how it went wrong.
This time I just use
O.bodies.append(Cylinder(length=1, radius=1))
I didn't figure out what type does the Cylinder class have.

I want to make a penetration test, and I want a cylinder shaped rod to do this.

Here's another question, I want to apply gravity to this cylinder and have contact with spheres, what kind of IGeomFunctor and LawFunctor should I use? Now the current script is as followed. The cylinder just disappeared at the beginning of the simulation.

from yade import pack

O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))

rod=Body()
rod.shape=Cylinder()
rod.shape.length=.5
rod.shape.radius=.2
rod.state.pos=(.5,.5,1.8)
O.bodies.append(rod)

sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=.05,rRelFuzz=.3)
sp.toSimulation()

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Cylinder_Aabb(),Bo1_Facet_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Sphere_ChainedCylinder_CylScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_CylScGeom_FrictPhys_CundallStrack()]
 ),
 # update position using Newton's equations
 NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
 # call the checkUnbalanced function (defined below) every 2 seconds
 PyRunner(command='checkUnbalanced()',realPeriod=2),
]
O.dt=.2*PWaveTimeStep()

def checkUnbalanced():
 if O.forces.f(rod.id)[2]==0: return
 ball.state.blockedDOFs='xyXYZ'
 ball.state.vel=(0,0,2)
 if unbalancedForce()<.05:
  O.pause()

O.saveTmp()

Thanks!

Jan Stránský (honzik) said : #5

> Here's another question

in that case, next time please open a new question [1]

> I want ... this cylinder ... have contact with spheres, what kind of IGeomFunctor and LawFunctor should I use?

that is the point, currently there is none..
Use an approximation of cylinder made of facets or boxes (for facets there is facetCylinder function [2])

cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://yade-dem.org/doc/yade.geom.html#yade.geom.facetCylinder

Huang peilun (hpl16) said : #6

Thank you, Jan!
I'll do better next time.