Tutorial #4 Superquadric Angle of Repose WITH REPRESENTATION Python Filter

richti83's picture
Submitted by richti83 on Tue, 01/30/2018 - 13:03

In the attached archive you'll find an enhanced input script (bases on the official example) for generating one type of superquadrics inside a cylinder. After settling the cylinder is lifted up and the sq are forming a pile.
You'll also find a ParaView (5.4.1) state file for visualisation (needs rigid reader from github [1]).

Have Fun,
Christian.

[1] https://github.com/richti83/ParaView_Reader_for_LIGGGHTS/tree/master/pre...

AndresMM | Tue, 01/30/2018 - 16:56

Thank you for the tutorial Richti, it looks very interesting.

Now I gotta make some time to take a look at it

deepakpawar.2310 | Wed, 04/18/2018 - 22:35

Running command

pawar@pawar:~/LIGGGHTS-PUBLIC/examples/LIGGGHTS/Tutorials_public/004_SQ_AOR$ liggghts360 -var blockiness1 4 -var blockiness2 4 -var angle 0 -in in.AOR

I am getting following error , quire related to dump

ERROR

shell mkdir post
dump dmp all custom/vtk ${writeOutEvery} post/dump*.superq.vtk type mass x y z id vx vy vz fx fy fz omegax omegay omegaz radius shapex shapey shapez quat1 quat2 quat3 quat4 blockiness1 blockiness2 tqx tqy tqz angmomx angmomy angmomz
dump dmp all custom/vtk 500 post/dump*.superq.vtk type mass x y z id vx vy vz fx fy fz omegax omegay omegaz radius shapex shapey shapez quat1 quat2 quat3 quat4 blockiness1 blockiness2 tqx tqy tqz angmomx angmomy angmomz
dump dmp all custom ${writeOutEvery} post/rigid*.dump id type x y z quat1 quat2 quat3 quat4 vx vy vz fx fy fz blockiness1
dump dmp all custom 500 post/rigid*.dump id type x y z quat1 quat2 quat3 quat4 vx vy vz fx fy fz blockiness1
ERROR: Reuse of dump ID (../output.cpp:604)

Can you command on the above mettioned error.

Thanks

jsams | Thu, 04/19/2018 - 01:58

About this error in general:
You are using dmp as the dump ID for both dump commands. Every ID needs to have a unique identifier. To avoid this error simply change the IDs to dmp1 and dmp2, or any other name.
More specifically to this case:
You might in fact only need one of dump commands, depending on whether you have compiled liggghts with vtk support or not. If yes, you can comment out the second dump command. If not, you will need the second dump command and use the liggghts rigid reader plugin to visualise in Paraview.
For your second post about the link that is not working:
You can download the filter from the attachment in the initial pos, i.e. transform filter v.2.0 add as tools->custom filter 5.85 KB

deepakpawar.2310 | Thu, 04/19/2018 - 09:10

Simulation is working as the modification you suggested, and i am getting the following dump files

(1) rigid*
(2) dump*
(3) dumpboundingBox*
(4) dump_Zcylinder*

Now i need to visulize the above dump files using PARAVIEW
I have following files (pluggin files ans some extra files)

(1) libliggghts_rigids_reader.so (I guess its a liggghts rigid reader plugin >> to visualise in Paraview )
(2) transform filter v.2.0 a (tools >> custom filter )
(3) transform_sq.py (python script)

Can you explain step by step how to incorporate/use this files to visulize the superquadraric element.

Sorry i am quite a new user to PARAVIEW and dont know much about it.
Your help is highly appreciated
Thanks

jsams | Fri, 04/20/2018 - 01:25

There have been a couple of posts about this already. I recommend that you have a look at the available resources and ask a specific question if you are stuck.

See this forum post about the liggghts reader plugin and this post about visualising superquadrics.

shokeyi | Fri, 04/20/2018 - 12:42

Hi Christian,
I had run the simulation using the input file you provided and got the rigid*.dump files. Then, I had downloaded the latest rigid reader plugin file with the transform filter to visualize particles in Paraview. However, I got the following errors:
Traceback (most recent call last):
File "", line 22, in
File "", line 14, in RequestData
AttributeError: 'NoneType' object has no attribute 'GetPointData'
I tried to use both the "c_id" and "id" in the filter, but got the same result. I am using the Paraview 5.4.1 on Ubuntu. Any suggestions to solve this?

Thanks.

justin_yarrington | Thu, 06/27/2019 - 19:35

Christian and jsams,
I tried to follow the advice given about the "AttributeError: 'NoneType' object has no attribute 'GetValue'" error , however, when the error doesn't go away when I "Change Input" both times as described. It is the exact same error depicted, and I've tried several times. Any ideas on what may be going on?

