Can I plot streamlines through .VTK output files?

hi, all

I want to plot streamlines by using paraview, but it seems not feasible? like in the “cavity2d”.

please tell me why? how can i plot streamlines in such 2D problem?

thks.

why not? you can do streamlines with paraview. if it doesn’t work, please explain your problem.

For the “cavity2d” in the examples folder, it indeed write output files in the format of “.vti”

I opened the “.vti” file in Paraview, but the “stream Tracer” filter doesn’t work. The button is grey?

I am not familiar with Paraview. can you tell me why?

thks!

alexlee

I am having the same problem, I know this is an old thread, but does anyone have a solution to this? Im gonna keep digging around in documentation so if i find a solution it will be posted here.

I think that the streamlines in paraview only work for 3D problems.

For 2d cases you can use matlab. It should work fine.

Can you tell me where I find information on how to save my simulation data such that I can use paraview for its illustration (incl. streamlines)?
Up to now, gnuplot was sufficient and I saved the data in a “personal” style, like


# header information
x-coord y-coord z-coord vel_x vel_y vel_z ...
x-coord y-coord z-coord vel_x vel_y vel_z ...
.
.
.

Thanks,
Timm

hi

I had ploted stream lines in paraview using the legacy vtk format in 2D.

I did not use openlb before.

check your data file if the velocity defined in the file as vector type. I think it should works.

because the stream lines in paraview only work on vector data

my file is look like


# vtk DataFile Version 2.0

out980.vtk

ASCII

DATASET RECTILINEAR_GRID

DIMENSIONS 32 32 1

X_COORDINATES 32 float

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

Y_COORDINATES 32 float

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

Z_COORDINATES 1 float

0

POINT_DATA 1024
VECTORS VecVelocity float

0              -3.49e-18         0

8.32-07    3.49605e-18  0

1.52e-05  0                      0
.
.
.
.
.

best regards

This looks quite nice and I will try this.
Thanks a lot for that hint!

I’ve managed to get my X and Y velocity to be stored in the VTK fies, however they come under scalar, and seperatley at that. So I still haven’t managed to get streamlines to work with Paraview. Matlab works as expected, but I would like to get this going with paraview

An additional question: In which order shall I store the data? Is this correct?


x y z
1 1 1
1 1 2
...
1 2 1
1 2 2
...
2 1 1
2 1 2

Thanks,
Timm

hi

dear Timm
let us assume you have 2d mesh 3X3X1
the data sort is

x y z
0 0 0
1 0 0
2 0 0
0 1 0
1 1 0
2 1 0
0 2 0
1 2 0
2 2 0

dear brucedjones

if you have already get a date saved as a scalar you can plot the stream function
let us assume you have 2d mesh 3X3X1
this is our data file


# vtk DataFile Version 2.0
stream
ASCII
DATASET RECTILINEAR_GRID
DIMENSIONS 3 3 1
X_COORDINATES 3 float
0 1 2
Y_COORDINATES 3 float
0 1 2
Z_COORDINATES 1 float
0
POINT_DATA 9
SCALARS Xvelocity float 1
LOOKUP_TABLE default
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
SCALARS Yvelocity float 1
LOOKUP_TABLE default
9.0
8.0
7.0
6.0
5.0
4.0
3.0
2.0
1.0
VECTORS VecVelocity float
1.0 9.0	0
2.0 8.0	0
3.0 7.0	0
4.0 6.0	0
5.0 5.0	0
6.0 4.0	0
7.0 3.0	0
8.0 2.0	0
9.0 1.0	0

use the (Caculator) filter
select (attribute mode) as (Point Data)
then in calculator input area insert (iHatVecVelocity_X+jHatVecVelocity_Y+kHat*0)
then click (apply)
then the you can press the stream button

to make sure this way is right plot the stream from the vector (VecVelocity) wich i put in the data file
and compare the result with the new vector wich we make from scalar.

best regards

Ok, very nice.
I also want to buy a book about VTK. Can anybody recommend one? I understand that there are some books available.

Timm

hi

if you interested in vtk as data file format

http://www.vtk.org/VTK/img/file-formats.pdf

other wise

if you interested in vtk as Visualization library

http://www.osc.edu/supercomputing/training/vtk/vtk_0505.pdf

best regards

Thanks SaS,

The information you supplied enabled me to compute the streamlines from the scalar values I had

Hello,

ok, I understand now how to plot streamlines. But I really did not get how to use the lookup tables in the vtk files in order to produce colored visualizations. Is there a short overview somewhere?

Thank you,
Timm

[b][size=large]A bit easy solution for this problem, according to my experience!

For 2D test cases, the Stream Tracer feature of Paraview is not feasible, even you have the velocity components data in your *.vti file. Here is the solution to plot streamlines by Paraview for 2D test cases.

  1. Open -> load your *.vti file and apply. (you see Stream Tracer is not active!)
  2. Filters-> Calculator (insert the following command line and apply)
    iHatx_velocity+jHaty_velocity
    enjoy!

Note: In this way, you can decompose the velocity magnitude to the velocity vector components if you’ve missed to export them in your data file…
Cheers[/size][/b]