← 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

NGANDU KALALA Gauthier gave more information on the question:
This is my MWE;

As I said before, I want to save for each iteration, the sum of force (amplitude) of interactions between balls and mill;
In this MWE, I have rather calculated the forces when there is interaction; But I wish to calculate it rather for each iteration; this will allow me to represent the evolution of its forces in time;

from 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),
    
   ]

O.dt=.5*PWaveTimeStep()

def saveForces():

   for i in O.interactions:

    if isinstance(O.bodies[i.id1].shape,Facet) or isinstance(O.bodies[i.id2].shape,Facet):
       MagnitudeNormalForce = sum((i.phys.normalForce.norm()))
    else :
       MagnitudeNormalForce = 0
     
   #   out=open(os.getcwd()+'/Resultat/MagnitudenormalForce','a')
   #   out.write('%s\n'%str(MagnitudenormalForce))
   #   out.close()

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

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