Associating Time to Data in order to Animate

I have about 400 velocity values that are associated with time that are for a 2D point and I have several hundred 2D points. Is there a way to associate these 400 values for each point in Paraview and then have them animated with time?

Thank you for your help.

Yes. Usually, time series are defined in a series of files, and each file corresponds to a single time. So, you could write out a series of 400 VTK files. Each file will have the points as well as the velocity associated with each point at that time.

Thank you for the advice. Each point has the 400 velocity points (the velocity is the third column in the data below). So I would need to take one line from each point’s file for each point in time and make 400 new VTK files. The data below is a .dat file. Do have any suggestions as to the best way to make the 400 vtk files?

1 00000011 0.1660 -0.0050 -0.0100 -0.0060 20 34 23 27 3.1 8.4 5.7 7.8 47 80 55 55
2 00000011 0.1640 0.0180 -0.0090 -0.0150 25 39 30 31 5.0 9.5 8.0 9.0 57 84 73 63
3 00000011 0.1520 -0.0010 -0.0070 -0.0090 27 27 25 40 5.7 6.3 6.4 11.2 75 59 63 86
4 00000011 0.1800 -0.0170 -0.0030 -0.0010 21 34 22 28 3.5 8.4 5.3 8.1 56 77 53 60
5 00000011 0.1680 -0.0130 -0.0050 -0.0050 27 34 30 32 5.7 8.4 8.0 9.3 68 76 67 66
6 00000011 0.1600 -0.0130 -0.0090 -0.0070 26 36 31 34 5.4 8.8 8.2 9.8 72 83 75 76
…

Thank you again

Yes, that sounds like it should work.

I would probably do this with a Python script (or whatever programming language you are comfortable with) and consult the VTK File Formats document to see how to write a VTK legacy file. The dataset type you will want is polydata, described on page 4.

2 Likes

Great, I wrote a Python script and have all the vtk files inputted and it is working well. The Stream Tracer filter is not able to be applied to this group of vtks. Is there a way to apply the stream Tracer to a vtk file? If not, what file type would you suggest I convert my data to?

Thank you

My understanding was that you had a set of points (you didn’t describe how they were organized, if at all) and that the velocity changes at these points. The Stream Tracer requires a volumetric dataset (or surface in a special case) and computes streamlines by integrating over a velocity field defined within that volume.

Are the points in your data set supposed to move according to the velocity at each time step? In that case, I don’t know of a filter that would move them over time.

A picture of your data (hand drawn is fine), and a picture of the kind of visualization you are expecting to produce is always helpful.

Attached is a screenshot of the animation I created in paraview. My data is 1178 points, each point has 400 vtk files (each vtk file is a new time step) so the animation is playing the 400 vtks in a sequence. This dataset has x,y,z coordinates so how should I input the data so that streamlines can be defined?

I just wanted to check in and see if you have any advice after I attached my data in the previous message? I am still trying to use streamlines in my animated data.

Thanks!

What kind of data set is the data in now? If you click on the Information tab in ParaView, it will tell you as the value of the “Type:” field.

The Data Type is Rectilinear Grid

You should now be able to add a Stream Tracer and position the seed point source relative to your data, and run it. See Exercise 2.12 in the ParaView tutorial for an example.

If your data is two dimensional, you can check the “Surface Streamlines” checkbox, and that will restrict the integration to only the in-plane components of the vector field.

Attached is the image from my paraview data. I can not follow exercise 2.12 because the Stream Tracer is greyed out as you can see and I do not know why.

Would you mind attaching your dataset? I don’t think it was attached in your earlier post.

Yes! Here is what one .vtk file looks like. Each of the 1178 points has 400 vtk files (each vtk file is a new time step) so the animation is playing the 400 vtks in a sequence
image

Can you share one VTK file for one timestep? Either attach it here (you might want to compress it) or send it to me directly if it is confidential (cory.quammen@kitware.com)?

Here is a zipped file of one of my Tests that is named ‘Right’. There are 63 points in this test and a total of 399 vtk files.

VTK Files.zip (194.2 KB)

There are two issues I see in the data sets.

  1. There is a single scalar array named xVel. You mentioned having vector values at each of these points. I would expect to have a xVel, yVel, and maybe zVel array for the three components in a vector field. Since you have a 2D domain, you may have just two components, but that’s fine. You can combine separave xVel, yVel, and zVel arrays into a single vector array (where each array value has 3 components corresponding to X, Y, and Z velocity components) and then use that velocity array in the Stream Tracer. With just a single xVel array, the Stream Tracer will not work.

  2. There are 69 values defined in the xVel array, but only 63 points. The number of array values and points should match.

Thank you for this insight. I have made the change so that array value and points are both 63.

It make sense to need two components for the velocity vector. I will input yVel array into my VTK files. How is that fomatted? Will the POINT_DATA be 126 since there will be 63 xVel and 63 yVel? Do I include a second LOOKUP_TABLE that will have all the yVel listed?

It should look like this:

SCALARS xVel float 1
LOOKUP_TABLE default
<63 data values for xVel>
SCALARS yVel float 1
LOOKUP_TABLE default
<63 data values for yVel>

With this approach, you will need to use the Calculator filter to assemble the different components into a vector value. This expression for the calculator should be

xVel * iHat + yVel * jHat

A different, probably better way: you can put the velocities together into one VECTORS array:

VECTORS vel float
xVel_0 yVel_0 0
xVel_1 yVel_1 0
<61 more entries like this>

Note the the vectors are assumed to have 3 components (they exist in 3D space), so the last column contains 0s for the z-component. The only real downside to doing it this way is the extra 2*63 bytes to hold the space and 0 characters, but you won’t need to use the Calculator filter to assemble the vector components into a vector array, so it should be simpler.

Attached is an example file with both approaches. Right1.vtk (2.2 KB)

I have decided to follow your advice and go with the better way. When I apply the stream tracer filter, no vectors/streamlines show. Attached is a picture with the stream tracer on.