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
@@ -3,12 +3,15 @@ import subprocess
3
3
  import threading
4
4
  import time
5
5
 
6
- import psutil
7
6
  import pytest
8
7
 
9
8
  import ansys.fluent.core as pyfluent
10
9
  from ansys.fluent.core.examples import download_file
11
- from ansys.fluent.core.fluent_connection import WaitTypeError, get_container
10
+ from ansys.fluent.core.fluent_connection import (
11
+ WaitTypeError,
12
+ _pid_exists,
13
+ get_container,
14
+ )
12
15
  from ansys.fluent.core.launcher.error_handler import IpPortNotProvided
13
16
  from ansys.fluent.core.utils.execution import asynchronous, timeout_loop
14
17
  from ansys.fluent.core.utils.fluent_version import FluentVersion
@@ -76,14 +79,14 @@ def test_server_exits_when_session_goes_out_of_scope() -> None:
76
79
 
77
80
  timeout_loop(
78
81
  lambda: (inside_container and not get_container(cortex_host))
79
- or (not inside_container and not psutil.pid_exists(fluent_host_pid)),
82
+ or (not inside_container and not _pid_exists(fluent_host_pid)),
80
83
  60,
81
84
  )
82
85
 
83
86
  if inside_container:
84
87
  assert not get_container(cortex_host)
85
88
  else:
86
- assert not psutil.pid_exists(fluent_host_pid)
89
+ assert not _pid_exists(fluent_host_pid)
87
90
 
88
91
 
89
92
  def test_server_does_not_exit_when_session_goes_out_of_scope() -> None:
@@ -104,7 +107,7 @@ def test_server_does_not_exit_when_session_goes_out_of_scope() -> None:
104
107
  else:
105
108
  from pathlib import Path
106
109
 
107
- assert psutil.pid_exists(fluent_host_pid)
110
+ assert _pid_exists(fluent_host_pid)
108
111
  if os.name == "nt":
109
112
  cleanup_file_ext = "bat"
110
113
  cmd_list = []
@@ -131,7 +134,7 @@ def test_does_not_exit_fluent_by_default_when_connected_to_running_fluent(
131
134
  ) -> None:
132
135
  session1 = pyfluent.launch_fluent()
133
136
 
