← Back to team overview

yade-users team mailing list archive

Re: [Question #691285]: Extract Normals and Shears/tangentials forces on a ballMill

 

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

Jan Stránský proposed the following answer:
> I also noticed that the increased rigidity, some balls pass through the walls of the mill, instead of remaining inside.
> O.dt = 1e-6

use time step according to the critical value, e.g. a fraction of
PWaveTimeStep [1]

> Moreover, I expected that at the beginning of the simulation, packages
of balls could fall along the y-axis, to disintegrate afterwards. But i
notice that it already disintegrates before falling, and go in the whole
direction of mill, despite the acceleration of gravity is defined
according to the y-axis.

> for i in (0,1): # red and blue spheres
>  sp=pack.SpherePack();
>  ...
>  sp.makeCloud(...)
>  O.bodies.append([utils.sphere(s[0],s[1],...) for s in sp])

Here you use two SpherePack, their makeCloud does not know anything about each other and create overlapping cloud, resulting in "disintegration".
Use just one SpherePack:
###
sp=pack.SpherePack() # (!) one instance before the for loop
for i in (0,1): # red and blue spheres
 ...
 sp.makeCloud(...)
 O.bodies.append([utils.sphere(s[0],s[1],...) for s in sp])
###

> there are interactions with the mill that normally have to produce
normal and tangential forces, That i can't save actually.

how do you know?
there should be != there are
I have tested your code and simply there were no interactions (for relatively long time for testing), so no forces were saved..
You can try something like "print len([i for i in O.interactions])" in PyRunner to be sure.
Always try to get numerical evidence for such statements.


========
To your exportForces function:

>  if isinstance(O.bodies[i.id1].shape,Sphere) and
isinstance(O.bodies[i.id2].shape,Facet):

I think the order is different, that Facet should be id1. anyway, do not
depend on the order of interaction bodies

>      with open(DataSim,"w") as f:

DataSim is not defined (dataSim is)

the saving code has wrong indentation, it should be on the "main" level,
not inside "for i in O.interactions" cycle


======
The MWE was not real MWE (e.g. materials is irrelevant here, the amount of spheres is too high for playing and testing, some comments were not comments but just commented unused code ...).
Next time please really try to isolate the specific problem, in this case saving sphere-facet interactions

below modified and reduced MWE:
###
import json

rMean = 0.8/2.0
length = 0.4
rBall = 0.075

# Simulation
pcv = 70.0 # [%] percentage of critical velocity
tEnd = 10.0 # [s] total simulation time
O.dt = 1.0e-5 # [s] fixed time step
tRec = 1.0e-2 # [s] recording interval

ids=O.bodies.append(geom.facetCylinder((0,0,0),0.8,0.4,segmentsNumber=64, wallMask=7, angleRange=None,
                   radiusTopInner=-1, radiusBottomInner=-1))
# 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)
sp=pack.SpherePack();
for i in (0,1): # red and blue spheres
 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,0,999999,False)
 O.bodies.append([utils.sphere(s[0],s[1],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()]
    ),
   RotationEngine(ids=ids,angularVelocity=1000,rotateAroundZero=True,rotationAxis=(0,0,1)),
   NewtonIntegrator(damping=0,gravity=[0,0,-100]),
   PyRunner(command='exportForces()',iterPeriod=1)
]
def exportForces():
  # Mechanical power
  data = [ ] # List of data for each interaction
  for i in O.interactions:

    # Force by sphere on facet
    if isinstance(O.bodies[i.id1].shape,Facet) or isinstance(O.bodies[i.id2].shape,Facet):
      fn = tuple(i.phys.normalForce)
      fs = tuple(i.phys.shearForce)
      cp = tuple(i.geom.contactPoint)
      pd = i.geom.penetrationDepth
      d = dict(normalForce=fn,shearForce=fs,contactPoint=cp,penetrationDepth=pd, id1=i.id1,id2=i.id2)
      data.append(d)
      print(data)

  # Save data
  dataSim = "data{:06d}.json".format(O.iter)
  with open(dataSim,"w") as f:
    json.dump(data,f,indent=2)

O.dt = .5*PWaveTimeStep()
O.run(200,True)
###

cheers
Jan

[1] https://yade-dem.org/doc/yade.utils.html#yade._utils.PWaveTimeStep

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