ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev2__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.
- ansys/fluent/core/__init__.py +1 -1
- ansys/fluent/core/_version.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/walk_api.py +45 -18
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +395 -390
- ansys/fluent/core/generated/solver/settings_252.py +782 -306
- ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
- ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
- ansys/fluent/core/launcher/container_launcher.py +4 -3
- ansys/fluent/core/launcher/fluent_container.py +22 -19
- ansys/fluent/core/launcher/launcher.py +2 -2
- ansys/fluent/core/launcher/pim_launcher.py +2 -2
- ansys/fluent/core/launcher/slurm_launcher.py +2 -2
- ansys/fluent/core/launcher/standalone_launcher.py +2 -2
- ansys/fluent/core/logging.py +2 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/services/app_utilities.py +2 -1
- ansys/fluent/core/services/datamodel_se.py +141 -61
- ansys/fluent/core/services/field_data.py +252 -0
- ansys/fluent/core/services/interceptors.py +28 -2
- ansys/fluent/core/session.py +7 -2
- ansys/fluent/core/session_solver.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/WHEEL +1 -1
- ansys/fluent/core/docs/README.rst +0 -155
- ansys/fluent/tests/conftest.py +0 -415
- ansys/fluent/tests/fluent_fixtures.py +0 -195
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
- ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
- ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
- ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
- ansys/fluent/tests/test_aero_session.py +0 -88
- ansys/fluent/tests/test_batch_ops.py +0 -39
- ansys/fluent/tests/test_builtin_settings.py +0 -761
- ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
- ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
- ansys/fluent/tests/test_casereader.py +0 -324
- ansys/fluent/tests/test_codegen.py +0 -783
- ansys/fluent/tests/test_creatable.py +0 -31
- ansys/fluent/tests/test_data_model_cache.py +0 -434
- ansys/fluent/tests/test_datamodel_api.py +0 -449
- ansys/fluent/tests/test_datamodel_service.py +0 -814
- ansys/fluent/tests/test_datareader.py +0 -103
- ansys/fluent/tests/test_error_handling.py +0 -24
- ansys/fluent/tests/test_events_manager.py +0 -214
- ansys/fluent/tests/test_field_data.py +0 -466
- ansys/fluent/tests/test_file_session.py +0 -355
- ansys/fluent/tests/test_file_transfer_service.py +0 -165
- ansys/fluent/tests/test_fix_doc.py +0 -29
- ansys/fluent/tests/test_flobject.py +0 -1235
- ansys/fluent/tests/test_fluent_fixes.py +0 -106
- ansys/fluent/tests/test_fluent_session.py +0 -270
- ansys/fluent/tests/test_fluent_version.py +0 -66
- ansys/fluent/tests/test_fluent_version_marker.py +0 -65
- ansys/fluent/tests/test_icing_session.py +0 -9
- ansys/fluent/tests/test_launcher.py +0 -529
- ansys/fluent/tests/test_launcher_remote.py +0 -272
- ansys/fluent/tests/test_lispy.py +0 -40
- ansys/fluent/tests/test_logging.py +0 -16
- ansys/fluent/tests/test_mapped_api.py +0 -774
- ansys/fluent/tests/test_meshing_utilities.py +0 -2436
- ansys/fluent/tests/test_meshing_workflow.py +0 -421
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
- ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
- ansys/fluent/tests/test_preferences.py +0 -89
- ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
- ansys/fluent/tests/test_reduction.py +0 -484
- ansys/fluent/tests/test_rp_vars.py +0 -77
- ansys/fluent/tests/test_scheduler.py +0 -471
- ansys/fluent/tests/test_scheme_eval_222.py +0 -338
- ansys/fluent/tests/test_scheme_eval_231.py +0 -243
- ansys/fluent/tests/test_search.py +0 -344
- ansys/fluent/tests/test_session.py +0 -594
- ansys/fluent/tests/test_settings_api.py +0 -606
- ansys/fluent/tests/test_settings_reader.py +0 -85
- ansys/fluent/tests/test_slurm_future.py +0 -67
- ansys/fluent/tests/test_solution_variables.py +0 -241
- ansys/fluent/tests/test_solver_monitors.py +0 -83
- ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
- ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
- ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
- ansys/fluent/tests/test_solvermode/test_general.py +0 -109
- ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
- ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
- ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
- ansys/fluent/tests/test_solvermode/test_models.py +0 -99
- ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
- ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
- ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
- ansys/fluent/tests/test_streaming_services.py +0 -52
- ansys/fluent/tests/test_systemcoupling.py +0 -44
- ansys/fluent/tests/test_topy.py +0 -179
- ansys/fluent/tests/test_tui_api.py +0 -70
- ansys/fluent/tests/test_type_stub.py +0 -37
- ansys/fluent/tests/test_utils.py +0 -82
- ansys/fluent/tests/util/__init__.py +0 -36
- ansys/fluent/tests/util/meshing_workflow.py +0 -33
- ansys/fluent/tests/util/solver.py +0 -72
- ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
|
@@ -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
|