134
- with pytest.raises(IpPortNotProvided) as msg:
137
+ with pytest.raises(IpPortNotProvided):
135
138
  session2 = pyfluent.connect_to_fluent(
136
139
  ip=session1.connection_properties.ip,
137
140
  password=session1.connection_properties.password,
@@ -243,7 +246,7 @@ def test_fluent_exit(monkeypatch: pytest.MonkeyPatch):
243
246
  solver.exit()
244
247
  assert timeout_loop(
245
248
  lambda: (inside_container and not get_container(cortex))
246
- or (not inside_container and not psutil.pid_exists(cortex)),
249
+ or (not inside_container and not _pid_exists(cortex)),
247
250
  timeout=60,
248
251
  idle_period=1,
249
252
  )
@@ -262,6 +265,6 @@ def test_fluent_exit_wait():
262
265
  session3.exit(wait=True)
263
266
  assert session3._fluent_connection.wait_process_finished(wait=0)
264
267
 
265
- with pytest.raises(WaitTypeError) as msg:
268
+ with pytest.raises(WaitTypeError):
266
269
  session4 = pyfluent.launch_fluent()
267
270
  session4.exit(wait="wait")
@@ -19,7 +19,7 @@ def test_version_found():
19
19
 
20
20
  def test_version_not_found():
21
21
  with pytest.raises(AnsysVersionNotFound):
22
- FluentVersion("25.2.0")
22
+ FluentVersion("25.3.0")
23
23
 
24
24
  with pytest.raises(AnsysVersionNotFound):
25
25
  FluentVersion(22)
@@ -1,16 +1,18 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  import platform
4
+ from tempfile import TemporaryDirectory
4
5
 
5
6
  import pytest
6
7
 
7
8
  import ansys.fluent.core as pyfluent
8
- from ansys.fluent.core import PyFluentDeprecationWarning # noqa: F401
9
+ from ansys.fluent.core import PyFluentDeprecationWarning
9
10
  from ansys.fluent.core.examples.downloads import download_file
10
11
  from ansys.fluent.core.exceptions import DisallowedValuesError, InvalidArgument
11
12
  from ansys.fluent.core.launcher import launcher_utils
12
13
  from ansys.fluent.core.launcher.error_handler import (
13
14
  GPUSolverSupportError,
15
+ LaunchFluentError,
14
16
  _raise_non_gui_exception_in_windows,
15
17
  )
16
18
  from ansys.fluent.core.launcher.launcher import create_launcher
@@ -34,7 +36,7 @@ import ansys.platform.instancemanagement as pypim
34
36
 
35
37
 
36
38
  def test_gpu_version_error():
37
- with pytest.raises(GPUSolverSupportError) as msg:
39
+ with pytest.raises(GPUSolverSupportError):
38
40
  pyfluent.launch_fluent(
39
41
  mode="meshing",
40
42
  dimension=2,
@@ -64,8 +66,10 @@ def test_mode():
64
66
  @pytest.mark.standalone
65
67
  def test_unsuccessful_fluent_connection():
66
68
  # start-timeout is intentionally provided to be 2s for the connection to fail
67
- with pytest.raises(TimeoutError) as msg:
69
+ with pytest.raises(LaunchFluentError) as ex:
68
70
  pyfluent.launch_fluent(mode="solver", start_timeout=2)
71
+ # TimeoutError -> LaunchFluentError
72
+ assert isinstance(ex.value.__context__, TimeoutError)
69
73
 
70
74
 
71
75
  @pytest.mark.fluent_version("<24.1")
@@ -307,6 +311,7 @@ def test_create_standalone_launcher():
307
311
  if is_windows()
308
312
  else FluentLinuxGraphicsDriver.AUTO
309
313
  ),
314
+ env={},
310
315
  )
311
316
 
312
317
  standalone_meshing_launcher = create_launcher(
@@ -419,7 +424,7 @@ def test_fluent_enums():
419
424
  with pytest.raises(ValueError):
420
425
  UIMode("")
421
426
  with pytest.raises(TypeError):
422
- UIMode.NO_GUI < FluentWindowsGraphicsDriver.AUTO
427
+ assert UIMode.NO_GUI < FluentWindowsGraphicsDriver.AUTO
423
428
 
424
429
 
425
430
  def test_exposure_and_graphics_driver_arguments():
@@ -479,6 +484,18 @@ def test_container_warning_for_mount_source(caplog):
479
484
  "mount_source": os.getcwd(),
480
485
  "mount_target": "/mnt/pyfluent/tests",
481
486
  }
482
- solver = pyfluent.launch_fluent(container_dict=container_dict)
487
+ _ = pyfluent.launch_fluent(container_dict=container_dict)
483
488
  assert container_dict["mount_source"] in caplog.text
484
489
  assert container_dict["mount_target"] in caplog.text
490
+
491
+
492
+ # runs only in container till cwd is supported for container launch
493
+ def test_fluent_automatic_transcript(monkeypatch):
494
+ with monkeypatch.context() as m:
495
+ m.setattr(pyfluent, "FLUENT_AUTOMATIC_TRANSCRIPT", True)
496
+ with TemporaryDirectory(dir=pyfluent.EXAMPLES_PATH) as tmp_dir:
497
+ with pyfluent.launch_fluent(container_dict=dict(working_dir=tmp_dir)):
498
+ assert list(Path(tmp_dir).glob("*.trn"))
499
+ with TemporaryDirectory(dir=pyfluent.EXAMPLES_PATH) as tmp_dir:
500
+ with pyfluent.launch_fluent(container_dict=dict(working_dir=tmp_dir)):
501
+ assert not list(Path(tmp_dir).glob("*.trn"))
@@ -2,6 +2,8 @@
2
2
 
