Tool and Script to Plot Probe Values on a Graph

An interesting request came in today: Can I plot the values from my interactive query probe in a graph?

Good question. Currently, you can see the values reported next to the query probe in the viewport, and you can click on “display values” to get a window pop up with the values in tabular form. But, you can’t populate a Query for a Plotter and get a graph of the values.

Python to the rescue again. Through python, you have direct access to a list of those Interactive Probe Queries and their values. With that information, we can utilize Python to populate those values into a Query Register and make a Plotter (or graph) of them.

This small Python macro will create 4 queries actually: one for X coordinate vs Variable; one for Y coordinate vs. Variable, one for Z Coordinate vs. Variable; and one of Distance (from first probe) vs. Variable. The default plot is chosen as “Distance Vs. Variable”. However, the user can easily drag any of the other 3 queries into the plotter (or make their own plotter) in EnSight. Here is what it looks like when I have 6 probe values:

You can see that you have 4 queries generated, and 1 plotter.

Download the following python and setup as a macro perhaps (assign it to a memorable keystroke sequence) and be able to quickly and easily plot the values from your multiple interactive probes…. Voila.

Python Code for Plotting Probes

Another option is a python tool that will do this.

 

query_probe_example

 

 

 

 

 

Data Translator for measured PIV data

Particle Image Velocimetry (PIV) is one way of experimentally measuring the velocity of a fluid. EnSight is highly suited for analysis of PIV results but there must be some way to load the data. One PIV data format is DaVis .vec or .ve7 which is an ascii file that is basically a comma-separated (.csv) file with one header line. The original data is a collection of points with defined XY position and velocity in X and Y directions. Using python I translated the .vec file to EnSight case gold format. I created a 2D part with a mesh instead of just a collection of data points so that more analysis could be performed.

Download the script Updated 2017-05-25

Previous version (2015-07-08)

Online documentation for this script.

The following images are from relative velocity measured for a rotating pump. Since the data is on a mesh, most CFD post processing techniques can be used.

(Above) Streamlines calculated with and colored by velocity.

(Above) Colored by vorticity, which was calculated in EnSight from the measured velocity.

Many other visualization techniques could also be used such as isosurfaces and elevated surfaces. Other uses might be to compare measured data vs. CFD side by side, or by directly calculating the difference. If using CFD data be careful to compare equivalent data. For example, the measured data has no information about the z component of the velocity. So if your simulation is 3D you must create a 2D velocity vector for comparison to experiment.

This translator is still fairly rough and the documentation is limited, so please contact me if you want to use it. Running the script will open a window to select a .vec file.

Update 4/2012: The script has been modified to work with DaVis 7 format. Also fixed one bug. My test data set is still very small, so if you experience a problem with the translator please send the data to me.

Update 8/2012: The script now has an option to create a transient case from multiple PIV files. It also now treats the data points as element centers instead of nodes of the mesh. Has better GUI for making selections, and reports on the success or failure of the translation.

Update 7/2015: Now handles DaVis 8 format. Also handles “,” (commas) when they are used for decimal points.

Update 5/2017: Can specify which axes to write out to instead of always writing to the X and Y axes. Now handles both spaces and tabs in DaVis 7 and 8 formats.