Merging multiple time periods of a CFx simulation into one

During the calculation of a CFx simulation, the solver can stop and restart. When this happens, the user can only export one dataset in Case Gold format for each one of the restarts, making it impossible to load the solution in EnSight as a single transient dataset. In this scenario, some operations such as the calculation of the temporal average, or the creation of plots vs. time over all the timeline, will not be possible.

If this is the problem you are facing, then you can use this User Defined Tool presented in this article to concatenate the datasets from the restarts into a single transient Case Gold dataset. The Tool will take care of distinguishing between changing or static connectivity, and will check the sequence of timesteps to create a unique timeset with increasing timesteps.

Shown below is the structure of the directories with the data that you need to have to run this UDT. Note that there is no constraint on the directory names – only on their structure

Transient data





In this example, Data1 will contain the dataset for the first restart, Data2 will contain the dataset for the second restart, and so on.

Download the attached file, un-zip it and place the files into your local UDT directory (which by default is in $CEI_HOME/ensight101/site_preferences/extensions/user_defined/Tools). Open EnSight a first time with the “-no_prefs” option to initially load this tool, and then restart EnSight  normally. Now, you will find the tool among the User Defined Tools.

Double-click on the tool lo launch it. It will pop-up a window asking for the first .case file. Select it and give “Ok”.

The script creates an additional ZData directory under the Transient_Data directory. In this new ZData you will find the new concatenated dataset. Note that the script makes a copy of the original files, doesn’t move/delete them. This means that you can end up using a lot of disk space, if your initial dataset is large.

Please feel free to contact us if you have any question or problem in using this Tool



Merging Multiple Time Periods of a Converge Result into One

Are you a ConvergeCFD user with EnSight?

Do you have a Single Dataset, but multiple time periods which you translated to Case Format? Ie you export results from Time T = 0 to T1 in one operation, then later exported from Time T2 to Time T3, and then again exported reults from Time T4 to T5?

If so, then currently you have multiple different time ‘sets’ or ‘periods’, which can’t easily read into a single session of EnSight (other than using Multiple Cases, but that is not what Cases are meant for).

Would you then like to be able to operate on this solution as though it were one complete time period from T = 0 to T5? Well, I think we have a little tool for you. This tool should provide you back with a single coherent time period (From T = 0 to T = T5) as a single case.

This little python tool takes a look at all of the .case files in your current directory, and gathers up a list of all of the files that are referenced, constants written, and time values. In then creates a internal global list of all of that infomation, and sorts it in ascending time order. It then renames all of the associated files so that they fall into a single progression in time order, and generates a NEW case file, referencing the global total time, global total constants, and the newly renamed set of variable and geometry files. The routine takes only a second to run (renames are quick), and you should be able to load up the NEW case file into EnSight.

As renaming files is perhaps a dangerous thing, the routine also writes an “undo” file as well. You can run the “undo”, and you will get back to your original set of files (if you need to for some reason).

As with any routine, there are some assumptions, limitations, and caveats. They shouldn’t be too restrictive, but here they are, so you have a better idea about what the routine is expecting:

a. All of the case files are in the same directory (the routine doesn’t go rooting around in sub directories looking for .case files to merge).

b. All the .case files in the current directory are meant to be “merged” into one. If there are some which aren’t meant to be merged, just move them temporarily to somewhere else.

c. When you exported the results (using post_convert), you ALWAYS exported the same variables. No exceptions allowed, no if’s, but’s, no coconuts. (EnSight can’t deal with some variables existing at some times, and not others…. rules are rules).

d. The time values can overlap, and be of varying delta T. The routine should handle that okay.

e. The routine assumes you have measured data (default for converge post_convert us).

