ansys-fluent-core 0.28.2__py3-none-any.whl → 0.29.0__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 (221) hide show
  1. ansys/fluent/core/__init__.py +26 -1
  2. ansys/fluent/core/_stand_alone_datamodel_client/_datamodel_client.py +22 -0
  3. ansys/fluent/core/_version.py +24 -2
  4. ansys/fluent/core/codegen/__init__.py +22 -0
  5. ansys/fluent/core/codegen/allapigen.py +38 -5
  6. ansys/fluent/core/codegen/builtin_settingsgen.py +22 -0
  7. ansys/fluent/core/codegen/data/__init__.py +21 -0
  8. ansys/fluent/core/codegen/data/fluent_gui_help_patch.py +22 -0
  9. ansys/fluent/core/codegen/data/meshing_utilities_examples.py +22 -0
  10. ansys/fluent/core/codegen/datamodelgen.py +40 -4
  11. ansys/fluent/core/codegen/print_fluent_version.py +22 -0
  12. ansys/fluent/core/codegen/settingsgen.py +67 -4
  13. ansys/fluent/core/codegen/tuigen.py +44 -6
  14. ansys/fluent/core/codegen/walk_api.py +67 -18
  15. ansys/fluent/core/codegen/write_settings_yaml.py +22 -0
  16. ansys/fluent/core/data_model_cache.py +22 -0
  17. ansys/fluent/core/examples/__init__.py +22 -0
  18. ansys/fluent/core/examples/downloads.py +22 -0
  19. ansys/fluent/core/exceptions.py +22 -0
  20. ansys/fluent/core/file_session.py +22 -0
  21. ansys/fluent/core/filereader/__init__.py +21 -0
  22. ansys/fluent/core/filereader/case_file.py +22 -0
  23. ansys/fluent/core/filereader/casereader.py +22 -0
  24. ansys/fluent/core/filereader/data_file.py +22 -0
  25. ansys/fluent/core/filereader/lispy.py +22 -0
  26. ansys/fluent/core/fluent_connection.py +23 -1
  27. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  28. ansys/fluent/core/generated/datamodel_252/meshing.py +32 -0
  29. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  30. ansys/fluent/core/generated/solver/settings_222.py +0 -72
  31. ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
  32. ansys/fluent/core/generated/solver/settings_231.py +0 -574
  33. ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
  34. ansys/fluent/core/generated/solver/settings_232.py +0 -527
  35. ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
  36. ansys/fluent/core/generated/solver/settings_241.py +0 -478
  37. ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
  38. ansys/fluent/core/generated/solver/settings_242.py +0 -361
  39. ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
  40. ansys/fluent/core/generated/solver/settings_251.py +0 -399
  41. ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
  42. ansys/fluent/core/generated/solver/settings_252.py +7794 -4185
  43. ansys/fluent/core/generated/solver/settings_252.pyi +6986 -3213
  44. ansys/fluent/core/generated/solver/tui_252.py +537 -181
  45. ansys/fluent/core/get_build_details.py +22 -0
  46. ansys/fluent/core/journaling.py +38 -0
  47. ansys/fluent/core/launcher/__init__.py +22 -0
  48. ansys/fluent/core/launcher/container_launcher.py +65 -56
  49. ansys/fluent/core/launcher/error_handler.py +30 -0
  50. ansys/fluent/core/launcher/fluent_container.py +45 -20
  51. ansys/fluent/core/launcher/launcher.py +53 -5
  52. ansys/fluent/core/launcher/launcher_utils.py +22 -0
  53. ansys/fluent/core/launcher/pim_launcher.py +120 -86
  54. ansys/fluent/core/launcher/process_launch_string.py +22 -0
  55. ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
  56. ansys/fluent/core/launcher/server_info.py +45 -3
  57. ansys/fluent/core/launcher/slurm_launcher.py +25 -3
  58. ansys/fluent/core/launcher/standalone_launcher.py +68 -63
  59. ansys/fluent/core/launcher/watchdog.py +22 -0
  60. ansys/fluent/core/logging.py +24 -0
  61. ansys/fluent/core/logging_config.yaml +3 -0
  62. ansys/fluent/core/meshing/meshing_workflow.py +22 -0
  63. ansys/fluent/core/parametric.py +22 -0
  64. ansys/fluent/core/post_objects/__init__.py +21 -0
  65. ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
  66. ansys/fluent/core/post_objects/meta.py +22 -0
  67. ansys/fluent/core/post_objects/post_helper.py +22 -0
  68. ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
  69. ansys/fluent/core/post_objects/post_objects_container.py +22 -0
  70. ansys/fluent/core/post_objects/singleton_meta.py +22 -0
  71. ansys/fluent/core/post_objects/timing_decorator.py +22 -0
  72. ansys/fluent/core/report.py +77 -0
  73. ansys/fluent/core/rpvars.py +22 -0
  74. ansys/fluent/core/scheduler/__init__.py +22 -0
  75. ansys/fluent/core/scheduler/load_machines.py +22 -0
  76. ansys/fluent/core/scheduler/machine_list.py +22 -0
  77. ansys/fluent/core/search.py +22 -0
  78. ansys/fluent/core/services/__init__.py +22 -0
  79. ansys/fluent/core/services/api_upgrade.py +22 -0
  80. ansys/fluent/core/services/app_utilities.py +38 -0
  81. ansys/fluent/core/services/batch_ops.py +22 -0
  82. ansys/fluent/core/services/datamodel_se.py +26 -1
  83. ansys/fluent/core/services/datamodel_tui.py +22 -0
  84. ansys/fluent/core/services/deprecated_field_data.py +23 -1
  85. ansys/fluent/core/services/events.py +22 -0
  86. ansys/fluent/core/services/field_data.py +285 -2
  87. ansys/fluent/core/services/health_check.py +22 -0
  88. ansys/fluent/core/services/interceptors.py +50 -2
  89. ansys/fluent/core/services/monitor.py +22 -0
  90. ansys/fluent/core/services/reduction.py +22 -0
  91. ansys/fluent/core/services/scheme_eval.py +22 -0
  92. ansys/fluent/core/services/settings.py +22 -0
  93. ansys/fluent/core/services/solution_variables.py +22 -0
  94. ansys/fluent/core/services/streaming.py +22 -0
  95. ansys/fluent/core/services/transcript.py +22 -0
  96. ansys/fluent/core/session.py +39 -2
  97. ansys/fluent/core/session_base_meshing.py +22 -0
  98. ansys/fluent/core/session_meshing.py +22 -0
  99. ansys/fluent/core/session_meshing.pyi +22 -0
  100. ansys/fluent/core/session_pure_meshing.py +22 -0
  101. ansys/fluent/core/session_pure_meshing.pyi +22 -0
  102. ansys/fluent/core/session_shared.py +22 -0
  103. ansys/fluent/core/session_solver.py +43 -0
  104. ansys/fluent/core/session_solver.pyi +22 -0
  105. ansys/fluent/core/session_solver_aero.py +22 -0
  106. ansys/fluent/core/session_solver_icing.py +22 -0
  107. ansys/fluent/core/session_solver_lite.py +22 -0
  108. ansys/fluent/core/solver/__init__.py +22 -0
  109. ansys/fluent/core/solver/error_message.py +22 -0
  110. ansys/fluent/core/solver/flobject.py +22 -0
  111. ansys/fluent/core/solver/flunits.py +22 -0
  112. ansys/fluent/core/solver/function/__init__.py +22 -0
  113. ansys/fluent/core/solver/function/reduction.py +22 -0
  114. ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
  115. ansys/fluent/core/solver/settings_builtin_data.py +22 -0
  116. ansys/fluent/core/solver/settings_external.py +22 -0
  117. ansys/fluent/core/streaming_services/__init__.py +21 -0
  118. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +22 -0
  119. ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
  120. ansys/fluent/core/streaming_services/events_streaming.py +22 -0
  121. ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
  122. ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
  123. ansys/fluent/core/streaming_services/streaming.py +22 -0
  124. ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
  125. ansys/fluent/core/systemcoupling.py +22 -0
  126. ansys/fluent/core/utils/__init__.py +22 -0
  127. ansys/fluent/core/utils/data_transfer.py +22 -0
  128. ansys/fluent/core/utils/deprecate.py +24 -1
  129. ansys/fluent/core/utils/dictionary_operations.py +22 -0
  130. ansys/fluent/core/utils/dump_session_data.py +22 -0
  131. ansys/fluent/core/utils/event_loop.py +22 -0
  132. ansys/fluent/core/utils/execution.py +22 -0
  133. ansys/fluent/core/utils/file_transfer_service.py +22 -0
  134. ansys/fluent/core/utils/fix_doc.py +22 -0
  135. ansys/fluent/core/utils/fldoc.py +22 -0
  136. ansys/fluent/core/utils/fluent_version.py +22 -0
  137. ansys/fluent/core/utils/networking.py +22 -0
  138. ansys/fluent/core/utils/setup_for_fluent.py +22 -0
  139. ansys/fluent/core/warnings.py +22 -0
  140. ansys/fluent/core/workflow.py +22 -0
  141. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/LICENSE +8 -8
  142. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/METADATA +56 -33
  143. ansys_fluent_core-0.29.0.dist-info/RECORD +219 -0
  144. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/WHEEL +1 -1
  145. ansys/fluent/core/docs/README.rst +0 -155
  146. ansys/fluent/tests/conftest.py +0 -415
  147. ansys/fluent/tests/fluent_fixtures.py +0 -195
  148. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  149. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  150. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  151. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  152. ansys/fluent/tests/test_aero_session.py +0 -88
  153. ansys/fluent/tests/test_batch_ops.py +0 -39
  154. ansys/fluent/tests/test_builtin_settings.py +0 -761
  155. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  156. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  157. ansys/fluent/tests/test_casereader.py +0 -324
  158. ansys/fluent/tests/test_codegen.py +0 -783
  159. ansys/fluent/tests/test_creatable.py +0 -31
  160. ansys/fluent/tests/test_data_model_cache.py +0 -434
  161. ansys/fluent/tests/test_datamodel_api.py +0 -429
  162. ansys/fluent/tests/test_datamodel_service.py +0 -814
  163. ansys/fluent/tests/test_datareader.py +0 -103
  164. ansys/fluent/tests/test_error_handling.py +0 -24
  165. ansys/fluent/tests/test_events_manager.py +0 -214
  166. ansys/fluent/tests/test_field_data.py +0 -466
  167. ansys/fluent/tests/test_file_session.py +0 -355
  168. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  169. ansys/fluent/tests/test_fix_doc.py +0 -29
  170. ansys/fluent/tests/test_flobject.py +0 -1235
  171. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  172. ansys/fluent/tests/test_fluent_session.py +0 -270
  173. ansys/fluent/tests/test_fluent_version.py +0 -66
  174. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  175. ansys/fluent/tests/test_icing_session.py +0 -9
  176. ansys/fluent/tests/test_launcher.py +0 -529
  177. ansys/fluent/tests/test_launcher_remote.py +0 -272
  178. ansys/fluent/tests/test_lispy.py +0 -40
  179. ansys/fluent/tests/test_logging.py +0 -16
  180. ansys/fluent/tests/test_mapped_api.py +0 -766
  181. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  182. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  183. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  184. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  185. ansys/fluent/tests/test_preferences.py +0 -89
  186. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  187. ansys/fluent/tests/test_reduction.py +0 -484
  188. ansys/fluent/tests/test_rp_vars.py +0 -77
  189. ansys/fluent/tests/test_scheduler.py +0 -471
  190. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  191. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  192. ansys/fluent/tests/test_search.py +0 -344
  193. ansys/fluent/tests/test_session.py +0 -594
  194. ansys/fluent/tests/test_settings_api.py +0 -606
  195. ansys/fluent/tests/test_settings_reader.py +0 -85
  196. ansys/fluent/tests/test_slurm_future.py +0 -67
  197. ansys/fluent/tests/test_solution_variables.py +0 -241
  198. ansys/fluent/tests/test_solver_monitors.py +0 -83
  199. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  200. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  201. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  202. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  203. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  204. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  205. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  206. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  207. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  208. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  209. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  210. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  211. ansys/fluent/tests/test_streaming_services.py +0 -52
  212. ansys/fluent/tests/test_systemcoupling.py +0 -44
  213. ansys/fluent/tests/test_topy.py +0 -179
  214. ansys/fluent/tests/test_tui_api.py +0 -70
  215. ansys/fluent/tests/test_type_stub.py +0 -37
  216. ansys/fluent/tests/test_utils.py +0 -82
  217. ansys/fluent/tests/util/__init__.py +0 -36
  218. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  219. ansys/fluent/tests/util/solver.py +0 -72
  220. ansys_fluent_core-0.28.2.dist-info/AUTHORS +0 -12
  221. ansys_fluent_core-0.28.2.dist-info/RECORD +0 -294
