RTZ Range Tool to generate Circumferential Average

Using roughly the same Python tool posted in the previous entry (RTZ Range Tool), I modified this tool to loop through the theta range and report back the distribution in the circumferential sense. This is useful when looking at some type of an average quantity as you traverse in theta, rather than using a line (which only reports back the local non-averaged value). The added benefit of using this small pie slice volume is that you can look at a more average quantity, rather than an unique quantity at a finite single point.

This routine shares about 85% with the above interactive routine, including all of the logic for the creation of the RTZ range selection. This routine has the added “loop” at the end of the routine, were the resulting RTZ range clip is then swept around through 360 degrees and a query of a variable is made.

The Batch version differs from the previous Interactive RTZ Clip tool in the following manner:

  1. It is made for batch operation (settings at the top of the file for input).
  2. It uses a single axial value, and this ends up as a thin clip.
  3. It uses a theta sector (say 5 degrees for example), and loops through the entire 360 deg range.
  4. It queries a variable on this clip part, and builds a Query and Plotter as a result.

The main goal for this tool is to be used in batch, and query a particular variable as a function of theta (over a sector plane).

An example screencast tutorial, dataset, and python routine for this batch python routine can be found at :



The same example manifold model is used for this case. A sample output from this routine yields the following type of graph:

The intention for this type of code is to allow the user to query a value on a segment in theta (rather than a single theta value), and report this back as a query and plot. This routine also works in batch mode, with a few user inputs listed at the top of the python routine.

Analytical Ray Casting

I had an interesting request come through last week regarding analyzing the maximum value along a particular direction. The user desired this information as a form of comparison against experimental information gathered. In this instance, the user really wanted to define a plane as a start point, then move along a direction from this plane, and register what the maximum value was… and plot that back on the surface as some type of filled contour. The user also wanted to limit the length of this survey, so that they could determine the maximum within X units from the originating plane.

EnSight’s built in “Radiograph_mesh” and “Radiograph_grid” were first looked at, as they return an integral along a ray cast from a surface. This was useful, however they needed the maximum value (rather than integral), and wanted to control the length of the ray (rather than infinite), as they needed to compare to experimental data.

So, we already had a “Streamline Analysis” tool which analyzed streamlines, and returned various analytical information about the streamlines (scalar max being one of them). This tool analyzes each streamline in turn, and creates new scalar fields like distance traveled, time traveled, normalized scalar, maximum scalar. If you then combine this tool with a “Fixed” vector field, rather than a spatial varying velocity vector field, you can in effect cast “rays” along a particular direction and then analyze the values along each streamline.

Here is an example of that output, using a simplified exhaust manifold model.

Example of Ray Casting and Analysis of Max value along ray.

Example of Ray Casting and Analysis of Max value along ray.


The image on the left indicates the maximum value of temperature experienced a direction specified (this case normal to the clip), for a distance of 0.2 units.
You can find more information by watching a short video/audio tutorial here : http://www.ensight.com/screencasts/sample_streamline_ray_cast/sample_streamline_ray_cast.html



Pipe centerline routine

As many of you know I’ve been working on the pipe centerline routine in the past. Today it’s running well on most geometries so it’s time to share it.

If you already know older versions, you will see that some changes have been made. One thing is that the the routine can be used as a User Defined tool now. If you want to use it that way, please delete the expression run(0), currently in line 693. Copy the routine and the thumbnail to ~/.ensight92/extensions/user_defined/Tools and restart EnSight. Now you should see the thumbnail and the tool description in the UDT dialog. Starting the routine will launch the GUI where you can make your settings.


















The GUI changes dynamically, depending on the selectid parts and the settings. For running the script, please select the wall part (this should be the pipe with the desired center spline), an inlet and an outlet. The order of inlet and outlet part is not important. If the pie has no parallel sections you can allow EnSight to generate infinite clips. If there are parallel sections do not allow that. EnSight will then generate a finite pipe clip with the plane tool. The diameter of the plane tool is the twice of the inlet part diameter by default. Modify this setting if the pipe diameter varies.
































The step delta controls the moving steps of the plane tool. This value is calculated automatically, depending on the selected wall part. This value should fit for most situations. Only modify it if the spline result is not satisfying. The script should generate a coaxial spline for the pipe geometry. If you are not satisfied with the result please play with the settings or contact me.









The script can be downloaded here:


The thumbnail:







temporal statistics

The EnSight calculator has the StatMoment function to calculate spatial  statistical quantities: mean, variance, skew, and kurtosis as shown in the image below from the User Manual.

But the EnSight calculator includes only the ability to calculate three temporal statistical quantities, min max and mean using two calculator functions.  An EnSight Python script is provided to calculate temporal mean, temporal variance, temporal skew and temporal kurtosis as well as temporal sum, temporal RMS, temporal min and temporal max scalars.  These are calculated over time rather than space, resulting in a spatial scalar with each element containing it’s temporal statistics.

These variables are named per the comments in the python script.

The user will have to edit this python script and change the variable name var_name to be their variable name, change the begin and end time values, and change the values of the variance_flag, skew_flag, and kurt_flag to True or False, in order to calculate these values.  Note that in order to calculate variance, skew or kurtosis, all other previous values must be True.

Note that an entire pass through all the timesteps is required for each of the temporal statistical values requested. That is, mean, variance, skew and kurtosis will require a total of 4 passes through all time.  Temporal sum, temporal RMS, temporal min, and temporal max will require an additional 4 passes.  For large datasets with a large number of times this can take quite a while.  First run this with the variance, skew and kurtosis flags set to false and set the min and max time close together to get an idea of how long it takes for one pass through.

Note that this will work for static geometry with temporal variables, or changing coordinate geometry with temporal variables.  It will not work for changing connectivity geometry, where the geometry connectivity changes at each timestep.  Do a query>dataset to determine if what kind of geometry is in your specific dataset.

The python script makes creative use of the temporal mean function included in EnSight to do temporal integrations using intermediate variables.  The Temporal Mean calculator function in EnSight uses, by default, the Trapezoidal rule for temporal integration.  The results using this integration are shown below.


Temporal Statistics Results for Flow2d Dataset

As of EnSight 9.2.2(e), a statistical integration option is allowed for Temporal Mean.  This methodology simply uses the data and the step size in a rectangular integration. This python script turns this form of integration on for the duration of the script then restores it back to the default of using Trapezoidal Rule.  Shown below are the results using this new statistical integration.  For this dataset there is not significant difference until the kurtosis.

and the temporal sum, min, max, and RMS are shown below.

Click on the link below to get the python script.