field_data#

Wrappers over FieldData gRPC service of Fluent.

Classes:

BaseFieldData(data, field_info, ...)

The base field data interface.

Batch(service, field_info, ...)

Populates Fluent field data on surfaces.

BatchFieldData(data, field_info, ...)

Provides access to Fluent field data on surfaces collected via batches.

CellElementType(value[, names, module, ...])

Element types for a cell element.

ChunkParser([callbacks_provider])

Class for parsing field data stream received from Fluent.

Element(_id, element_type[, node_indices, ...])

Element class for mesh.

Facet(node_indices)

Facet class within a mesh element.

FieldDataService(channel, metadata, ...)

FieldData service of Fluent.

FieldInfo(service, is_data_valid)

Provides access to Fluent field information.

LiveFieldData(service, field_info, is_data_valid)

Provides access to Fluent field data on surfaces.

Mesh(nodes, elements)

Mesh class for Fluent field data.

Node(_id, x, y, z)

Node class for mesh.

ZoneInfo(_id, name, zone_type)

Zone information for mesh.

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

Zone types for mesh.

Functions:

get_fields_request()

Populates a new field request.

override_help_text(func, func_to_be_wrapped)

Override function help text.

class ansys.fluent.core.services.field_data.BaseFieldData(data, field_info, allowed_surface_names, allowed_scalar_field_names)#

Bases: object

The base field data interface.

Methods:

__init__(data, field_info, ...)

__init__ method of BaseFieldData class.

get_field_data(obj)

Get the surface, scalar, vector or path-lines field data on a surface.

get_surface_ids(surfaces)

Get a list of surface ids based on surfaces provided as inputs.

__init__(data, field_info, allowed_surface_names, allowed_scalar_field_names)#

__init__ method of BaseFieldData class.

get_field_data(obj)#

Get the surface, scalar, vector or path-lines field data on a surface.

Returns:
Dict[int | str, Dict | np.array]

Field data for the requested surface. If field data is unavailable for the surface, an empty array is returned and a warning is issued. Users should always check the array size before using the data.

Example:

data = get_field_data(field_data_request)[surface_id] if data.size == 0:

# Handle missing data

get_surface_ids(surfaces)#

Get a list of surface ids based on surfaces provided as inputs.

class ansys.fluent.core.services.field_data.Batch(service, field_info, allowed_surface_ids, allowed_surface_names, allowed_scalar_field_names, allowed_vector_field_names)#

Bases: FieldBatch

Populates Fluent field data on surfaces.

Methods:

__init__(service, field_info, ...)

__init__ method of Batch class.

add_pathlines_fields_request(field_name, ...)

Add request to get path-lines field on surfaces.

add_requests(obj, *args)

Add field data requests for surfaces, scalars, vectors, or pathlines.

add_scalar_fields_request(field_name, surfaces)

Add request to get scalar field data on surfaces.

add_surfaces_request(data_types, surfaces[, ...])

Add request to get surface data (vertices, face connectivity, centroids, and normals).

add_vector_fields_request(field_name, surfaces)

Add request to get vector field data on surfaces.

get_fields()

Get data for previously added requests.

get_response()

Get data for previously added requests.

get_surface_ids(surfaces)

Get a list of surface ids based on surfaces provided as inputs.

__init__(service, field_info, allowed_surface_ids, allowed_surface_names, allowed_scalar_field_names, allowed_vector_field_names)#

__init__ method of Batch class.

add_pathlines_fields_request(field_name, surfaces, additional_field_name='', provide_particle_time_field=False, node_value=True, steps=500, step_size=500, skip=0, reverse=False, accuracy_control_on=False, tolerance=0.001, coarsen=1, velocity_domain='all-phases', zones=None)#

Add request to get path-lines field on surfaces.

Deprecated since version v0.23.dev0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.

add_requests(obj, *args)#

Add field data requests for surfaces, scalars, vectors, or pathlines.

This method allows users to specify multiple field data requests, which will later be processed when retrieving responses.

add_scalar_fields_request(field_name, surfaces, node_value=True, boundary_value=True)#

Add request to get scalar field data on surfaces.

Deprecated since version v0.23.dev0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.

add_surfaces_request(data_types, surfaces, overset_mesh=False)#

Add request to get surface data (vertices, face connectivity, centroids, and normals).

Deprecated since version v0.23.dev0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.

add_vector_fields_request(field_name, surfaces)#

Add request to get vector field data on surfaces.

