CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Paraview & paraFoam

visualizing spheres in fluid

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 19, 2012, 12:29
Default visualizing spheres in fluid
  #1
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 5
Jellyfish is on a distinguished road
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!
Jellyfish is offline   Reply With Quote

Old   April 20, 2012, 04:50
Default
  #2
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
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
bigphil is offline   Reply With Quote

Old   April 20, 2012, 05:19
Default
  #3
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 5
Jellyfish is on a distinguished road
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 is offline   Reply With Quote

Old   April 20, 2012, 05:51
Default
  #4
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 5
Jellyfish is on a distinguished road
Wow, it worked, And its even possibble to set the diameter by the radius, given in the script. Thanks a lot!!!
Jellyfish is offline   Reply With Quote

Old   April 20, 2012, 05:55
Default
  #5
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 568
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Great!

Philip
bigphil is offline   Reply With Quote

Reply

Tags
sphere multi body merge

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specifying fluid density sanjibdsharma OpenFOAM 2 February 22, 2011 09:55
Questions of fluid pairs fjalil CFX 1 June 10, 2009 17:36
My Revised "Time Vs Energy" Article For Review Abhi Main CFD Forum 2 July 9, 2002 09:08
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11
fluid hot volume in fluid cold volume zahid FLUENT 4 June 1, 2002 09:11


All times are GMT -4. The time now is 04:50.