CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   visualizing spheres in fluid (http://www.cfd-online.com/Forums/openfoam-paraview/100074-visualizing-spheres-fluid.html)

Jellyfish April 19, 2012 12:29

visualizing spheres in fluid
 
Hello community,
I have simulated (with an in-house code) 3D spheres that move in liquid. Now i want to visualize the results in a movie of liquid and spheres, using Paraview. Unfortunately I have not found a feature that puts spheres to a position that is automatically taken from a input file (*.dat). I only managed to put spheres manually, which does not help me much. I also had the idea to load the particle file into paraview together with the fluid field (which worked), but i didnt manage to merge the positions and i didnt manage to plot spheres from these particle positions neither.
It would be great if you could hint me in a possible direction or give me a link where this is described (I didnt found any)
Thanks a lot!

bigphil April 20, 2012 04:50

Hi Jellyfish,

I have found the VTK format quite straightforward for visualisation in ParaView.

For example, if you want to visualise spheres then the VTK file would look like this:
Code:

# vtk DataFile Version 2.0
Unstructured grid legacy vtk file with point scalar data
ASCII

DATASET UNSTRUCTURED_GRID
POINTS 4 double
0 0 0
1 0 0
0 1 0
1 1 0

If you save the above code in a file (i.e. test.vtk) and then open it with paraview. To visualise sphere at the specified points, use the glyph filter and set the glyph type to sphere.

If you have multiple time steps then name the VTK files as test_1.vtk, test_2.vtk, test_3.vtk, etc.
And ParaView will know they are time steps.

If you want to define scalar or vector data at each point (maybe representing the radii or velocity or some other variable) then the VTK file would look like this:
Code:

# vtk DataFile Version 2.0
Unstructured grid legacy vtk file with point scalar data
ASCII

DATASET UNSTRUCTURED_GRID
POINTS 4 double
0 0 0
1 0 0
0 1 0
1 1 0

POINT_DATA 4
SCALARS radii double
LOOKUP_TABLE default
2
1.5
3
0.5

VECTORS velocity double
1 1 1
0 30 3
-4 5 6
0.4 -4 16

It is quite straight forward to write some code to create these VTK files either in OpenFOAM or Matlab or what ever you like.

You can find more on the (legacy) VTK format here: http://www.vtk.org/VTK/img/file-formats.pdf

Hope it helps,
Philip

Jellyfish April 20, 2012 05:19

Hey Philip,
This sounds indeed very easy. I did not know that the glyphe-feature can do sth else than arrows. I will create this file format this afternoon and tell you how it goes. In any case, thanks for the fast and good reply!!!
Many greetings
Jellyfish

Jellyfish April 20, 2012 05:51

Wow, it worked, And its even possibble to set the diameter by the radius, given in the script. Thanks a lot!!!

bigphil April 20, 2012 05:55

Great!

Philip


All times are GMT -4. The time now is 20:37.