how to record the force applied on the plate

Asked by ting

Hello everyone:

I am a new user for yade. I did some changes according to the oedometric test example [1] and trying to simulate a simple soil cutting process with a plate moving in horizontal direction. However, I met one problem that I cannot record the force acted on the plate. Did anyone know how to solve that? It's really confused me a lot. The following is the code:

readParamsFromTable(rMean=.05,rRelFuzz=.3,maxLoad=1e6,minLoad=1e4)
from yade.params.table import *
from yade import pack, plot
O.bodies.append(geom.facetBox((0.15,1.5,3),(0.15,1.5,3),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(.3,3,6),rMean=rMean,rRelFuzz=rRelFuzz)
sp.toSimulation()

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.5),
                  #VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
   PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),
]
O.dt=.5*PWaveTimeStep()

def checkUnbalanced():
   if O.iter<5000: return
   if unbalancedForce()>.1: return

   O.bodies.append(facet([(.15,1.5,.1),(.15,1.5,1.2),(.3,1.5,2)]))

   global plate
   plate=O.bodies[-1]
   plate.state.vel=(0,-1,0)
   O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=200)]
   checker.command='unloadPlate()'

def unloadPlate():
   if abs(O.forces.f(plate.id)[1])>maxLoad:
      plate.state.vel*=-1
      checker.command='stopUnloading()'

def stopUnloading():
   if abs(O.forces.f(plate.id)[1])<minLoad:
      plot.saveDataTxt(O.tags['d.id']+'.txt')
      O.pause()

def addPlotData():
   if not isinstance(O.bodies[1].shape,Wall):
      plot.addData(); return
   F=O.forces.f(plate.id)[1]
   plot.addData(F=F,displacement=plate.state.pos[1]-plate.state.refPos[1],unbalanced=unbalancedForce(),i=O.iter)

plot.plots={'displacement':('F',)}
plot.plot()

O.run()
waitIfBatch()

Also, I would like to konw how to add a rectangle rigid plate boundary which I can define the size rather than a triangle.
Thank you so much and wish have a good day!

REgards.
Ting

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
mohsen
Solved:
Last query:
Last reply:
Revision history for this message
Best mohsen (agha-mohsena) said :
#1

Hi ting

Every thing is True, but just you made an samll mistake in defining addPlotdata; may be this works:

def addPlotData():
   if not isinstance(O.bodies[-1].shape,Facet):
      plot.addData(); return
   F=O.forces.f(plate.id)[1]
   plot.addData(F=F,displacement=plate.state.pos[1]-plate.state.refPos[1],unbalanced=unbalancedForce(),i=O.iter)

Regards
Mohsen

Revision history for this message
ting (ting1994) said :
#2

Thanks mohsen, that solved my question.