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,67 +0,0 @@
1
- from concurrent.futures import Future
2
-
3
- import pytest
4
-
5
- from ansys.fluent.core.launcher.slurm_launcher import SlurmFuture
6
-
7
-
8
- class SlurmEnvironment:
9
- def __init__(self):
10
- self.state = None
11
-
12
- def set_state(self, state):
13
- self.state = state
14
-
15
-
16
- class SlurmFutureResult:
17
- pass
18
-
19
-
20
- class SlurmFutureException:
21
- pass
22
-
23
-
24
- @pytest.fixture
25
- def slurm_future(monkeypatch: pytest.MonkeyPatch) -> SlurmFuture:
26
- env = SlurmEnvironment()
27
- future = Future()
28
- future.set_running_or_notify_cancel()
29
- slurm_future = SlurmFuture(future, 0)
30
- monkeypatch.setattr(slurm_future, "_get_state", lambda: env.state)
31
- monkeypatch.setattr(slurm_future, "_cancel", lambda: env.set_state(""))
32
- env.set_state("RUNNING")
33
- slurm_future.env = env
34
- return slurm_future
35
-
36
-
37
- def test_cancel_slurm_future(slurm_future: SlurmFuture):
38
- assert slurm_future.cancel()
39
-
40
-
41
- def test_slurm_future_lifecycle(slurm_future: SlurmFuture):
42
- assert slurm_future.pending()
43
- assert not slurm_future.running()
44
- assert not slurm_future.done()
45
- slurm_future._future.set_result(SlurmFutureResult())
46
- assert not slurm_future.pending()
47
- assert slurm_future.running()
48
- assert not slurm_future.done()
49
- assert isinstance(slurm_future.result(), SlurmFutureResult)
50
- slurm_future.env.set_state("")
51
- assert not slurm_future.pending()
52
- assert not slurm_future.running()
53
- assert slurm_future.done()
54
-
55
-
56
- def test_slurm_future_exception(slurm_future: SlurmFuture):
57
- slurm_future._future.set_exception(SlurmFutureException())
58
- assert isinstance(slurm_future.exception(), SlurmFutureException)
59
-
60
-
61
- def test_slurm_future_done_callback(slurm_future: SlurmFuture):
62
- called = []
63
- slurm_future.add_done_callback(lambda session: called.append(True))
64
- assert not called
65
- slurm_future._future.set_result(SlurmFutureResult())
66
- assert called
67
- assert called[0]
@@ -1,241 +0,0 @@
1
- import numpy as np
2
- import pytest
3
-
4
- from ansys.fluent.core import examples
5
- from ansys.fluent.core.examples.downloads import download_file
6
-
7
-
8
- @pytest.mark.fluent_version(">=23.2")
9
- def test_solution_variables(new_solver_session):
10
- solver = new_solver_session
11
- import_file_name = examples.download_file(
12
- "mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
13
- )
14
- examples.download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
15
-
16
- solution_variable_info = solver.fields.solution_variable_info
17
- solution_variable_data = solver.fields.solution_variable_data
18
- assert solution_variable_info == solver.svar_info
19
- assert solution_variable_data == solver.svar_data
20
-
21
- solver.file.read_case_data(file_name=import_file_name)
22
-
23
- zones_info = solution_variable_info.get_zones_info()
24
-
25
- assert zones_info.domains == ["mixture"]
26
-
27
- assert set(zones_info.zones) == {
28
- "symmetry-xyplane",
29
- "hot-inlet",
30
- "cold-inlet",
31
- "outlet",
32
- "wall-inlet",
33
- "wall-elbow",
34
- "elbow-fluid",
35
- "interior--elbow-fluid",
36
- }
37
-
38
- zone_info = zones_info["wall-inlet"]
39
-
40
- assert zone_info.name == "wall-inlet"
41
-
42
- assert zone_info.count == 268
43
-
44
- assert zone_info.zone_id == 33
45
-
46
- assert zone_info.zone_type == "wall"
47
-
48
- wall_fluid_info = solution_variable_info.get_variables_info(
49
- zone_names=["wall-elbow", "elbow-fluid"], domain_name="mixture"
50
- )
51
-
52
- assert set(wall_fluid_info.solution_variables) == {
53
- "SV_ADS_0",
54
- "SV_ADS_1",
55
- "SV_CENTROID",
56
- "SV_H",
57
- "SV_K",
58
- "SV_O",
59
- "SV_P",
60
- "SV_T",
61
- "SV_U",
62
- "SV_V",
63
- "SV_W",
64
- }
65
-
66
- solution_variable_info_centroid = wall_fluid_info["SV_CENTROID"]
67
-
68
- assert solution_variable_info_centroid.name == "SV_CENTROID"
69
-
70
- assert solution_variable_info_centroid.dimension == 3
71
-
72
- assert solution_variable_info_centroid.field_type == np.float64
73
-
74
- sv_p_wall_fluid = solution_variable_data.get_data(
75
- solution_variable_name="SV_P",
76
- zone_names=["elbow-fluid", "wall-elbow"],
77
- domain_name="mixture",
78
- )
79
- assert sv_p_wall_fluid.domain == "mixture"
80
-
81
- assert sv_p_wall_fluid.zones == ["wall-elbow", "elbow-fluid"]
82
-
83
- fluid_temp = sv_p_wall_fluid["elbow-fluid"]
84
- assert fluid_temp.size == 17822
85
- assert str(fluid_temp.dtype) == "float64"
86
-
87
- wall_press_array = solution_variable_data.create_empty_array(
88
- "SV_P", "wall-elbow", "mixture"
89
- )
90
- fluid_press_array = solution_variable_data.create_empty_array(
91
- "SV_P", "elbow-fluid", "mixture"
92
- )
93
- wall_press_array[:] = 500
94
- fluid_press_array[:] = 600
95
- zone_names_to_solution_variable_data = {
96
- "wall-elbow": wall_press_array,
97
- "elbow-fluid": fluid_press_array,
98
- }
99
- solution_variable_data.set_data(
100
- solution_variable_name="SV_P",
101
- zone_names_to_solution_variable_data=zone_names_to_solution_variable_data,
102
- domain_name="mixture",
103
- )
104
-
105
- updated_sv_p_data = solution_variable_data.get_data(
106
- solution_variable_name="SV_P",
107
- zone_names=["elbow-fluid", "wall-elbow"],
108
- domain_name="mixture",
109
- )
110
-
111
- assert updated_sv_p_data.domain == "mixture"
112
- assert updated_sv_p_data.zones == ["wall-elbow", "elbow-fluid"]
113
-
114
- assert updated_sv_p_data["elbow-fluid"].size == 17822
115
- assert str(updated_sv_p_data["elbow-fluid"].dtype) == "float64"
116
-
117
- assert updated_sv_p_data["wall-elbow"][0] == 500.0
118
- assert updated_sv_p_data["elbow-fluid"][-1] == 600.0
119
-
120
-
121
- @pytest.mark.fluent_version(">=23.2")
122
- def test_solution_variables_single_precision(new_solver_session_sp):
123
- solver = new_solver_session_sp
124
- import_file_name = examples.download_file(
125
- "mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
126
- )
127
- examples.download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
128
-
129
- solution_variable_info = solver.fields.solution_variable_info
130
- solution_variable_data = solver.fields.solution_variable_data
131
- assert solution_variable_info == solver.svar_info
132
- assert solution_variable_data == solver.svar_data
133
-
134
- solver.file.read_case_data(file_name=import_file_name)
135
-
136
- zones_info = solution_variable_info.get_zones_info()
137
-
138
- assert zones_info.domains == ["mixture"]
139
-
140
- assert set(zones_info.zones) == {
141
- "symmetry-xyplane",
142
- "hot-inlet",
143
- "cold-inlet",
144
- "outlet",
145
- "wall-inlet",
146
- "wall-elbow",
147
- "elbow-fluid",
148
- "interior--elbow-fluid",
149
- }
150
-
151
- zone_info = zones_info["wall-elbow"]
152
-
153
- assert zone_info.name == "wall-elbow"
154
-
155
- assert zone_info.count == 2168
156
-
157
- assert zone_info.zone_id == 34
158
-
159
- assert zone_info.zone_type == "wall"
160
-
161
- wall_fluid_info = solution_variable_info.get_variables_info(
162
- zone_names=["wall-elbow", "elbow-fluid"], domain_name="mixture"
163
- )
164
-
165
- assert set(wall_fluid_info.solution_variables) == {
166
- "SV_ADS_0",
167
- "SV_ADS_1",
168
- "SV_CENTROID",
169
- "SV_H",
170
- "SV_K",
171
- "SV_O",
172
- "SV_P",
173
- "SV_T",
174
- "SV_U",
175
- "SV_V",
176
- "SV_W",
177
- }
178
-
179
- solution_variable_info_centroid = wall_fluid_info["SV_CENTROID"]
180
-
181
- assert solution_variable_info_centroid.name == "SV_CENTROID"
182
-
183
- assert solution_variable_info_centroid.dimension == 3
184
-
185
- assert solution_variable_info_centroid.field_type == np.float32
186
-
187
- sv_p_wall_fluid = solution_variable_data.get_data(
188
- solution_variable_name="SV_P",
189
- zone_names=["wall-elbow", "elbow-fluid"],
190
- domain_name="mixture",
191
- )
192
- assert sv_p_wall_fluid.domain == "mixture"
193
-
194
- assert sv_p_wall_fluid.zones == ["wall-elbow", "elbow-fluid"]
195
-
196
- fluid_temp = sv_p_wall_fluid["elbow-fluid"]
197
- assert fluid_temp.size == 17822
198
- assert str(fluid_temp.dtype) == "float32"
199
-
200
-
201
- @pytest.mark.fluent_version(">=24.2")
202
- def test_solution_variable_does_not_modify_case(new_solver_session):
203
- solver = new_solver_session
204
- case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
205
- download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
206
- solver.file.read_case_data(file_name=case_path)
207
- solver.scheme_eval.scheme_eval("(%save-case-id)")
208
- assert not solver.scheme_eval.scheme_eval("(case-modified?)")
209
- solver.fields.solution_variable_data.get_data(
210
- solution_variable_name="SV_P",
211
- zone_names=["elbow-fluid", "wall-elbow"],
212
- domain_name="mixture",
213
- )
214
- assert not solver.scheme_eval.scheme_eval("(case-modified?)")
215
-
216
-
217
- @pytest.mark.fluent_version(">=25.2")
218
- def test_solution_variable_udm_data(mixing_elbow_case_session_t4):
219
- solver = mixing_elbow_case_session_t4
220
- solver.tui.define.user_defined.user_defined_memory("2")
221
- solver.settings.solution.initialization.hybrid_initialize()
222
- solver.settings.solution.run_calculation.iterate(iter_count=1)
223
- udm_data = solver.fields.solution_variable_data.get_data(
224
- solution_variable_name="SV_UDM_I",
225
- domain_name="mixture",
226
- zone_names=["wall-elbow"],
227
- )["wall-elbow"]
228
- np.testing.assert_array_equal(udm_data, np.zeros(4336))
229
- udm_data[:2168] = 5
230
- udm_data[2168:] = 10
231
- solver.fields.solution_variable_data.set_data(
232
- solution_variable_name="SV_UDM_I",
233
- domain_name="mixture",
234
- zone_names_to_solution_variable_data={"wall-elbow": udm_data},
235
- )
236
- new_array = solver.fields.solution_variable_data.get_data(
237
- solution_variable_name="SV_UDM_I",
238
- domain_name="mixture",
239
- zone_names=["wall-elbow"],
240
- )["wall-elbow"]
241
- np.testing.assert_array_equal(new_array, udm_data)
@@ -1,83 +0,0 @@
1
- import pytest
2
-
3
- from ansys.fluent.core import examples
4
- from ansys.fluent.core.utils.execution import timeout_loop
5
-
6
-
7
- @pytest.mark.fluent_version(">=23.2")
8
- def test_solver_monitors(new_solver_session):
9
-
10
- solver = new_solver_session
11
-
12
- import_case = examples.download_file(
13
- file_name="exhaust_system.cas.h5", directory="pyfluent/exhaust_system"
14
- )
15
-
16
- solver.file.read_case(file_name=import_case)
17
-
18
- ordered_report_plot_names = [
19
- "mass-bal-rplot",
20
- "mass-in-rplot",
21
- "mass-tot-rplot",
22
- "point-vel-rplot",
23
- ]
24
-
25
- assert (
26
- sorted(solver.settings.solution.monitor.report_plots())
27
- == ordered_report_plot_names
28
- )
29
-
30
- # monitor set names unavailable without data
31
- assert len(solver.monitors.get_monitor_set_names()) == 0
32
-
33
- import_data = examples.download_file(
34
- file_name="exhaust_system.dat.h5", directory="pyfluent/exhaust_system"
35
- )
36
-
37
- solver.file.read_data(file_name=import_data)
38
-
39
- # monitor set names remains unavailable after loading data
40
- assert len(solver.monitors.get_monitor_set_names()) == 0
41
-
42
- # monitor set names becomes available after initializing
43
- solver.solution.initialization.hybrid_initialize()
44
-
45
- monitor_set_names = ordered_report_plot_names + ["residual"]
46
- assert sorted(solver.monitors.get_monitor_set_names()) == sorted(monitor_set_names)
47
-
48
- # no data in monitors at this point
49
- assert all(
50
- all(
51
- len(elem) == 0
52
- for elem in solver.monitors.get_monitor_set_data(monitor_set_name=name)
53
- )
54
- for name in monitor_set_names
55
- ), "One or more monitor sets contain non-empty elements."
56
-
57
- # run the solver...
58
- solver.solution.run_calculation.iterate(iter_count=1)
59
-
60
- # ...data is in monitors
61
- assert all(
62
- all(
63
- len(elem) != 0
64
- for elem in solver.monitors.get_monitor_set_data(monitor_set_name=name)
65
- )
66
- for name in monitor_set_names
67
- ), "One or more monitor sets contain empty elements."
68
-
69
- def monitor_callback():
70
- monitor_callback.called = True
71
-
72
- monitor_callback.called = False
73
-
74
- # n.b. there is no checking of the callback signature at registration. Instead
75
- # we would get a TypeError at callback time if the signature is wrong. The correct
76
- # signature is undocumented.
77
- solver.monitors.register_callback(monitor_callback)
78
-
79
- # trigger callback by running the solver
80
- assert not monitor_callback.called
81
- solver.solution.run_calculation.iterate(iter_count=1)
82
- assert timeout_loop(lambda: monitor_callback.called, 5)
83
- assert monitor_callback.called