PIV Data Translator Help

Section 1: Converting the data

Run the script in EnSight. You will see a GUI with 3 fields.

  1. Choose a file or a directory:  Only one file can be selected. Any file extension can be used.
  2. Translation options: Three options. The first option translates only the file chosen in (1). The other two translate all files in the directory which have the same extension as the chosen file.
  3. Sets the time increment between every two time steps. This option only applies if “All similar input files as one transient case” was chosen in (2).

After the translation is finished you should see a window that reports success (or failure). The new EnSight case(s) are located in the “ensight” subdirectory in the same directory as the original data.

There are additional options which are changed by editing the .py script. These are located near the beginning of the file, after the line “# options meant for the user to change:” These options are lightly documented in the script.

  • BINARY_OPTION – Whether to write the EnSight files as binary or ascii.
  • UNIT_OPTION – Select which units to use. PIV files tend to have different units for the grid and velocity. For example [mm] for the grid and [m/s] for velocity. This would be incompatible with some EnSight features such as pathlines. So this option will create an EnSight case with consistent units.
  • X/Y_OPTION – Flip the x and/or y axes.
  • ORIGIN_OPTION – Shift the origin of the data. For example if you have rotating machinery it may be convenient to have the origin at the center of rotation.


Section 2: Using EnSight after the data has been converted

How to remove unwanted data points

The original data may include data points which are invalid. For example there may be solid areas such as the walls of a container. If this junk data is not removed, then some calculations and visualization techniques may be incorrect. For example if you want to calculate an average velocity of the fluid.

If there is a “blank” variable:
The blank variable will be present if your PIV data contains a “count” column.
Do filter elements and use ‘blank’ = 0.0. This will alter the original part, completely removing the elements with blank = 0 from mesh, as if they were not in the dataset at all.

If there is no blank variable:
All of the velocity values are as they exist in the original data (but possibly with different units). Hopefully you can use the velocity values to distinguish between what data points are valid and which are invalid. This is something you need to know about your own data. In the examples below I will use velocity magnitude <= 0 or = 0 to indicate invalid data.

Method 1: Isovolume
In this method we create a new part which is an “isovolume” (actually it will be a 2d surface). Create an isovolume of all values > 0. This new part is the region of the mesh with valid data. Hide the original part, and use this new part for all of your visualization and calculations.

Method 2: Filter elements
EnSight requires element-centered scalar variables for this feature. Velocity is a vector, so we need to create a velocity magnitude variable first. Use the calculator to do this, for example with the formula VelMag = SQRT(DOT(velocity,velocity)). When you have the new variable, do filter elements with VelMag = 0.0 as the criteria. This will alter the original part, completely removing the elements with VelMag = 0 from mesh, as if they were not in the dataset at all.

If you cannot use the velocity values, then you may need to manually remove elements by using clips or other methods.

Coloring options

Since velocity is an element variable, you can choose whether to color each element by a single color, or smooth the colors out. This option is found in the Palette Editor, Options tab, scroll down to “Use continuous palette for element variables.”

Warning. If you use the smooth coloring (continuous palette) option the colors near invalid data points may be incorrect unless you use one of the methods described in “How to remove unwanted data points” above.

The image demonstrates the three situations mentioned above. (Center) Shows each element with a single color. In this case blue represents invalid velocity values. (Left) Shows interpolated smooth colors, but the colors are incorrect because the blue values have not been removed. (Right) Using “blank” to remove invalid elements results in the correct interpolated colors.

Leave a Reply