f. Due to internal coding assumptions/methods, this routine is for CONVERGE users only. If you have results from OpenFOAM, or Fluent, CFx, or other solvers, please contact CEI ( separately. We have some prototypes for other solvers.

To run the routine, simply download the python file, and place it into the directory you want to merge Converge .case files together. Then, type :


After running, should you need to undo, there will be a new python file created in your directory, and that can be run via:


This works for MAC/Linux/Win. Use a cmd shell in Windows to run the python routine.

As always, please contact if you have questions, comments, requests. We’d love to hear from you, and work with you to provide you with the best post processing experience.


Download Link for file:


Once downloaded, simply unzip the file to find the python .py routine.

Creating curved clips from splines

These are two related tools which create 2D curved “clips” from user-created splines. The tools do not create actual EnSight clip parts. Instead the final result is either an offset part (a type of elevated surface) or a second case with a single part and no variables. The “clip” geometry and mesh depend only on the splines, not on any parts.

Tool 1 – Curved clip from a single spline


This will create a clip which is the shape of a spine extruded in a single direction.


  1. Makes one or more splines
  2. Run the tool (if there is more than one spline the tool will ask you to select one)
  3. Set the extrusion distance and direction

The tool should run and a new part should be visible.

Options to set in the file before starting EnSight

grid_size – The clip mesh will be quad4 elements that are approximately square. The grid_size variable sets the desired length of one side of each element.
min_spline_points – In cases where the grid_size is too large relative to the length of the spline the number of elements could be very small. If the number of points along the spline is below the minimum specified here then the grid_size will be reduced to meet the minimum requirement.

Tool 2 – Curved clip from two splines


This will create a clip which is the shape of a spine extruded along the direction of a second spline.


  1. Make two or more splines
  2. Run the tool
  3. Select the two splines to use (the order of the splines matters) and other options in the window

The tool should run and a new part should be visible. If there are critical errors a window should pop up with an error message. If the direction of the extrusion is in the wrong direction, invert the second spline and run the tool again.

Options to set in the file before starting EnSight

There are two methods the tool can use for creating clips.
1. The default is to write a new case file, load it in as a second case, and use CaseMap to color it by a variable. This method is much faster and more robust but it does require loading a second case. For that reason a second method is included.
2. Create a point part with triangle mesh, then use the point part to create an offset part. There are two sub-methods for how to create the point part. See below.

temp_file_type – chooses which method above to use.
‘case’ is for writing a new case file.
‘point’ is for creating a point part by writing a point part file.
‘none’ will create a point part without using a file.
grid_size – The grid_size variable sets the desired distance between neighboring nodes.
max_rectangles – (for ‘case’ only) If the given grid_size and spline lengths would result in more than max_rectangles then the grid_size will be increased.
max_triangles – (for ‘point’ and ‘none’ only) The tool can become prohibitively slow if there are too many triangles. The number depends on your hardware and OS but 10k triangles should take a few seconds, 100k triangles a few minutes. The time increase is faster than linear (i.e. n^2) so be careful how high you go. If the given grid_size and spline lengths would result in more than max_triangles then the grid_size will be increased.


Creating point parts should be faster in 10.1.4a and later. Some text output is sent to the python tab. (updated 2015-4-23)

Fluent Particle Data with Multiple Injections

Currently (up to at least Fluent 15), when you attempt to export multiple injections from Fluent to the EnSight format, each injection is written as its own set of Measured Data files **SEPARATELY**, with separate .encas files written.

The result is that if you were to attempt to load any of the separate .encas files into EnSight, you would only see particles from a single injection. You could perhaps load in the multiple .encas files as multiple cases, but this would perhaps multiply the amount of memory used, result in lots of extra parts, and is not a suggested method (although it might work for you).

Fluent are aware of this issue, and have been requested to correctly export multiple injections to a single set of Measured Data files. Their schedule for that improvement is currently unknown.

However, in the meantime, there is a potential work around for this. With a short python script, one can merge the various injections into a single set of measured data files, so that you can visualize all of the injections in a single case. In addition to merging the injections, the routine also creates one additional variable called “inj_id” for the injection ID. Thus, you can still analyze, interrogate, visualize separate injections within EnSight, even though it is contained within a single Measured Data Part.

The ptyhon routine does require a very minor edit, based on your particular dataset, variable export, and timesteps.

A short video tutorial on using this python utility (including the basic editing for your dataset) is provided below.

Tutorial Video on Handling Multiple Injection Particle Data from Fluent

Click here to Download the Python Utility

Smoke rendering for FDS

From the official site for FDS:

Fire Dynamics Simulator (FDS) is a large-eddy simulation (LES) code for low-speed flows, with an emphasis on smoke and heat transport from fires.

Smokeview (SMV) is a visualization program used to display the output of FDS and CFASTsimulations.

FDS+Evac is the evacuation simulation module for FDS.

These tools are open source and freely available.

FDS smoke 2

One use of FDS is simulation of visibility through smoke. The most realistic way to visualize smoke is volume rendering, which the default post processor Smokeview can do.

EnSight volume rendering color and transparency are customizable by the user, so they cannot be relied upon to accurately represent the visibility through smoke. The attached document and python script present a method which sets the volume rendering opacity in EnSight to accurately represent visibility. With minor modification the script also applies to any data that has a light extinction coefficient or optical density variable.

Analysis and python script.

A session file containing this dataset can be downloaded here.

Releasing Streamlines from Centroids of Elements

imgoutA request came in the other day to release streamlines from the centroids of all of the 2D elements of the selected parts. Now, EnSight, the default seed locations are from the nodes of the parts, not the centroids. However, this user would like to release from the centroids of the parts selected.

Python to rescue. We can utilize the Calculator Capability in EnSight to compute the X,Y,Z coordinates of the selected parts, and use the “NodeToElem” to convert those three scalar variable field values to be at the centroids of each element. With Elemental Values at the centroids of the parts, we use the FlatFile export with the “CELLID” parameter and ascii format to write out the elements of selected part(s) and their elemental variables to a text file. We can then just reformat this text file into a qualified “Particle Emitter File”. Voila. Within the standard streamline creation of EnSight, we can use a “Particle Emitter File” as the seed locations for the Streamlines, and therefore generate streamlines from the centroids of all elements in the selected part(s).

See below a short little Python Code to do this operation, as well as an image of what such a release would look like.

Python Utility to create Particle Emitter File from Centroids of Parts Selected

Converting Plot3D variables to dimensional variables

PLOT3D variables in EnSight are non-dimensional.  They are non-dimensionalized in a somewhat arcane calculation.  The density is scaled by the freestream density, the momentum is scaled by the product of the  freestream density and the speed of sound, and the Energy is scaled by the product of the freestream density and the speed of sound squared.

For those who don’t want to go through this calculation of dimensioned variables manually and want access to the engineering variables in consistent, user-selected units at a user-selected altitude from a PLOT3D calculation, this script calculates the extended plot3d variables in either SI or English units. This script uses the non-dimensional Plot3D Energy, Density, and Momentum variables in its calculation. This script is assumes Earth atmospheric data. So, it is not valid for calculations on Mars, nor is it valid for calculations in water.

If ‘Energy’, ‘Density’ and ‘Momentum’ all exist then the script will prompt the user for unit type (SI or English) and the altitude and then use a lookup table to find the corresponding variables in consistent units.  The code will then calculate a Density_true, Momentum_true, and Energy_true variables (which have consistent units for the user input)  and use those to calculate the extended CFD variables.

Click below to download the zipped EnSight Python Script

Element Metrics and Histogram Tool

elemetric_histogramAs part of the core capability of EnSight to not only visualize, but analyze the domain and solution results, we have implemented the Element Metrics routines from Sandia Verdict Library ( There are approximately 30 different element metrics that this routine will calculate for you, depending upon the grid types used. Again, we have implemented this function as a general purpose calculator function, as well wrap this fundamental capability with a Python-based macro to add further ease of use and end-user functionality. This macro is called “EleMetric_Histogram”, and performs the following on the selected parts in EnSight:

1. Determines the element types selected, and only calculates EleMetric quantities which apply.
2. Creates separate scalar variables for each Metric computed. Users can color by any of these variables, or further query where maximum or minimum values occur.
3. Determines a Histogram Distribution through the domain, and reports this to a text file (EleMetric_Histogram.txt) in the directory where your case is. This file is simple ascii, and can be inspected with any text editor.
4. An EnSight Query is generated for each Metric Histogram, so that you can visually graph the distribution of that Metric for the domain.

elemetrics_guiDouble clicking on this utility will launch the following short GUI for some basic user controls:
The first option allows the user to utilize the current selected parts only, or to calculate the variables for ALL parts in the model.
The histogram options provide the ability to control the number of bins for the histogram function, as well as where to write this information (text file and/or EnSight query registers).
The typical output to the text file should provide a nice overview of the variables computed, as well as quantification of the variable distribution in the domain.

The “EleMetric_Histogram.txt” file list all of the variables computed. If the minimum and maximum are the same, we simply report that. Else, the distribution is given as well:


In EnSight, the user now has access to the variable information computed, and can clip the domain (perhaps a crinkly clip would be best), and color the domain by the metric of interest:



The following link can be used to download the user defined tool for “EleMetric_Histogram”

Download here for elemetric_histogram

Current version is 4.0, dated 23-Oct-2014, updated by Marina Galvagni.

Kevin Colburn, CEI


Exporting variable values on a grid

This was made for a specific customer request. It exports variable values that lay on a specified grid of points over an X-Y plane. It saves these values for all time steps. Download:


The default settings work with the flow2d data and save to a .csv file.

This was also my first venture with PyQt. These lines of code pop up a confirm file overwrite window if the target save file already exists:

q = PyQt4.QtGui.QMessageBox()
q.setWindowTitle(“File already exists”)
q.setText(“The file “+filename+” already exists.\nDo you want to overwrite the existing file?”)
ret = q.exec_()

I didn’t make my own class to do it, but QMessageBox is already a class so I don’t see why my own class would be better for a simple case like this. The setWindowTitle method doesn’t seem to work for me though (the window has no title). Making it a function would have been cleaner but this was just a quick script.

Prepare cube tool for a skybox

Here is a very short script that prepares the cube tool to make a skybox. Just change the numbers in the first 2 lines and go. Then create the skybox manually.