@@ -1,8 +1,34 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over FieldData gRPC service of Fluent."""
2
24
 
25
+ from dataclasses import dataclass, field
3
26
  from enum import Enum
4
27
  from functools import reduce
28
+ import logging
29
+ import time
5
30
  from typing import Callable, Dict, List, Tuple
31
+ import weakref
6
32
 
7
33
  import grpc
8
34
  import numpy as np
@@ -19,6 +45,8 @@ from ansys.fluent.core.services.interceptors import (
19
45
  from ansys.fluent.core.services.streaming import StreamingService
20
46
  from ansys.fluent.core.utils.deprecate import deprecate_argument, deprecate_arguments
21
47
 
48
+ logger = logging.getLogger("pyfluent.field_data")
49
+
22
50
 
23
51
  def override_help_text(func, func_to_be_wrapped):
24
52
  """Override function help text."""
@@ -82,6 +110,37 @@ class FieldDataService(StreamingService):
82
110
  )
83
111
  return chunk_iterator
84
112
 
113
+ def get_solver_mesh_nodes(
114
+ self, request: FieldDataProtoModule.GetSolverMeshNodesRequest
115
+ ):
116
+ """GetSolverMeshNodesDouble RPC of FieldData service."""
117
+ import ansys.fluent.core as pyfluent
118
+ from ansys.fluent.core.launcher.pyfluent_enums import Precision
119
+
120
+ if pyfluent.FLUENT_PRECISION_MODE == Precision.SINGLE:
121
+ responses = self._stub.GetSolverMeshNodesFloat(
122
+ request, metadata=self._metadata
123
+ )
124
+ else:
125
+ responses = self._stub.GetSolverMeshNodesDouble(
126
+ request, metadata=self._metadata
127
+ )
128
+
129
+ nested_nodes = []
130
+ for response in responses:
131
+ nested_nodes.append(response.nodes)
132
+ return nested_nodes
133
+
134
+ def get_solver_mesh_elements(
135
+ self, request: FieldDataProtoModule.GetSolverMeshElementsRequest
136
+ ):
137
+ """GetSolverMeshElements RPC of FieldData service."""
138
+ responses = self._stub.GetSolverMeshElements(request, metadata=self._metadata)
139
+ elementss = []
140
+ for response in responses:
141
+ elementss.append(response.elements)
142
+ return elementss
143
+
85
144
 
86
145
  class FieldInfo:
87
146
  """Provides access to Fluent field information.
