field_data#

Wrappers over FieldData gRPC service of Fluent.

Classes:

ChunkParser([callbacks_provider])

Class for parsing field data stream received from Fluent.

FieldData(service, field_info, is_data_valid)

Provides access to Fluent field data on surfaces.

FieldDataService(channel, metadata, ...)

FieldData service of Fluent.

FieldInfo(service, is_data_valid)

Provides access to Fluent field information.

FieldTransaction(service, field_info, ...)

Populates Fluent field data on surfaces.

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

Provides surface data types.

Exceptions:

FieldUnavailable

Raised when field is unavailable.

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.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.FieldData(service, field_info, is_data_valid, scheme_eval=None)#

Bases: object

Provides access to Fluent field data on surfaces.

Methods:

__init__(service, field_info, is_data_valid)

__init__ method of FieldData class.

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_transaction()

Create a new field transaction.

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

__init__ method of FieldData class.

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.

Parameters:
field_namestr

Name of the scalar field to color pathlines.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

additional_field_namestr, optional

Additional field if required.

provide_particle_time_field: bool, optional

Whether to provide the particle time. The default is False.

node_valuebool, optional

Whether to provide the nodal values. The default is True. If False, element values are provided.

steps: int, optional

Pathlines steps. The default is 500

step_size: float, optional

Pathlines step size. The default is 0.01.

skip: int, optional

Pathlines to skip. The default is 0.

reverse: bool, optional

Whether to draw pathlines in reverse direction. The default is False.

accuracy_control_on: bool, optional

Whether to control accuracy. The default is False.

tolerance: float, optional

Pathlines tolerance. The default is 0.001.

coarsen: int, optional

Pathlines coarsen. The default is 1.

velocity_domain: str, optional

Domain for pathlines. The default is "all-phases".

zones: list, optional

Zones for pathlines. The default is [].

Returns:
Dict

Dictionary containing a map of surface IDs to the pathline data. For example, pathlines connectivity, vertices, and field.

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

Get scalar field data on a surface.

Parameters:
field_namestr

Name of the scalar field.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

node_valuebool, optional

Whether to provide data for the nodal location. The default is True. When False, data is provided for the element location.

boundary_valuebool, optional

Whether to provide slip velocity at the wall boundaries. The default is True. When True, no slip velocity is provided.

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

Returns a map of surface IDs (or names) to scalar field data.

get_surface_data(data_types, surfaces, overset_mesh=False)#

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

Parameters:
data_typesList[SurfaceDataType],

SurfaceDataType Enum members.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

overset_meshbool, optional

Whether to provide the overset method. The default is False.

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

Returns a map of surface IDs (or names) to face vertices, connectivity data, and normal or centroid data.

get_vector_field_data(field_name, surfaces)#

Get vector field data on a surface.

Parameters:
field_namestr

Name of the vector field.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

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

Returns a map of surface IDs (or names) to vector field data.

new_transaction()#

Create a new field transaction.

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_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_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: object

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.

get_scalar_field_range(field[, node_value, ...])

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

get_scalar_fields_info()

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

get_surfaces_info()

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

get_vector_fields_info()

Get vector fields information (vector components).

validate_scalar_fields(field_name)

Validate scalar fields.

validate_surfaces(surfaces)

Validate surfaces.

validate_vector_fields(field_name)

Validate vector fields.

__init__(service, is_data_valid)#

__init__ method of FieldInfo class.

get_scalar_field_range(field, node_value=False, surface_ids=None)#

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

Parameters:
field: str

Field name

node_value: bool
surface_idsList[int], optional

List of surface IDS for the surface data.

Returns:
List[float]
get_scalar_fields_info()#

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

Returns:
Dict
get_surfaces_info()#

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

Returns:
Dict
get_vector_fields_info()#

Get vector fields information (vector components).

Returns:
Dict
validate_scalar_fields(field_name)#

Validate scalar fields.

validate_surfaces(surfaces)#

Validate surfaces.

validate_vector_fields(field_name)#

Validate vector fields.

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

Bases: object

Populates Fluent field data on surfaces.

Methods:

__init__(service, field_info, ...)

__init__ method of FieldTransaction class.

add_pathlines_fields_request(field_name, ...)

Add request to get pathlines field on surfaces.

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 and then clear all requests.

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

__init__ method of FieldTransaction 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 pathlines field on surfaces.

Parameters:
field_namestr

Name of the scalar field to color pathlines.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

additional_field_namestr, optional

Additional field if required.

provide_particle_time_field: bool, optional

Whether to provide the particle time. The default is False.

node_valuebool, optional

Whether to provide the nodal values. The default is True. If False, element values are provided.

steps: int, optional

Pathlines steps. The default is 500

step_size: float, optional

Pathlines step size. The default is 0.01.

skip: int, optional

Pathlines to skip. The default is 0.

reverse: bool, optional

Whether to draw pathlines in a reverse direction. The default is False.

accuracy_control_on: bool, optional

Whether to control accuracy. The default is False.

tolerance: float, optional

Pathlines tolerance. The default is 0.001.

coarsen: int, optional

Pathlines coarsen. The default is 1.

velocity_domain: str, optional

Domain for pathlines. The default is "all-phases".

zones: list, optional

Zones for pathlines. The default is [].

Returns
——-
None
add_scalar_fields_request(field_name, surfaces, node_value=True, boundary_value=True)#

Add request to get scalar field data on surfaces.

Parameters:
field_namestr

Name of the scalar field.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

node_valuebool, optional

Whether to provide the nodal location. The default is True. If False, the element location is provided.

boundary_valuebool, optional

Whether to provide the slip velocity at the wall boundaries. The default is True. When True, no slip velocity is provided.

Returns:
None
add_surfaces_request(data_types, surfaces, overset_mesh=False)#

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

Parameters:
data_typesList[SurfaceDataType] | List[str],

SurfaceDataType Enum members.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

overset_meshbool, optional

Whether to get the overset met. The default is False.

Returns:
None
add_vector_fields_request(field_name, surfaces)#

Add request to get vector field data on surfaces.

Parameters:
field_namestr

Name of the vector field.

surfacesList[int | str]

List of surface IDS or surface names for the surface data.

Returns:
None
get_fields()#

Get data for previously added requests and then clear all 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.

exception ansys.fluent.core.services.field_data.FieldUnavailable#

Bases: RuntimeError

Raised when field is unavailable.

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

Bases: Enum

Provides surface data types.

Attributes:

FacesCentroid = 'centroid'#
FacesConnectivity = 'faces'#
FacesNormal = 'face-normal'#
Vertices = 'vertices'#
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.