Deprecated since version v0.23.dev0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.

get_fields()#

Get data for previously added requests.

get_response()#

Get data for previously added requests.

Returns:
Dict[int, Dict[int, Dict[str, np.array]]]

Data is returned as dictionary of dictionaries in the following structure: tag int | Tuple-> surface_id [int] -> field_name [str] -> field_data[np.array]

The tag is a tuple for Fluent 2023 R1 or later.

get_surface_ids(surfaces)#

Get a list of surface ids based on surfaces provided as inputs.

class ansys.fluent.core.services.field_data.BatchFieldData(data, field_info, allowed_surface_names, allowed_scalar_field_names)#

Bases: BaseFieldData, BaseFieldDataSource

Provides access to Fluent field data on surfaces collected via batches.

Methods:

__init__(data, field_info, ...)

__init__ method of BatchFieldData class.

__init__(data, field_info, allowed_surface_names, allowed_scalar_field_names)#

__init__ method of BatchFieldData class.

class ansys.fluent.core.services.field_data.CellElementType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

Element types for a cell element.

Attributes:

GHOST = 8#
HEXAHEDRON = 4#
POLYHEDRON = 7#
PYRAMID = 5#
QUADRATIC_HEXAHEDRON = 10#
QUADRATIC_PYRAMID = 11#
QUADRATIC_TETRAHEDRON = 9#
QUADRATIC_WEDGE = 12#
QUADRILATERAL = 3#
TETRAHEDRON = 2#
TRIANGLE = 1#
WEDGE = 6#
class ansys.fluent.core.services.field_data.ChunkParser(callbacks_provider=None)#

Bases: object

Class for parsing field data stream received from Fluent.

Parameters:
callbacks_providerobject
The object which can register and unregister callbacks.
It provides callbacks, which are triggered with following arguments:

zone_id : int

field_name : str

field : numpy array

Methods:

__init__([callbacks_provider])

__init__ method of ChunkParser class.

extract_fields(chunk_iterator)

Extracts field data received from Fluent.

__init__(callbacks_provider=None)#

__init__ method of ChunkParser class.

extract_fields(chunk_iterator)#

Extracts field data received from Fluent.

if callbacks_provider is set then callbacks are triggered with extracted data.

class ansys.fluent.core.services.field_data.Element(_id, element_type, node_indices=<factory>, facets=<factory>)#

Bases: object

Element class for mesh.

Attributes:
element_typeCellElementType

Element type of the element.

node_indiceslist[int]

0-based node indices of the element. Populated for standard elements.

facetslist[Facet]

List of facets of the element. Populated for polyhedral elements.

Attributes:

element_type: CellElementType#
facets: list[Facet]#
node_indices: list[int]#
class ansys.fluent.core.services.field_data.Facet(node_indices)#

Bases: object

Facet class within a mesh element.

Attributes:
node_indiceslist[int]

0-based node indices of the facet.

Attributes:

node_indices: list[int]#
class ansys.fluent.core.services.field_data.FieldDataService(channel, metadata, fluent_error_state)#

Bases: StreamingService

FieldData service of Fluent.

Methods:

__init__(channel, metadata, fluent_error_state)

__init__ method of FieldDataService class.

get_fields(request)

GetFields RPC of FieldData service.

get_scalar_field_range(request)

GetRange RPC of FieldData service.

get_scalar_fields_info(request)

GetFieldsInfo RPC of FieldData service.

get_solver_mesh_elements(request)

GetSolverMeshElements RPC of FieldData service.

get_solver_mesh_nodes_double(request)

GetSolverMeshNodesDouble RPC of FieldData service.

get_solver_mesh_nodes_float(request)

GetSolverMeshNodesFloat RPC of FieldData service.

get_surfaces_info(request)

GetSurfacesInfo RPC of FieldData service.

get_vector_fields_info(request)

GetVectorFieldsInfo RPC of FieldData service.

__init__(channel, metadata, fluent_error_state)#

__init__ method of FieldDataService class.

get_fields(request)#

GetFields RPC of FieldData service.

Raises:
RuntimeError

If an empty chunk encountered during field extraction.

get_scalar_field_range(request)#

GetRange RPC of FieldData service.

get_scalar_fields_info(request)#

GetFieldsInfo RPC of FieldData service.

get_solver_mesh_elements(request)#

GetSolverMeshElements RPC of FieldData service.

get_solver_mesh_nodes_double(request)#