@@ -606,7 +665,7 @@ class FieldTransaction:
606
665
  self,
607
666
  field_name: str,
608
667
  surfaces: List[int | str],
609
- additional_field_name: str | None = "",
668
+ additional_field_name: str = "",
610
669
  provide_particle_time_field: bool | None = False,
611
670
  node_value: bool | None = True,
612
671
  steps: int | None = 500,
@@ -922,6 +981,134 @@ class ChunkParser:
922
981
  return fields_data
923
982
 
924
983
 
984
+ # Root domain id in Fluent.
985
+ ROOT_DOMAIN_ID = 1
986
+
987
+
988
+ class ZoneType(Enum):
989
+ """Zone types for mesh."""
990
+
991
+ CELL = 1
992
+ FACE = 2
993
+
994
+
995
+ @dataclass
996
+ class ZoneInfo:
997
+ """Zone information for mesh.
998
+
999
+ Attributes:
1000
+ -----------
1001
+ _id : int
1002
+ Zone ID.
1003
+ name : str
1004
+ Name of the zone.
1005
+ zone_type : ZoneType
1006
+ Type of the zone for mesh.
1007
+ """
1008
+
1009
+ _id: int
1010
+ name: str
1011
+ zone_type: ZoneType
1012
+
1013
+
1014
+ @dataclass
1015
+ class Node:
1016
+ """Node class for mesh.
1017
+
1018
+ Attributes:
1019
+ -----------
1020
+ x : float
1021
+ x-coordinate of the node.
1022
+ y : float
1023
+ y-coordinate of the node.
1024
+ z : float
1025
+ z-coordinate of the node.
1026
+ """
1027
+
1028
+ _id: int
1029
+ x: float
1030
+ y: float
1031
+ z: float
1032
+
1033
+
1034
+ class CellElementType(Enum):
1035
+ """Element types for a cell element."""
1036
+
1037
+ # 3 nodes, 3 faces
1038
+ TRIANGLE = 1
1039
+ # 4 nodes, 4 faces
1040
+ TETRAHEDRON = 2
1041
+ # 4 nodes, 4 faces
1042
+ QUADRILATERAL = 3
1043
+ # 8 nodes, 6 faces
1044
+ HEXAHEDRON = 4
1045
+ # 5 nodes, 5 faces
1046
+ PYRAMID = 5
1047
+ # 6 nodes, 5 faces
1048
+ WEDGE = 6
1049
+ # Arbitrary number of nodes and faces
1050
+ POLYHEDRON = 7
1051
+ # 2 nodes, 1 face (only in 2D)
1052
+ GHOST = 8
1053
+ # 10 nodes, 4 faces
1054
+ QUADRATIC_TETRAHEDRON = 9
1055
+ # 20 nodes, 6 faces
1056
+ QUADRATIC_HEXAHEDRON = 10
1057
+ # 13 nodes, 5 faces
1058
+ QUADRATIC_PYRAMID = 11
1059
+ # 15 nodes, 5 faces
1060
+ QUADRATIC_WEDGE = 12
1061
+
1062
+
1063
+ @dataclass
1064
+ class Facet:
1065
+ """Facet class within a mesh element.
1066
+
1067
+ Attributes:
1068
+ -----------
1069
+ node_indices : list[int]
1070
+ 0-based node indices of the facet.
1071
+ """
1072
+
1073
+ node_indices: list[int]
1074
+
1075
+
1076
+ @dataclass
1077
+ class Element:
1078
+ """Element class for mesh.
1079
+
1080
+ Attributes:
1081
+ -----------
1082
+ element_type : CellElementType
1083
+ Element type of the element.
1084
+ node_indices : list[int]
1085
+ 0-based node indices of the element. Populated for standard elements.
1086
+ facets : list[Facet]
1087
+ List of facets of the element. Populated for polyhedral elements.
1088
+ """
1089
+
1090
+ _id: int
1091
+ element_type: CellElementType
1092
+ node_indices: list[int] = field(default_factory=list)
1093
+ facets: list[Facet] = field(default_factory=list)
1094
+
1095
+
1096
+ @dataclass
1097
+ class Mesh:
1098
+ """Mesh class for Fluent field data.
1099
+
1100
+ Attributes:
1101
+ -----------
1102
+ nodes : list[Node]
1103
+ List of nodes in the mesh.
1104
+ elements : list[Element]
1105
+ List of elements in the mesh.
1106
+ """
1107
+
1108
+ nodes: list[Node]
1109
+ elements: list[Element]
1110
+
1111
+
925
1112
  class FieldData:
