### 15.5.2. areaAve

The `areaAve` function calculates the area-weighted average of a variable or expression on a 2D location. The area-weighted average of a variable or expression is the average value of the variable or expression on a location with the mesh element sizes taken into account. Without the area weighting function, the average of all the nodal variable or expression values would be biased towards values in regions of high mesh density.

    areaAve[_<Axis>[_<Coord Frame>] ](<Variable|Expression>)@<Location>

where:

- `<Axis>` is x, y, or z.

- `<Coord Frame>` is available in CFD-Post only.

- `<Variable|Expression>` is a variable or expression.

- `<Location>` is any 2D region (such as a boundary or interface). An error is raised if the location specified is not a 2D object.

To calculate the pressure coefficient Cp, use:

    (Pressure - 1[bar])/(0.5*Density*(areaAve(Velocity)@inlet)^2)

You can create an expression using this, and then create a user variable using the expression. The user variable can then be plotted on objects like any other variable.

Note: Projected areaAve (for example, areaAve_x) works as expected only for surfaces that do not fold in the selected direction. In extreme case, if the surface is fully closed, the projected average will result in a randomly large number, as the projected area will be zero.

#### 15.5.2.1. Tools > Command Editor Example

    >calculate areaAve, <Expression>, <Location>, <Axis>

#### 15.5.2.2. Tools > Function Calculator Examples

- This example will calculate the average magnitude of `Velocity` on `outlet`.

  Function: `areaAve`, Location: `outlet`, Variable: `Velocity`.

  Note that flow direction is not considered because the magnitude of a vector quantity at each node is calculated.

- You can use the scalar components of `Velocity` (such as `Velocity u`) to include a directional sign. This example will calculate the area-weighted average value of `Velocity u`, with negative values of `Velocity u` replaced by zero. Note that this is not the average positive value because zero values will contribute to the average.

  Function: `areaAve`, Location: `outlet`, Variable: `max(Velocity u, 0.0[m s^-1])`.

Release 18.2 - © ANSYS, Inc. All rights reserved.