field_data#

Wrappers over FieldData gRPC service of Fluent.

Classes:

BaseFieldData(i_d, data)

Contains common properties required by all field data types.

ChunkParser([callbacks_provider])

Class for parsing field data stream received from Fluent.

FacesCentroid(i_d, data)

Provides the container for the face centroid data.

FacesConnectivity(i_d, data)

Provides the container for the face connectivity data.

FacesNormal(i_d, data)

Provides the container for the face normal data.

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.

ScalarFieldData(i_d, data)

Contains scalar field data.

SurfaceDataType(value)

Provides surface data types.

Vector(x, y, z)

Stores the data as a vector (x, y, z).

VectorFieldData(i_d, data, scale)

Provides a container for vector field data.

Vertices(i_d, data)

Provides a container for the vertex data.

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.BaseFieldData(i_d, data)#

Bases: object

Contains common properties required by all field data types.

Methods:

__init__(i_d, data)

__init__ method of BaseFieldData class.

Attributes:

data

Returns data.

size

Returns size of data.

surface_id

Returns surface ID.

__init__(i_d, data)#

__init__ method of BaseFieldData class.

property data#

Returns data.

property size#

Returns size of data.

property surface_id#

Returns surface ID.

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.FacesCentroid(i_d, data)#

Bases: BaseFieldData

Provides the container for the face centroid data.

Classes:

Centroid(x, y, z)

Stores and provides the face centroid data as a vector.

Methods:

__init__(i_d, data)

__init__ method of FacesCentroid class.

class Centroid(x, y, z)#

Bases: Vector

Stores and provides the face centroid data as a vector.

Methods:

__init__(x, y, z)

__init__ method of Centroid class.

__init__(x, y, z)#

__init__ method of Centroid class.

__init__(i_d, data)#

__init__ method of FacesCentroid class.

class ansys.fluent.core.services.field_data.FacesConnectivity(i_d, data)#

Bases: BaseFieldData

Provides the container for the face connectivity data.

Classes:

Faces(node_count, node_indices)

Stores and provides the face connectivity data as an array.

Methods:

__init__(i_d, data)

__init__ method of FacesConnectivity class.

class Faces(node_count, node_indices)#

Bases: object

Stores and provides the face connectivity data as an array.

Methods:

__init__(node_count, node_indices)

__init__ method of Faces class.

__init__(node_count, node_indices)#

__init__ method of Faces class.

__init__(i_d, data)#

__init__ method of FacesConnectivity class.

class ansys.fluent.core.services.field_data.FacesNormal(i_d, data)#

Bases: BaseFieldData

Provides the container for the face normal data.

Classes:

Normal(x, y, z)

Stores and provides the face normal data as a vector.

Methods:

__init__(i_d, data)

__init__ method of FacesNormal class.

class Normal(x, y, z)#

Bases: Vector

Stores and provides the face normal data as a vector.

Methods:

__init__(x, y, z)

__init__ method of Normal class.

__init__(x, y, z)#

__init__ method of Normal class.

__init__(i_d, data)#

__init__ method of FacesNormal class.

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[, ...])

Get the pathlines field data on a surface.

get_scalar_field_data(field_name[, ...])

Get scalar field data on a surface.

get_surface_data(data_type[, surface_ids, ...])

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

get_vector_field_data(field_name[, ...])

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, surface_ids=None, surface_name=None, additional_field_name='', provide_particle_time_field=False, node_value=True, steps=500, step_size=0.01, skip=0, reverse=False, accuracy_control_on=False, tolerance=0.001, coarsen=1, velocity_domain='all-phases', zones=[])#

Get the pathlines field data on a surface.

Parameters:
field_namestr

Name of the scalar field to color pathlines.

surface_idsList[int], optional

List of surface IDs for pathlines field data.

surface_namestr, optional

Surface name for pathlines field 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, surface_ids=None, surface_name=None, node_value=True, boundary_value=True)#

Get scalar field data on a surface.

Parameters:
field_namestr

Name of the scalar field.

surface_idsList[int], optional

List of surface IDs for scalar field data.

surface_name: str, optional

Surface Name for scalar field 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:
Union[ScalarFieldData, Dict[int, ScalarFieldData]]

If a surface name is provided as input, scalar field data is returned. If surface IDs are provided as input, a dictionary containing a map of surface IDs to scalar field data.

get_surface_data(data_type, surface_ids=None, surface_name=None, overset_mesh=False)#

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

Parameters:
data_typeSurfaceDataType

SurfaceDataType Enum member.

surface_idsList[int], optional

List of surface IDs for the surface data.

surface_namestr, optional

Surface name for the surface data.

overset_meshbool, optional

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

Returns:
Union[Vertices, FacesConnectivity, FacesNormal, FacesCentroid,
Dict[int, Union[Vertices, FacesConnectivity, FacesNormal, FacesCentroid]]]

If a surface name is provided as input, face vertices, connectivity data, and normal or centroid data are returned. If surface IDs are provided as input, a dictionary containing a map of surface IDs to face vertices, connectivity data, and normal or centroid data is returned.

