functional#

Module providing reductions functions that can be applied to Fluent data from one or across multiple remote Fluent sessions.

The following parameters are relevant for the reduction functions. The expr parameter is not relevant to all reductions functions.

Parameters#

expressionAny

Expression that can be either a string or an instance of a specific settings API named_expressions object. The expression can be a field variable or a a valid Fluent expression. A specified named expression can be handled for multiple solvers as long as the expression’s definition is valid in each solver (it does not need to be created in each solver)

locationsAny

A list of location strings, or an API object that can be resolved to a list of location strings (for example, setup.boundary_conditions, or results.surfaces.plane_surface), or a list of such objects. If location strings are included in the list, then only string must be included

ctxtAny, optional

An optional API object (for example, the root solver session object but any solver API object will suffice) to set the context of the call’s execution. If the location objects are strings, then such a context is required

Returns#

float or List[float]

The result of the reduction

Examples#

>>> from ansys.fluent.core.fields.reduction import functional as reduction
>>> # Compute the area average of absolute pressure across all boundary
>>> # condition surfaces of the given solver
>>> reduction.area_average(
...     expr = "AbsolutePressure",
...     locations = solver.settings.setup.boundary_conditions.velocity_inlet
... )
10623.0
>>> from ansys.fluent.core.fields.reduction import functional as reduction
>>> # Compute the minimum of the square of velocity magnitude
>>> # for all pressure outlets across two solvers
>>> named_exprs = solver1.settings.setup.named_expressions
>>> vsquared = named_exprs["vsquared"] = {}
>>> vsquared.definition = "VelocityMagnitude ** 2"
>>> reduction.minimum(
...     expr = vsquared,
...     locations = solver1.settings.setup.boundary_conditions.pressure_outlet
...     + solver2.settings.setup.boundary_conditions.pressure_outlet
...     )
19.28151

Exceptions:

BadReductionRequest(err)

Raised on an attempt to make a bad reduction request.

Classes:

Weight(value[, names, module, qualname, ...])

Enum of available weighting options for sum and sum_if.

weight

alias of Weight

Functions:

area(locations[, ctxt])

Compute the total area of the specified locations.

area_average(expression, locations[, ctxt])

Compute the area averaged value of the specified expression over the specified locations.

area_integral(expression, locations[, ctxt])

Compute the area integrated averaged of the specified expression over the specified locations.

centroid(locations[, ctxt])

Compute the geometric centroid of the specified location(s) as a vector.

count(locations[, ctxt])

Compute the total number of cells included in the specified locations.

force(locations[, ctxt])

Compute the force acting on the location(s) specified (should be walls) as a vector.

mass_average(expression, locations[, ctxt])

Compute the mass-weighted average value of the specified expression over the specified locations.

mass_flow(locations[, ctxt])

Compute the total mass flow rate of the specified locations.

mass_flow_average(expression, locations[, ctxt])

Compute the mass-flow-weighted average value of the specified expression over the specified locations.

mass_flow_integral(expression, locations[, ctxt])

Compute the total mass flow over the specified locations.

mass_integral(expression, locations[, ctxt])

Compute the total mass-weighted value of the specified expression over the specified locations.

maximum(expression, locations[, ctxt])

Compute the maximum of the specified expression over the specified locations.

minimum(expression, locations[, ctxt])

Compute the minimum of the specified expression over the specified locations.

moment(expression, locations[, ctxt])

Compute the moment vector about the specified point (which can be single-valued expression) for the specified location(s).

pressure_force(locations[, ctxt])

Compute the pressure force acting on the location(s) specified (should be walls) as a vector.

sum(expression, locations, weight[, ctxt])

Compute the sum of the specified expression over the specified locations.

sum_if(expression, condition, locations, weight)

Compute the sum of the specified expression over the specified locations if a condition is satisfied.

viscous_force(locations[, ctxt])

Compute the viscous force acting on the location(s) specified (should be walls) as a vector.

volume(locations[, ctxt])

Compute the total volume of the specified locations.

volume_average(expression, locations[, ctxt])

Compute the volume-weighted average value of the specified expression over the specified locations.

volume_integral(expression, locations[, ctxt])

Compute the volume-weighted total of the specified expression over the specified locations.

exception ansys.fluent.core.fields.reduction.functional.BadReductionRequest(err)#

Bases: Exception

Raised on an attempt to make a bad reduction request.

Methods:

__init__(err)

__init__ method of BadReductionRequest class.

__init__(err)#

__init__ method of BadReductionRequest class.

class ansys.fluent.core.fields.reduction.functional.Weight(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

Enum of available weighting options for sum and sum_if.

Attributes:

ABS_MASS_FLOW_RATE = 'AbsMassFlowRate'#
AREA = 'Area'#
MASS = 'Mass'#
MASS_FLOW_RATE = 'MassFlowRate'#
VOLUME = 'Volume'#
ansys.fluent.core.fields.reduction.functional.area(locations, ctxt=None)#

Compute the total area of the specified locations.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.area_average(expression, locations, ctxt=None)#

Compute the area averaged value of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.area_integral(expression, locations, ctxt=None)#

Compute the area integrated averaged of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.centroid(locations, ctxt=None)#

Compute the geometric centroid of the specified location(s) as a vector.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
tuple
ansys.fluent.core.fields.reduction.functional.count(locations, ctxt=None)#

Compute the total number of cells included in the specified locations.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.force(locations, ctxt=None)#

Compute the force acting on the location(s) specified (should be walls) as a vector.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
tuple
ansys.fluent.core.fields.reduction.functional.mass_average(expression, locations, ctxt=None)#

Compute the mass-weighted average value of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.mass_flow(locations, ctxt=None)#

Compute the total mass flow rate of the specified locations.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.mass_flow_average(expression, locations, ctxt=None)#

Compute the mass-flow-weighted average value of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.mass_flow_integral(expression, locations, ctxt=None)#

Compute the total mass flow over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.mass_integral(expression, locations, ctxt=None)#

Compute the total mass-weighted value of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.maximum(expression, locations, ctxt=None)#

Compute the maximum of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.minimum(expression, locations, ctxt=None)#

Compute the minimum of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.moment(expression, locations, ctxt=None)#

Compute the moment vector about the specified point (which can be single-valued expression) for the specified location(s).

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
tuple
ansys.fluent.core.fields.reduction.functional.pressure_force(locations, ctxt=None)#

Compute the pressure force acting on the location(s) specified (should be walls) as a vector.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
tuple
ansys.fluent.core.fields.reduction.functional.sum(expression, locations, weight, ctxt=None)#

Compute the sum of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
weight: str | Weight
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.sum_if(expression, condition, locations, weight, ctxt=None)#

Compute the sum of the specified expression over the specified locations if a condition is satisfied.

Parameters:
expressionAny
condition: str
locationsAny
weight: str | Weight
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.viscous_force(locations, ctxt=None)#

Compute the viscous force acting on the location(s) specified (should be walls) as a vector.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
tuple
ansys.fluent.core.fields.reduction.functional.volume(locations, ctxt=None)#

Compute the total volume of the specified locations.

Parameters:
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.volume_average(expression, locations, ctxt=None)#

Compute the volume-weighted average value of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.volume_integral(expression, locations, ctxt=None)#

Compute the volume-weighted total of the specified expression over the specified locations.

Parameters:
expressionAny
locationsAny
ctxtAny, optional
Returns
——-
float
ansys.fluent.core.fields.reduction.functional.weight#

alias of Weight