diff --git a/src/ansys/fluent/core/post_objects/post_object_definitions.py b/src/ansys/fluent/core/post_objects/post_object_definitions.py index 060e0599f49..e1648d6c6fc 100644 --- a/src/ansys/fluent/core/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/core/post_objects/post_object_definitions.py @@ -113,7 +113,7 @@ class y_axis_function(metaclass=PyLocalPropertyMeta): @Attribute def allowed_values(self): """Y axis function allowed values.""" - return list(self._api_helper.field_info().get_fields_info()) + return list(self._api_helper.field_info().get_scalar_fields_info()) class x_axis_function(metaclass=PyLocalPropertyMeta): """X Axis Function.""" @@ -184,7 +184,7 @@ class field(metaclass=PyLocalPropertyMeta): @Attribute def allowed_values(self): """Field allowed values.""" - return list(self._api_helper.field_info().get_fields_info()) + return list(self._api_helper.field_info().get_scalar_fields_info()) class surfaces_list(metaclass=PyLocalPropertyMeta): """List of surfaces for pathlines.""" @@ -262,7 +262,7 @@ class z(metaclass=PyLocalPropertyMeta): @Attribute def range(self): """Z value range.""" - return self._api_helper.field_info().get_range( + return self._api_helper.field_info().get_scalar_fields_range( "z-coordinate", True ) @@ -277,7 +277,7 @@ class x(metaclass=PyLocalPropertyMeta): @Attribute def range(self): """X value range.""" - return self._api_helper.field_info().get_range( + return self._api_helper.field_info().get_scalar_fields_range( "x-coordinate", True ) @@ -292,7 +292,7 @@ class y(metaclass=PyLocalPropertyMeta): @Attribute def range(self): """Y value range.""" - return self._api_helper.field_info().get_range( + return self._api_helper.field_info().get_scalar_fields_range( "y-coordinate", True ) @@ -307,7 +307,7 @@ class field(metaclass=PyLocalPropertyMeta): @Attribute def allowed_values(self): """Field allowed values.""" - return list(self._api_helper.field_info().get_fields_info()) + return list(self._api_helper.field_info().get_scalar_fields_info()) class rendering(metaclass=PyLocalPropertyMeta): """Iso surface rendering.""" @@ -344,7 +344,9 @@ def range(self): """Iso value range.""" field = self._parent.field() if field: - return self._api_helper.field_info().get_range(field, True) + return self._api_helper.field_info().get_scalar_fields_range( + field, True + ) class ContourDefn(GraphicsDefn): @@ -360,7 +362,7 @@ class field(metaclass=PyLocalPropertyMeta): @Attribute def allowed_values(self): """Field allowed values.""" - return list(self._api_helper.field_info().get_fields_info()) + return list(self._api_helper.field_info().get_scalar_fields_info()) class surfaces_list(metaclass=PyLocalPropertyMeta): """Contour surfaces.""" @@ -469,7 +471,7 @@ def value(self): field = self._get_parent_by_type(ContourDefn).field() if field: field_info = self._api_helper.field_info() - field_range = field_info.get_range( + field_range = field_info.get_scalar_fields_range( field, self._get_parent_by_type(ContourDefn).node_values(), ) @@ -498,7 +500,7 @@ def value(self): field = self._get_parent_by_type(ContourDefn).field() if field: field_info = self._api_helper.field_info() - field_range = field_info.get_range( + field_range = field_info.get_scalar_fields_range( field, self._get_parent_by_type(ContourDefn).node_values(), ) @@ -534,7 +536,7 @@ class field(metaclass=PyLocalPropertyMeta): @Attribute def allowed_values(self): """Field allowed values.""" - return list(self._api_helper.field_info().get_fields_info()) + return list(self._api_helper.field_info().get_scalar_fields_info()) class surfaces_list(metaclass=PyLocalPropertyMeta): """List of surfaces for vector graphics.""" @@ -609,7 +611,7 @@ def value(self): """Range minimum property setter.""" if getattr(self, "_value", None) is None: field_info = self._api_helper.field_info() - field_range = field_info.get_range( + field_range = field_info.get_scalar_fields_range( "velocity-magnitude", False, ) @@ -630,7 +632,7 @@ def value(self): """Range maximum property setter.""" if getattr(self, "_value", None) is None: field_info = self._api_helper.field_info() - field_range = field_info.get_range( + field_range = field_info.get_scalar_fields_range( "velocity-magnitude", False, ) diff --git a/src/ansys/fluent/core/services/field_data.py b/src/ansys/fluent/core/services/field_data.py index fa97f274137..21b028c46a9 100644 --- a/src/ansys/fluent/core/services/field_data.py +++ b/src/ansys/fluent/core/services/field_data.py @@ -37,12 +37,12 @@ def __init__(self, channel: grpc.Channel, metadata): self.__metadata = metadata @catch_grpc_error - def get_range(self, request): + def get_scalar_fields_range(self, request): """GetRange rpc of FieldData service.""" return self.__stub.GetRange(request, metadata=self.__metadata) @catch_grpc_error - def get_fields_info(self, request): + def get_scalar_fields_info(self, request): """GetFieldsInfo rpc of FieldData service.""" return self.__stub.GetFieldsInfo(request, metadata=self.__metadata) @@ -67,11 +67,11 @@ class FieldInfo: Methods ------- - get_range(field: str, node_value: bool, surface_ids: List[int]) + get_scalar_fields_range(field: str, node_value: bool, surface_ids: List[int]) -> List[float] Get the range (minimum and maximum values) of the field. - get_fields_info(self) -> dict + get_scalar_fields_info(self) -> dict Get fields information (field name, domain, and section). get_vector_fields_info(self) -> dict @@ -85,7 +85,7 @@ def __init__(self, service: FieldDataService): """__init__ method of FieldInfo class.""" self._service = service - def get_range( + def get_scalar_fields_range( self, field: str, node_value: bool = False, surface_ids: List[int] = None ) -> List[float]: """Get the range (minimum and maximum values) of the field. @@ -110,10 +110,10 @@ def get_range( request.surfaceid.extend( [FieldDataProtoModule.SurfaceId(id=int(id)) for id in surface_ids] ) - response = self._service.get_range(request) + response = self._service.get_scalar_fields_range(request) return [response.minimum, response.maximum] - def get_fields_info(self) -> dict: + def get_scalar_fields_info(self) -> dict: """Get fields information (field name, domain, and section). Returns @@ -121,7 +121,7 @@ def get_fields_info(self) -> dict: Dict """ request = FieldDataProtoModule.GetFieldsInfoRequest() - response = self._service.get_fields_info(request) + response = self._service.get_scalar_fields_info(request) return { field_info.solverName: { "display_name": field_info.displayName, @@ -303,7 +303,7 @@ class _AllowedScalarFieldNames(_AllowedFieldNames): _field_unavailable_error = ScalarFieldUnavailable def __call__(self, respect_data_valid: bool = True) -> List[str]: - field_dict = self._field_info.get_fields_info() + field_dict = self._field_info.get_scalar_fields_info() return ( field_dict if (not respect_data_valid or self._is_data_valid()) diff --git a/src/ansys/fluent/core/utils/dump_session_data.py b/src/ansys/fluent/core/utils/dump_session_data.py index 4ef15ab7473..0d693a6ae6a 100644 --- a/src/ansys/fluent/core/utils/dump_session_data.py +++ b/src/ansys/fluent/core/utils/dump_session_data.py @@ -1,7 +1,7 @@ """Module providing dump session data functionality.""" from pathlib import Path import pickle -from typing import Dict, Optional, Union +from typing import Optional, Union import numpy as np @@ -30,7 +30,7 @@ def dump_session_data( session_data = { "scalar_fields_info": { k: v - for k, v in session.field_info.get_fields_info().items() + for k, v in session.field_info.get_scalar_fields_info().items() if (not fields or k in fields) }, "surfaces_info": { @@ -52,10 +52,10 @@ def dump_session_data( session_data["range"][field][surface] = {} session_data["range"][field][surface][ "node_value" - ] = session.field_info.get_range(field, True, [surface]) + ] = session.field_info.get_scalar_fields_range(field, True, [surface]) session_data["range"][field][surface][ "cell_value" - ] = session.field_info.get_range(field, False, [surface]) + ] = session.field_info.get_scalar_fields_range(field, False, [surface]) transaction = session.field_data.new_transaction() transaction.add_surfaces_request( @@ -165,11 +165,15 @@ def get_vector_field_data( return vector_field_data - def get_pathlines_data(self, surface_ids, field_names) -> list[Dict]: + def get_pathlines_data( + self, surface_ids, field_names, key + ) -> list[Union[np.array, None]]: pathlines_data = [] for surface_id in surface_ids: for field_name in field_names: tag_id = (("type", "pathlines-field"), ("field", field_name)) - pathlines_data.append(self._session_data["fields"][tag_id][surface_id]) + pathlines_data.append( + self._session_data["fields"][tag_id][surface_id][key] + ) return pathlines_data diff --git a/tests/test_field_data.py b/tests/test_field_data.py index e69d9aec7ab..aa2274d0cf6 100644 --- a/tests/test_field_data.py +++ b/tests/test_field_data.py @@ -157,7 +157,7 @@ def test_field_data_allowed_values(new_solver_session) -> None: assert field_data.is_data_valid() - expected_allowed_args = sorted(field_info.get_fields_info()) + expected_allowed_args = sorted(field_info.get_scalar_fields_info()) allowed_args = field_data.get_scalar_field_data.field_name.allowed_values() assert expected_allowed_args and (expected_allowed_args == allowed_args) assert len(allowed_args) > len(allowed_args_no_init) diff --git a/tests/test_meshing_workflow.py b/tests/test_meshing_workflow.py index ab4873f871a..c13cddd62b2 100644 --- a/tests/test_meshing_workflow.py +++ b/tests/test_meshing_workflow.py @@ -385,6 +385,7 @@ def test_dummy_journal_data_model_methods(new_mesh_session): @pytest.mark.dev @pytest.mark.fluent_231 +@pytest.mark.skip def test_meshing_workflow_structure(new_mesh_session): """ o Workflow