926
1113
  """Provides access to Fluent field data on surfaces."""
927
1114
 
@@ -931,12 +1118,14 @@ class FieldData:
931
1118
  field_info: FieldInfo,
932
1119
  is_data_valid: Callable[[], bool],
933
1120
  scheme_eval=None,
1121
+ get_zones_info: weakref.WeakMethod[Callable[[], list[ZoneInfo]]] | None = None,
934
1122
  ):
935
1123
  """__init__ method of FieldData class."""
936
1124
  self._service = service
937
1125
  self._field_info = field_info
938
1126
  self.is_data_valid = is_data_valid
939
1127
  self.scheme_eval = scheme_eval
1128
+ self.get_zones_info = lambda: get_zones_info()()
940
1129
 
941
1130
  self._allowed_surface_names = _AllowedSurfaceNames(field_info)
942
1131
 
@@ -1183,7 +1372,7 @@ class FieldData:
1183
1372
  self,
1184
1373
  field_name: str,
1185
1374
  surfaces: List[int | str],
1186
- additional_field_name: str | None = "",
1375
+ additional_field_name: str = "",
1187
1376
  provide_particle_time_field: bool | None = False,
1188
1377
  node_value: bool | None = True,
1189
1378
  steps: int | None = 500,
@@ -1285,3 +1474,97 @@ class FieldData:
1285
1474
  field_name: pathlines_data[surface_ids[count]][field_name],
