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
@@ -14,4 +14,4 @@ class Journal:
14
14
 
15
15
  def stop(self):
16
16
  """Stop writing the Fluent Python journal."""
17
- self.scheme_eval.exec([f"(api-stop-python-journal)"])
17
+ self.scheme_eval.exec(["(api-stop-python-journal)"])
@@ -9,6 +9,7 @@ class InvalidPassword(ValueError):
9
9
  """Raised when password is invalid."""
10
10
 
11
11
  def __init__(self):
12
+ """Initialize InvalidPassword."""
12
13
  super().__init__("Provide correct 'password'.")
13
14
 
14
15
 
@@ -16,6 +17,7 @@ class GPUSolverSupportError(ValueError):
16
17
  """Raised when an unsupported Fluent version is specified."""
17
18
 
18
19
  def __init__(self):
20
+ """Initialize GPUSolverSupportError."""
19
21
  super().__init__("Fluent GPU Solver is only supported for 3D.")
20
22
 
21
23
 
@@ -23,6 +25,7 @@ class IpPortNotProvided(ValueError):
23
25
  """Raised when IP address and port are not specified."""
24
26
 
25
27
  def __init__(self):
28
+ """Initialize IpPortNotProvided."""
26
29
  super().__init__("Provide either 'ip' and 'port' or 'server_info_file_name'.")
27
30
 
28
31
 
