← Back to team overview

yade-users team mailing list archive

Re: [Question #694017]: Extract normal force

 

Question #694017 on Yade changed:
https://answers.launchpad.net/yade/+question/694017

    Status: Answered => Open

NGANDU KALALA Gauthier is still having a problem:
Hi Jan,

This is my updated MWE, as i tell you before, i need  the simulation
show the plot on the screen, and update while the simulation runs in
time, and save the result in txt format.

rom yade import pack,utils, plot,ymport,qt
#######################################################################################

fr = 0.1;rho=7640.0;length = 4.0;rMean  = 0.772/2.0;sphRadFuzz =
0.8;rBall  = 0.04 ;

MillMat = O.materials.append(ViscElMat(kn=2*1.0e5,ks=2*1.0e5,frictionAngle=2*fr))
ballMat = O.materials.append(ViscElMat(kn=2*1.0e5,ks=2*1.0e5,frictionAngle=fr,density=rho))

#######################################################################################

# Create Mill from facets
Mill=O.bodies.append(geom.facetCylinder((0.0,0.0,0.5),8.0,height=4.0,segmentsNumber=64,wallMask=7,material=MillMat))
#Walls=O.bodies.append([utils.wall(position=(0,0,0),axis=2,sense=0,material=MillMat),
#                      utils.wall(position=(0,length,0),axis=2,sense=0,material=MillMat)
#                      ])
# define domains for initial cloud of red and blue spheres
packHt=.8*rMean # size of the area
bboxes=[(Vector3(-.5*length,-.5*packHt,-.5*packHt),Vector3(.5*length,0,.5*packHt)),(Vector3(-.5*length,-.5,-.5*packHt),Vector3(.5*length,.5*packHt,.5*packHt))]
colors=(1,0,0),(0,0,1)
for i in (0,1): 
 sp=pack.SpherePack();
 bb=bboxes[i];
 vol=(bb[1][0]-bb[0][0])*(bb[1][1]-bb[0][1])*(bb[1][2]-bb[0][2])
 sp.makeCloud(bb[0],bb[1],rBall,sphRadFuzz,int(.25*vol/((4./3)*pi*rBall**3)),False)
 O.bodies.append([utils.sphere(s[0],s[1],material=ballMat,color=colors[i]) for s in sp])

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,-9.81,0),damping=0.0),

    RotationEngine(ids=Mill,rotationAxis=[0,0,-1],rotateAroundZero=True,
                 angularVelocity=1),
    PyRunner(command='addPlotData()',iterPeriod=100),
   ]

O.dt=.5*PWaveTimeStep()

   
# collect history of data which will be plotted
def addPlotData():

  for i in O.interactions:

    if isinstance(O.bodies[i.id1].shape,Facet) or isinstance(O.bodies[i.id2].shape,Facet):
       Force  = sum((O.forces.f(i).norm()))
    else :
       Force = 0
  
  plot.addData(i=O.iter,Force=sum(O.forces.f(i).norm()))

plot.plots={'i':('Force')}

# show the plot on the screen, and update while the simulation runs
plot.plot()

O.run(100000)
#O.save('Mymodel2.yade')

but when i run the simulation i get this error;

ArgumentError: Python argument types in
    ForceContainer.f(ForceContainer, Interaction)
did not match C++ signature:
    f(yade::pyForceContainer {lvalue}, long id, bool sync=False)
In [1]: Erreur de segmentation (core dumped)

Can i have some correction in my code please?

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.