How to create a 3d grid in Paraview

Submitted by subhodhk on Sun, 07/06/2014 - 19:35

Hi

I ran a mixing simulation in Liggghts and now I am trying to analyze the results using Paraview. I want to create a 3d grid in Paraview (please see attached pictures) and want to analyze particle velocities inside each of the boxes of the grid. This can be easily done in EDEM using 'grid bin group'. I was wondering if there was something similar in Paraview. If not, then is there another way to do such analysis?

Thanks.

Subhodh

AttachmentSize
Image icon grid1.jpg35.79 KB
Image icon grid.jpg53.61 KB
Plain text icon Input script6.14 KB
Binary Data CSV result fie875 bytes
richti83's picture

richti83 | Tue, 07/08/2014 - 11:09

It is easy directly in liggghts on skriptlevel:
create x*y*z regions (you can use a loop for that) and use the variable vcm command with region filter-flag.
than use fix print to write the variables into a textfile.
If you do not want to simulate again you can use the Clip filter OR (which is better in my opinion) use three calculator-filters to extract the coordX, coordY, coordZ from dumpdata and than attach as many threadshold-filters as you need to them.
Than use a python script to iterate over all particles in one single threadshold box and calculate the value you are interested in
At all a little bit complicated :-)
Best,
Christian.

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

subhodhk | Thu, 07/17/2014 - 21:33

Thanks Christian. I went with the first method (changing the input script). I tried it for two grid-bins and it works fine . I had a few questions about how I can go about making it run for the entire grid:
1. I am not sure how to create regions using a loop. Do you have an example i could look at?
2. I am trying to create a 1x10x10 grid. That's a hundred grid-bins for each of which I am creating a .CSV file to store the velocity values. So I wanted to ask if writing to 100 files at say every 1000 timesteps would give any problems?
3. Can the fix print command be used inside a loop? If so then how do i name the fix ids and CSV files... I mean how can I change the fix id and file name so that the grid-bin number is attached to it? For example: fix-id= Result1 and file-name= File1.csv for grid-bin number 1; fix-id= Result2 and file-name= File2.csv for grid-bin number 2 etc.

I have attached the input script and the .CSV result file from two grid-bins simulation if you need to take a look.

Thanks
Subhodh

alberthappy | Fri, 07/18/2014 - 17:38

Hi Subhodh,

This topic gives me some hint on how to get local velocity. If you have tried the second way, can you share your experience with me? I have one more question. How can I display a particle layer inbetween two planes, say x=0.1 and x=0.2, so that I can visualize the particle mixing easily. Thank you

Fenglei Qi

richti83's picture

richti83 | Sat, 07/19/2014 - 20:51

@Subhodh

variable x loop 10
label for_x
variable y loop 10
label for_y
variable xlow equal $x*${constx}
variable xhi equal ${xlow}+${deltax}
variable ylow equal $y*${consty}
variable yhi equal ${ylow}+${deltay}
region reg_$x_$y block ${xlow} ${xhi} ${ylow} ${yhi} ${zmin} ${zmax} units box
variable vel_$x_$y equal vcm(reg_$x_$y}
next y
jump for_y
next x
jump for_x
fix out_1_1 all print 1000 "${vel_1_1}" screen no file vel_1_1.csv
fix out_2_2 all print 1000 "${vel_2_2}" screen no file vel_2_2.csv
...

unfortunately you can't use ${vel_$x_$y} because the parser does not support variable variable names.
Usually I use an an excel sheet to create this lines (something like ="fix out"&A1&"_"&A2&" all print 1000 ${vel_"&A1&"_"&A2&"..." in column C) does the trick)
and than make one text file called PRINT.lmp which is included with

include PRINT.lmp

in the main script. This keeps the skript readable and handy :-)

(I didn't test the code above it's only a way how you can start, maybe I missed some syntax errors)

Best,
Christian

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

Vinci | Tue, 11/24/2020 - 13:57

hi,

I am new to liggghts. I have used python before.
I am trying a similar situation, and i was looking for a way to access variabled variables in my loops, as in this case: ${vel_$x_$y}

you have mentioned the workaround in excel sheet, which i did not quite understand. could you elaborate it or point me in some direction. i tried searching in excel forums but was not useful (maybe because i did not understand the line well here)

richti83's picture

richti83 | Sat, 07/19/2014 - 20:57

about your 2nd question:
in Paraview use two clip filters,
x-normal
the first one origin x=0.1
the second attached to the first
x-normal, x=0.2,
and [x] inside out
you should get a slice between 0.1 and 0.2
Best,
Christian

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

alberthappy | Mon, 07/21/2014 - 03:39

Thanks for your help, Christian. There is another problem with it. I applies clips to visualize both the particles and geometry in-between this slice. However, The geometry surfaces are jagged. I guess this is because the surfaces of this geometry have been discretized before exporting them into ligggths in the form of stl. Do you know how to make the geometry looks better? Thank you.

Fenglei Qi

richti83's picture

richti83 | Mon, 07/21/2014 - 14:40

I would suggest View-Options, [x] use Parallel Projection, than set Camera to View X-Plane and for your STL Geometry "Wireframe" representation.
(I made the housing and belt in this video:
https://www.youtube.com/watch?v=NAhna5SGEHw
that way.)

Or you can make a single geometry with smaller triangles for Postprozessing only and load it to ParaView (but than without moving walls).

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