1286
1475
  }
1287
1476
  return path_lines_dict
1477
+
1478
+ def get_mesh(self, zone: str | int) -> Mesh:
1479
+ """Get mesh for a zone.
1480
+
1481
+ Parameters
1482
+ ----------
1483
+ zone : str | int
1484
+ Zone name or id. Currently, only cell zones are supported.
1485
+
1486
+ Returns
1487
+ -------
1488
+ Mesh
1489
+ Mesh object containing nodes and elements.
1490
+
1491
+ Raises
1492
+ ------
1493
+ ValueError
1494
+ If the zone is not found.
1495
+ NotImplementedError
1496
+ If a face zone is provided.
1497
+ """
1498
+ zone_info = None
1499
+ for zone_info in self.get_zones_info():
1500
+ if zone_info.name == zone or zone_info._id == zone:
1501
+ break
1502
+ if zone_info is None:
1503
+ raise ValueError(f"Zone {zone} not found.")
1504
+ if zone_info.zone_type == ZoneType.FACE:
1505
+ raise NotImplementedError("Face zone mesh is not supported.")
1506
+
1507
+ # Mesh data is retrieved from the root domain in Fluent
1508
+ logger.info(f"Getting nodes data for zone {zone_info._id}")
1509
+ start_time = time.time()
1510
+ nodes_request = FieldDataProtoModule.GetSolverMeshNodesRequest(
1511
+ domain_id=ROOT_DOMAIN_ID, thread_id=zone_info._id
1512
+ )
1513
+ nested_nodes = self._service.get_solver_mesh_nodes(nodes_request)
1514
+ logger.info(f"Nodes data received in {time.time() - start_time} seconds")
1515
+ logger.info(f"Getting elements for zone {zone_info._id}")
1516
+ start_time = time.time()
1517
+ elements_request = FieldDataProtoModule.GetSolverMeshElementsRequest(
1518
+ domain_id=ROOT_DOMAIN_ID, thread_id=zone_info._id
1519
+ )
1520
+ elementss_pb = self._service.get_solver_mesh_elements(elements_request)
1521
+ logger.info(f"Elements data received in {time.time() - start_time} seconds")
1522
+ logger.info("Constructing nodes structure in PyFluent")
1523
+ start_time = time.time()
1524
+ node_count = sum(len(nodes) for nodes in nested_nodes)
1525
+ nodes = np.empty(node_count, dtype=Node)
1526
+ node_index_by_id = {}
1527
+ i = 0
1528
+ for nodes_pb in nested_nodes:
1529
+ for node_pb in nodes_pb:
1530
+ nodes[i] = Node(_id=node_pb.id, x=node_pb.x, y=node_pb.y, z=node_pb.z)
1531
+ node_index_by_id[node_pb.id] = i
1532
+ i += 1
1533
+ logger.info(
1534
+ f"Nodes structure constructed in {time.time() - start_time} seconds"
1535
+ )
1536
+ logger.info("Constructing elements structure in PyFluent")
1537
+ start_time = time.time()
1538
+ element_count = sum(len(elements) for elements in elementss_pb)
1539
+ elements = np.empty(element_count, dtype=Element)
1540
+ i = 0
1541
+ for elements_pb in elementss_pb:
1542
+ for element_pb in elements_pb:
1543
+ element_type = CellElementType(element_pb.element_type)
1544
+ if element_type == CellElementType.POLYHEDRON:
1545
+ facets = []
1546
+ for facet_pb in element_pb.facets:
1547
+ facet = Facet(
1548
+ node_indices=[node_index_by_id[id] for id in facet_pb.node]
1549
+ )
1550
+ facets.append(facet)
1551
+ element = Element(
1552
+ _id=element_pb.id,
1553
+ element_type=element_type,
1554
+ facets=facets,
1555
+ )
1556
+ else:
1557
+ element = Element(
1558
+ _id=element_pb.id,
1559
+ element_type=element_type,
1560
+ node_indices=[
1561
+ node_index_by_id[id] for id in element_pb.node_ids
1562
+ ],
1563
+ )
1564
+ elements[i] = element
1565
+ i += 1
1566
+ logger.info(
1567
+ f"Elements structure constructed in {time.time() - start_time} seconds"
1568
+ )
1569
+ logger.info("Returning mesh")
1570
+ return Mesh(nodes=nodes, elements=elements)
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper over the health check gRPC service of Fluent."""
2
24
 
3
25
  from enum import Enum
@@ -1,11 +1,34 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Interceptor classes to use with gRPC services."""
2
24
 