GetSolverMeshNodesDouble RPC of FieldData service.

get_solver_mesh_nodes_float(request)#

GetSolverMeshNodesFloat RPC of FieldData service.

get_surfaces_info(request)#

GetSurfacesInfo RPC of FieldData service.

get_vector_fields_info(request)#

GetVectorFieldsInfo RPC of FieldData service.

class ansys.fluent.core.services.field_data.FieldInfo(service, is_data_valid)#

Bases: _FieldInfo

Provides access to Fluent field information.

Methods

get_scalar_field_range(field: str, node_value: bool, surface_ids: List[int])

-> List[float]

Get the range (minimum and maximum values) of the field.

get_scalar_fields_info(self) -> dict

Get fields information (field name, domain, and section).

get_vector_fields_info(self) -> dict

Get vector fields information.

get_surfaces_info(self) -> dict

Get surfaces information (surface name, ID, and type).

Methods:

__init__(service, is_data_valid)

__init__ method of FieldInfo class.

__init__(service, is_data_valid)#

__init__ method of FieldInfo class.

class ansys.fluent.core.services.field_data.LiveFieldData(service, field_info, is_data_valid, scheme_eval=None, get_zones_info=None)#

Bases: BaseFieldData, FieldDataSource

Provides access to Fluent field data on surfaces.

Methods:

__init__(service, field_info, is_data_valid)

__init__ method of FieldData class.

get_mesh(zone)

Get mesh for a zone.

get_pathlines_field_data(field_name, surfaces)

Get the pathlines field data on a surface.

get_scalar_field_data(field_name, surfaces)

Get scalar field data on a surface.

get_surface_data(data_types, surfaces[, ...])

Get surface data (vertices, faces connectivity, centroids, and normals).

get_vector_field_data(field_name, surfaces)

Get vector field data on a surface.

new_batch()

Create a new field batch.

new_transaction()

Create a new field transaction.

__init__(service, field_info, is_data_valid, scheme_eval=None, get_zones_info=None)#

__init__ method of FieldData class.

get_mesh(zone)#

Get mesh for a zone.

Parameters:
zonestr | int

Zone name or id. Currently, only cell zones are supported.

Returns:
Mesh

Mesh object containing nodes and elements.

Raises:
ValueError

If the zone is not found.

NotImplementedError

If a face zone is provided.

get_pathlines_field_data(field_name, surfaces, additional_field_name='', provide_particle_time_field=False, node_value=True, steps=500, step_size=500, skip=0, reverse=False, accuracy_control_on=False, tolerance=0.001, coarsen=1, velocity_domain='all-phases', zones=None)#

Get the pathlines field data on a surface.

get_scalar_field_data(field_name, surfaces, node_value=True, boundary_value=True)#

Get scalar field data on a surface.

get_surface_data(data_types, surfaces, overset_mesh=False)#

Get surface data (vertices, faces connectivity, centroids, and normals).

get_vector_field_data(field_name, surfaces)#

Get vector field data on a surface.

new_batch()#

Create a new field batch.

new_transaction()#

Create a new field transaction.

Deprecated since version 0.34: Use new_batch instead.

class ansys.fluent.core.services.field_data.Mesh(nodes, elements)#

Bases: object

Mesh class for Fluent field data.

Attributes:
nodeslist[Node]

List of nodes in the mesh.

elementslist[Element]

List of elements in the mesh.

Attributes:

elements: list[Element]#
nodes: list[Node]#
class ansys.fluent.core.services.field_data.Node(_id, x, y, z)#

Bases: object

Node class for mesh.

Attributes:
xfloat

x-coordinate of the node.

yfloat

y-coordinate of the node.

zfloat

z-coordinate of the node.

Attributes:

x

y

z

x: float#
y: float#
z: float#
class ansys.fluent.core.services.field_data.ZoneInfo(_id, name, zone_type)#

Bases: object

Zone information for mesh.

Attributes:
_idint

Zone ID.

namestr

Name of the zone.

zone_typeZoneType

Type of the zone for mesh.

Attributes:

name: str#
zone_type: ZoneType#
class ansys.fluent.core.services.field_data.ZoneType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

Zone types for mesh.

Attributes:

CELL = 1#
FACE = 2#
ansys.fluent.core.services.field_data.get_fields_request()#

Populates a new field request.

ansys.fluent.core.services.field_data.override_help_text(func, func_to_be_wrapped)#

Override function help text.