← 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: Needs information => Open

NGANDU KALALA Gauthier gave more information on the question:
Hi,

Thanks for your response, and you can find here after some response at
your questions;

What is "the extraction"? printing, saving, ...?
The term extraction  used here means , Saving force
What is "the normal contact forces"? individual force vectors? magnitudes? sum of the vectors? sum of magnitudes? ... ?
I call normal contact force, the magnitudes of the force of contact between ball and mill in the normal direction, saving at each step time; i need to save this force of contact at each time step. To know the evolution of this in time.
what is "the number of simulation"?
the number of simulation is the number of iteration  here is 4098
what is "a force vector"? I would expect "a force vector" to be a "standard Euclidean vector"..
I call force vector, or normal force, in my question here, the vector contenning the value  of magnitudes force  in normal direction saving at each step time.

 the force at each step time. if the length of simulation, or the vector
time length is 4098, i expect to have the saving vector force with the
same length.

Briefly i want to save the evolution of interaction force in time; reason why i insert a loop for j in O.time in my script; But i can't have the result i need.
I don't know if there is an other way,  to save the contact force at each step time, and to plot his evolution in time;

I' m trying to do it in my mwe here after:

# Material
rho = 7640.0 # [kg/m^3] density (of the balls)
kn  = 1.0e5  # [N/m]    equivalent normal stiffness
kt  = kn     # [N/m]    equivalent tangential stiffness
en  = 0.3    # [-]      normal coefficient of restitution (sphere/sphere)
mu  = 0.75   # [-]      friction coefficient
cn  = 0.75
ct  = cn

# Geometry/Filling
length = 0.4       # [m] axial length of the mill
rMean  = 0.772/2.0 # [m] liner profile mean radius
rBall  = 0.01      # [m] ball radius
fRatio = 1.0       # [%] filling ratio
sphRadFuzz = 0.8

# Simulation

tEnd = 1.0         # [s] total simulation time
O.dt = 2.44140e-4  # [s] fixed time step
tRec = 1.0e-2       # [s] recording interval

#material of cylinder
cylMat = O.materials.append(ViscElMat(kn=2*kn,ks=2*kt,cn=2*cn,
                                             cs=2*ct,frictionAngle=.1))
#material of spheres                                            
ballMat = O.materials.append(ViscElMat(kn=2*kn,ks=2*kt,cn=2*cn,
                                             cs=2*ct,frictionAngle=.1,density=rho))

ids=O.bodies.append(geom.facetCylinder((0,0,0),0.8,0.4,segmentsNumber=64, wallMask=7, angleRange=None,
                   radiusTopInner=-1, radiusBottomInner=-1,material=cylMat))


# 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): # red and blue spheres
 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_MindlinPhys()],
        [Law2_ScGeom_MindlinPhys_Mindlin()]
    ),

   #GravityEngine(gravity=(0,-3e4,0)), # gravity artificially high, to make it faster going ;-)
   RotationEngine(ids=ids,angularVelocity=1000,rotateAroundZero=True,rotationAxis=(0,0,1)),
   NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),
   PyRunner(command='exportForces()',iterPeriod=1)
]
def exportForces():

  # get data
  
for j in O.time:  
  for i in O.interactions:
    if isinstance(O.bodies[i.id1].shape,Sphere) \
        and isinstance(O.bodies[i.id2].shape,Facet):
        
  totalNormalForce  = i.phys.normalForce
 
  # Save data

  out=open(os.getcwd()+'/output/NormalForceMagnitude','a')
  out.write('%s\n'%str(NormalForceMagnitude))
  out.close()     
###
O.run(int(math.ceil(tEnd/O.dt))+1)

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