get_vector_field_data(field_name, surface_ids=None, surface_name=None)#

Get vector field data on a surface.

Parameters:
field_namestr

Name of the vector field.

surface_idsList[int], optional

List of surface IDs for vector field data.

surface_name: str, optional

Surface Name for vector field data.

Returns:
Union[VectorFieldData, Dict[int, VectorFieldData]]

If a surface name is provided as input, vector field data is returned. If surface IDs are provided as input, a dictionary containing a map of surface IDs to vector field data is returned.

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[, ...])

Add request to get scalar field data on surfaces.

add_surfaces_request([surface_ids, ...])

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

add_vector_fields_request(field_name[, ...])

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, surface_ids=None, surface_names=None, additional_field_name='', provide_particle_time_field=False, node_value=True, steps=500, step_size=0.01, skip=0, reverse=False, accuracy_control_on=False, tolerance=0.001, coarsen=1, velocity_domain='all-phases', zones=[])#

Add request to get pathlines field on surfaces.

Parameters:
field_namestr

Name of the scalar field to color pathlines.

surface_idsList[int], optional

List of surface IDs for pathlines field data.

surface_namesList[str], optional

List of surface names for pathlines field 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, surface_ids=None, surface_names=None, node_value=True, boundary_value=True)#

Add request to get scalar field data on surfaces.

Parameters:
field_namestr

Name of the scalar field.

surface_idsList[int], optional

List of surface IDs for scalar field data.

surface_names: List[str], optional

List of surface names for scalar field 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(surface_ids=None, surface_names=None, overset_mesh=False, provide_vertices=True, provide_faces=True, provide_faces_centroid=False, provide_faces_normal=False)#

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

Parameters:
surface_idsList[int], optional

List of surface IDS for the surface data.

surface_names: List[str], optional

List of surface names for the surface data.

overset_meshbool, optional

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

provide_verticesbool, optional

Whether to get node coordinates. The default is True.

provide_facesbool, optional

Whether to get face connectivity. The default is True.

provide_faces_centroidbool, optional

Whether to get face centroids. The default is False.

provide_faces_normalbool, optional

Whether to get faces normal. The default is False

Returns:
None
add_vector_fields_request(field_name, surface_ids=None, surface_names=None)#

Add request to get vector field data on surfaces.

Parameters:
field_namestr

Name of the vector field.

surface_idsList[int], optional

List of surface IDs for vector field data.

surface_names: List[str], optional

List of surface names for vector field 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 Union[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.ScalarFieldData(i_d, data)#

Bases: BaseFieldData

Contains scalar field data.

Classes:

ScalarData(data)

Stores and provides the data as a scalar.

Methods:

__init__(i_d, data)

__init__ method of ScalarFieldData class.

class ScalarData(data)#

Bases: object

Stores and provides the data as a scalar.

Methods:

__init__(data)

__init__ method of ScalarData class.

__init__(data)#

__init__ method of ScalarData class.

__init__(i_d, data)#

__init__ method of ScalarFieldData class.

class ansys.fluent.core.services.field_data.SurfaceDataType(value)#

Bases: IntEnum

Provides surface data types.

Attributes:

FacesCentroid

FacesConnectivity

FacesNormal

Vertices

FacesCentroid = 4#
FacesConnectivity = 2#
FacesNormal = 3#
Vertices = 1#
class ansys.fluent.core.services.field_data.Vector(x, y, z)#

Bases: object

Stores the data as a vector (x, y, z).

Methods:

__init__(x, y, z)

__init__ method of Vector class.

Attributes:

x

Returns vector point x.

y

Returns vector point y.

z

Returns vector point z.

__init__(x, y, z)#

__init__ method of Vector class.

property x: float#

Returns vector point x.

property y: float#

Returns vector point y.

property z: float#

Returns vector point z.

class ansys.fluent.core.services.field_data.VectorFieldData(i_d, data, scale)#

Bases: BaseFieldData

Provides a container for vector field data.

Classes:

VectorData(x, y, z)

Stores and provides the data as a vector.

Methods:

__init__(i_d, data, scale)

__init__ method of VectorFieldData class.

Attributes:

scale

Returns scale of the vector field.

class VectorData(x, y, z)#

Bases: Vector

Stores and provides the data as a vector.

Methods:

__init__(x, y, z)

__init__ method of VectorData class.

__init__(x, y, z)#

__init__ method of VectorData class.

__init__(i_d, data, scale)#

__init__ method of VectorFieldData class.

property scale: float#

Returns scale of the vector field.

class ansys.fluent.core.services.field_data.Vertices(i_d, data)#

Bases: BaseFieldData

Provides a container for the vertex data.

Classes:

Vertex(x, y, z)

Stores and provides the data as a vector of a vertex.

Methods:

__init__(i_d, data)

__init__ method of Vertices class.

class Vertex(x, y, z)#

Bases: Vector

Stores and provides the data as a vector of a vertex.

Methods:

__init__(x, y, z)

__init__ method of Vertex class.

__init__(x, y, z)#

__init__ method of Vertex class.

__init__(i_d, data)#

__init__ method of Vertices class.

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.