ansys-fluent-core 0.28.1__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 (223) 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/datamodel_252/preferences.py +7 -0
  30. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  31. ansys/fluent/core/generated/meshing/tui_252.py +395 -390
  32. ansys/fluent/core/generated/solver/settings_222.py +0 -72
  33. ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
  34. ansys/fluent/core/generated/solver/settings_231.py +0 -574
  35. ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
  36. ansys/fluent/core/generated/solver/settings_232.py +0 -527
  37. ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
  38. ansys/fluent/core/generated/solver/settings_241.py +0 -478
  39. ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
  40. ansys/fluent/core/generated/solver/settings_242.py +0 -361
  41. ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
  42. ansys/fluent/core/generated/solver/settings_251.py +0 -399
  43. ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
  44. ansys/fluent/core/generated/solver/settings_252.py +8118 -4206
  45. ansys/fluent/core/generated/solver/settings_252.pyi +7229 -3259
  46. ansys/fluent/core/generated/solver/tui_252.py +4508 -3877
  47. ansys/fluent/core/get_build_details.py +22 -0
  48. ansys/fluent/core/journaling.py +38 -0
  49. ansys/fluent/core/launcher/__init__.py +22 -0
  50. ansys/fluent/core/launcher/container_launcher.py +65 -56
  51. ansys/fluent/core/launcher/error_handler.py +30 -0
  52. ansys/fluent/core/launcher/fluent_container.py +45 -20
  53. ansys/fluent/core/launcher/launcher.py +53 -5
  54. ansys/fluent/core/launcher/launcher_utils.py +22 -0
  55. ansys/fluent/core/launcher/pim_launcher.py +120 -86
  56. ansys/fluent/core/launcher/process_launch_string.py +22 -0
  57. ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
  58. ansys/fluent/core/launcher/server_info.py +45 -3
  59. ansys/fluent/core/launcher/slurm_launcher.py +25 -3
  60. ansys/fluent/core/launcher/standalone_launcher.py +68 -63
  61. ansys/fluent/core/launcher/watchdog.py +22 -0
  62. ansys/fluent/core/logging.py +24 -0
  63. ansys/fluent/core/logging_config.yaml +3 -0
  64. ansys/fluent/core/meshing/meshing_workflow.py +22 -0
  65. ansys/fluent/core/parametric.py +22 -0
  66. ansys/fluent/core/post_objects/__init__.py +21 -0
  67. ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
  68. ansys/fluent/core/post_objects/meta.py +22 -0
  69. ansys/fluent/core/post_objects/post_helper.py +22 -0
  70. ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
  71. ansys/fluent/core/post_objects/post_objects_container.py +22 -0
  72. ansys/fluent/core/post_objects/singleton_meta.py +22 -0
  73. ansys/fluent/core/post_objects/timing_decorator.py +22 -0
  74. ansys/fluent/core/report.py +77 -0
  75. ansys/fluent/core/rpvars.py +22 -0
  76. ansys/fluent/core/scheduler/__init__.py +22 -0
  77. ansys/fluent/core/scheduler/load_machines.py +22 -0
  78. ansys/fluent/core/scheduler/machine_list.py +22 -0
  79. ansys/fluent/core/search.py +22 -0
  80. ansys/fluent/core/services/__init__.py +22 -0
  81. ansys/fluent/core/services/api_upgrade.py +22 -0
  82. ansys/fluent/core/services/app_utilities.py +38 -0
  83. ansys/fluent/core/services/batch_ops.py +22 -0
  84. ansys/fluent/core/services/datamodel_se.py +163 -61
  85. ansys/fluent/core/services/datamodel_tui.py +22 -0
  86. ansys/fluent/core/services/deprecated_field_data.py +23 -1
  87. ansys/fluent/core/services/events.py +22 -0
  88. ansys/fluent/core/services/field_data.py +285 -2
  89. ansys/fluent/core/services/health_check.py +22 -0
  90. ansys/fluent/core/services/interceptors.py +50 -2
  91. ansys/fluent/core/services/monitor.py +22 -0
  92. ansys/fluent/core/services/reduction.py +22 -0
  93. ansys/fluent/core/services/scheme_eval.py +22 -0
  94. ansys/fluent/core/services/settings.py +22 -0
  95. ansys/fluent/core/services/solution_variables.py +22 -0
  96. ansys/fluent/core/services/streaming.py +22 -0
  97. ansys/fluent/core/services/transcript.py +22 -0
  98. ansys/fluent/core/session.py +39 -2
  99. ansys/fluent/core/session_base_meshing.py +22 -0
  100. ansys/fluent/core/session_meshing.py +22 -0
  101. ansys/fluent/core/session_meshing.pyi +22 -0
  102. ansys/fluent/core/session_pure_meshing.py +22 -0
  103. ansys/fluent/core/session_pure_meshing.pyi +22 -0
  104. ansys/fluent/core/session_shared.py +22 -0
  105. ansys/fluent/core/session_solver.py +43 -0
  106. ansys/fluent/core/session_solver.pyi +22 -0
  107. ansys/fluent/core/session_solver_aero.py +22 -0
  108. ansys/fluent/core/session_solver_icing.py +22 -0
  109. ansys/fluent/core/session_solver_lite.py +22 -0
  110. ansys/fluent/core/solver/__init__.py +22 -0
  111. ansys/fluent/core/solver/error_message.py +22 -0
  112. ansys/fluent/core/solver/flobject.py +22 -0
  113. ansys/fluent/core/solver/flunits.py +22 -0
  114. ansys/fluent/core/solver/function/__init__.py +22 -0
  115. ansys/fluent/core/solver/function/reduction.py +22 -0
  116. ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
  117. ansys/fluent/core/solver/settings_builtin_data.py +22 -0
  118. ansys/fluent/core/solver/settings_external.py +22 -0
  119. ansys/fluent/core/streaming_services/__init__.py +21 -0
  120. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +34 -12
  121. ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
  122. ansys/fluent/core/streaming_services/events_streaming.py +22 -0
  123. ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
  124. ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
  125. ansys/fluent/core/streaming_services/streaming.py +22 -0
  126. ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
  127. ansys/fluent/core/systemcoupling.py +22 -0
  128. ansys/fluent/core/utils/__init__.py +22 -0
  129. ansys/fluent/core/utils/data_transfer.py +22 -0
  130. ansys/fluent/core/utils/deprecate.py +24 -1
  131. ansys/fluent/core/utils/dictionary_operations.py +22 -0
  132. ansys/fluent/core/utils/dump_session_data.py +22 -0
  133. ansys/fluent/core/utils/event_loop.py +22 -0
  134. ansys/fluent/core/utils/execution.py +22 -0
  135. ansys/fluent/core/utils/file_transfer_service.py +22 -0
  136. ansys/fluent/core/utils/fix_doc.py +22 -0
  137. ansys/fluent/core/utils/fldoc.py +22 -0
  138. ansys/fluent/core/utils/fluent_version.py +22 -0
  139. ansys/fluent/core/utils/networking.py +22 -0
  140. ansys/fluent/core/utils/setup_for_fluent.py +22 -0
  141. ansys/fluent/core/warnings.py +22 -0
  142. ansys/fluent/core/workflow.py +22 -0
  143. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/LICENSE +8 -8
  144. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/METADATA +56 -33
  145. ansys_fluent_core-0.29.0.dist-info/RECORD +219 -0
  146. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/WHEEL +1 -1
  147. ansys/fluent/core/docs/README.rst +0 -155
  148. ansys/fluent/tests/conftest.py +0 -415
  149. ansys/fluent/tests/fluent_fixtures.py +0 -195
  150. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  151. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  152. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  153. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  154. ansys/fluent/tests/test_aero_session.py +0 -88
  155. ansys/fluent/tests/test_batch_ops.py +0 -39
  156. ansys/fluent/tests/test_builtin_settings.py +0 -761
  157. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  158. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  159. ansys/fluent/tests/test_casereader.py +0 -324
  160. ansys/fluent/tests/test_codegen.py +0 -783
  161. ansys/fluent/tests/test_creatable.py +0 -31
  162. ansys/fluent/tests/test_data_model_cache.py +0 -434
  163. ansys/fluent/tests/test_datamodel_api.py +0 -449
  164. ansys/fluent/tests/test_datamodel_service.py +0 -814
  165. ansys/fluent/tests/test_datareader.py +0 -103
  166. ansys/fluent/tests/test_error_handling.py +0 -24
  167. ansys/fluent/tests/test_events_manager.py +0 -214
  168. ansys/fluent/tests/test_field_data.py +0 -466
  169. ansys/fluent/tests/test_file_session.py +0 -355
  170. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  171. ansys/fluent/tests/test_fix_doc.py +0 -29
  172. ansys/fluent/tests/test_flobject.py +0 -1235
  173. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  174. ansys/fluent/tests/test_fluent_session.py +0 -270
  175. ansys/fluent/tests/test_fluent_version.py +0 -66
  176. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  177. ansys/fluent/tests/test_icing_session.py +0 -9
  178. ansys/fluent/tests/test_launcher.py +0 -529
  179. ansys/fluent/tests/test_launcher_remote.py +0 -272
  180. ansys/fluent/tests/test_lispy.py +0 -40
  181. ansys/fluent/tests/test_logging.py +0 -16
  182. ansys/fluent/tests/test_mapped_api.py +0 -774
  183. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  184. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  185. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  186. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  187. ansys/fluent/tests/test_preferences.py +0 -89
  188. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  189. ansys/fluent/tests/test_reduction.py +0 -484
  190. ansys/fluent/tests/test_rp_vars.py +0 -77
  191. ansys/fluent/tests/test_scheduler.py +0 -471
  192. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  193. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  194. ansys/fluent/tests/test_search.py +0 -344
  195. ansys/fluent/tests/test_session.py +0 -594
  196. ansys/fluent/tests/test_settings_api.py +0 -606
  197. ansys/fluent/tests/test_settings_reader.py +0 -85
  198. ansys/fluent/tests/test_slurm_future.py +0 -67
  199. ansys/fluent/tests/test_solution_variables.py +0 -241
  200. ansys/fluent/tests/test_solver_monitors.py +0 -83
  201. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  202. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  203. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  204. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  205. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  206. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  207. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  208. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  209. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  210. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  211. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  212. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  213. ansys/fluent/tests/test_streaming_services.py +0 -52
  214. ansys/fluent/tests/test_systemcoupling.py +0 -44
  215. ansys/fluent/tests/test_topy.py +0 -179
  216. ansys/fluent/tests/test_tui_api.py +0 -70
  217. ansys/fluent/tests/test_type_stub.py +0 -37
  218. ansys/fluent/tests/test_utils.py +0 -82
  219. ansys/fluent/tests/util/__init__.py +0 -36
  220. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  221. ansys/fluent/tests/util/solver.py +0 -72
  222. ansys_fluent_core-0.28.1.dist-info/AUTHORS +0 -12
  223. ansys_fluent_core-0.28.1.dist-info/RECORD +0 -294
