Visualize the 2D particle pack as 2D circles in Paraview

Asked by Yipeng Xie

Hello everyone,
I have built a dense pack with spheres in the xy plane (blockedDOFs="zXY) with the following code:

#####################################
from __future__ import print_function
from yade import pack

O.materials.append(FrictMat(young=6.e8,poisson=.8,frictionAngle=.0))

sp = pack.SpherePack()
size = .24
sp.makeCloud(minCorner=(0,0,.05),maxCorner=(size,size,.05),rMean=.005,rRelFuzz=.4,num=400,periodic=True,seed=1)
sp.toSimulation()
O.cell.hSize = Matrix3(size,0,0, 0,size,0, 0,0,.1)
print(len(O.bodies))
for p in O.bodies:
   p.state.blockedDOFs = 'zXY'
   p.state.mass = 2650 * 0.1 * pi * p.shape.radius**2 # 0.1 = thickness of cylindrical particle
   inertia = 0.5 * p.state.mass * p.shape.radius**2
   p.state.inertia = (.5*inertia,.5*inertia,inertia)

O.dt = utils.PWaveTimeStep()
print(O.dt)

O.engines = [
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   PeriTriaxController(
      dynCell=True,
      goal=(-1.e5,-1.e5,0),
      stressMask=3,
      relStressTol=.001,
      maxUnbalanced=.001,
      maxStrainRate=(.5,.5,.0),
      doneHook='term()',
      label='biax'
   ),
   NewtonIntegrator(damping=.1)
]

def term():
   O.engines = O.engines[:3]+O.engines[4:]
   print(getStress())
   print(O.cell.hSize)
   setContactFriction(0.5)
   O.cell.trsf=Matrix3.Identity
   O.cell.velGrad=Matrix3.Zero
   for p in O.bodies:
      p.state.vel = Vector3.Zero
      p.state.angVel = Vector3.Zero
      p.state.refPos = p.state.pos
      p.state.refOri = p.state.ori
   O.save('0.yade.gz')
   O.pause()

O.run();O.wait()
#####################################

Now I want to export the particle information and visualize it as a real 2D circle inside the Paraview.
However, if I use ‘VTKRecorder’ to store and export the data, it still appears as a 3D sphere in Paraview.
I also tried the '2D Glyph' filter in Paraview, but it still didn't work.
Does anyone know how to do this? Many thanks for any advises or solutions.

Kind regards
Yipeng

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hello,

> the following code

plsease always try to make your code MWE [1].
To export and visualize particles, you do not need PeriTriaxController etc.

True MWE:
###
O.bodies.append([
    sphere((0,0,0),1),
    sphere((3,4,0),3),
])
O.engines = [
    VTKRecorder(fileName="test",iterPeriod=1),
]
O.step()
###

Now I want to export the particle information and

> ... visualize it as a real 2D circle inside the Paraview.
> However, if I use ‘VTKRecorder’ to store and export the data

please provide actual code, there is no VTKRecorder in your code (provide MWE [1])

> it still appears as a 3D sphere in Paraview.

By defualt, I see points (Paraview 5.10.0)
But anyway, Paraview is powerful to stick with spheres only..

> I also tried the '2D Glyph' filter in Paraview, but it still didn't work.

Please be more specific.
Circle 2D Glyph should do exactly what you are asking..

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
Yipeng Xie (ypxie2020) said :
#2

Thanks Jan Stránský, that solved my question.