If it makes any difference. When I change the input to only rigid*, I get a similar error: "AttributeError: 'NoneType' object has no attribute 'GetPointData'"

Not sure if this makes a difference or not, but any help related to this would be much appreciated!

Thanks,
Justin

lumblab227 | Wed, 05/29/2019 - 09:23

Hey Christian,

Would you please give me some hints how to improve the reader in order to visualize superquadric particles of different sizes? Thanks!

richti83's picture

richti83 | Fri, 05/31/2019 - 14:08

For less different types I would use a threashold filter and devide the dump into n-subdatasets and append the filter to each of them.
Another solution could be to add a scaling factor to

xnew=T11*x+T12*y+T13*z+r[0]
ynew=T21*x+T22*y+T23*z+r[1]
znew=T31*x+T32*y+T33*z+r[2]

(T is the 3x3 rotation matrix, r is the vector to center of SQ in world;x,y,z are the original coordiantes of SQ-Source for each point of the Geometry), so multiplying the first part with a scaling factor should give correct size),
and one norm-sized superquadric prototype (scaling=1,a,b,c=1).

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

deepakpawar.2310 | Thu, 06/13/2019 - 15:53

Hello

How to import the 304_transform_sq_with_colors.xml in the pipeline in PV (I am using PV) for visualization of the superquadratic element.
I got the dump files as described as above

richti83's picture

richti83 | Tue, 07/02/2019 - 09:50

First add the filter with Tools->Manage Custom Filters [import]
2nd: open the dump files
3rd: create a source Superqaudric, settings pls see screenshot of my post
4th: select rigid*.dump AND superquadric source (hold ctrl key and left mouse click on both in pipeline browser), than use Filters->Alphabetic->004_transform
Good Luck.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

martin.kozakovic | Fri, 12/13/2019 - 21:44

Modified notes (by DaveK):

ParaView_Reader_for_LIGGGHTS is not strictly needed if LIGGGHTS is compiled with VTK support

Use custom/vtk dump inside liggghts file with defined values
dump dmp all custom/vtk ${writeOutEvery} post/dump*.superq.vtk type mass x y z id vx vy vz fx fy fz omegax omegay omegaz radius shapex shapey shapez quat1 quat2 quat3 quat4 blockiness1 blockiness2 tqx tqy tqz angmomx angmomy angmomz
to generate visualisable particles with precomputed
f,v,id,type,TENSOR
some parameters can have different names in new LIGGGHTS versions (TENSOR=M)
Their calculation is present in ParaView_Reader_for_LIGGGHTS (TENSOR/M is computed from quat values)
ParaView_Reader_for_LIGGGHTS/blob/master/reader_src/rigid_reader/liggghts_rigids_reader.cxx

0) Load cylinder wall

1) Load dump*.superq.vtk

2) Create Paraview Source -> Superquadric

Fill in coefficients:
Scale x y z - shapex shapey shapez (in Liggghts particletemplate/superquadric shape constant 0.001 0.001 0.002)
0.001 0.001 0.002
Theta Roundiness / Phi Roundiness - 2/blockiness2 2/blockiness1 (in Liggghts particletemplate/superquadric blockiness constant 10.0 2.0)
1 0.2
Size 1
Uncheck Toroidal

Save superquadric source as .vtk file for later use (do not use other formats!)

Notes:
For some Paraview versions, transform filter with rotation needs to be applied, so that main axis is in z dimension (ie. for cylinder some Paraview versions produce axis in y dimension)

3) Select dump + superquadric source

Notes:
Order of selection is important in some Paraview versions

4) Apply Programmable Filter

Input python data from
transform_filter_superquadric_with_colors.py
select output as
vtkUnstructuredGrid

Notes:
You may need to change order of
GetInputDataObject(0, 0)
GetInputDataObject(0, 1)
to
GetInputDataObject(0, 1)
GetInputDataObject(0, 0)
in some cases
and for some versions of LIGGGHTS
change value names in python script from "TENSOR" to "M", from "f" to "F" and similarly

5) done

FelipeL | Wed, 05/19/2021 - 08:30

Hi Martin,

Can you explain me how to relate blockiness with Theta and Phi Roundiness?. In particular, the reason of changing blockiness from 10 2 to 1 0.2 in Theta Phi coefficients.

Thank you very much!

Sherif | Thu, 02/18/2021 - 11:28

I'm new for all the DEM stuff. I did some modifications on chute_wear official example to make the particles superquadric (flaky particles). But in paraview the particles are still spheres (however they don't act like spheres in their motion).

My question is how could I make paraview output the real particle shape in the animation? or could I use another program?
I really appreciate any help, Thanks