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) or injection region. For an injection region, only the cumulative geometry of the injection positions is considered, not the location of the entire injection region. 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.
This example will calculate the average magnitude of
Velocity
onoutlet
.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 asVelocity u
) to include a directional sign. This example will calculate the area-weighted average value ofVelocity u
, with negative values ofVelocity 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])
.