@@ -1,250 +0,0 @@
1
- """
2
- End-to-end Fluent Solver Workflow using Watertight Meshing
3
- -----------------------------------------------------------------------------
4
- This test covers the setup and solution of a 3D
5
- turbulent fluid flow and heat transfer problem in a mixing elbow. The mixing
6
- elbow configuration is encountered in piping systems in power plants and
7
- process industries. It is often important to predict the flow field and
8
- temperature field in the area of the mixing region to properly design
9
- the junction.
10
-
11
- This test queries the following using PyTest:
12
-
13
- - Meshing workflow tasks state before and after the task execution
14
- - Report definitions check after solution
15
- """
16
-
17
- from functools import partial
18
-
19
- import pytest
20
- from util.meshing_workflow import (
21
- assign_task_arguments,
22
- execute_task_with_pre_and_postcondition_checks,
23
- )
24
- from util.solver import check_report_definition_result
25
-
26
- from ansys.fluent.core.utils.fluent_version import FluentVersion
27
-
28
-
29
- @pytest.mark.nightly
30
- @pytest.mark.codegen_required
31
- def test_mixing_elbow(watertight_workflow_session, mixing_elbow_geometry_filename):
32
- meshing_session = watertight_workflow_session
33
- workflow = meshing_session.workflow
34
-
35
- assign_task_args = partial(
36
- assign_task_arguments, workflow=workflow, check_state=True
37
- )
38
-
39
- execute_task_with_pre_and_postconditions = partial(
40
- execute_task_with_pre_and_postcondition_checks, workflow=workflow
41
- )
42
-
43
- ###############################################################################
44
- # Import the CAD geometry
45
- # Query the task state before and after task execution
46
- assign_task_args(
47
- task_name="Import Geometry",
48
- FileName=mixing_elbow_geometry_filename,
49
- LengthUnit="in",
50
- )
51
-
52
- execute_task_with_pre_and_postconditions(task_name="Import Geometry")
53
-
54
- ###############################################################################
55
- # Add local sizing
56
- # Query the task state before and after task execution
57
- workflow.TaskObject["Add Local Sizing"].AddChildToTask()
58
-
59
- execute_task_with_pre_and_postconditions(task_name="Add Local Sizing")
60
-
61
- ###############################################################################
62
- # Generate the surface mesh
63
- # Query the task state before and after task execution
64
- assign_task_args(
65
- task_name="Generate the Surface Mesh",
66
- CFDSurfaceMeshControls={"MaxSize": 0.3},
67
- )
68
-
69
- execute_task_with_pre_and_postconditions(task_name="Generate the Surface Mesh")
70
-
71
- ###############################################################################
72
- # Describe the geometry
73
- # Query the task state before and after task execution
74
- describe_geo = workflow.TaskObject["Describe Geometry"]
75
- describe_geo.UpdateChildTasks(SetupTypeChanged=False)
76
- assign_task_args(
77
- task_name="Describe Geometry",
78
- SetupType="The geometry consists of only fluid regions with no voids",
79
- )
80
- describe_geo.UpdateChildTasks(SetupTypeChanged=True)
81
-
82
- execute_task_with_pre_and_postconditions(task_name="Describe Geometry")
83
-
84
- ###############################################################################
85
- # Update Boundaries Task
86
- # Query the task state before and after task execution
87
- assign_task_args(
88
- task_name="Update Boundaries",
89
- BoundaryLabelList=["wall-inlet"],
90
- BoundaryLabelTypeList=["wall"],
91
- OldBoundaryLabelList=["wall-inlet"],
92
- OldBoundaryLabelTypeList=["velocity-inlet"],
93
- )
94
-
95
- execute_task_with_pre_and_postconditions(task_name="Update Boundaries")
96
-
97
- ###############################################################################
98
- # Update your regions
99
- # Query the task state before and after task execution
100
-
101
- execute_task_with_pre_and_postconditions(task_name="Update Regions")
102
-
103
- ###############################################################################
104
- # Add Boundary Layers
105
- # Query the task state before and after task execution
106
- add_boundary_layers = workflow.TaskObject["Add Boundary Layers"]
107
- add_boundary_layers.AddChildToTask()
108
- add_boundary_layers.InsertCompoundChildTask()
109
- assign_task_args(
110
- task_name="smooth-transition_1", BLControlName="smooth-transition_1"
111
- )
112
- add_boundary_layers.Arguments = {}
113
-
114
- execute_task_with_pre_and_postconditions(task_name="Add Boundary Layers")
115
-
116
- ###############################################################################
117
- # Generate the volume mesh
118
- # Query the task state before and after task execution
119
- assign_task_args(
120
- task_name="Generate the Volume Mesh",
121
- VolumeFill="poly-hexcore",
122
- VolumeFillControls={"HexMaxCellLength": 0.3},
123
- )
124
-
125
- execute_task_with_pre_and_postconditions(task_name="Generate the Volume Mesh")
126
-
127
- ###############################################################################
128
- # Check the mesh in Meshing mode
129
- # TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
130
- if meshing_session.get_fluent_version() < FluentVersion.v231:
131
- meshing_session.tui.mesh.check_mesh()
132
-
133
- ###############################################################################
134
- # Switch to Solution mode
135
- solver_session = meshing_session.switch_to_solver()
136
-
137
- ###############################################################################
138
- # Check the mesh in Solver mode
139
- solver_session.tui.mesh.check()
140
-
141
- ###############################################################################
142
- # Set the working units for the mesh
143
- define = solver_session.tui.define
144
- define.units("length", "in")
145
-
146
- ###############################################################################
147
- # Enable heat transfer by activating the energy equation.
148
- define.models.energy("yes", ", ", ", ", ", ", ", ")
149
-
150
- ###############################################################################
151
- # Create a new material called water-liquid.
152
- define.materials.copy("fluid", "water-liquid")
153
-
154
- ###############################################################################
155
- # Set up the cell zone conditions for the fluid zone (elbow-fluid). Select
156
- # water-liquid from the Material list.
157
- # TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
158
- if solver_session.get_fluent_version() < FluentVersion.v231:
159
- define.boundary_conditions.fluid(
160
- "elbow-fluid",
161
- "yes",
162
- "water-liquid",
163
- "no",
164
- "no",
165
- "no",
166
- "no",
167
- "0",
168
- "no",
169
- "0",
170
- "no",
171
- "0",
172
- "no",
173
- "0",
174
- "no",
175
- "0",
176
- "no",
177
- "1",
178
- "no",
179
- "no",
180
- "no",
181
- "no",
182
- "no",
183
- )
184
-
185
- ###############################################################################
186
- # Set up the boundary conditions
187
- velocity_inlet = define.boundary_conditions.set.velocity_inlet
188
- velocity_inlet("cold-inlet", [], "vmag", "no", 0.4, "quit")
189
- velocity_inlet("cold-inlet", [], "ke-spec", "no", "no", "no", "yes", "quit")
190
- velocity_inlet("cold-inlet", [], "turb-intensity", 5, "quit")
191
- velocity_inlet("cold-inlet", [], "turb-hydraulic-diam", 4, "quit")
192
- velocity_inlet("cold-inlet", [], "temperature", "no", 293.15, "quit")
193
- velocity_inlet("hot-inlet", [], "vmag", "no", 1.2, "quit")
194
- velocity_inlet("hot-inlet", [], "ke-spec", "no", "no", "no", "yes", "quit")
195
- velocity_inlet("hot-inlet", [], "turb-intensity", 5, "quit")
196
- velocity_inlet("hot-inlet", [], "turb-hydraulic-diam", 1, "quit")
197
- velocity_inlet("hot-inlet", [], "temperature", "no", 313.15, "quit")
198
-
199
- pressure_outlet = define.boundary_conditions.set.pressure_outlet
200
- pressure_outlet("outlet", [], "turb-intensity", 5, "quit")
201
- pressure_outlet("outlet", [], "turb-viscosity-ratio", 4, "quit")
202
-
203
- ###############################################################################
204
- # Enable the plotting of residuals during the calculation.
205
- solver_session.tui.solve.monitors.residual.plot("yes")
206
-
207
- ###############################################################################
208
- # Initialize the flow field using the Hybrid Initialization
209
- solver_session.tui.solve.initialize.hyb_initialization()
210
-
211
- ###############################################################################
212
- # Solve for 250 Iterations.
213
- solver_session.tui.solve.iterate(250)
214
-
215
- ###############################################################################
216
- # Assert the returned mass flow rate report definition value
217
- flux = solver_session.solution.report_definitions.flux
218
- flux["mass_flow_rate"] = {}
219
- flux["mass_flow_rate"].zone_names = [
220
- "cold-inlet",
221
- "hot-inlet",
222
- "outlet",
223
- ]
224
-
225
- check_report_definition = partial(
226
- check_report_definition_result,
227
- report_definitions=solver_session.solution.report_definitions,
228
- )
229
-
230
- check_report_definition(
231
- report_definition_name="mass_flow_rate",
232
- expected_result=pytest.approx(-2.985690364942784e-06, abs=1e-3),
233
- )
234
-
235
- ###############################################################################
236
- # Assert the returned temperature report definition value on the outlet surface
237
- solver_session.solution.report_definitions.surface["temperature_outlet"] = {}
238
- temp_outlet = solver_session.solution.report_definitions.surface[
239
- "temperature_outlet"
240
- ]
241
- temp_outlet.report_type = "surface-massavg"
242
- temp_outlet.field = "temperature"
243
- temp_outlet.surface_names = ["outlet"]
244
-
245
- check_report_definition(
246
- report_definition_name="temperature_outlet",
247
- expected_result=pytest.approx(296.229, rel=1e-3),
248
- )
249
-
250
- ###############################################################################
@@ -1,324 +0,0 @@
1
- from os.path import dirname, join
2
- import pathlib
3
- import shutil
4
-
5
- import pytest
6
-
7
- from ansys.fluent.core import examples
8
- from ansys.fluent.core.filereader import lispy
9
- from ansys.fluent.core.filereader.case_file import (
10
- InputParameter,
11
- InputParameterOld,
12
- MeshType,
13
- _get_processed_string,
14
- )
15
- from ansys.fluent.core.filereader.case_file import CaseFile as CaseReader
16
-
17
-
18
- def call_casereader(
19
- case_file_name: str | None = None,
20
- project_file_name: str | None = None,
21
- expected: dict | None = None,
22
- ):
23
- reader = CaseReader(
24
- case_file_name=case_file_name, project_file_name=project_file_name
25
- )
26
- if expected is not None:
27
- assert reader.precision() == expected["precision"]
28
- assert reader.num_dimensions() == expected["num_dimensions"]
29
- assert reader.iter_count() == expected["iter_count"]
30
- assert {
31
- p.name: (p.numeric_value, p.units) for p in reader.input_parameters()
32
- } == expected["input_parameters"]
33
- assert {p.name: p.units for p in reader.output_parameters()} == expected[
34
- "output_parameters"
35
- ]
36
-
37
-
38
- def call_casereader_static_mixer(
39
- case_file_name: str | None = None, project_file_name: str | None = None
40
- ):
41
- call_casereader(
42
- case_file_name=case_file_name,
43
- project_file_name=project_file_name,
44
- expected=dict(
45
- precision=2,
46
- num_dimensions=3,
47
- iter_count=100,
48
- input_parameters=dict(
49
- inlet1_temp=(300, "K"),
50
- inlet1_vel=(1, "m/s"),
51
- inlet2_temp=(350, "K"),
52
- inlet2_vel=(1, "m/s"),
53
- ),
54
- output_parameters={
55
- "outlet-temp-avg-op": "K",
56
- "outlet-vel-avg-op": "m s^-1",
57
- },
58
- ),
59
- )
60
-
61
-
62
- def static_mixer_file():
63
- return examples.download_file(
64
- "Static_Mixer_Parameters.cas.h5",
65
- "pyfluent/static_mixer",
66
- return_without_path=False,
67
- )
68
-
69
-
70
- def test_casereader_static_mixer_h5():
71
- call_casereader_static_mixer(case_file_name=static_mixer_file())
72
-
73
-
74
- def test_casereader_static_mixer_binary_cas():
75
- call_casereader_static_mixer(
76
- case_file_name=examples.download_file(
77
- "Static_Mixer_Parameters_legacy_binary.cas",
78
- "pyfluent/static_mixer",
79
- return_without_path=False,
80
- )
81
- )
82
-
83
-
84
- def test_casereader_static_mixer_binary_gz():
85
- call_casereader_static_mixer(
86
- case_file_name=examples.download_file(
87
- "Static_Mixer_Parameters_legacy_binary.cas.gz",
88
- "pyfluent/static_mixer",
89
- return_without_path=False,
90
- )
91
- )
92
-
93
-
94
- def test_casereader_static_mixer_text_cas():
95
- call_casereader_static_mixer(
96
- case_file_name=examples.download_file(
97
- "Static_Mixer_Parameters_legacy_text.cas",
98
- "pyfluent/static_mixer",
99
- return_without_path=False,
100
- )
101
- )
102
-
103
-
104
- def test_casereader_static_mixer_text_gz():
105
- call_casereader_static_mixer(
106
- case_file_name=examples.download_file(
107
- "Static_Mixer_Parameters_legacy_text.cas.gz",
108
- "pyfluent/static_mixer",
109
- return_without_path=False,
110
- )
111
- )
112
-
113
-
114
- def create_dir_structure_locally(copy_1: bool = False, copy_2: bool = False):
115
- # Copying from and then creating the entire directory structure locally
116
- case_file_dir = (
117
- "Static_Mixer_Parameter_project_file/"
118
- "Static_Mixer_Parameters.cffdb/Static_Mixer_Parameters-Solve"
119
- )
120
- case_file_name = examples.download_file(
121
- "Static_Mixer_Parameters.cas.h5",
122
- "pyfluent/static_mixer/" + case_file_dir,
123
- return_without_path=False,
124
- )
125
- prj_dir = join(dirname(case_file_name), case_file_dir)
126
- pathlib.Path(prj_dir).mkdir(parents=True, exist_ok=True)
127
- if copy_1:
128
- shutil.copy2(case_file_name, prj_dir)
129
- if copy_2:
130
- case_file_name_2 = examples.download_file(
131
- "Static_Mixer_Parameters_legacy_binary.cas.gz",
132
- "pyfluent/static_mixer",
133
- return_without_path=False,
134
- )
135
- shutil.copy2(case_file_name_2, prj_dir)
136
- prj_file_dir = "Static_Mixer_Parameter_project_file"
137
- prj_file = r"Static_Mixer_Parameters.flprj"
138
- prj_file_name = examples.download_file(
139
- prj_file, "pyfluent/static_mixer/" + prj_file_dir, return_without_path=False
140
- )
141
- prj_file_dir = join(dirname(prj_file_name), prj_file_dir)
142
- shutil.copy2(prj_file_name, prj_file_dir)
143
-
144
- return join(prj_file_dir, prj_file)
145
-
146
-
147
- def test_processed_string():
148
- assert (
149
- _get_processed_string(b"Hello! World (37 ( Get this part of the string ))")
150
- == "(37 ( Get this part of the string ))"
151
- )
152
-
153
-
154
- def test_casereader_no_file():
155
- with pytest.raises(FileNotFoundError):
156
- call_casereader("no_file.cas.h5")
157
-
158
-
159
- def test_casereader_with_both_project_and_case_file():
160
- with pytest.raises(RuntimeError):
161
- call_casereader(
162
- case_file_name="case_file.cas.h5", project_file_name="project.flprj"
163
- )
164
-
165
-
166
- def test_casereader_for_project_directory_invalid_project_file():
167
- with pytest.raises(FileNotFoundError):
168
- call_casereader(project_file_name="project.flprx")
169
-
170
-
171
- def test_case_reader_with_bad_data_to_be_skipped_and_input_parameters_labeled_differently():
172
- call_casereader(
173
- case_file_name=examples.download_file(
174
- "mixer-ran_2019r3.cas.gz", "pyfluent/optislang", return_without_path=False
175
- ),
176
- expected=dict(
177
- precision=1,
178
- num_dimensions=3,
179
- iter_count=25,
180
- input_parameters=dict(
181
- swirl_max_hot=(0.1, "m s^-1"),
182
- vel_hot=(0.1, "m s^-1"),
183
- vel_cold=(0.1, "m s^-1"),
184
- swirl_max_cold=(0.1, "m s^-1"),
185
- ),
186
- output_parameters={
187
- "p2-op": "kg m^-1 s^-2",
188
- "t-dev-op": "K",
189
- "p1-op": "kg m^-1 s^-2",
190
- "ave_temp_out": "K",
191
- },
192
- ),
193
- )
194
-
195
-
196
- def test_case_reader_get_rp_and_config_vars():
197
- reader = CaseReader(case_file_name=static_mixer_file())
198
- rp_vars = reader.rp_vars()
199
- assert rp_vars
200
- assert hasattr(rp_vars, "__getitem__")
201
- config_vars = reader.config_vars()
202
- assert config_vars
203
- assert hasattr(config_vars, "__getitem__")
204
- assert config_vars["rp-3d?"] is True
205
- assert reader.config_var("rp-3d?") is True
206
- assert reader.config_var.rp_3d__q() is True
207
- assert reader.rp_var.smooth_mesh.niter() == 4
208
- assert reader.rp_var.pressure.output_dpdt__q() is True
209
- assert len(reader.rp_var.context.map_r17__plus()) == 53
210
- assert reader.rp_var.defaults.pre_r19__dot0_early__q() is False
211
-
212
- with pytest.raises(RuntimeError) as msg:
213
- reader.rp_var.defaults.pre_r19__dot0_early()
214
-
215
- with pytest.raises(ValueError) as msg:
216
- reader.config_var("rp-3d")
217
- assert (
218
- msg.value.args[0] == "'config-vars' has no attribute 'rp-3d'.\n"
219
- "The most similar names are: rp-3d?, rp-des?."
220
- )
221
-
222
-
223
- def test_case_reader_input_parameter():
224
- number = InputParameter(raw_data=(("name", "n"), ("definition", "12.4")))
225
-
226
- assert number.name == "n"
227
- assert number.units == ""
228
- assert number.numeric_value == 12.4
229
- assert number.value == "12.4"
230
-
231
- length = InputParameter(raw_data=(("name", "x"), ("definition", "12.4 [m]")))
232
-
233
- assert length.name == "x"
234
- assert length.units == "m"
235
- assert length.numeric_value == 12.4
236
- assert length.value == "12.4 [m]"
237
-
238
- momentum = InputParameter(
239
- raw_data=(("name", "p"), ("definition", "12.4 [kg m s^-1]"))
240
- )
241
-
242
- assert momentum.name == "p"
243
- assert momentum.units == "kg m s^-1"
244
- assert momentum.numeric_value == 12.4
245
- assert momentum.value == "12.4 [kg m s^-1]"
246
-
247
- velocity = InputParameter(raw_data=(("name", "v"), ("definition", "2[m/s]")))
248
-
249
- assert velocity.name == "v"
250
- assert velocity.units == "m/s"
251
- assert velocity.numeric_value == 2
252
- assert velocity.value == "2 [m/s]"
253
-
254
- vel_data = [
255
- "real-1",
256
- [
257
- ("type", "real"),
258
- ["name", ("value", '"inlet_velocity"'), ("type", "string-class")],
259
- [
260
- "parameter-value",
261
- ("type", "real-class"),
262
- ("value", 20.0),
263
- ("min", False),
264
- ("max", False),
265
- ("units-quantity", "velocity"),
266
- ],
267
- ],
268
- ]
269
- velocity = InputParameterOld(raw_data=vel_data)
270
-
271
- assert velocity.name == "inlet_velocity"
272
- assert velocity.value == [
273
- "parameter-value",
274
- ("type", "real-class"),
275
- ("value", 20.0),
276
- ("min", False),
277
- ("max", False),
278
- ("units-quantity", "velocity"),
279
- ]
280
- assert velocity.units == "velocity"
281
- assert velocity.numeric_value == 20.0
282
-
283
-
284
- def test_lispy_for_multiline_string():
285
- assert lispy.parse('(define x "abc\ndef")') == ["define", "x", '"abc\ndef"']
286
-
287
-
288
- def test_lispy_for_quotes():
289
- assert lispy.parse(
290
- '(define x "\n(format \\"\n-------------------------\nRunning Original Settings\n------------------------\n\\")")'
291
- ) == [
292
- "define",
293
- "x",
294
- '"\n(format \\"\n-------------------------\nRunning Original Settings\n------------------------\n\\")"',
295
- ]
296
-
297
-
298
- def test_mesh_reader():
299
- mesh_file_2d = examples.download_file(
300
- "sample_2d_mesh.msh.h5",
301
- "pyfluent/surface_mesh",
302
- return_without_path=False,
303
- )
304
- mesh_file_3d = examples.download_file(
305
- "mixing_elbow.msh.h5",
306
- "pyfluent/mixing_elbow",
307
- return_without_path=False,
308
- )
309
- case_file = examples.download_file(
310
- "mixing_elbow.cas.h5",
311
- "pyfluent/mixing_elbow",
312
- return_without_path=False,
313
- )
314
- mesh_reader_2d = CaseReader(case_file_name=mesh_file_2d)
315
- mesh_reader_3d = CaseReader(case_file_name=mesh_file_3d)
316
- case_reader = CaseReader(case_file_name=case_file)
317
-
318
- assert mesh_reader_2d.get_mesh().get_mesh_type() == MeshType.SURFACE
319
- assert mesh_reader_3d.get_mesh().get_mesh_type() == MeshType.VOLUME
320
- assert case_reader.get_mesh().get_mesh_type() == MeshType.VOLUME
321
-
322
- assert mesh_reader_2d.precision() is None
323
- assert mesh_reader_3d.precision() is None
324
- assert case_reader.precision() == 2