CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] visualizing spheres in fluid

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2012, 13:29
Default visualizing spheres in fluid
  #1
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 14
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, 05:50
Default
  #2
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
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, 06:19
Default
  #3
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 14
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, 06:51
Default
  #4
New Member
 
Join Date: Apr 2012
Posts: 3
Rep Power: 14
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, 06:55
Default
  #5
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
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


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulty in calculating angular velocity of Savonius turbine simulation alfaruk CFX 14 March 17, 2017 07:08
Average Rising Velocity as boundary condition Floing CFX 11 August 21, 2016 06:47
Multiphase simulation of bubble rising Niru CFX 5 November 25, 2014 14:57
My Revised "Time Vs Energy" Article For Review Abhi Main CFD Forum 2 July 9, 2002 10:08
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


All times are GMT -4. The time now is 15:33.