ansys-fluent-core 0.27.dev1__py3-none-any.whl → 0.28.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ansys-fluent-core might be problematic. Click here for more details.

Files changed (188) hide show
  1. ansys/fluent/core/__init__.py +22 -9
  2. ansys/fluent/core/_version.py +5 -2
  3. ansys/fluent/core/codegen/__init__.py +0 -3
  4. ansys/fluent/core/codegen/allapigen.py +1 -5
  5. ansys/fluent/core/codegen/builtin_settingsgen.py +44 -10
  6. ansys/fluent/core/codegen/datamodelgen.py +53 -12
  7. ansys/fluent/core/codegen/settingsgen.py +21 -12
  8. ansys/fluent/core/codegen/settingsgen_old.py +2 -2
  9. ansys/fluent/core/codegen/tuigen.py +1 -1
  10. ansys/fluent/core/codegen/write_settings_yaml.py +3 -4
  11. ansys/fluent/core/data_model_cache.py +132 -70
  12. ansys/fluent/core/docs/README.rst +2 -2
  13. ansys/fluent/core/examples/downloads.py +3 -5
  14. ansys/fluent/core/exceptions.py +1 -0
  15. ansys/fluent/core/file_session.py +59 -131
  16. ansys/fluent/core/filereader/case_file.py +17 -17
  17. ansys/fluent/core/filereader/casereader.py +2 -1
  18. ansys/fluent/core/filereader/data_file.py +7 -7
  19. ansys/fluent/core/filereader/lispy.py +6 -1
  20. ansys/fluent/core/fluent_connection.py +35 -7
  21. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  22. ansys/fluent/core/generated/datamodel_222/PMFileManagement.py +2 -2
  23. ansys/fluent/core/generated/datamodel_222/PartManagement.py +28 -28
  24. ansys/fluent/core/generated/datamodel_222/meshing.py +301 -301
  25. ansys/fluent/core/generated/datamodel_222/workflow.py +9 -9
  26. ansys/fluent/core/generated/datamodel_231/PMFileManagement.py +2 -2
  27. ansys/fluent/core/generated/datamodel_231/PartManagement.py +55 -55
  28. ansys/fluent/core/generated/datamodel_231/flicing.py +51 -51
  29. ansys/fluent/core/generated/datamodel_231/meshing.py +317 -317
  30. ansys/fluent/core/generated/datamodel_231/solverworkflow.py +51 -51
  31. ansys/fluent/core/generated/datamodel_231/workflow.py +9 -9
  32. ansys/fluent/core/generated/datamodel_232/PMFileManagement.py +2 -2
  33. ansys/fluent/core/generated/datamodel_232/PartManagement.py +55 -55
  34. ansys/fluent/core/generated/datamodel_232/flicing.py +51 -51
  35. ansys/fluent/core/generated/datamodel_232/meshing.py +335 -335
  36. ansys/fluent/core/generated/datamodel_232/solverworkflow.py +58 -58
  37. ansys/fluent/core/generated/datamodel_232/workflow.py +9 -9
  38. ansys/fluent/core/generated/datamodel_241/PMFileManagement.py +2 -2
  39. ansys/fluent/core/generated/datamodel_241/PartManagement.py +57 -57
  40. ansys/fluent/core/generated/datamodel_241/flicing.py +51 -51
  41. ansys/fluent/core/generated/datamodel_241/meshing.py +361 -361
  42. ansys/fluent/core/generated/datamodel_241/solverworkflow.py +58 -58
  43. ansys/fluent/core/generated/datamodel_241/workflow.py +9 -9
  44. ansys/fluent/core/generated/datamodel_242/MeshingUtilities.py +240 -240
  45. ansys/fluent/core/generated/datamodel_242/PMFileManagement.py +2 -2
  46. ansys/fluent/core/generated/datamodel_242/PartManagement.py +60 -60
  47. ansys/fluent/core/generated/datamodel_242/flicing.py +51 -51
  48. ansys/fluent/core/generated/datamodel_242/meshing.py +371 -371
  49. ansys/fluent/core/generated/datamodel_242/solverworkflow.py +58 -58
  50. ansys/fluent/core/generated/datamodel_242/workflow.py +9 -9
  51. ansys/fluent/core/generated/datamodel_251/MeshingUtilities.py +244 -244
  52. ansys/fluent/core/generated/datamodel_251/PMFileManagement.py +2 -2
  53. ansys/fluent/core/generated/datamodel_251/PartManagement.py +60 -60
  54. ansys/fluent/core/generated/datamodel_251/flicing.py +51 -51
  55. ansys/fluent/core/generated/datamodel_251/meshing.py +384 -382
  56. ansys/fluent/core/generated/datamodel_251/preferences.py +7 -0
  57. ansys/fluent/core/generated/datamodel_251/solverworkflow.py +58 -58
  58. ansys/fluent/core/generated/datamodel_251/workflow.py +10 -10
  59. ansys/fluent/core/generated/datamodel_252/MeshingUtilities.py +3664 -0
  60. ansys/fluent/core/generated/datamodel_252/PMFileManagement.py +288 -0
  61. ansys/fluent/core/generated/datamodel_252/PartManagement.py +2588 -0
  62. ansys/fluent/core/generated/datamodel_252/flicing.py +7972 -0
  63. ansys/fluent/core/generated/datamodel_252/meshing.py +2644 -0
  64. ansys/fluent/core/generated/datamodel_252/preferences.py +2760 -0
  65. ansys/fluent/core/generated/datamodel_252/solverworkflow.py +479 -0
  66. ansys/fluent/core/generated/datamodel_252/workflow.py +466 -0
  67. ansys/fluent/core/generated/fluent_version_251.py +4 -4
  68. ansys/fluent/core/generated/fluent_version_252.py +5 -0
  69. ansys/fluent/core/generated/meshing/tui_251.py +1139 -1179
  70. ansys/fluent/core/generated/meshing/tui_252.py +10181 -0
  71. ansys/fluent/core/generated/solver/settings_222.py +3 -3
  72. ansys/fluent/core/generated/solver/settings_231.py +4 -4
  73. ansys/fluent/core/generated/solver/settings_232.py +5 -5
  74. ansys/fluent/core/generated/solver/settings_241.py +5 -5
  75. ansys/fluent/core/generated/solver/settings_242.py +1185 -1185
  76. ansys/fluent/core/generated/solver/settings_251.py +1847 -1652
  77. ansys/fluent/core/generated/solver/settings_251.pyi +237 -211
  78. ansys/fluent/core/generated/solver/settings_252.py +90369 -0
  79. ansys/fluent/core/generated/solver/settings_252.pyi +63778 -0
  80. ansys/fluent/core/generated/solver/settings_builtin.py +612 -1
  81. ansys/fluent/core/generated/solver/settings_builtin.pyi +235 -0
  82. ansys/fluent/core/generated/solver/tui_251.py +2283 -2103
  83. ansys/fluent/core/generated/solver/tui_252.py +37720 -0
  84. ansys/fluent/core/journaling.py +1 -1
  85. ansys/fluent/core/launcher/error_handler.py +3 -0
  86. ansys/fluent/core/launcher/fluent_container.py +5 -0
  87. ansys/fluent/core/launcher/launcher.py +1 -2
  88. ansys/fluent/core/launcher/launcher_utils.py +17 -6
  89. ansys/fluent/core/launcher/process_launch_string.py +3 -3
  90. ansys/fluent/core/launcher/pyfluent_enums.py +1 -1
  91. ansys/fluent/core/launcher/slurm_launcher.py +2 -1
  92. ansys/fluent/core/launcher/standalone_launcher.py +11 -5
  93. ansys/fluent/core/launcher/watchdog.py +1 -1
  94. ansys/fluent/core/launcher/watchdog_exec +6 -3
  95. ansys/fluent/core/logging.py +1 -5
  96. ansys/fluent/core/parametric.py +6 -3
  97. ansys/fluent/core/post_objects/meta.py +1 -39
  98. ansys/fluent/core/post_objects/post_helper.py +4 -3
  99. ansys/fluent/core/post_objects/post_object_definitions.py +12 -7
  100. ansys/fluent/core/post_objects/post_objects_container.py +39 -2
  101. ansys/fluent/core/rpvars.py +2 -1
  102. ansys/fluent/core/scheduler/machine_list.py +3 -1
  103. ansys/fluent/core/search.py +109 -262
  104. ansys/fluent/core/services/__init__.py +3 -0
  105. ansys/fluent/core/services/api_upgrade.py +1 -0
  106. ansys/fluent/core/services/batch_ops.py +3 -1
  107. ansys/fluent/core/services/datamodel_se.py +37 -30
  108. ansys/fluent/core/services/datamodel_tui.py +8 -3
  109. ansys/fluent/core/services/deprecated_field_data.py +691 -0
  110. ansys/fluent/core/services/field_data.py +67 -357
  111. ansys/fluent/core/services/interceptors.py +6 -4
  112. ansys/fluent/core/services/reduction.py +1 -2
  113. ansys/fluent/core/services/scheme_eval.py +2 -3
  114. ansys/fluent/core/services/solution_variables.py +46 -48
  115. ansys/fluent/core/session.py +6 -4
  116. ansys/fluent/core/session_meshing.pyi +5 -0
  117. ansys/fluent/core/session_pure_meshing.pyi +4 -1
  118. ansys/fluent/core/session_solver_lite.py +2 -1
  119. ansys/fluent/core/solver/flobject.py +179 -207
  120. ansys/fluent/core/solver/flunits.py +65 -56
  121. ansys/fluent/core/solver/function/reduction.py +9 -29
  122. ansys/fluent/core/solver/settings_builtin_bases.py +28 -22
  123. ansys/fluent/core/solver/settings_builtin_data.py +105 -1
  124. ansys/fluent/core/solver/settings_external.py +0 -28
  125. ansys/fluent/core/streaming_services/field_data_streaming.py +1 -0
  126. ansys/fluent/core/streaming_services/monitor_streaming.py +0 -1
  127. ansys/fluent/core/systemcoupling.py +145 -14
  128. ansys/fluent/core/utils/__init__.py +18 -2
  129. ansys/fluent/core/utils/dump_session_data.py +7 -4
  130. ansys/fluent/core/utils/execution.py +2 -2
  131. ansys/fluent/core/utils/file_transfer_service.py +37 -42
  132. ansys/fluent/core/utils/fluent_version.py +20 -2
  133. ansys/fluent/core/utils/networking.py +39 -1
  134. ansys/fluent/core/workflow.py +3 -15
  135. ansys/fluent/tests/conftest.py +89 -7
  136. ansys/fluent/tests/fluent/test_version/test.py +2 -0
  137. ansys/fluent/tests/fluent_fixtures.py +195 -0
  138. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +7 -7
  139. ansys/fluent/tests/parametric/test_parametric_workflow.py +14 -4
  140. ansys/fluent/tests/test_builtin_settings.py +28 -0
  141. ansys/fluent/tests/test_cad_to_post_ftm.py +1 -3
  142. ansys/fluent/tests/test_cad_to_post_wtm.py +1 -1
  143. ansys/fluent/tests/test_casereader.py +1 -1
  144. ansys/fluent/tests/test_codegen.py +116 -6
  145. ansys/fluent/tests/test_data_model_cache.py +1 -1
  146. ansys/fluent/tests/test_datamodel_service.py +14 -19
  147. ansys/fluent/tests/test_field_data.py +93 -45
  148. ansys/fluent/tests/test_file_session.py +32 -29
  149. ansys/fluent/tests/test_flobject.py +16 -58
  150. ansys/fluent/tests/test_fluent_fixes.py +5 -5
  151. ansys/fluent/tests/test_fluent_session.py +11 -8
  152. ansys/fluent/tests/test_fluent_version.py +1 -1
  153. ansys/fluent/tests/test_launcher.py +22 -5
  154. ansys/fluent/tests/test_launcher_remote.py +80 -4
  155. ansys/fluent/tests/test_meshing_utilities.py +93 -44
  156. ansys/fluent/tests/test_meshing_workflow.py +6 -6
  157. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +1 -1
  158. ansys/fluent/tests/test_new_meshing_workflow.py +42 -3
  159. ansys/fluent/tests/test_preferences.py +6 -6
  160. ansys/fluent/tests/test_reduction.py +61 -30
  161. ansys/fluent/tests/test_rp_vars.py +1 -1
  162. ansys/fluent/tests/test_search.py +53 -200
  163. ansys/fluent/tests/test_session.py +18 -13
  164. ansys/fluent/tests/test_settings_api.py +93 -29
  165. ansys/fluent/tests/test_settings_reader.py +1 -1
  166. ansys/fluent/tests/test_solver_monitors.py +1 -1
  167. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +4 -4
  168. ansys/fluent/tests/test_solvermode/test_controls.py +3 -3
  169. ansys/fluent/tests/test_solvermode/test_methods.py +1 -1
  170. ansys/fluent/tests/test_solvermode/test_models.py +3 -3
  171. ansys/fluent/tests/test_systemcoupling.py +33 -5
  172. ansys/fluent/tests/test_topy.py +2 -2
  173. ansys/fluent/tests/test_tui_api.py +5 -5
  174. ansys/fluent/tests/test_utils.py +1 -1
  175. {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/METADATA +6 -17
  176. ansys_fluent_core-0.28.dev0.dist-info/RECORD +291 -0
  177. ansys/fluent/core/generated/api_tree_222.pickle +0 -0
  178. ansys/fluent/core/generated/api_tree_231.pickle +0 -0
  179. ansys/fluent/core/generated/api_tree_232.pickle +0 -0
  180. ansys/fluent/core/generated/api_tree_241.pickle +0 -0
  181. ansys/fluent/core/generated/api_tree_242.pickle +0 -0
  182. ansys/fluent/core/generated/api_tree_251.pickle +0 -0
  183. ansys/fluent/tests/test_tests_util.py +0 -47
  184. ansys/fluent/tests/util/__init__.py +0 -38
  185. ansys_fluent_core-0.27.dev1.dist-info/RECORD +0 -283
  186. {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/AUTHORS +0 -0
  187. {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/LICENSE +0 -0
  188. {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/WHEEL +0 -0
@@ -616,7 +616,7 @@ class FieldTransaction:
616
616
  tolerance: float | None = 0.001,
617
617
  coarsen: int | None = 1,
618
618
  velocity_domain: str | None = "all-phases",
619
- zones: list = [],
619
+ zones: list | None = None,
620
620
  ) -> None:
621
621
  """Add request to get pathlines field on surfaces.
622
622
 
@@ -655,6 +655,8 @@ class FieldTransaction:
655
655
  -------
656
656
  None
657
657
  """
658
+ if zones is None:
659
+ zones = []
658
660
  surface_ids = _get_surface_ids(
659
661
  field_info=self._field_info,
660
662
  allowed_surface_names=self._allowed_surface_names,
@@ -740,7 +742,7 @@ def _get_surface_ids(
740
742
 
741
743
  Parameters
742
744
  ----------
743
- surfaces : List[int], | List[str]
745
+ surfaces : List[int] | List[str]
744
746
  List of surface IDs or surface names.
745
747
 
746
748
  Returns
@@ -757,7 +759,7 @@ def _get_surface_ids(
757
759
  )
758
760
  else:
759
761
  surface_ids.append(surf)
760
- return list(set(surface_ids))
762
+ return surface_ids
761
763
 
762
764
 
763
765
  def get_fields_request():
@@ -777,7 +779,9 @@ class ChunkParser:
777
779
  The object which can register and unregister callbacks.
778
780
  It provides callbacks, which are triggered with following arguments:
779
781
  zone_id : int
782
+
780
783
  field_name : str
784
+
781
785
  field : numpy array
782
786
  """
783
787
 
@@ -917,176 +921,6 @@ class ChunkParser:
917
921
  return fields_data
918
922
 
919
923
 
920
- class BaseFieldData:
921
- """Contains common properties required by all field data types."""
922
-
923
- def __init__(self, i_d, data):
924
- """__init__ method of BaseFieldData class."""
925
- self._data = data
926
- self._id = i_d
927
-
928
- @property
929
- def data(self):
930
- """Returns data."""
931
- return self._data
932
-
933
- @property
934
- def surface_id(self):
935
- """Returns surface ID."""
936
- return self._id
937
-
938
- @property
939
- def size(self):
940
- """Returns size of data."""
941
- return len(self._data)
942
-
943
- def __getitem__(self, item):
944
- return self._data[item]
945
-
946
-
947
- class ScalarFieldData(BaseFieldData):
948
- """Contains scalar field data."""
949
-
950
- class ScalarData:
951
- """Stores and provides the data as a scalar."""
952
-
953
- def __init__(self, data):
954
- """__init__ method of ScalarData class."""
955
- self.scalar_data = data
956
-
957
- def __init__(self, i_d, data):
958
- """__init__ method of ScalarFieldData class."""
959
- super().__init__(i_d, [ScalarFieldData.ScalarData(_data) for _data in data])
960
-
961
-
962
- class Vector:
963
- """Stores the data as a vector ``(x, y, z)``."""
964
-
965
- def __init__(self, x, y, z):
966
- """__init__ method of Vector class."""
967
- self._x = x
968
- self._y = y
969
- self._z = z
970
-
971
- @property
972
- def x(self) -> float:
973
- """Returns vector point x."""
974
- return self._x
975
-
976
- @property
977
- def y(self) -> float:
978
- """Returns vector point y."""
979
- return self._y
980
-
981
- @property
982
- def z(self) -> float:
983
- """Returns vector point z."""
984
- return self._z
985
-
986
-
987
- def _resolve_into_array_of_vectors(data):
988
- if data.size % 3:
989
- raise ValueError(
990
- "Dataset must be resolved as a set of vectors."
991
- "The length of the dataset should always be in multiples of 3."
992
- )
993
- data.shape = data.size // 3, 3
994
-
995
-
996
- class VectorFieldData(BaseFieldData):
997
- """Provides a container for vector field data."""
998
-
999
- class VectorData(Vector):
1000
- """Stores and provides the data as a vector."""
1001
-
1002
- def __init__(self, x, y, z):
1003
- """__init__ method of VectorData class."""
1004
- super().__init__(x, y, z)
1005
-
1006
- def __init__(self, i_d, data, scale):
1007
- """__init__ method of VectorFieldData class."""
1008
- _resolve_into_array_of_vectors(data)
1009
- self._scale = scale
1010
- super().__init__(i_d, [VectorFieldData.VectorData(x, y, z) for x, y, z in data])
1011
-
1012
- @property
1013
- def scale(self) -> float:
1014
- """Returns scale of the vector field."""
1015
- return self._scale
1016
-
1017
-
1018
- class Vertices(BaseFieldData):
1019
- """Provides a container for the vertex data."""
1020
-
1021
- class Vertex(Vector):
1022
- """Stores and provides the data as a vector of a vertex."""
1023
-
1024
- def __init__(self, x, y, z):
1025
- """__init__ method of Vertex class."""
1026
- super().__init__(x, y, z)
1027
-
1028
- def __init__(self, i_d, data):
1029
- """__init__ method of Vertices class."""
1030
- _resolve_into_array_of_vectors(data)
1031
- super().__init__(i_d, [(Vertices.Vertex(x, y, z)) for x, y, z in data])
1032
-
1033
-
1034
- class FacesCentroid(BaseFieldData):
1035
- """Provides the container for the face centroid data."""
1036
-
1037
- class Centroid(Vector):
1038
- """Stores and provides the face centroid data as a vector."""
1039
-
1040
- def __init__(self, x, y, z):
1041
- """__init__ method of Centroid class."""
1042
- super().__init__(x, y, z)
1043
-
1044
- def __init__(self, i_d, data):
1045
- """__init__ method of FacesCentroid class."""
1046
- _resolve_into_array_of_vectors(data)
1047
- super().__init__(i_d, [(FacesCentroid.Centroid(x, y, z)) for x, y, z in data])
1048
-
1049
-
1050
- class FacesConnectivity(BaseFieldData):
1051
- """Provides the container for the face connectivity data."""
1052
-
1053
- class Faces:
1054
- """Stores and provides the face connectivity data as an array."""
1055
-
1056
- def __init__(self, node_count, node_indices):
1057
- """__init__ method of Faces class."""
1058
- self.node_count = node_count
1059
- self.node_indices = node_indices
1060
-
1061
- def __init__(self, i_d, data):
1062
- """__init__ method of FacesConnectivity class."""
1063
- faces_data = []
1064
- i = 0
1065
-
1066
- while i < len(data):
1067
- end = i + 1 + data[i]
1068
- faces_data.append(FacesConnectivity.Faces(data[i], data[i + 1 : end]))
1069
- i = end
1070
-
1071
- super().__init__(i_d, faces_data)
1072
-
1073
-
1074
- class FacesNormal(BaseFieldData):
1075
- """Provides the container for the face normal data."""
1076
-
1077
- class Normal(Vector):
1078
- """Stores and provides the face normal data as a vector."""
1079
-
1080
- def __init__(self, x, y, z):
1081
- """__init__ method of Normal class."""
1082
- super().__init__(x, y, z)
1083
-
1084
- def __init__(self, i_d, data):
1085
- """__init__ method of FacesNormal class."""
1086
- _resolve_into_array_of_vectors(data)
1087
- super().__init__(i_d, [FacesNormal.Normal(x, y, z) for x, y, z in data])
1088
-
1089
-
1090
924
  class FieldData:
1091
925
  """Provides access to Fluent field data on surfaces."""
1092
926
 
@@ -1166,23 +1000,13 @@ class FieldData:
1166
1000
  self._allowed_vector_field_names,
1167
1001
  )
1168
1002
 
1169
- @deprecate_argument(
1170
- old_arg="surface_name",
1171
- new_arg="surfaces",
1172
- converter=lambda old_arg_val: [old_arg_val] if old_arg_val else [],
1173
- )
1174
- @deprecate_argument(
1175
- old_arg="surface_ids",
1176
- new_arg="surfaces",
1177
- converter=lambda old_arg_val: old_arg_val or [],
1178
- )
1179
1003
  def get_scalar_field_data(
1180
1004
  self,
1181
1005
  field_name: str,
1182
1006
  surfaces: List[int | str],
1183
1007
  node_value: bool | None = True,
1184
1008
  boundary_value: bool | None = True,
1185
- ) -> ScalarFieldData | Dict[int, ScalarFieldData]:
1009
+ ) -> Dict[int | str, np.array]:
1186
1010
  """Get scalar field data on a surface.
1187
1011
 
1188
1012
  Parameters
@@ -1200,10 +1024,8 @@ class FieldData:
1200
1024
 
1201
1025
  Returns
1202
1026
  -------
1203
- ScalarFieldData | Dict[int, ScalarFieldData]
1204
- If a surface name is provided as input, scalar field data is returned. If surface
1205
- IDs are provided as input, a dictionary containing a map of surface IDs to scalar
1206
- field data.
1027
+ Dict[int | str, np.array]
1028
+ Returns a map of surface IDs (or names) to scalar field data.
1207
1029
  """
1208
1030
  surface_ids = _get_surface_ids(
1209
1031
  field_info=self._field_info,
@@ -1232,50 +1054,22 @@ class FieldData:
1232
1054
  fields = ChunkParser().extract_fields(self._service.get_fields(fields_request))
1233
1055
  scalar_field_data = next(iter(fields.values()))
1234
1056
 
1235
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1236
- return ScalarFieldData(
1237
- surface_ids[0], scalar_field_data[surface_ids[0]][field_name]
1238
- )
1239
- else:
1240
- return {
1241
- surface_id: ScalarFieldData(
1242
- surface_id, scalar_field_data[surface_id][field_name]
1243
- )
1244
- for surface_id in surface_ids
1245
- }
1057
+ return {
1058
+ surface: scalar_field_data[surface_ids[count]][field_name]
1059
+ for count, surface in enumerate(surfaces)
1060
+ }
1246
1061
 
1247
- @deprecate_argument(
1248
- old_arg="surface_name",
1249
- new_arg="surfaces",
1250
- converter=lambda old_arg_val: [old_arg_val] if old_arg_val else [],
1251
- )
1252
- @deprecate_argument(
1253
- old_arg="surface_ids",
1254
- new_arg="surfaces",
1255
- converter=lambda old_arg_val: old_arg_val or [],
1256
- )
1257
- @deprecate_argument(
1258
- old_arg="data_type",
1259
- new_arg="data_types",
1260
- converter=lambda old_arg_val: [old_arg_val] if old_arg_val else [],
1261
- )
1262
1062
  def get_surface_data(
1263
1063
  self,
1264
- data_types: List[SurfaceDataType] | List[str],
1064
+ data_types: List[SurfaceDataType],
1265
1065
  surfaces: List[int | str],
1266
1066
  overset_mesh: bool | None = False,
1267
- ) -> (
1268
- Vertices
1269
- | FacesConnectivity
1270
- | FacesNormal
1271
- | FacesCentroid
1272
- | Dict[int, Vertices | FacesConnectivity | FacesNormal | FacesCentroid]
1273
- ):
1067
+ ) -> Dict[int | str, Dict[SurfaceDataType, np.array | List[np.array]]]:
1274
1068
  """Get surface data (vertices, faces connectivity, centroids, and normals).
1275
1069
 
1276
1070
  Parameters
1277
1071
  ----------
1278
- data_types : List[SurfaceDataType] | List[str],
1072
+ data_types : List[SurfaceDataType],
1279
1073
  SurfaceDataType Enum members.
1280
1074
  surfaces : List[int | str]
1281
1075
  List of surface IDS or surface names for the surface data.
@@ -1284,23 +1078,15 @@ class FieldData:
1284
1078
 
1285
1079
  Returns
1286
1080
  -------
1287
- Vertices, FacesConnectivity, FacesNormal, FacesCentroid | Dict[int, Vertices | FacesConnectivity | FacesNormal | FacesCentroid]
1288
- If a surface name is provided as input, face vertices, connectivity data, and normal or centroid data are returned.
1289
- If surface IDs are provided as input, a dictionary containing a map of surface IDs to face
1290
- vertices, connectivity data, and normal or centroid data is returned.
1081
+ Dict[int | str, Dict[SurfaceDataType, np.array | List[np.array]]]
1082
+ Returns a map of surface IDs (or names) to face
1083
+ vertices, connectivity data, and normal or centroid data.
1291
1084
  """
1292
1085
  surface_ids = _get_surface_ids(
1293
1086
  field_info=self._field_info,
1294
1087
  allowed_surface_names=self._allowed_surface_names,
1295
1088
  surfaces=surfaces,
1296
1089
  )
1297
- updated_data = []
1298
- for d_type in data_types:
1299
- if isinstance(d_type, str):
1300
- updated_data.append(SurfaceDataType(d_type))
1301
- else:
1302
- updated_data.append(d_type)
1303
- data_types = updated_data
1304
1090
  fields_request = get_fields_request()
1305
1091
  fields_request.surfaceRequest.extend(
1306
1092
  [
@@ -1318,79 +1104,39 @@ class FieldData:
1318
1104
  fields = ChunkParser().extract_fields(self._service.get_fields(fields_request))
1319
1105
  surface_data = next(iter(fields.values()))
1320
1106
 
1321
- def _get_surfaces_data(parent_class, surf_id, _data_type):
1322
- return parent_class(
1323
- surf_id,
1324
- surface_data[surf_id][SurfaceDataType(_data_type).value],
1325
- )
1326
-
1327
- if SurfaceDataType.Vertices in data_types:
1328
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1329
- return _get_surfaces_data(
1330
- Vertices, surface_ids[0], SurfaceDataType.Vertices
1331
- )
1332
- else:
1333
- return {
1334
- surface_id: _get_surfaces_data(
1335
- Vertices, surface_id, SurfaceDataType.Vertices
1336
- )
1337
- for surface_id in surface_ids
1338
- }
1339
-
1340
- if SurfaceDataType.FacesCentroid in data_types:
1341
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1342
- return _get_surfaces_data(
1343
- FacesCentroid, surface_ids[0], SurfaceDataType.FacesCentroid
1344
- )
1345
- else:
1346
- return {
1347
- surface_id: _get_surfaces_data(
1348
- FacesCentroid, surface_id, SurfaceDataType.FacesCentroid
1349
- )
1350
- for surface_id in surface_ids
1351
- }
1352
-
1353
- if SurfaceDataType.FacesConnectivity in data_types:
1354
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1355
- return _get_surfaces_data(
1356
- FacesConnectivity, surface_ids[0], SurfaceDataType.FacesConnectivity
1357
- )
1358
- else:
1359
- return {
1360
- surface_id: _get_surfaces_data(
1361
- FacesConnectivity, surface_id, SurfaceDataType.FacesConnectivity
1107
+ ret_surf_data = {}
1108
+ for count, surface in enumerate(surfaces):
1109
+ ret_surf_data[surface] = {}
1110
+ for data_type in data_types:
1111
+ if data_type == SurfaceDataType.FacesConnectivity:
1112
+ ret_surf_data[surface][data_type] = (
1113
+ self._get_faces_connectivity_data(
1114
+ surface_data[surface_ids[count]][
1115
+ SurfaceDataType.FacesConnectivity.value
1116
+ ]
1117
+ )
1362
1118
  )
1363
- for surface_id in surface_ids
1364
- }
1119
+ else:
1120
+ ret_surf_data[surface][data_type] = surface_data[
1121
+ surface_ids[count]
1122
+ ][data_type.value].reshape(-1, 3)
1123
+ return ret_surf_data
1365
1124
 
1366
- if SurfaceDataType.FacesNormal in data_types:
1367
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1368
- return _get_surfaces_data(
1369
- FacesNormal, surface_ids[0], SurfaceDataType.FacesNormal
1370
- )
1371
- else:
1372
- return {
1373
- surface_id: _get_surfaces_data(
1374
- FacesNormal, surface_id, SurfaceDataType.FacesNormal
1375
- )
1376
- for surface_id in surface_ids
1377
- }
1125
+ @staticmethod
1126
+ def _get_faces_connectivity_data(data):
1127
+ faces_data = []
1128
+ i = 0
1129
+ while i < len(data):
1130
+ end = i + 1 + data[i]
1131
+ faces_data.append(data[i + 1 : end])
1132
+ i = end
1133
+ return faces_data
1378
1134
 
1379
- @deprecate_argument(
1380
- old_arg="surface_name",
1381
- new_arg="surfaces",
1382
- converter=lambda old_arg_val: [old_arg_val] if old_arg_val else [],
1383
- )
1384
- @deprecate_argument(
1385
- old_arg="surface_ids",
1386
- new_arg="surfaces",
1387
- converter=lambda old_arg_val: old_arg_val or [],
1388
- )
1389
1135
  def get_vector_field_data(
1390
1136
  self,
1391
1137
  field_name: str,
1392
1138
  surfaces: List[int | str],
1393
- ) -> VectorFieldData | Dict[int, VectorFieldData]:
1139
+ ) -> Dict[int | str, np.array]:
1394
1140
  """Get vector field data on a surface.
1395
1141
 
1396
1142
  Parameters
@@ -1402,10 +1148,8 @@ class FieldData:
1402
1148
 
1403
1149
  Returns
1404
1150
  -------
1405
- VectorFieldData | Dict[int, VectorFieldData]
1406
- If a surface name is provided as input, vector field data is returned.
1407
- If surface IDs are provided as input, a dictionary containing a map of
1408
- surface IDs to vector field data is returned.
1151
+ Dict[int | str, np.array]
1152
+ Returns a map of surface IDs (or names) to vector field data.
1409
1153
  """
1410
1154
  surface_ids = _get_surface_ids(
1411
1155
  field_info=self._field_info,
@@ -1429,32 +1173,11 @@ class FieldData:
1429
1173
  fields = ChunkParser().extract_fields(self._service.get_fields(fields_request))
1430
1174
  vector_field_data = next(iter(fields.values()))
1431
1175
 
1432
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1433
- return VectorFieldData(
1434
- surface_ids[0],
1435
- vector_field_data[surface_ids[0]][field_name],
1436
- vector_field_data[surface_ids[0]]["vector-scale"][0],
1437
- )
1438
- else:
1439
- return {
1440
- surface_id: VectorFieldData(
1441
- surface_id,
1442
- vector_field_data[surface_id][field_name],
1443
- vector_field_data[surface_id]["vector-scale"][0],
1444
- )
1445
- for surface_id in surface_ids
1446
- }
1176
+ return {
1177
+ surface: vector_field_data[surface_ids[count]][field_name].reshape(-1, 3)
1178
+ for count, surface in enumerate(surfaces)
1179
+ }
1447
1180
 
1448
- @deprecate_argument(
1449
- old_arg="surface_name",
1450
- new_arg="surfaces",
1451
- converter=lambda old_arg_val: [old_arg_val] if old_arg_val else [],
1452
- )
1453
- @deprecate_argument(
1454
- old_arg="surface_ids",
1455
- new_arg="surfaces",
1456
- converter=lambda old_arg_val: old_arg_val or [],
1457
- )
1458
1181
  def get_pathlines_field_data(
1459
1182
  self,
1460
1183
  field_name: str,
@@ -1470,7 +1193,7 @@ class FieldData:
1470
1193
  tolerance: float | None = 0.001,
1471
1194
  coarsen: int | None = 1,
1472
1195
  velocity_domain: str | None = "all-phases",
1473
- zones: list = [],
1196
+ zones: list | None = None,
1474
1197
  ) -> Dict:
1475
1198
  """Get the pathlines field data on a surface.
1476
1199
 
@@ -1512,6 +1235,8 @@ class FieldData:
1512
1235
  Dictionary containing a map of surface IDs to the pathline data.
1513
1236
  For example, pathlines connectivity, vertices, and field.
1514
1237
  """
1238
+ if zones is None:
1239
+ zones = []
1515
1240
  surface_ids = _get_surface_ids(
1516
1241
  field_info=self._field_info,
1517
1242
  allowed_surface_names=self._allowed_surface_names,
@@ -1546,31 +1271,16 @@ class FieldData:
1546
1271
  fields = ChunkParser().extract_fields(self._service.get_fields(fields_request))
1547
1272
  pathlines_data = next(iter(fields.values()))
1548
1273
 
1549
- def _get_surfaces_data(parent_class, surf_id, _data_type):
1550
- return parent_class(
1551
- surf_id,
1552
- pathlines_data[surf_id][_data_type],
1553
- )
1554
-
1555
- if len(surfaces) == 1 and isinstance(surfaces[0], str):
1556
- vertices_data = _get_surfaces_data(Vertices, surface_ids[0], "vertices")
1557
- lines_data = _get_surfaces_data(FacesConnectivity, surface_ids[0], "lines")
1558
- field_data = ScalarFieldData(
1559
- surface_ids[0], pathlines_data[surface_ids[0]][field_name]
1560
- )
1561
- return {
1562
- "vertices": vertices_data,
1563
- "lines": lines_data,
1564
- field_name: field_data,
1274
+ path_lines_dict = {}
1275
+
1276
+ for count, surface in enumerate(surfaces):
1277
+ path_lines_dict[surface] = {
1278
+ "vertices": pathlines_data[surface_ids[count]]["vertices"].reshape(
1279
+ -1, 3
1280
+ ),
1281
+ "lines": self._get_faces_connectivity_data(
1282
+ pathlines_data[surface_ids[count]]["lines"]
1283
+ ),
1284
+ field_name: pathlines_data[surface_ids[count]][field_name],
1565
1285
  }
1566
- else:
1567
- path_lines_dict = {}
1568
- for surface_id in surface_ids:
1569
- path_lines_dict[surface_id] = {
1570
- "vertices": _get_surfaces_data(Vertices, surface_id, "vertices"),
1571
- "lines": _get_surfaces_data(FacesConnectivity, surface_id, "lines"),
1572
- field_name: ScalarFieldData(
1573
- surface_id, pathlines_data[surface_id][field_name]
1574
- ),
1575
- }
1576
- return path_lines_dict
1286
+ return path_lines_dict
@@ -106,10 +106,12 @@ class GrpcErrorInterceptor(grpc.UnaryUnaryClientInterceptor):
106
106
  ) -> Any:
107
107
  response = continuation(client_call_details, request)
108
108
  if response.exception() is not None and response.code() != grpc.StatusCode.OK:
109
- grpc_ex = response.exception()
110
- ex = RuntimeError(grpc_ex.details())
111
- ex.__context__ = grpc_ex
112
- raise ex from None
109
+ ex = response.exception()
110
+ new_ex = RuntimeError(
111
+ ex.details() if isinstance(ex, grpc.RpcError) else str(ex)
112
+ )
113
+ new_ex.__context__ = ex
114
+ raise new_ex from None
113
115
  return response
114
116
 
115
117
  def intercept_unary_unary(
@@ -172,6 +172,7 @@ class BadReductionRequest(Exception):
172
172
  """Raised on an attempt to make a bad reduction request."""
173
173
 
174
174
  def __init__(self, err):
175
+ """Initialize BadReductionRequest."""
175
176
  super().__init__(f"Could not complete reduction function request: {err}")
176
177
 
177
178
 
@@ -251,8 +252,6 @@ class Reduction:
251
252
  self.service = service
252
253
  self.ctxt = weakref.proxy(ctxt)
253
254
 
254
- docstring = None
255
-
256
255
  def _validate_str_location(self, loc: str):
257
256
  if all(
258
257
  loc not in names()
@@ -5,9 +5,9 @@ Example
5
5
  >>> from ansys.fluent.core.services.scheme_eval import Symbol as S
6
6
  >>> session.scheme_eval.eval([S('+'), 2, 3])
7
7
  5
8
- >>> session.scheme_eval.eval([S('rpgetvar'), [S('string->symbol'), "mom/relax"]]) # noqa: E501
8
+ >>> session.scheme_eval.eval([S('rpgetvar'), [S('string->symbol'), "mom/relax"]])
9
9
  0.7
10
- >>> session.scheme_eval.exec(('(ti-menu-load-string "/report/system/proc-stats")',)) # noqa: E501
10
+ >>> session.scheme_eval.exec(('(ti-menu-load-string "/report/system/proc-stats")',))
11
11
  >>> # Returns TUI output string
12
12
  >>> session.scheme_eval.string_eval("(+ 2 3)")
13
13
  '5'
@@ -355,7 +355,6 @@ class SchemeEval:
355
355
  bool
356
356
  True if symbol is defined, False otherwise
357
357
  """
358
- S = Symbol # noqa N806
359
358
  return not self.scheme_eval(
360
359
  f"(lexical-unreferenceable? user-initial-environment '{symbol})"
361
360
  )