« Back to Video Tutorials

Calculating Average Over Time


Computing an average over time is an important method in CFD to understand overall trends in turbulent flow fields. In ocean science, a time average can be used to remove the effects of seasonality to understand long term trends. Thankfully, this can be accomplished fairly easily in Tecplot 360.

In this video we’ll start with a vertical transect extracted from an FVCOM solution. This transect shows the salinity along a prescribed path through time. The data has a common grid throughout time, so we can use simple equations to compute the average.

We will duplicate the first zone in our transect and rename the zone to “Transect Time Average.”

Then we can use the Specify Equations dialog to compute the average as such:

  1. Select the Transect Time Average zone
  2. Enter an equation summing the salinity in each zone, and dividing by the number of zones:
    {salinity} = ({salinity}[1]) + {salinity}[2] + … + {salinity}[n]) / n

Clearly, this will become cumbersome for a large number of timesteps and multiple variables. This will be better done with a Python script which will not only easily handle a large number of zones, but can also compute the time average for a large number of variables.

To run this script we must first enable PyTecplot Connections via the Scripting menu. Then, from a command prompt we execute the script. This will prompt us for which Strand we want to average. The strand number can be found in the Dataset Information dialog. A strand is simply an integer which identifies a collection of zones through time.

Once we enter the strand number the script will handle the zone duplication and execution of the formulas to average the results.

When the script is finished we’ll simply copy the original frame and activate the Time Average zone to view our results.

This concludes the tutorial for computing an average over time in Tecplot 360 using PyTecplot.

Thank you for watching!

Try Tecplot 360 for Free

Related Videos