Plotting Cross-Sectional Averaged Values: Part 2 – EnSight

As mentioned in Part 1 of this blog, you reduce complex 3D flows down to cross-sectional averaged values for plotting against the distance along the flow path in either of Ansys’s dedicated post-processing tools: CFD-Post and EnSight.  Part 2 of this blog will focus on the method available in EnSight.

Method 3: Query

Application: Ansys EnSight

Pro: Utilizes EnSight, which can be used for much larger models than is practical with CFD-Post

Con: Defining cross-section location can be very difficult for complex geometry

EnSight’s Query tool has a built-in feature for cycling a location over a range of values, performing a calculation as it progresses, and making a plot of that data.

The first step to use this feature is to create a location that defines the cross-section of your flow path.  For simple geometry this will just be a Clip along a particular direction, but for more complicated flow paths this could involve defining a spline path for a clip to follow.

Next, you will need to create a Variable that calculates the cross-sectional average of the quantity of interest on the clip.  For transported quantities, this should be a mass-flow-weighted average.  Unfortunately, EnSight does not have a direction-independent mass-flow-weighted average function, but one can be built in a few steps.  First, a new variable for mass flux needs to be created.

Then, the weighted average can be calculated on the clip using the SpaMeanWeighted predefined function and the MassFlux variable that was created in the previous step.

To create the plot of the averaged value as the clip progresses along the flow path, create a new Query using Query > Over time/distance, set the Sample to By constant on part sweep, select the variable that was just created, Start, set the range and number of samples, and then Create query.

Note that the plot data can be exported to a file by right-clicking on the query and choosing Data > Save CSV file.

Plotting Cross-Sectional Averaged Values: Part 1 – CFD-Post

When analyzing complex 3D flow, it’s often helpful to visualize data using simple 1D plots.  One of the most commonly requested plots is to be able to show how the flow is changing on average as you progress from inlet to outlet.  While there is a native feature in Ansys Fluent to calculate circumferential averages on boundaries and plot them with respect to the axial direction (for reference, the TUI command /plot circum-avg-axial), for volumetric data this process needs to be done in one of the dedicated post-processing tools: CFD-Post or EnSight.  This blog will show various methods to create cross-sectional average plots within each tool as well as discuss some of the pros and cons of each method.

Part 1 focuses on the two methods available in CFD-Post.

Method 1: Turbo Mode

Application: Ansys CFD-Post

Pro: Easiest method to enable and customize

Con: Limited to axially-aligned geometry

CFD-Post has a suite of turbomachinery focused post-processing tools called Turbo Mode.  However, it is not limited to just turbomachinery models.  To utilize Turbo Mode, you simply have to identify a hub, shroud, inlet, and outlet.  If those items exist as part of your geometry, you can just specify them directly, but if not you can identify them using a series of Lines.  For example, you can create a hub line along the axis of your model, a shroud line around the outer diameter, and then inlet and outlet lines to connect the two.

Note that for the purposes of calculating average data the lines do not have to follow the exact contour of the geometry.

Once this is done, within Turbo Mode you can identify the global rotation axis (the axis perpendicular to your cross-section), specify the Lines that were just created, and Initialize.  This will create a 2D grid defining the revolved region for the calculations.

Now that the region has been identified, you can use the Inlet to Outlet chart to plot area-weight or mass-flow-weighted values versus progress from inlet to outlet.

Method 2: Scripting a Session File

Application: Ansys CFD-Post

Pro: Direct control over process, allowing for complex flow paths

Con: Requires knowledge of CFX Command Language and Perl

The most direct way of getting cross-sectional averaged values along a flow path is to create a location that defines the cross-section, calculate the averaged value at that location, and then script the progression of the location from inlet to outlet.  In CFD-Post, this scripting is done using Sessions.

First, a location needs to be created: typically a simple plane, but if the flow path is complex then a bounded plane defined by point and normal.

Then, an Expression needs to be created that calculates the appropriate type of average on the plane, such as area-weighted or mass-flow-weighted.

To start the scripting process, you will need the code to modify the plane location.  This can be generated by starting a new Session, starting Recording, editing the plane location, and then stopping the Recording.  This creates a CSE file in your working directory.

The CSE file can then be modified with Perl commands to loop over the flow path from inlet to outlet and save the calculated Expression value to a file.  Once that is done, the modified Session file can then be played back in CFD-Post to perform the calculations.

An example of this script can be obtained by e-mailing