3
3
  from concurrent import futures
4
4
  import os
5
+ from pathlib import Path
6
+ import shutil
5
7
  from unittest.mock import create_autospec
6
8
  import uuid
7
9
 
@@ -12,7 +14,7 @@ from test_session import MockHealthServicer, MockSchemeEvalServicer
12
14
 
13
15
  from ansys.api.fluent.v0 import scheme_eval_pb2_grpc
14
16
  import ansys.fluent.core as pyfluent
15
- from ansys.fluent.core import examples
17
+ from ansys.fluent.core import EXAMPLES_PATH, examples
16
18
  from ansys.fluent.core.fluent_connection import (
17
19
  FluentConnection,
18
20
  UnsupportedRemoteFluentInstance,
@@ -26,11 +28,10 @@ import ansys.fluent.core.utils.fluent_version as docker_image_version
26
28
  from ansys.fluent.core.utils.fluent_version import FluentVersion
27
29
  from ansys.fluent.core.utils.networking import get_free_port
28
30
  import ansys.platform.instancemanagement as pypim
29
- from tests.util import rename_downloaded_file
30
31
 
31
32
 
32
33
  def test_launch_remote_instance(monkeypatch, new_solver_session):
33
- pyfluent.CHECK_HEALTH = False
34
+ monkeypatch.setattr(pyfluent, "CHECK_HEALTH", False)
34
35
  fluent = new_solver_session
35
36
  # Create a mock pypim pretending it is configured and returning a channel to an already running Fluent
36
37
  mock_instance = pypim.Instance(
@@ -99,7 +100,7 @@ def test_launch_remote_instance(monkeypatch, new_solver_session):
99
100
  )
100
101
  server.start()
101
102
 
102
- with pytest.raises(UnsupportedRemoteFluentInstance) as msg:
103
+ with pytest.raises(UnsupportedRemoteFluentInstance):
103
104
  fluent_connection = FluentConnection(
104
105
  ip=ip,
105
106
  port=port,
@@ -143,6 +144,81 @@ class TransferRequestRecorder:
143
144
  return True
144
145
 
145
146
 
147
+ def rename_downloaded_file(file_path: str, suffix: str) -> str:
148
+ """Rename downloaded file by appending a suffix to the file name.
149
+
150
+ Parameters
151
+ ----------
152
+ file_path : str
153
+ Downloaded file path. Can be absolute or relative.
154
+ suffix : str
155
+ Suffix to append to the file name.
156
+
157
+ Returns:
158
+ --------
159
+ str
160
+ New file path with the suffix appended to the file name.
161
+ """
162
+ ext = "".join(Path(file_path).suffixes)
163
+ orig_path = Path(file_path)
164
+ file_path = file_path.removesuffix(ext)
165
+ file_path = Path(file_path)
166
+ if file_path.is_absolute():
167
+ new_stem = f"{file_path.stem}{suffix}"
168
+ new_path = file_path.with_stem(new_stem)
169
+ new_path = new_path.with_suffix(ext)
170
+ orig_path.rename(new_path)
171
+ return str(new_path)
172
+ else:
173
+ orig_abs_path = Path(EXAMPLES_PATH) / orig_path
174
+ abs_path = Path(EXAMPLES_PATH) / file_path
175
+ new_stem = f"{file_path.stem}{suffix}"
176
+ new_path = abs_path.with_stem(new_stem)
177
+ new_path = new_path.with_suffix(ext)
178
+ orig_abs_path.rename(new_path)
179
+ return str(file_path.with_stem(new_stem).with_suffix(ext))
180
+
181
+
182
+ @pytest.mark.parametrize(
183
+ "ext,a,b,c,d",
184
+ [(".cas", "a1", "b1", "c1", "d1"), (".cas.gz", "a2", "b2", "c2", "d2")],
185
+ )
186
+ def test_rename_downloaded_file(ext, a, b, c, d):
187
+ try:
188
+ file_path = Path(EXAMPLES_PATH) / f"{a}{ext}"
189
+ file_path.touch()
190
+ file_path = str(file_path)
191
+ new_file_path = rename_downloaded_file(file_path, "_1")
192
+ assert new_file_path == str(Path(EXAMPLES_PATH) / f"{a}_1{ext}")
193
+ except Exception:
194
+ raise
195
+ finally:
196
+ Path(new_file_path).unlink(missing_ok=True)
197
+
198
+ try:
199
+ file_path = f"{b}{ext}"
200
+ (Path(EXAMPLES_PATH) / file_path).touch()
201
+ new_file_path = rename_downloaded_file(file_path, "_1")
202
+ assert new_file_path == f"{b}_1{ext}"
203
+ except Exception:
204
+ raise
205
+ finally:
206
+ (Path(EXAMPLES_PATH) / new_file_path).unlink(missing_ok=True)
207
+
208
+ try:
209
+ dir_path = Path(EXAMPLES_PATH) / c
210
+ dir_path.mkdir()
211
+ file_path = dir_path / f"{d}{ext}"
212
+ file_path.touch()
213
+ file_path = str(Path(c) / f"{d}{ext}")
214
+ new_file_path = rename_downloaded_file(file_path, "_1")
215
+ assert new_file_path == str(Path(c) / f"{d}_1{ext}")
216
+ except Exception:
217
+ raise
218
+ finally:
219
+ shutil.rmtree(dir_path, ignore_errors=True)
220
+
221
+
146
222
  @pytest.mark.codegen_required
147
223
  @pytest.mark.fluent_version(">=24.2")
148
224
  def test_file_purpose_on_remote_instance(
@@ -1081,64 +1081,113 @@ def test_meshing_utilities(new_meshing_session):
1081
1081
  [163, 91, 19]
1082
1082
  )
1083
1083
 
1084
- # Commented due to print only output
1085
-
1086
- # assert meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(cell_zone_id_list=[87]) == "2001 faces on symmetry-xyplane refer to cell zone elbow-fluid \
1087
- # 55 faces on hot-inlet refer to cell zone elbow-fluid \
1088
- # 152 faces on cold-inlet refer to cell zone elbow-fluid \
1089
- # 155 faces on outlet refer to cell zone elbow-fluid \
1090
- # 268 faces on wall-inlet refer to cell zone elbow-fluid \
1091
- # 2168 faces on wall-elbow refer to cell zone elbow-fluid"
1084
+ assert not meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(
1085
+ cell_zone_id_list=[87]
1086
+ )
1092
1087
 
1093
- # assert meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(cell_zone_name_list=["elbow-fluid"]) == "2001 faces on symmetry-xyplane refer to cell zone elbow-fluid \
1094
- # 55 faces on hot-inlet refer to cell zone elbow-fluid \
1095
- # 152 faces on cold-inlet refer to cell zone elbow-fluid \
1096
- # 155 faces on outlet refer to cell zone elbow-fluid \
1097
- # 268 faces on wall-inlet refer to cell zone elbow-fluid \
1098
- # 2168 faces on wall-elbow refer to cell zone elbow-fluid"
1088
+ assert not meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(
1089
+ cell_zone_name_list=["elbow-fluid"]
1090
+ )
1099
1091
 
1100
- # assert meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(cell_zone_name_pattern="*") == "2001 faces on symmetry-xyplane refer to cell zone elbow-fluid \
1101
- # 55 faces on hot-inlet refer to cell zone elbow-fluid \
1102
- # 152 faces on cold-inlet refer to cell zone elbow-fluid \
1103
- # 155 faces on outlet refer to cell zone elbow-fluid \
1104
- # 268 faces on wall-inlet refer to cell zone elbow-fluid \
1105
- # 2168 faces on wall-elbow refer to cell zone elbow-fluid"
1092
+ assert not meshing_session.meshing_utilities.get_shared_boundary_face_zones_for_given_cell_zones(
1093
+ cell_zone_name_pattern="*"
1094
+ )
1106
1095
 
1107
- # assert meshing_session.meshing_utilities.mark_faces_in_self_proximity(face_zone_id_list=[30, 31, 32], relative_tolerance=True, tolerance=0.05, proximity_angle=40.5, ignore_orientation=False) == 0 slit faces, 0
1096
+ assert (
1097
+ meshing_session.meshing_utilities.mark_faces_in_self_proximity(
1098
+ face_zone_id_list=[30, 31, 32],
1099
+ relative_tolerance=True,
1100
+ tolerance=0.05,
1101
+ proximity_angle=40.5,
1102
+ ignore_orientation=False,
1103
+ )
1104
+ == 0
1105
+ )
1108
1106
 
1109
- # assert meshing_session.meshing_utilities.mark_faces_in_self_proximity(face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], relative_tolerance=True, tolerance=0.05, proximity_angle=40.5, ignore_orientation=False) == 0 slit faces, 0
1107
+ assert (
1108
+ meshing_session.meshing_utilities.mark_faces_in_self_proximity(
1109
+ face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"],
1110
+ relative_tolerance=True,
1111
+ tolerance=0.05,
1112
+ proximity_angle=40.5,
1113
+ ignore_orientation=False,
1114
+ )
1115
+ == 0
1116
+ )
1110
1117
 
1111
- # assert meshing_session.meshing_utilities.mark_faces_in_self_proximity(face_zone_name_pattern="*", relative_tolerance=True, tolerance=0.05, proximity_angle=40.5, ignore_orientation=False) == 0 slit faces, 0
1118
+ assert (
1119
+ meshing_session.meshing_utilities.mark_faces_in_self_proximity(
1120
+ face_zone_name_pattern="*",
1121
+ relative_tolerance=True,
1122
+ tolerance=0.05,
1123
+ proximity_angle=40.5,
1124
+ ignore_orientation=False,
1125
+ )
1126
+ == 0
1127
+ )
1112
1128
 
1113
- # assert meshing_session.meshing_utilities.mark_point_contacts(face_zone_id_list=[30, 31, 32]) == 0 point contacts are identified. 0
1129
+ assert (
1130
+ meshing_session.meshing_utilities.mark_point_contacts(
1131
+ face_zone_id_list=[30, 31, 32]
1132
+ )
1133
+ == 0
1134
+ )
1114
1135
 
1115
- # assert meshing_session.meshing_utilities.mark_point_contacts(face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"]) == 0 point contacts are identified. 0
1136
+ assert (
1137
+ meshing_session.meshing_utilities.mark_point_contacts(
1138
+ face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"]
1139
+ )
1140
+ == 0
1141
+ )
1116
1142
 
1117
- # assert meshing_session.meshing_utilities.mark_point_contacts(face_zone_name_pattern="cold*") == 0 point contacts are identified. 0
1143
+ assert (
1144
+ meshing_session.meshing_utilities.mark_point_contacts(
1145
+ face_zone_name_pattern="cold*"
1146
+ )
1147
+ == 0
1148
+ )
1118
1149
 
1119
- # assert meshing_session.meshing_utilities.mesh_check(type_name="face-children", edge_zone_id_list=[22, 23], face_zone_id_list=[30, 31, 32], cell_zone_id_list=[87]) == "Checking face children. \
1120
- # Checking modified centroid."
1150
+ assert meshing_session.meshing_utilities.mesh_check(
1151
+ type_name="face-children",
1152
+ edge_zone_id_list=[22, 23],
1153
+ face_zone_id_list=[30, 31, 32],
1154
+ cell_zone_id_list=[87],
1155
+ )
1121
1156
 
1122
- # assert meshing_session.meshing_utilities.mesh_check(type_name="nodes-per-cell", edge_zone_name_pattern="cold-inlet*", face_zone_id_list=[30, 31, 32], cell_zone_id_list=[87]) == "Checking face children. \
1123
- # Checking modified centroid."
1157
+ assert meshing_session.meshing_utilities.mesh_check(
1158
+ type_name="nodes-per-cell",
1159
+ edge_zone_name_pattern="cold-inlet*",
1160
+ face_zone_id_list=[30, 31, 32],
1161
+ cell_zone_id_list=[87],
1162
+ )
1124
1163
 
1125
- # assert meshing_session.meshing_utilities.mesh_check(type_name="volume-statistics", edge_zone_id_list=[22, 23], face_zone_name_pattern="*", cell_zone_id_list=[87]) == "Volume statistics. \
1126
- # minimum volume: 1.491291e-05. \
1127
- # maximum volume: 3.490789e-02. \
1128
- # total volume: 1.525994e+02. \
1129
- # Checking modified centroid."
1164
+ assert meshing_session.meshing_utilities.mesh_check(
1165
+ type_name="volume-statistics",
1166
+ edge_zone_id_list=[22, 23],
1167
+ face_zone_name_pattern="*",
1168
+ cell_zone_id_list=[87],
1169
+ )
1130
1170
 
1131
- # assert meshing_session.meshing_utilities.mesh_check(type_name="nodes-per-cell", edge_zone_name_pattern="cold-inlet*", face_zone_name_pattern="*", cell_zone_id_list=[87]) == "Checking face children. \
1132
- # Checking modified centroid."
1171
+ assert meshing_session.meshing_utilities.mesh_check(
1172
+ type_name="nodes-per-cell",
1173
+ edge_zone_name_pattern="cold-inlet*",
1174
+ face_zone_name_pattern="*",
1175
+ cell_zone_id_list=[87],
1176
+ )
1133
1177
 
1134
- # assert meshing_session.meshing_utilities.mesh_check(type_name="face-children", edge_zone_id_list=[22, 23], face_zone_id_list=[30, 31, 32], cell_zone_name_pattern="*") == "Checking face children. \
1135
- # Checking modified centroid."
1178
+ assert meshing_session.meshing_utilities.mesh_check(
1179
+ type_name="face-children",
1180
+ edge_zone_id_list=[22, 23],
1181
+ face_zone_id_list=[30, 31, 32],
1182
+ cell_zone_name_pattern="*",
1183
+ )
1136
1184
 
1137
- # assert meshing_session.meshing_utilities.mesh_check(type_name="volume-statistics", edge_zone_name_pattern="cold-inlet*", face_zone_name_pattern="*", cell_zone_name_pattern="*") == "Volume statistics. \
1138
- # minimum volume: 1.491291e-05. \
1139
- # maximum volume: 3.490789e-02. \
1140
- # total volume: 1.525994e+02. \
1141
- # Checking modified centroid."
1185
+ assert meshing_session.meshing_utilities.mesh_check(
1186
+ type_name="volume-statistics",
1187
+ edge_zone_name_pattern="cold-inlet*",
1188
+ face_zone_name_pattern="*",
1189
+ cell_zone_name_pattern="*",
1190
+ )
1142
1191
 
1143
1192
  # assert meshing_session.meshing_utilities.print_worst_quality_cell(cell_zone_id_list=[87], measure="Orthogonal Quality") == "Worst Quality Cell (c5018) (quality: 0.24536377), in cell zone (elbow-fluid) at location: ((4.955211100621864 -6.054548533874768 0.1959202011308238))"
1144
1193
 
@@ -1,7 +1,7 @@
1
1
  from functools import partial
2
2
 
3
3
  import pytest
4
- from util.meshing_workflow import ( # noqa: F401; model_object_throws_on_invalid_arg,
4
+ from util.meshing_workflow import (
5
5
  assign_task_arguments,
6
6
  execute_task_with_pre_and_postcondition_checks,
7
7
  )
@@ -195,10 +195,10 @@ def test_read_only_behaviour_of_command_arguments(new_meshing_session):
195
195
  w.InitializeWorkflow(WorkflowType="Watertight Geometry")
196
196
  import_geom = w.TaskObject["Import Geometry"]
197
197
 
198
- with pytest.raises(AttributeError) as msg:
198
+ with pytest.raises(AttributeError):
199
199
  import_geom.arguments.MeshUnit.set_state("in")
200
200
 
201
- with pytest.raises(AttributeError) as msg:
201
+ with pytest.raises(AttributeError):
202
202
  import_geom.arguments.CadImportOptions.OneZonePer.set_state(None)
203
203
 
204
204
  assert "set_state" in dir(m())
@@ -212,7 +212,7 @@ def test_dummy_journal_data_model_methods(new_meshing_session):
212
212
  w.InitializeWorkflow(WorkflowType="Watertight Geometry")
213
213
  import_geom = w.TaskObject["Import Geometry"]
214
214
 
215
- with pytest.raises(AttributeError) as msg:
215
+ with pytest.raises(AttributeError):
216
216
  import_geom.delete_child()
217
217
 
218
218
 
@@ -229,7 +229,7 @@ def test_iterate_meshing_workflow_task_container(new_meshing_session):
229
229
  def test_nonexistent_attrs(new_meshing_session):
230
230
  meshing = new_meshing_session
231
231
  assert not hasattr(meshing.workflow, "xyz")
232
- with pytest.raises(AttributeError) as msg:
232
+ with pytest.raises(AttributeError):
233
233
  meshing.workflow.xyz
234
234
 
235
235
 
@@ -239,7 +239,7 @@ def test_old_workflow_structure(new_meshing_session):
239
239
  meshing = new_meshing_session
240
240
  meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
241
241
  assert meshing.workflow.TaskObject["Import Geometry"]
242
- with pytest.raises(AttributeError) as msg:
242
+ with pytest.raises(AttributeError):
243
243
  meshing.workflow.import_geometry
244
244
 
245
245
 
@@ -83,7 +83,7 @@ def test_launch_pure_meshing(mixing_elbow_watertight_pure_meshing_session):
83
83
  def test_launch_meshing_and_switch(new_meshing_session):
84
84
  meshing = new_meshing_session
85
85
  assert not meshing.switched
86
- solver = meshing.switch_to_solver()
86
+ _ = meshing.switch_to_solver()
87
87
  assert meshing.switched
88
88
  assert not meshing.tui
89
89
  assert not meshing.meshing
@@ -5,8 +5,6 @@ import pytest
5
5
 
6
6
  from ansys.fluent.core import FluentVersion, examples
7
7
  from ansys.fluent.core.workflow import camel_to_snake_case
8
- from tests.conftest import new_meshing_session
9
- from tests.test_datamodel_service import disable_datamodel_cache # noqa: F401
10
8
 
11
9
 
12
10
  @pytest.mark.nightly
@@ -1469,7 +1467,9 @@ def test_created_workflow(new_meshing_session):
1469
1467
  )
1470
1468
 
1471
1469
 
1472
- new_meshing_session2 = new_meshing_session
1470
+ @pytest.fixture
1471
+ def new_meshing_session2(new_meshing_session):
1472
+ return new_meshing_session
1473
1473
 
1474
1474
 
1475
1475
  @pytest.mark.codegen_required
@@ -1760,3 +1760,42 @@ def test_return_state_changes(new_meshing_session):
1760
1760
  wt.describe_geometry()
1761
1761
 
1762
1762
  assert wt.add_multizone_controls
1763
+
1764
+
1765
+ @pytest.mark.codegen_required
1766
+ @pytest.mark.fluent_version(">=25.1")
1767
+ def test_recursive_update_dict(new_meshing_session):
1768
+ meshing = new_meshing_session
1769
+ fault_tolerant = meshing.fault_tolerant()
1770
+ import_file_name = examples.download_file(
1771
+ "exhaust_system.fmd", "pyfluent/exhaust_system"
1772
+ )
1773
+
1774
+ import_cad = fault_tolerant.import_cad_and_part_management
1775
+ import_cad.feature_angle = 35
1776
+ import_cad.fmd_file_name = import_file_name
1777
+ import_cad()
1778
+
1779
+ descr_geom = fault_tolerant.describe_geometry_and_flow
1780
+ descr_geom.arguments()
1781
+ descr_geom.flow_type = "Internal flow through the object"
1782
+ descr_geom.add_enclosure = "Yes"
1783
+ descr_geom.close_caps = "Yes"
1784
+ descr_geom.local_refinement_regions = "Yes"
1785
+ descr_geom.describe_geometry_and_flow_options.moving_objects = "Yes"
1786
+ descr_geom.describe_geometry_and_flow_options.advanced_options = True
1787
+ descr_geom.describe_geometry_and_flow_options.porous_regions = "Yes"
1788
+ descr_geom.describe_geometry_and_flow_options.enable_overset = "Yes"
1789
+ descr_geom.describe_geometry_and_flow_options.extract_edge_features = "Yes"
1790
+ descr_geom.describe_geometry_and_flow_options.zero_thickness = "Yes"
1791
+ descr_geom.arguments()
1792
+ assert meshing.workflow.TaskObject["Describe Geometry and Flow"].Arguments()[
1793
+ "DescribeGeometryAndFlowOptions"
1794
+ ] == {
1795
+ "AdvancedOptions": True,
1796
+ "EnableOverset": "Yes",
1797
+ "ExtractEdgeFeatures": "Yes",
1798
+ "MovingObjects": "Yes",
1799
+ "PorousRegions": "Yes",
1800
+ "ZeroThickness": "Yes",
1801
+ }
@@ -18,7 +18,7 @@ def test_solver_preferences(new_solver_session):
18
18
  preferred_drawing.FacetLimit = 6000000
19
19
  assert preferred_drawing.FacetLimit() == 6000000
20
20
  preferred_drawing.FaceZoneLimit = 15000
21
- preferred_drawing.FaceZoneLimit() == 15000
21
+ assert preferred_drawing.FaceZoneLimit() == 15000
22
22
 
23
23
  ansys_logo = solver.preferences.Appearance.AnsysLogo
24
24
  ansys_logo.Color = "white"
@@ -53,7 +53,7 @@ def test_meshing_preferences(new_meshing_session):
53
53
  assert preferred_drawing.FacetLimit() == 6000000
54
54
 
55
55
  preferred_drawing.FaceZoneLimit = 15000
56
- preferred_drawing.FaceZoneLimit() == 15000
56
+ assert preferred_drawing.FaceZoneLimit() == 15000
57
57
 
58
58
  ansys_logo = meshing.preferences.Appearance.AnsysLogo
59
59
  ansys_logo.Color = "white"
@@ -77,13 +77,13 @@ def test_read_only_preferences(new_solver_session):
77
77
  solver = new_solver_session
78
78
  m = solver.preferences.MeshingWorkflow
79
79
  m.SaveCheckpointFiles = True
80
- assert m.SaveCheckpointFiles() == True
80
+ assert m.SaveCheckpointFiles() is True
81
81
  assert m.CheckpointingOption() == "Write mesh files"
82
- assert m.CheckpointingOption.is_read_only() == True
82
+ assert m.CheckpointingOption.is_read_only() is True
83
83
  with pytest.raises(RuntimeError):
84
84
  m.CheckpointingOption = "Write into memory"
85
85
  m.SaveCheckpointFiles = False
86
- assert m.SaveCheckpointFiles() == False
87
- assert m.CheckpointingOption.is_read_only() == False
86
+ assert m.SaveCheckpointFiles() is False
87
+ assert m.CheckpointingOption.is_read_only() is False
88
88
  m.CheckpointingOption = "Write into memory"
89
89
  assert m.CheckpointingOption() == "Write into memory"