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,421 +0,0 @@
1
- from functools import partial
2
-
3
- import pytest
4
- from util.meshing_workflow import (
5
- assign_task_arguments,
6
- execute_task_with_pre_and_postcondition_checks,
7
- )
8
-
9
- from ansys.fluent.core import examples
10
- from ansys.fluent.core.utils.fluent_version import FluentVersion
11
-
12
-
13
- @pytest.mark.fluent_version(">=23.1")
14
- @pytest.mark.nightly
15
- @pytest.mark.codegen_required
16
- def test_mixing_elbow_meshing_workflow(
17
- watertight_workflow_session,
18
- mixing_elbow_geometry_filename,
19
- ):
20
- """This test covers generic meshing workflow behaviour."""
21
- meshing_session = watertight_workflow_session
22
- workflow = meshing_session.workflow
23
-
24
- ###############################################################################
25
-
26
- assign_task_args = partial(
27
- assign_task_arguments, workflow=workflow, check_state=True
28
- )
29
-
30
- execute_task_with_pre_and_postconditions = partial(
31
- execute_task_with_pre_and_postcondition_checks,
32
- workflow=workflow,
33
- )
34
-
35
- ###############################################################################
36
- # Import the CAD geometry
37
- # Query the task state before and after task execution
38
- assign_task_args(
39
- task_name="Import Geometry",
40
- FileName=mixing_elbow_geometry_filename,
41
- LengthUnit="in",
42
- )
43
-
44
- execute_task_with_pre_and_postconditions(task_name="Import Geometry")
45
-
46
- ###############################################################################
47
- # Add local sizing
48
- # Query the task state before and after task execution
49
- workflow.TaskObject["Add Local Sizing"].AddChildToTask()
50
-
51
- execute_task_with_pre_and_postconditions(task_name="Add Local Sizing")
52
-
53
- ###############################################################################
54
- # Generate the surface mesh
55
- # Query the task state before and after task execution
56
- assign_task_args(
57
- task_name="Generate the Surface Mesh", CFDSurfaceMeshControls={"MaxSize": 0.3}
58
- )
59
-
60
- execute_task_with_pre_and_postconditions(task_name="Generate the Surface Mesh")
61
-
62
- ###############################################################################
63
- # Describe the geometry
64
- # Query the task state before and after task execution
65
- describe_geo = workflow.TaskObject["Describe Geometry"]
66
- describe_geo.UpdateChildTasks(SetupTypeChanged=False)
67
- assign_task_args(
68
- task_name="Describe Geometry",
69
- SetupType="The geometry consists of only fluid regions with no voids",
70
- )
71
- describe_geo.UpdateChildTasks(SetupTypeChanged=True)
72
-
73
- execute_task_with_pre_and_postconditions(task_name="Describe Geometry")
74
-
75
- ###############################################################################
76
- # Update Boundaries Task
77
- # Query the task state before and after task execution
78
- assign_task_args(
79
- task_name="Update Boundaries",
80
- BoundaryLabelList=["wall-inlet"],
81
- BoundaryLabelTypeList=["wall"],
82
- OldBoundaryLabelList=["wall-inlet"],
83
- OldBoundaryLabelTypeList=["velocity-inlet"],
84
- )
85
-
86
- execute_task_with_pre_and_postconditions(task_name="Update Boundaries")
87
-
88
- ###############################################################################
89
- # Update your regions
90
- # Query the task state before and after task execution
91
-
92
- execute_task_with_pre_and_postconditions(task_name="Update Regions")
93
-
94
- ###############################################################################
95
- # Add Boundary Layers
96
- # Query the task state before and after task execution
97
- add_boundary_layer = workflow.TaskObject["Add Boundary Layers"]
98
- add_boundary_layer.AddChildToTask()
99
- add_boundary_layer.InsertCompoundChildTask()
100
- assign_task_args(
101
- task_name="smooth-transition_1", BLControlName="smooth-transition_1"
102
- )
103
- add_boundary_layer.Arguments = {}
104
-
105
- execute_task_with_pre_and_postconditions(task_name="Add Boundary Layers")
106
-
107
- ###############################################################################
108
- # Generate the volume mesh
109
- # Query the task state before and after task execution
110
- assign_task_args(
111
- task_name="Generate the Volume Mesh",
112
- VolumeFill="poly-hexcore",
113
- VolumeFillControls={"HexMaxCellLength": 0.3},
114
- )
115
-
116
- execute_task_with_pre_and_postconditions(task_name="Generate the Volume Mesh")
117
-
118
- ###############################################################################
119
- # Check the mesh in Meshing mode
120
- # TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
121
- if meshing_session.get_fluent_version() < FluentVersion.v231:
122
- meshing_session.tui.mesh.check_mesh()
123
-
124
-
125
- @pytest.mark.codegen_required
126
- def test_meshing_workflow_raises_exception_on_invalid_task_name(
127
- watertight_workflow_session,
128
- ):
129
- try:
130
- watertight_workflow_session.workflow.TaskObject["no such task"]
131
- except Exception:
132
- pass
133
- else:
134
- assert False
135
-
136
-
137
- """
138
- Cannot enable this test because meshing workflow makes invalid queries as
139
- soon as the meshing application is started:
140
-
141
- Error: workflow/cx-create-workflow-tree:Invalid query for child TaskType from parent /Workflow
142
- Error Object: ()
143
-
144
-
145
- def test_meshing_workflow_raises_exception_on_invalid_key_in_task_args(
146
- model_object_throws_on_invalid_arg,
147
- watertight_workflow_session,
148
- mixing_elbow_geometry_filename
149
- ):
150
- # task_names = ("Import Geometry", "Add Local Sizing")
151
- task_names = ("Add Local Sizing",)
152
- for task_name in task_names:
153
- task = watertight_workflow_session.workflow.TaskObject[task_name]
154
- try:
155
- task.Arguments = {"no such arg": 42}
156
- except Exception:
157
- pass
158
- else:
159
- assert False
160
-
161
- def test_meshing_workflow_raises_exception_on_invalid_key_in_task_args_2(
162
- model_object_throws_on_invalid_arg,
163
- watertight_workflow_session,
164
- mixing_elbow_geometry_filename
165
- ):
166
- workflow = watertight_workflow_session.workflow
167
- assign_task_args = partial(
168
- assign_task_arguments, workflow=workflow, check_state=False
169
- )
170
-
171
- assign_task_args(
172
- task_name="Import Geometry", FileName=mixing_elbow_geometry_filename, LengthUnit="in"
173
- )
174
-
175
- workflow.TaskObject["Import Geometry"].Execute()
176
-
177
- try:
178
- assign_task_args(
179
- task_name="Add Local Sizing", XXX=42
180
- )
181
- except:
182
- pass
183
- else:
184
- assert False
185
- """
186
-
187
-
188
- @pytest.mark.skip("Wait for later implementation.")
189
- @pytest.mark.fluent_version(">=23.1")
190
- @pytest.mark.codegen_required
191
- def test_read_only_behaviour_of_command_arguments(new_meshing_session):
192
- session_new = new_meshing_session
193
- w = session_new.workflow
194
- m = session_new.meshing.ImportGeometry.create_instance
195
- w.InitializeWorkflow(WorkflowType="Watertight Geometry")
196
- import_geom = w.TaskObject["Import Geometry"]
197
-
198
- with pytest.raises(AttributeError):
199
- import_geom.arguments.MeshUnit.set_state("in")
200
-
201
- with pytest.raises(AttributeError):
202
- import_geom.arguments.CadImportOptions.OneZonePer.set_state(None)
203
-
204
- assert "set_state" in dir(m())
205
- assert "set_state" in dir(m().NumParts)
206
-
207
-
208
- @pytest.mark.codegen_required
209
- def test_dummy_journal_data_model_methods(new_meshing_session):
210
- session_new = new_meshing_session
211
- w = session_new.workflow
212
- w.InitializeWorkflow(WorkflowType="Watertight Geometry")
213
- import_geom = w.TaskObject["Import Geometry"]
214
-
215
- with pytest.raises(AttributeError):
216
- import_geom.delete_child()
217
-
218
-
219
- @pytest.mark.codegen_required
220
- def test_iterate_meshing_workflow_task_container(new_meshing_session):
221
- workflow = new_meshing_session.workflow
222
- workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
223
- tasks = [task for task in workflow.TaskObject]
224
- assert len(tasks) == 11
225
- assert tasks[0].name() == "Import Geometry"
226
-
227
-
228
- @pytest.mark.codegen_required
229
- def test_nonexistent_attrs(new_meshing_session):
230
- meshing = new_meshing_session
231
- assert not hasattr(meshing.workflow, "xyz")
232
- with pytest.raises(AttributeError):
233
- meshing.workflow.xyz
234
-
235
-
236
- @pytest.mark.codegen_required
237
- @pytest.mark.fluent_version(">=23.2")
238
- def test_old_workflow_structure(new_meshing_session):
239
- meshing = new_meshing_session
240
- meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
241
- assert meshing.workflow.TaskObject["Import Geometry"]
242
- with pytest.raises(AttributeError):
243
- meshing.workflow.import_geometry
244
-
245
-
246
- @pytest.mark.nightly
247
- @pytest.mark.codegen_required
248
- @pytest.mark.fluent_version("==24.2")
249
- def test_new_2d_meshing_workflow(new_meshing_session):
250
- # Import geometry
251
- import_file_name = examples.download_file("NACA0012.fmd", "pyfluent/airfoils")
252
- meshing = new_meshing_session
253
- meshing.workflow.InitializeWorkflow(WorkflowType="2D Meshing")
254
- meshing.workflow.TaskObject["Load CAD Geometry"].Arguments.set_state(
255
- {
256
- r"FileName": import_file_name,
257
- r"LengthUnit": r"mm",
258
- r"Refaceting": {
259
- r"Refacet": False,
260
- },
261
- }
262
- )
263
- meshing.workflow.TaskObject["Load CAD Geometry"].Execute()
264
-
265
- meshing.workflow.TaskObject["Update Regions"].Execute()
266
- meshing.workflow.TaskObject["Update Boundaries"].Arguments.set_state(
267
- {
268
- r"SelectionType": r"zone",
269
- }
270
- )
271
- meshing.workflow.TaskObject["Update Boundaries"].Execute()
272
-
273
- meshing.workflow.TaskObject["Define Global Sizing"].Arguments.set_state(
274
- {
275
- r"CurvatureNormalAngle": 20,
276
- r"MaxSize": 2000,
277
- r"MinSize": 5,
278
- r"SizeFunctions": r"Curvature",
279
- }
280
- )
281
- meshing.workflow.TaskObject["Define Global Sizing"].Execute()
282
-
283
- meshing.workflow.TaskObject["Add Local Sizing"].Arguments.set_state(
284
- {
285
- r"AddChild": r"yes",
286
- r"BOIControlName": r"boi_1",
287
- r"BOIExecution": r"Body Of Influence",
288
- r"BOIFaceLabelList": [r"boi"],
289
- r"BOISize": 50,
290
- r"BOIZoneorLabel": r"label",
291
- r"DrawSizeControl": True,
292
- }
293
- )
294
- meshing.workflow.TaskObject["Add Local Sizing"].AddChildAndUpdate(DeferUpdate=False)
295
-
296
- meshing.workflow.TaskObject["Add Local Sizing"].Arguments.set_state(
297
- {
298
- r"AddChild": r"yes",
299
- r"BOIControlName": r"edgesize_1",
300
- r"BOIExecution": r"Edge Size",
301
- r"BOISize": 5,
302
- r"BOIZoneorLabel": r"label",
303
- r"DrawSizeControl": True,
304
- r"EdgeLabelList": [r"airfoil-te"],
305
- }
306
- )
307
- meshing.workflow.TaskObject["Add Local Sizing"].AddChildAndUpdate(DeferUpdate=False)
308
-
309
- meshing.workflow.TaskObject["Add Local Sizing"].Arguments.set_state(
310
- {
311
- r"AddChild": r"yes",
312
- r"BOIControlName": r"curvature_1",
313
- r"BOICurvatureNormalAngle": 10,
314
- r"BOIExecution": r"Curvature",
315
- r"BOIMaxSize": 2,
316
- r"BOIMinSize": 1.5,
317
- r"BOIScopeTo": r"edges",
318
- r"BOIZoneorLabel": r"label",
319
- r"DrawSizeControl": True,
320
- r"EdgeLabelList": [r"airfoil"],
321
- }
322
- )
323
- meshing.workflow.TaskObject["Add Local Sizing"].AddChildAndUpdate(DeferUpdate=False)
324
-
325
- meshing.workflow.TaskObject["Add 2D Boundary Layers"].Arguments.set_state(
326
- {
327
- r"AddChild": r"yes",
328
- r"BLControlName": r"aspect-ratio_1",
329
- r"NumberOfLayers": 4,
330
- r"OffsetMethodType": r"aspect-ratio",
331
- }
332
- )
333
- meshing.workflow.TaskObject["Add 2D Boundary Layers"].AddChildAndUpdate(
334
- DeferUpdate=False
335
- )
336
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments.set_state(
337
- {
338
- r"Surface2DPreferences": {
339
- r"MergeEdgeZonesBasedOnLabels": r"no",
340
- r"MergeFaceZonesBasedOnLabels": r"no",
341
- r"ShowAdvancedOptions": True,
342
- },
343
- }
344
- )
345
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
346
-
347
- meshing.workflow.TaskObject["aspect-ratio_1"].Revert()
348
- meshing.workflow.TaskObject["aspect-ratio_1"].Arguments.set_state(
349
- {
350
- r"AddChild": r"yes",
351
- r"BLControlName": r"uniform_1",
352
- r"FirstLayerHeight": 2,
353
- r"NumberOfLayers": 4,
354
- r"OffsetMethodType": r"uniform",
355
- }
356
- )
357
- meshing.workflow.TaskObject["aspect-ratio_1"].Execute()
358
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments.set_state(None)
359
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments.set_state(
360
- {
361
- r"Surface2DPreferences": {
362
- r"MergeEdgeZonesBasedOnLabels": r"no",
363
- r"MergeFaceZonesBasedOnLabels": r"no",
364
- r"ShowAdvancedOptions": True,
365
- },
366
- }
367
- )
368
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
369
- meshing.workflow.TaskObject["uniform_1"].Revert()
370
- meshing.workflow.TaskObject["uniform_1"].Arguments.set_state(
371
- {
372
- r"AddChild": r"yes",
373
- r"BLControlName": r"smooth-transition_1",
374
- r"FirstLayerHeight": 2,
375
- r"NumberOfLayers": 7,
376
- r"OffsetMethodType": r"smooth-transition",
377
- }
378
- )
379
- meshing.workflow.TaskObject["uniform_1"].Execute()
380
-
381
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments.set_state(None)
382
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments.set_state(
383
- {
384
- r"Surface2DPreferences": {
385
- r"MergeEdgeZonesBasedOnLabels": r"no",
386
- r"MergeFaceZonesBasedOnLabels": r"no",
387
- r"ShowAdvancedOptions": True,
388
- },
389
- }
390
- )
391
- meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
392
-
393
- meshing.workflow.TaskObject["Export Fluent 2D Mesh"].Arguments.set_state(
394
- {
395
- r"FileName": r"C:\ANSYSDev\PyFluent_Dev_01\pyfluent\out\case1.msh.h5",
396
- }
397
- )
398
- meshing.workflow.TaskObject["Export Fluent 2D Mesh"].Execute()
399
-
400
- # Switch to solution mode
401
- solver = meshing.switch_to_solver()
402
- assert solver
403
-
404
-
405
- @pytest.mark.fluent_version(">=24.1")
406
- def test_setting_none_type_tasks(new_meshing_session):
407
- meshing = new_meshing_session
408
- meshing.workflow.InitializeWorkflow(WorkflowType=r"Fault-tolerant Meshing")
409
- meshing.workflow.setState(
410
- {
411
- r"TaskObject:Describe Overset Features": {},
412
- }
413
- )
414
- meshing.workflow.TaskObject["Describe Overset Features"].CommandName.setState(
415
- r"OversetOptions"
416
- )
417
-
418
- assert (
419
- meshing.workflow.TaskObject["Describe Overset Features"].CommandName()
420
- == "DescribeOversetFeatures"
421
- )
@@ -1,168 +0,0 @@
1
- import os
2
-
3
- import pytest
4
-
5
- from ansys.fluent.core import MeshingEvent
6
- from ansys.fluent.core.examples.downloads import download_file
7
-
8
-
9
- @pytest.mark.nightly
10
- @pytest.mark.fluent_version("latest")
11
- @pytest.mark.codegen_required
12
- def test_launch_pure_meshing(mixing_elbow_watertight_pure_meshing_session):
13
- pure_meshing_session = mixing_elbow_watertight_pure_meshing_session
14
- assert pure_meshing_session.health_check.is_serving
15
- file_name = "launch_pure_meshing_journal.py"
16
- pure_meshing_session.journal.start(file_name)
17
- session_dir = dir(pure_meshing_session)
18
- for attr in ("fields", "meshing", "workflow"):
19
- assert attr in session_dir
20
- workflow = pure_meshing_session.workflow
21
- workflow.TaskObject["Import Geometry"].Execute()
22
-
23
- add_local_sizing = workflow.TaskObject["Add Local Sizing"]
24
- add_local_sizing.AddChildToTask()
25
- add_local_sizing.Execute()
26
-
27
- surface_mesh_gen = workflow.TaskObject["Generate the Surface Mesh"]
28
- surface_mesh_gen.Arguments = {"CFDSurfaceMeshControls": {"MaxSize": 0.3}}
29
- surface_mesh_gen.Execute()
30
-
31
- describe_geo = workflow.TaskObject["Describe Geometry"]
32
- describe_geo.UpdateChildTasks(SetupTypeChanged=False)
33
- describe_geo.Arguments = dict(
34
- SetupType="The geometry consists of only fluid regions with no voids"
35
- )
36
- describe_geo.UpdateChildTasks(SetupTypeChanged=True)
37
- describe_geo.Execute()
38
-
39
- boundary_update = workflow.TaskObject["Update Boundaries"]
40
- boundary_update.Arguments = {
41
- "BoundaryLabelList": ["wall-inlet"],
42
- "BoundaryLabelTypeList": ["wall"],
43
- "OldBoundaryLabelList": ["wall-inlet"],
44
- "OldBoundaryLabelTypeList": ["velocity-inlet"],
45
- }
46
- boundary_update.Execute()
47
-
48
- workflow.TaskObject["Update Regions"].Execute()
49
-
50
- add_boundary_layers = workflow.TaskObject["Add Boundary Layers"]
51
- add_boundary_layers.AddChildToTask()
52
- add_boundary_layers.InsertCompoundChildTask()
53
- smooth_transition_1 = workflow.TaskObject["smooth-transition_1"]
54
- smooth_transition_1.Arguments = {
55
- "BLControlName": "smooth-transition_1",
56
- }
57
- add_boundary_layers.Arguments = {}
58
- smooth_transition_1.Execute()
59
- volume_mesh_gen = workflow.TaskObject["Generate the Volume Mesh"]
60
- volume_mesh_gen.Arguments = {
61
- "VolumeFill": "poly-hexcore",
62
- "VolumeFillControls": {
63
- "HexMaxCellLength": 0.3,
64
- },
65
- }
66
- volume_mesh_gen.Execute()
67
-
68
- pure_meshing_session.journal.stop()
69
- with pytest.raises(AttributeError):
70
- pure_meshing_session.switch_to_solver()
71
- pure_meshing_session.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
72
- geom_name = download_file("mixing_elbow.pmdb", "pyfluent/mixing_elbow")
73
- pure_meshing_session.workflow.TaskObject["Import Geometry"].Arguments = dict(
74
- FileName=geom_name, LengthUnit="in"
75
- )
76
- pure_meshing_session.tui.file.read_journal(file_name)
77
- if os.path.exists(file_name):
78
- os.remove(file_name)
79
-
80
-
81
- @pytest.mark.fluent_version("latest")
82
- @pytest.mark.codegen_required
83
- def test_launch_meshing_and_switch(new_meshing_session):
84
- meshing = new_meshing_session
85
- assert not meshing.switched
86
- _ = meshing.switch_to_solver()
87
- assert meshing.switched
88
- assert not meshing.tui
89
- assert not meshing.meshing
90
- assert not meshing.workflow
91
- assert not meshing.watertight
92
-
93
-
94
- @pytest.mark.fluent_version("latest")
95
- @pytest.mark.codegen_required
96
- def test_meshing_streaming_and_switch(new_meshing_session):
97
-
98
- def on_case_loaded(session, event_info):
99
- on_case_loaded.loaded = True
100
-
101
- on_case_loaded.loaded = False
102
-
103
- def on_trancript(transcript):
104
- on_trancript.called = True
105
-
106
- on_trancript.called = False
107
-
108
- meshing = new_meshing_session
109
-
110
- meshing.events.register_callback(MeshingEvent.CASE_LOADED, on_case_loaded)
111
- meshing.transcript.register_callback(on_trancript)
112
-
113
- solver = meshing.switch_to_solver()
114
-
115
- on_trancript.called = False
116
-
117
- case_file_name = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
118
-
119
- try:
120
- solver.settings.file.read_case(file_name=case_file_name)
121
- except AttributeError:
122
- solver.tui.file.read_case(case_file_name)
123
-
124
- assert not on_trancript.called
125
- assert not on_case_loaded.loaded
126
-
127
-
128
- @pytest.mark.fluent_version("latest")
129
- @pytest.mark.codegen_required
130
- def test_meshing_no_foreign_objects(new_meshing_session):
131
- meshing = new_meshing_session
132
- with pytest.raises(AttributeError):
133
- meshing.monitors
134
-
135
-
136
- def test_fake_session():
137
-
138
- class fake_session_base:
139
-
140
- def bar(self):
141
- pass
142
-
143
- class fake_session(fake_session_base):
144
-
145
- def __init__(self) -> None:
146
- self.switched = False
147
-
148
- def __getattribute__(self, item: str):
149
- if item == "switched":
150
- return super(fake_session, self).__getattribute__(item)
151
-
152
- if self.switched:
153
- return None
154
-
155
- return super(fake_session, self).__getattribute__(item)
156
-
157
- def foo(self):
158
- return 42
159
-
160
- f = fake_session()
161
-
162
- assert f.foo() == 42
163
-
164
- f.switched = True
165
-
166
- assert f.foo is None
167
-
168
- assert f.bar is None