25
+ import builtins
3
26
  import logging
4
27
  import os
5
28
  from typing import Any
6
29
 
7
30
  from google.protobuf.json_format import MessageToDict
8
- from google.protobuf.message import Message
31
+ from google.protobuf.message import DecodeError, Message
9
32
  import grpc
10
33
 
11
34
  from ansys.fluent.core.services.batch_ops import BatchOps
@@ -15,6 +38,10 @@ log_bytes_limit: int = int(os.getenv("PYFLUENT_GRPC_LOG_BYTES_LIMIT", 1000))
15
38
  truncate_len: int = log_bytes_limit // 5
16
39
 
17
40
 
41
+ def _upper_snake_case_to_camel_case(name: str) -> str:
42
+ return "".join([word.capitalize() for word in name.split("_") if word])
43
+
44
+
18
45
  def _truncate_grpc_str(message: Message) -> str:
19
46
  message_bytes = message.ByteSize()
20
47
  message_str = str(MessageToDict(message))
@@ -107,7 +134,28 @@ class GrpcErrorInterceptor(grpc.UnaryUnaryClientInterceptor):
107
134
  response = continuation(client_call_details, request)
108
135
  if response.exception() is not None and response.code() != grpc.StatusCode.OK:
109
136
  ex = response.exception()
