Tecplot Macros

Using Macros to reduce repetitive tasks in Tecplot

by Arnab Ganguly (agangul@purdue.edu)

  1. Record and Play!

This is particularly useful when a set of tasks need to performed repeatedly. For example, if I have the same geometry for 10 different inlet pressure conditions, but need to generate the velocity contours and streamtraces for each of them, it may be laborious to repeat the same steps for each of them. The section below summarizes the procedure to record and play a macro in Tecplot.

In order to use the macro in Tecplot, all one needs to do is to record the steps that are needed to generate the contours for one case. The comprising steps are saved in a .mcr file which can be recalled for any of the subsequent cases and used to generate the contours and streamtraces. It is important to keep in mind that while recording the steps, the image is not redrawn automatically but needs to be done manually (“Redraw-All” button) from time to time. A pictorial representation of the steps is shown below:

Screen shot of the scripting tab

2. Running Python Scripts in the Tecplot Environment

Writing Python scripts can be a useful means of extracting information from your results in the Tecplot environment. Python scripts can be written to perform array manipulations or setup interactive, GUI based input/output. These are two among a plethora of techniques that can be used to streamline the data handling which can quite often be voluminous.

I have written a script to compute the largest mass flux in a 3D domain which can be downloaded from the link provided. The script generates an interactive user interface when run from the Tecplot environment. It asks the user to input the variable numbers corresponding to the X (1), Y (2) and Z (3) axes, followed by the variable number for the mass flux (25) and finally the zone number (2) for the domain. Having run the script, it outputs the coordinates (X, Y and Z) and the corresponding mass flux at which the flux is largest. Before running the script one must remember to indicate the location of the script. This can be done under the scripting tab, by selecting the “Configure Python Search Path…”. Below is a screen shot of the interactive session that is established on running the script.

Screen shot of the interactive input/output generated using a Python Script