@@ -313,6 +313,11 @@ def configure_container_dict(
313
313
 
314
314
  container_dict["fluent_image"] = fluent_image
315
315
 
316
+ if not pyfluent.FLUENT_AUTOMATIC_TRANSCRIPT:
317
+ if "environment" not in container_dict:
318
+ container_dict["environment"] = {}
319
+ container_dict["environment"]["FLUENT_NO_AUTOMATIC_TRANSCRIPT"] = "1"
320
+
316
321
  fluent_commands = ["-gu", f"-sifile={container_server_info_file}"] + args
317
322
 
318
323
  container_dict_default = {}
@@ -7,7 +7,6 @@ with gRPC.
7
7
  import inspect
8
8
  import logging
9
9
  import os
10
- from pathlib import Path
11
10
  from typing import Any, Dict
12
11
 
13
12
  import ansys.fluent.core as pyfluent
@@ -102,7 +101,7 @@ def launch_fluent(
102
101
  journal_file_names: None | str | list[str] = None,
103
102
  start_timeout: int = None,
104
103
  additional_arguments: str | None = "",
105
- env: Dict[str, Any] | Path | None = None,
104
+ env: Dict[str, Any] | None = None,
106
105
  start_container: bool | None = None,
107
106
  container_dict: dict | None = None,
108
107
  dry_run: bool = False,
@@ -21,11 +21,17 @@ def is_windows():
21
21
 
22
22
 
23
23
  def _get_subprocess_kwargs_for_fluent(env: Dict[str, Any], argvals) -> Dict[str, Any]:
24
+ import ansys.fluent.core as pyfluent
25
+
24
26
  scheduler_options = argvals.get("scheduler_options")
25
27
  is_slurm = scheduler_options and scheduler_options["scheduler"] == "slurm"
26
28
  kwargs: Dict[str, Any] = {}
27
29
  if is_slurm:
28
30
  kwargs.update(stdout=subprocess.PIPE)
31
+ else:
32
+ kwargs.update(
33
+ stdout=pyfluent.LAUNCH_FLUENT_STDOUT, stderr=pyfluent.LAUNCH_FLUENT_STDERR
34
+ )
29
35
  if is_windows():
30
36
  kwargs.update(shell=True, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
31
37
  else:
@@ -33,15 +39,19 @@ def _get_subprocess_kwargs_for_fluent(env: Dict[str, Any], argvals) -> Dict[str,
33
39
  fluent_env = os.environ.copy()
34
40
  fluent_env.update({k: str(v) for k, v in env.items()})
35
41
  fluent_env["REMOTING_THROW_LAST_TUI_ERROR"] = "1"
42
+ if pyfluent.CLEAR_FLUENT_PARA_ENVS:
43
+ del fluent_env["PARA_NPROCS"]
44
+ del fluent_env["PARA_MESH_NPROCS"]
36
45
 
37
46
  if not is_slurm:
38
- from ansys.fluent.core import INFER_REMOTING_IP
39
-
40
- if INFER_REMOTING_IP and not "REMOTING_SERVER_ADDRESS" in fluent_env:
47
+ if pyfluent.INFER_REMOTING_IP and "REMOTING_SERVER_ADDRESS" not in fluent_env:
41
48
  remoting_ip = find_remoting_ip()
42
49
  if remoting_ip:
43
50
  fluent_env["REMOTING_SERVER_ADDRESS"] = remoting_ip
44
51
 
52
+ if not pyfluent.FLUENT_AUTOMATIC_TRANSCRIPT:
53
+ fluent_env["FLUENT_NO_AUTOMATIC_TRANSCRIPT"] = "1"
54
+
45
55
  kwargs.update(env=fluent_env)
46
56
  return kwargs
47
57
 
@@ -82,12 +92,13 @@ def _build_journal_argument(
82
92
  ) -> str:
83
93
  """Build Fluent commandline journal argument."""
84
94
 
85
- from beartype import BeartypeConf, beartype
86
-
87
- @beartype(conf=BeartypeConf(violation_type=TypeError))
88
95
  def _impl(
89
96
  topy: None | bool | str, journal_file_names: None | str | list[str]
90
97
  ) -> str:
98
+ if journal_file_names and not isinstance(journal_file_names, (str, list)):
99
+ raise TypeError(
100
+ "Use 'journal_file_names' to specify and convert journal files."
101
+ )
91
102
  if topy and not journal_file_names:
92
103
  raise InvalidArgument(
93
104
  "Use 'journal_file_names' to specify and convert journal files."
@@ -108,14 +108,14 @@ def _generate_launch_string(
108
108
  if " " in server_info_file_name:
109
109
  server_info_file_name = '"' + server_info_file_name + '"'
110
110
  launch_string += f" -sifile={server_info_file_name}"
111
- if not pyfluent.SHOW_MESH_AFTER_CASE_READ:
111
+ if not pyfluent.FLUENT_SHOW_MESH_AFTER_CASE_READ:
112
112
  launch_string += " -nm"
113
113
  return launch_string
114
114
 
115
115
 
116
116
  def get_fluent_exe_path(**launch_argvals) -> Path:
117
- """Get the path for the Fluent executable file.
118
- The search for the path is performed in this order:
117
+ """Get the path for the Fluent executable file. The search for the path is performed
118
+ in the following order.
119
119
 
120
120
  1. ``product_version`` parameter passed with the ``launch_fluent`` method.
121
121
  2. The latest Ansys version from ``AWP_ROOTnnn``` environment variables.
@@ -42,7 +42,7 @@ class FluentEnum(Enum):
42
42
 
43
43
  def is_int():
44
44
  for m in cls:
45
- return True if type(m.value) == int else False
45
+ return True if isinstance(m.value, int) else False
46
46
 
47
47
  msg = ", " if is_int() else "', '"
48
48
  msg = (
@@ -147,6 +147,7 @@ class SlurmFuture:
147
147
  """
148
148
 
149
149
  def __init__(self, future: Future, job_id: int):
150
+ """Initialize SlurmFuture."""
150
151
  self._future = future
151
152
  self._job_id = job_id
152
153
 
@@ -272,7 +273,7 @@ class SlurmLauncher:
272
273
  journal_file_names: None | str | list[str] = None,
273
274
  start_timeout: int = -1,
274
275
  additional_arguments: str | None = "",
275
- env: Dict[str, Any] | Path | None = None,
276
+ env: Dict[str, Any] | None = None,
276
277
  cleanup_on_exit: bool = True,
277
278
  start_transcript: bool = True,
278
279
  case_file_name: str | None = None,
@@ -68,7 +68,7 @@ class StandaloneLauncher:
68
68
  journal_file_names: None | str | list[str] = None,
69
69
  start_timeout: int = 60,
70
70
  additional_arguments: str | None = "",
71
- env: Dict[str, Any] | Path | None = None,
71
+ env: Dict[str, Any] | None = None,
72
72
  cleanup_on_exit: bool = True,
73
73
  dry_run: bool = False,
74
74
  start_transcript: bool = True,
@@ -177,6 +177,8 @@ class StandaloneLauncher:
177
177
  The allocated machines and core counts are queried from the scheduler environment and
178
178
  passed to Fluent.
179
179
  """
180
+ import ansys.fluent.core as pyfluent
181
+
180
182
  self.argvals, self.new_session = _get_argvals_and_session(locals().copy())
181
183
  self.file_transfer_service = file_transfer_service
182
184
  if os.getenv("PYFLUENT_SHOW_SERVER_GUI") == "1":
@@ -215,8 +217,11 @@ class StandaloneLauncher:
215
217
  )
216
218
 
217
219
  if is_windows():
218
- # Using 'start.exe' is better; otherwise Fluent is more susceptible to bad termination attempts.
219
- self._launch_cmd = 'start "" ' + self._launch_string
220
+ if pyfluent.LAUNCH_FLUENT_STDOUT or pyfluent.LAUNCH_FLUENT_STDERR:
221
+ self._launch_cmd = self._launch_string
222
+ else:
223
+ # Using 'start.exe' is better; otherwise Fluent is more susceptible to bad termination attempts.
224
+ self._launch_cmd = 'start "" ' + self._launch_string
220
225
  else:
221
226
  if self.argvals["ui_mode"] not in [UIMode.GUI, UIMode.HIDDEN_GUI]:
222
227
  # Using nohup to hide Fluent output from the current terminal
@@ -231,7 +236,7 @@ class StandaloneLauncher:
231
236
  try:
232
237
  logger.debug(f"Launching Fluent with command: {self._launch_cmd}")
233
238
 
234
- subprocess.Popen(self._launch_cmd, **self._kwargs)
239
+ process = subprocess.Popen(self._launch_cmd, **self._kwargs)
235
240
 
236
241
  try:
237
242
  _await_fluent_launch(
@@ -247,7 +252,7 @@ class StandaloneLauncher:
247
252
  logger.warning(
248
253
  f"Retrying Fluent launch with less robust command: {launch_cmd}"
249
254
  )
250
- subprocess.Popen(launch_cmd, **self._kwargs)
255
+ process = subprocess.Popen(launch_cmd, **self._kwargs)
251
256
  _await_fluent_launch(
252
257
  self._server_info_file_name,
253
258
  self.argvals["start_timeout"],
@@ -264,6 +269,7 @@ class StandaloneLauncher:
264
269
  launcher_args=self.argvals,
265
270
  inside_container=False,
266
271
  )
272
+ session._process = process
267
273
  start_watchdog = _confirm_watchdog_start(
268
274
  self.argvals["start_watchdog"],
269
275
  self.argvals["cleanup_on_exit"],
@@ -157,7 +157,7 @@ def launch(
157
157
 
158
158
  subprocess.Popen(cmd_send, **kwargs)
159
159
 
160
- logger.info(f"Waiting for Watchdog to initialize, then proceeding...")
160
+ logger.info("Waiting for Watchdog to initialize, then proceeding...")
161
161
  file_exists = timeout_loop(
162
162
  lambda: init_file.is_file() or watchdog_err.is_file(), 30.0
163
163
  )
@@ -12,11 +12,14 @@ if __name__ == "__main__":
12
12
  import sys
13
13
  import time
14
14
 
15
- import psutil
16
15
  from watchdog import IDLE_PERIOD, WATCHDOG_INIT_FILE
17
16
 
18
17
  import ansys.fluent.core as pyfluent
19
- from ansys.fluent.core.fluent_connection import FluentConnection, get_container
18
+ from ansys.fluent.core.fluent_connection import (
19
+ FluentConnection,
20
+ _pid_exists,
21
+ get_container,
22
+ )
20
23
  from ansys.fluent.core.utils.execution import timeout_exec, timeout_loop
21
24
 
22
25
  watchdog_id = sys.argv[5]
@@ -103,7 +106,7 @@ if __name__ == "__main__":
103
106
 
104
107
  def check_pid_down(pid, name):
105
108
  """Check whether pid is down or not."""
106
- if not psutil.pid_exists(pid):
109
+ if not _pid_exists(pid):
107
110
  logger.debug(name + " down")
108
111
  down.append(name)
109
112
 
@@ -1,7 +1,4 @@
1
- """Module controlling PyFluent's logging functionality.
2
-
3
- For a basic user guide, see the :ref:`logging user guide <ref_logging_user_guide>`.
4
- """
1
+ """Module controlling PyFluent's logging functionality."""
5
2
 
6
3
  import logging.config
7
4
  import os
@@ -228,7 +225,6 @@ def configure_env_var() -> None:
228
225
  ``PYFLUENT_LOGGING`` set to ``0`` or ``OFF`` is the same as if no environment variable was set.
229
226
  If logging debug output to file by default is desired, without having to use :func:`enable()` every time,
230
227
  set environment variable ``PYFLUENT_LOGGING`` to ``DEBUG``.
231
- See also the :ref:`user guide environment variable subsection <ref_logging_env_var>`.
232
228
  """
233
229
  env_logging_level = os.getenv("PYFLUENT_LOGGING")
234
230
  if env_logging_level:
@@ -71,6 +71,7 @@ class LocalDesignPoint:
71
71
  """
72
72
 
73
73
  def __init__(self, design_point_name: str, base_design_point=None):
74
+ """Initialize LocalDesignPoint."""
74
75
  self.name = design_point_name
75
76
  if base_design_point:
76
77
  self.__inputs = base_design_point.input_parameters.copy()
@@ -119,6 +120,7 @@ class LocalDesignPointTable(list):
119
120
  """
120
121
 
121
122
  def __init__(self, base_design_point: LocalDesignPoint):
123
+ """Initialize LocalDesignPointTable."""
122
124
  super().__init__()
123
125
  self.append(base_design_point)
124
126
 
@@ -255,13 +257,13 @@ class LocalParametricStudy:
255
257
 
256
258
  Methods
257
259
  -------
258
- add_design_point(design_point_name: str) -> LocalDesignPoint
260
+ add_design_point(design_point_name)
259
261
  Add a design point.
260
262
  design_point(idx_or_name)
261
263
  Get a design point, either by name (str) or an index
262
264
  indicating the position in the table (by order of insertion).
263
- run_in_fluent
264
- Run the study in Fluent
265
+ run_in_fluent()
266
+ Run the study in Fluent
265
267
 
266
268
  Raises
267
269
  ------
@@ -270,6 +272,7 @@ class LocalParametricStudy:
270
272
  """
271
273
 
272
274
  def __init__(self, case_filepath: str, base_design_point_name: str = "Base DP"):
275
+ """Initialize LocalParametricStudy."""
273
276
  from ansys.fluent.core.filereader.casereader import CaseReader
274
277
 
275
278
  self.case_filepath = case_filepath
@@ -98,7 +98,7 @@ class Command:
98
98
  )
99
99
 
100
100
  elif attr == "range":
101
- if type(arg_value) != int and type(arg_value) != float:
101
+ if not isinstance(arg_value, (int, float)):
102
102
  raise RuntimeError(
103
103
  f"{arg} value {arg_value} is not number."
104
104
  )
@@ -788,15 +788,6 @@ class PyLocalContainer(MutableMapping):
788
788
  cls(self, api_helper, name),
789
789
  )
790
790
 
791
- @classmethod
792
- def get_root(self, obj=None):
793
- """Returns the top-most parent object."""
794
- obj = self if obj is None else obj
795
- parent = obj
796
- if getattr(obj, "_parent", None):
797
- parent = self.get_root(obj._parent)
798
- return parent
799
-
800
791
  def update(self, value):
801
792
  """Updates this object with the provided dictionary."""
802
793
  for name, val in value.items():
@@ -842,35 +833,6 @@ class PyLocalContainer(MutableMapping):
842
833
  """Returns the session-handle object."""
843
834
  return self.get_session_handle()
844
835
 
845
- def get_root(self, obj=None):
846
- """Get root object."""
847
- obj = self if obj is None else obj
848
- parent = obj
849
- if getattr(obj, "_parent", None):
850
- parent = self.get_root(obj._parent)
851
- return parent
852
-
853
- def get_session(self, obj=None):
854
- """Get session object."""
855
- root = self.get_root(obj)
856
- return root.session
857
-
858
- def get_path(self):
859
- """Get parent path."""
860
- if getattr(self, "_parent", None):
861
- return self._parent.get_path() + "/" + self._name
862
- return self._name
863
-
864
- @property
865
- def path(self):
866
- """Get path."""
867
- return self.get_path()
868
-
869
- @property
870
- def session(self):
871
- """Get session object."""
872
- return self.get_session()
873
-
874
836
  def __iter__(self):
875
837
  return iter(self.__collection)
876
838
 
@@ -7,6 +7,7 @@ class IncompleteISOSurfaceDefinition(RuntimeError):
7
7
  """Raised when iso-surface definition is incomplete."""
8
8
 
9
9
  def __init__(self):
10
+ """Initialize IncompleteISOSurfaceDefinition."""
10
11
  super().__init__("Iso surface definition is incomplete.")
11
12
 
12
13
 
@@ -14,6 +15,7 @@ class SurfaceCreationError(RuntimeError):
14
15
  """Raised when surface creation is unsuccessful."""
15
16
 
16
17
  def __init__(self):
18
+ """Initialize SurfaceCreationError."""
17
19
  super().__init__("Surface creation is unsuccessful.")
18
20
 
19
21
 
@@ -125,15 +127,14 @@ class PostAPIHelper:
125
127
  # Following functions will be deprecated in future.
126
128
  def get_vector_fields(self):
127
129
  """Returns vector field."""
128
- scheme_eval_str = "(map car (apply append (map client-inquire-cell-vector-functions (inquire-domain-for-cell-functions))))" # noqa: E501
129
- return self._scheme_str_to_py_list(scheme_eval_str)
130
+ return self.field_info.get_vector_fields_info()
130
131
 
131
132
  def get_field_unit(self, field):
132
133
  """Returns the unit of the field."""
133
134
  quantity = self._field_unit_quantity(field)
134
135
  if quantity == "*null*":
135
136
  return ""
136
- scheme_eval_str = f"(units/get-pretty-wb-units-from-dimension (units/inquire-dimension '{quantity}))" # noqa: E501
137
+ scheme_eval_str = f"(units/get-pretty-wb-units-from-dimension (units/inquire-dimension '{quantity}))"
137
138
  return " ".join(self._scheme_str_to_py_list(scheme_eval_str))
138
139
 
139
140
  def _field_unit_quantity(self, field):
@@ -19,7 +19,7 @@ class BasePostObjectDefn:
19
19
 
20
20
  def _pre_display(self):
21
21
  local_surfaces_provider = self.get_root()._local_surfaces_provider()
22
- for surf_name in self.surfaces_list():
22
+ for surf_name in self.surfaces():
23
23
  if surf_name in list(local_surfaces_provider):
24
24
  surf_obj = local_surfaces_provider[surf_name]
25
25
  surf_api = surf_obj._api_helper.surface_api
@@ -27,7 +27,7 @@ class BasePostObjectDefn:
27
27
 
28
28
  def _post_display(self):
29
29
  local_surfaces_provider = self.get_root()._local_surfaces_provider()
30
- for surf_name in self.surfaces_list():
30
+ for surf_name in self.surfaces():
31
31
  if surf_name in list(local_surfaces_provider):
32
32
  surf_obj = local_surfaces_provider[surf_name]
33
33
  surf_api = surf_obj._api_helper.surface_api
@@ -128,7 +128,7 @@ class XYPlotDefn(PlotDefn):
128
128
  """X axis function allowed values."""
129
129
  return ["direction-vector"]
130
130
 
131
- class surfaces_list(metaclass=PyLocalPropertyMeta):
131
+ class surfaces(metaclass=PyLocalPropertyMeta):
132
132
  """List of surfaces for plotting."""
133
133
 
134
134
  value: List[str] = []
@@ -146,7 +146,7 @@ class MeshDefn(GraphicsDefn):
146
146
 
147
147
  PLURAL = "Meshes"
148
148
 
149
- class surfaces_list(metaclass=PyLocalPropertyMeta):
149
+ class surfaces(metaclass=PyLocalPropertyMeta):
150
150
  """List of surfaces for mesh graphics."""
151
151
 
152
152
  value: List[str] = []
@@ -189,7 +189,7 @@ class PathlinesDefn(GraphicsDefn):
189
189
  """Field allowed values."""
190
190
  return list(self._api_helper.field_info().get_scalar_fields_info())
191
191
 
192
- class surfaces_list(metaclass=PyLocalPropertyMeta):
192
+ class surfaces(metaclass=PyLocalPropertyMeta):
193
193
  """List of surfaces for pathlines."""
194
194
 
195
195
  value: List[str] = []
@@ -207,6 +207,11 @@ class SurfaceDefn(GraphicsDefn):
207
207
 
208
208
  PLURAL = "Surfaces"
209
209
 
210
+ @property
211
+ def name(self) -> str:
212
+ """Return name of the surface."""
213
+ return self._name
214
+
210
215
  class show_edges(metaclass=PyLocalPropertyMeta):
211
216
  """Show edges for surface."""
212
217
 
@@ -376,7 +381,7 @@ class ContourDefn(GraphicsDefn):
376
381
  """Field allowed values."""
377
382
  return list(self._api_helper.field_info().get_scalar_fields_info())
378
383
 
379
- class surfaces_list(metaclass=PyLocalPropertyMeta):
384
+ class surfaces(metaclass=PyLocalPropertyMeta):
380
385
  """Contour surfaces."""
381
386
 
382
387
  value: List[str] = []
@@ -557,7 +562,7 @@ class VectorDefn(GraphicsDefn):
557
562
  """Field allowed values."""
558
563
  return list(self._api_helper.field_info().get_scalar_fields_info())
559
564
 
560
- class surfaces_list(metaclass=PyLocalPropertyMeta):
565
+ class surfaces(metaclass=PyLocalPropertyMeta):
561
566
  """List of surfaces for vector graphics."""
562
567
 
563
568
  value: List[str] = []
@@ -80,14 +80,51 @@ class Container:
80
80
  return state
81
81
 
82
82
  def _init_module(self, obj, mod, post_api_helper):
83
+ """
84
+ Dynamically initializes and attaches containers for classes in a module.
85
+
86
+ Args:
87
+ obj: The parent object to which containers are attached.
88
+ mod: The module containing class definitions to process.
89
+ post_api_helper: Helper object for post-processing API interactions.
90
+
91
+ This method identifies classes in the module that match certain criteria,
92
+ creates a container for managing instances of these classes, and attaches
93
+ the container to the parent object (`obj`). A `create()` method is also
94
+ dynamically added to each container for creating and initializing new objects.
95
+ """
96
+ # Iterate through all attributes in the module's dictionary
83
97
  for name, cls in mod.__dict__.items():
84
98
  if cls.__class__.__name__ in (
85
99
  "PyLocalNamedObjectMetaAbstract",
86
100
  ) and not inspect.isabstract(cls):
101
+ cont = PyLocalContainer(self, cls, post_api_helper, cls.PLURAL)
102
+
103
+ # Define a method to add a "create" function to the container
104
+ def _add_create(py_cont):
105
+ def _create(**kwargs):
106
+ new_object = py_cont.__getitem__(
107
+ py_cont._get_unique_chid_name()
108
+ )
109
+ # Validate that all kwargs are valid attributes for the object
110
+ unexpected_args = set(kwargs) - set(new_object())
111
+ if unexpected_args:
112
+ raise TypeError(
113
+ f"create() got an unexpected keyword argument '{next(iter(unexpected_args))}'."
114
+ )
115
+ for key, value in kwargs.items():
116
+ setattr(new_object, key, value)
117
+ return new_object
118
+
119
+ return _create
120
+
121
+ # Attach the create method to the container
122
+ setattr(cont, "create", _add_create(cont))
123
+ # Attach the container to the parent object
87
124
  setattr(
88
125
  obj,
89
126
  cls.PLURAL,
90
- PyLocalContainer(self, cls, post_api_helper, cls.PLURAL),
127
+ cont,
91
128
  )
92
129
 
93
130
 
@@ -179,7 +216,7 @@ class Graphics(Container):
179
216
  if meshes is not None:
180
217
  outline_mesh_id = "mesh-outline"
181
218
  outline_mesh = meshes[outline_mesh_id]
182
- outline_mesh.surfaces_list = [
219
+ outline_mesh.surfaces = [
183
220
  k
184
221
  for k, v in outline_mesh._api_helper.field_info()
185
222
  .get_surfaces_info()
@@ -17,6 +17,7 @@ class RPVars:
17
17
  _allowed_values = None
18
18
 
19
19
  def __init__(self, eval_fn):
20
+ """Initialize RPVars."""
20
21
  self._eval_fn = eval_fn
21
22
 
22
23
  def __call__(self, var: str | None = None, val: Any | None = None) -> Any:
@@ -48,7 +49,7 @@ class RPVars:
48
49
  >>> solver.rp_vars("number-of-iterations")
49
50
  100
50
51
 
51
- Getting dictionary with all rpvars available:
52
+ >>> # Get dictionary of all available rpvars:
52
53
 
53
54
  >>> solver.rp_vars()
54
55
  {'sg-swirl?': False, 'rp-seg?': True, 'rf-energy?': False, 'rp-inviscid?': False, ...
@@ -80,8 +80,10 @@ class Machine(object):
80
80
  class MachineList(object):
81
81
  """Provides an interface to list of machines allocated by a queue system."""
82
82
 
83
- def __init__(self, machinesIn=[]):
83
+ def __init__(self, machinesIn=None):
84
84
  """Constructs and initializes an empty machine file object."""
85
+ if machinesIn is None:
86
+ machinesIn = []
85
87
  self._machines = []
86
88
  for machine in machinesIn:
87
89
  self._machines.append(machine)