Plotting force & displacement of impactor in a penetration test

Asked by Swapnil

Hello Jan, Bruno and other Yade mates :)

Referring to my previous question (#657126), my further task now is to find the force experienced by a hammer (trying spherical first) as it penetrates through a granular media (spherical grains packed in a cylinder here) and plot this force on hammer along with the displacement of the hammer.

Currently I have the following script and can get the simulation running but I am trying to proceed further. Please assist.

from yade import pack,plot
pred=pack.inCylinder((0,0,0),(0,0,0.25),0.10)
sp=pack.randomDensePack(pred,radius=0.01,spheresInCell=300)
O.bodies.append(sp)
yade.qt.Controller()
idSteel=O.materials.append(FrictMat(young=210e9,poisson=.25,frictionAngle=.8,label="steel"))
hammer=sphere((0,0,0.30),0.04,material=idSteel)
hammerID=O.bodies.append(hammer)
hammer.state.blockedDOFs='z'
calm()
hammer.state.vel=Vector3(0,0,-0.5)
O.engines=[ForceResetter(),InsertionSortCollider([Bo1_Sphere_Aabb()]),InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()]),NewtonIntegrator(),PyRunner(iterPeriod=100,command="print hammer.state.displ()")]
O.dt=0.5*PWaveTimeStep()
O.saveTmp()

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Swapnil (swapspace) said :
#1

what I have found so far is that for measuring the force experienced by the hammer I can use

O.forces.f(hammerID)

and for its displacement I can use

hammer.state.displ()

Is this correct? But if one has to find the force and displacement components (x/y/z) what should one do?

Revision history for this message
Swapnil (swapspace) said :
#2

I tested the above two commands and they seem to be correct :)

Now I am attempting to plot the force-displacements in the Z-direction. The following is the current script:

from yade import pack,plot
pred=pack.inCylinder((0,0,0),(0,0,0.25),0.10)
sp=pack.randomDensePack(pred,radius=0.01,spheresInCell=300)
O.bodies.append(sp)
yade.qt.Controller()
idSteel=O.materials.append(FrictMat(young=210e9,poisson=.25,frictionAngle=.8,label="steel"))
hammer=sphere((0,0,0.30),0.04,material=idSteel)
hammerID=O.bodies.append(hammer)
hammer.state.blockedDOFs='z'
calm()
hammer.state.vel=Vector3(0,0,-0.5)
O.engines=[ForceResetter(),InsertionSortCollider([Bo1_Sphere_Aabb()]),InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()]),NewtonIntegrator(),PyRunner(iterPeriod=100,command="addPlotData()")]
def addPlotData():
  Dz=hammer.state.displ[2]
  Fz=O.forces.f(hammerID)[2]
  plot.addData(i=O.iter,Fz=Fz,Dz=Dz)
plot.plots{'Dz':('Fz')}
plot.plot()
O.dt=0.5*PWaveTimeStep()
O.saveTmp()

But I am receiving an error saying the line - plot.plots{'Dz':('Fz')} is an invalid syntax. I tried to run through the documentation but cannot figure out the correction required here.

Revision history for this message
Jérôme Duriez (jduriez) said :
#3

Hello

It should be "plot.plots =" with the equal sign.
plot.plots is an object you're defining here, not a function.

Jerome

Revision history for this message
Swapnil (swapspace) said :
#4

Hi Jerome, thanks a lot for the correction. Now, it runs and I can see the plot window but I cannot see any changes occuring0 on the plot. Looks like the values are not updated on the plot somehow. Where could I be going wrong with the script?

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

Once again, take care of errors :-)

I got:
TypeError
...
---> 14 Dz=hammer.state.displ[2]

should be Dz=hammer.state.displ()[2] # state.displ() is a fanction, therefore called by (), than you can extract z component by [2]

cheers
Jan

Revision history for this message
Swapnil (swapspace) said :
#6

Thanks Jan, you saved me again :-) That part works now.

How can we apply a confining cylindrical boundary to the cylindrical arrangement of the spheres here ( in order to constrain the motion of spheres outwards) ? I have been searching but can only find information about 'Wall'?

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

This time the question is completely unrelated to Plotting force & displacement, so next time please open a new question.
https://github.com/yade/trunk/blob/master/examples/concrete/triax.py
Jan

Can you help with this problem?

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

To post a message you must log in.