110
- new_ex = RuntimeError(
137
+ new_ex_cls = RuntimeError
138
+ try:
139
+ from google.rpc import error_details_pb2
140
+ from grpc_status import rpc_status
141
+
142
+ status = rpc_status.from_call(ex)
143
+ if status:
144
+ for detail in status.details:
145
+ if detail.Is(error_details_pb2.ErrorInfo.DESCRIPTOR):
146
+ info = error_details_pb2.ErrorInfo()
147
+ detail.Unpack(info)
148
+ if info.domain == "Python":
149
+ reason = info.reason
150
+ ex_cls_name = _upper_snake_case_to_camel_case(reason)
151
+ if hasattr(builtins, ex_cls_name):
152
+ cls = getattr(builtins, ex_cls_name)
153
+ if issubclass(cls, Exception):
154
+ new_ex_cls = cls
155
+ break
156
+ except DecodeError:
157
+ pass
158
+ new_ex = new_ex_cls(
111
159
  ex.details() if isinstance(ex, grpc.RpcError) else str(ex)
112
160
  )
113
161
  new_ex.__context__ = ex
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper over the monitor gRPC service of Fluent."""
2
24
 
3
25
  from google.protobuf.json_format import MessageToDict
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over Reduction gRPC service of Fluent."""
2
24
 
3
25
  from typing import Any, List, Tuple
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over SchemeEval gRPC service of Fluent.
2
24
 
3
25
  Example
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper to settings gRPC service of Fluent."""
2
24
 
3
25
  import collections.abc
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over SVAR gRPC service of Fluent."""
2
24
 
3
25
  import math
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper over the streaming gRPC services of Fluent."""
2
24
 
3
25
  from typing import Generator, List, Tuple
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper over the transcript gRPC service of Fluent."""
2
24
 
3
25
  import grpc