file_session#
Provides a module for file session.
Classes:
|
Populates field data on surfaces. |
|
Provides access to Fluent field data on surfaces collected via batches. |
|
Container for field and solution variables. |
|
File field data. |
|
File field info. |
|
File session to read case and data file. |
Exceptions:
Raised when a field name is inappropriate. |
|
Raised when multi-phase field name is inappropriate. |
- class ansys.fluent.core.file_session.Batch(file_session, field_info)#
Bases:
FieldBatchPopulates field data on surfaces.
Methods:
__init__(file_session, field_info)__init__ method of Batch class.
add_pathlines_fields_request(field_name, ...)Add request to get pathlines field on surfaces.
add_requests(obj, *args)Add request to get surface, scalar, vector or path-lines 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 data for previously added requests.
Get data for previously added requests.
get_surface_ids(surfaces)Get a list of surface ids based on surfaces provided as inputs.
- __init__(file_session, field_info)#
__init__ method of Batch class.
- add_pathlines_fields_request(field_name, surfaces)#
Add request to get pathlines field on surfaces.
- add_requests(obj, *args)#
Add request to get surface, scalar, vector or path-lines field on surfaces.
- add_scalar_fields_request(field_name, surfaces, node_value=True, boundary_value=True)#
Add request to get scalar field data on surfaces.
- Parameters:
- field_name
str Name of the scalar field.
- surfaces
List[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. IfFalse, the element location is provided.- boundary_valuebool,
optional Whether to provide the slip velocity at the wall boundaries. The default is
True. WhenTrue, no slip velocity is provided.
- field_name
- Returns:
- Raises:
InvalidMultiPhaseFieldNameIf field name does not have prefix
phase-for multi-phase cases.
Deprecated since version v0.25.0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.
- add_surfaces_request(data_types, surfaces)#
Add request to get surface data (vertices, face connectivity, centroids, and normals).
- Parameters:
- Returns:
-
Deprecated since version v0.25.0: 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.
- Parameters:
- Returns:
- Raises:
InvalidMultiPhaseFieldNameIf field name does not have prefix
phase-for multi-phase cases.
Deprecated since version v0.25.0: 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:
- Raises:
InvalidFieldNameIf any field other than
"velocity"is provided.
- get_surface_ids(surfaces)#
Get a list of surface ids based on surfaces provided as inputs.
- class ansys.fluent.core.file_session.BatchFieldData(data, field_info, allowed_surface_names, allowed_scalar_field_names)#
Bases:
objectProvides access to Fluent field data on surfaces collected via batches.
Methods:
__init__(data, field_info, ...)__init__ method of BatchFieldData 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 BatchFieldData 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.file_session.Fields(_session)#
Bases:
objectContainer for field and solution variables.
Methods:
__init__(_session)Initialize Fields.
- __init__(_session)#
Initialize Fields.
- class ansys.fluent.core.file_session.FileFieldData(file_session, field_info)#
Bases:
FieldDataSourceFile field data.
Methods:
__init__(file_session, field_info)Initialize FileFieldData.
get_field_data(obj)Get the surface, scalar, vector or path-lines field data on a surface.
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_surface_ids(surfaces)Get a list of surface ids based on surfaces provided as inputs.
get_vector_field_data(field_name, surfaces)Get vector field data on a surface.
Create a new field batch.
Create a new field transaction.
Attributes:
Get the surface ids.
- __init__(file_session, field_info)#
Initialize FileFieldData.
- 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_pathlines_field_data(field_name, surfaces)#
Get the pathlines field data on a surface.
- Parameters:
- Returns:
DictDictionary containing a map of surface IDs to the pathline data. For example, pathlines connectivity, vertices, and field.
Deprecated since version v0.25.0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.
- get_scalar_field_data(field_name, surfaces, node_value=True, boundary_value=True)#
Get scalar field data on a surface.
- Parameters:
- field_name
str Name of the scalar field.
- surfaces
List[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. WhenFalse, data is provided for the element location.- boundary_valuebool,
optional Whether to provide slip velocity at the wall boundaries. The default is
True. WhenTrue, no slip velocity is provided.
- field_name
- 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:
InvalidMultiPhaseFieldNameIf field name does not have prefix
phase-for multi-phase cases.
Deprecated since version v0.25.0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.
- get_surface_data(data_types, surfaces, overset_mesh=False, flatten_connectivity=False)#
Get surface data (vertices and faces connectivity).
- Parameters:
- data_types
List[SurfaceDataType] |List[str], SurfaceDataType Enum members.
- surfaces
List[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.- flatten_connectivity: bool, optional
Whether to provide faces connectivity data in flattened format.
- data_types
- 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.
Deprecated since version v0.25.0: Old arguments ‘surface_ids’, ‘surface_names’ and ‘data_type’ are deprecated. Use ‘surfaces’ and ‘data_types’ instead.
- get_surface_ids(surfaces)#
Get a list of surface ids based on surfaces provided as inputs.
- get_vector_field_data(field_name, surfaces)#
Get vector field data on a surface.
- Parameters:
- 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:
InvalidFieldNameIf any field other than
"velocity"is provided.InvalidMultiPhaseFieldNameIf field name does not have prefix
phase-for multi-phase cases.
Deprecated since version v0.25.0: Old arguments ‘surface_ids’ and ‘surface_names’ are deprecated. Use ‘surfaces’ instead.
- new_batch()#
Create a new field batch.
- new_transaction()#
Create a new field transaction.
Deprecated since version 0.34: Use new_batch instead.
- property surface_ids#
Get the surface ids.
- class ansys.fluent.core.file_session.FileFieldInfo(file_session)#
Bases:
_FileFieldInfoFile field info.
Methods:
__init__(file_session)Initialize FileFieldInfo
- __init__(file_session)#
Initialize FileFieldInfo
- class ansys.fluent.core.file_session.FileSession(case_file_name=None, data_file_name=None)#
Bases:
objectFile session to read case and data file.
Methods:
__init__([case_file_name, data_file_name])__init__ method of FileSession class.
read_case(case_file_name)Read Case file.
read_data(data_file_name)Read Data file.
Attributes:
Fluent field data on surfaces.
Provides access to Fluent field information.
- __init__(case_file_name=None, data_file_name=None)#
__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:
ValueErrorRaised when a field name is inappropriate.
Methods:
__init__()Initialize InvalidFieldName.
- __init__()#
Initialize InvalidFieldName.
- exception ansys.fluent.core.file_session.InvalidMultiPhaseFieldName#
Bases:
ValueErrorRaised when multi-phase field name is inappropriate.
Methods:
__init__()Initialize InvalidMultiPhaseFieldName.
- __init__()#
Initialize InvalidMultiPhaseFieldName.