ansys.fluent.core.file_session#

Provides a module for file session.

Classes:

FileFieldData(file_session, field_info)

File field data.

FileFieldInfo(file_session)

File field info.

FileSession()

File session to read case and data file.

Transaction(file_session, field_info)

Populates field data on surfaces.

Exceptions:

InvalidFieldName()

Raised when a field name is inappropriate.

InvalidMultiPhaseFieldName()

Raised when multi-phase field name is inappropriate.

class ansys.fluent.core.file_session.FileFieldData(file_session, field_info)#

Bases: object

File field data.

Methods:

__init__(file_session, field_info)

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 and faces connectivity).

get_vector_field_data(field_name, surfaces)

Get vector field data on a surface.

new_transaction()

Create a new field transaction.

__init__(file_session, field_info)#
get_pathlines_field_data(field_name, surfaces)#

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.

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:
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.

Raises:
InvalidMultiPhaseFieldName

If field name does not have prefix phase- for multi-phase cases.

get_surface_data(data_types, surfaces, overset_mesh=False)#

Get surface data (vertices and faces connectivity).

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 provide the overset method. The default is False.

Returns:
Vertices | FacesConnectivity | Dict[int, Vertices | FacesConnectivity]

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, 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:
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.

Raises:
InvalidFieldName

If any field other than "velocity" is provided.

InvalidMultiPhaseFieldName

If field name does not have prefix phase- for multi-phase cases.

new_transaction()#

Create a new field transaction.

class ansys.fluent.core.file_session.FileFieldInfo(file_session)#

Bases: object

File field info.

Methods:

__init__(file_session)

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).

__init__(file_session)#
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
class ansys.fluent.core.file_session.FileSession#

Bases: object

File session to read case and data file.

Methods:

__init__()

__init__ method of FileSession class.

read_case(case_file_name)

Read Case file.

read_data(data_file_name)

Read Data file.

Attributes:

field_data

Fluent field data on surfaces.

field_info

Provides access to Fluent field information.

__init__()#

__init__ method of FileSession class.

property field_data#

Fluent field data on surfaces.

property field_info#

Provides access to Fluent field information.

read_case(case_file_name)#

Read Case file.

read_data(data_file_name)#

Read Data file.

exception ansys.fluent.core.file_session.InvalidFieldName#

Bases: ValueError

Raised when a field name is inappropriate.

__init__()#
exception ansys.fluent.core.file_session.InvalidMultiPhaseFieldName#

Bases: ValueError

Raised when multi-phase field name is inappropriate.

__init__()#
class ansys.fluent.core.file_session.Transaction(file_session, field_info)#

Bases: object

Populates field data on surfaces.

Methods:

__init__(file_session, field_info)

__init__ method of Transaction 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__(file_session, field_info)#

__init__ method of Transaction class.

add_pathlines_fields_request(field_name, surfaces)#

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.

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
Raises:
InvalidMultiPhaseFieldName

If field name does not have prefix phase- for multi-phase cases.

add_surfaces_request(data_types, surfaces)#

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.

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
Raises:
InvalidMultiPhaseFieldName

If field name does not have prefix phase- for multi-phase cases.

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]

Raises:
InvalidFieldName

If any field other than "velocity" is provided.