ansys-fluent-core 0.27.dev1__py3-none-any.whl → 0.28.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansys-fluent-core might be problematic. Click here for more details.
- ansys/fluent/core/__init__.py +22 -9
- ansys/fluent/core/_version.py +5 -2
- ansys/fluent/core/codegen/__init__.py +0 -3
- ansys/fluent/core/codegen/allapigen.py +1 -5
- ansys/fluent/core/codegen/builtin_settingsgen.py +44 -10
- ansys/fluent/core/codegen/datamodelgen.py +53 -12
- ansys/fluent/core/codegen/settingsgen.py +21 -12
- ansys/fluent/core/codegen/settingsgen_old.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/write_settings_yaml.py +3 -4
- ansys/fluent/core/data_model_cache.py +132 -70
- ansys/fluent/core/docs/README.rst +2 -2
- ansys/fluent/core/examples/downloads.py +3 -5
- ansys/fluent/core/exceptions.py +1 -0
- ansys/fluent/core/file_session.py +59 -131
- ansys/fluent/core/filereader/case_file.py +17 -17
- ansys/fluent/core/filereader/casereader.py +2 -1
- ansys/fluent/core/filereader/data_file.py +7 -7
- ansys/fluent/core/filereader/lispy.py +6 -1
- ansys/fluent/core/fluent_connection.py +35 -7
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_222/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_222/PartManagement.py +28 -28
- ansys/fluent/core/generated/datamodel_222/meshing.py +301 -301
- ansys/fluent/core/generated/datamodel_222/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_231/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_231/PartManagement.py +55 -55
- ansys/fluent/core/generated/datamodel_231/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_231/meshing.py +317 -317
- ansys/fluent/core/generated/datamodel_231/solverworkflow.py +51 -51
- ansys/fluent/core/generated/datamodel_231/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_232/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_232/PartManagement.py +55 -55
- ansys/fluent/core/generated/datamodel_232/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_232/meshing.py +335 -335
- ansys/fluent/core/generated/datamodel_232/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_232/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_241/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_241/PartManagement.py +57 -57
- ansys/fluent/core/generated/datamodel_241/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_241/meshing.py +361 -361
- ansys/fluent/core/generated/datamodel_241/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_241/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_242/MeshingUtilities.py +240 -240
- ansys/fluent/core/generated/datamodel_242/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_242/PartManagement.py +60 -60
- ansys/fluent/core/generated/datamodel_242/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_242/meshing.py +371 -371
- ansys/fluent/core/generated/datamodel_242/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_242/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_251/MeshingUtilities.py +244 -244
- ansys/fluent/core/generated/datamodel_251/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_251/PartManagement.py +60 -60
- ansys/fluent/core/generated/datamodel_251/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_251/meshing.py +384 -382
- ansys/fluent/core/generated/datamodel_251/preferences.py +7 -0
- ansys/fluent/core/generated/datamodel_251/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_251/workflow.py +10 -10
- ansys/fluent/core/generated/datamodel_252/MeshingUtilities.py +3664 -0
- ansys/fluent/core/generated/datamodel_252/PMFileManagement.py +288 -0
- ansys/fluent/core/generated/datamodel_252/PartManagement.py +2588 -0
- ansys/fluent/core/generated/datamodel_252/flicing.py +7972 -0
- ansys/fluent/core/generated/datamodel_252/meshing.py +2644 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +2760 -0
- ansys/fluent/core/generated/datamodel_252/solverworkflow.py +479 -0
- ansys/fluent/core/generated/datamodel_252/workflow.py +466 -0
- ansys/fluent/core/generated/fluent_version_251.py +4 -4
- ansys/fluent/core/generated/fluent_version_252.py +5 -0
- ansys/fluent/core/generated/meshing/tui_251.py +1139 -1179
- ansys/fluent/core/generated/meshing/tui_252.py +10181 -0
- ansys/fluent/core/generated/solver/settings_222.py +3 -3
- ansys/fluent/core/generated/solver/settings_231.py +4 -4
- ansys/fluent/core/generated/solver/settings_232.py +5 -5
- ansys/fluent/core/generated/solver/settings_241.py +5 -5
- ansys/fluent/core/generated/solver/settings_242.py +1185 -1185
- ansys/fluent/core/generated/solver/settings_251.py +1847 -1652
- ansys/fluent/core/generated/solver/settings_251.pyi +237 -211
- ansys/fluent/core/generated/solver/settings_252.py +90369 -0
- ansys/fluent/core/generated/solver/settings_252.pyi +63778 -0
- ansys/fluent/core/generated/solver/settings_builtin.py +612 -1
- ansys/fluent/core/generated/solver/settings_builtin.pyi +235 -0
- ansys/fluent/core/generated/solver/tui_251.py +2283 -2103
- ansys/fluent/core/generated/solver/tui_252.py +37720 -0
- ansys/fluent/core/journaling.py +1 -1
- ansys/fluent/core/launcher/error_handler.py +3 -0
- ansys/fluent/core/launcher/fluent_container.py +5 -0
- ansys/fluent/core/launcher/launcher.py +1 -2
- ansys/fluent/core/launcher/launcher_utils.py +17 -6
- ansys/fluent/core/launcher/process_launch_string.py +3 -3
- ansys/fluent/core/launcher/pyfluent_enums.py +1 -1
- ansys/fluent/core/launcher/slurm_launcher.py +2 -1
- ansys/fluent/core/launcher/standalone_launcher.py +11 -5
- ansys/fluent/core/launcher/watchdog.py +1 -1
- ansys/fluent/core/launcher/watchdog_exec +6 -3
- ansys/fluent/core/logging.py +1 -5
- ansys/fluent/core/parametric.py +6 -3
- ansys/fluent/core/post_objects/meta.py +1 -39
- ansys/fluent/core/post_objects/post_helper.py +4 -3
- ansys/fluent/core/post_objects/post_object_definitions.py +12 -7
- ansys/fluent/core/post_objects/post_objects_container.py +39 -2
- ansys/fluent/core/rpvars.py +2 -1
- ansys/fluent/core/scheduler/machine_list.py +3 -1
- ansys/fluent/core/search.py +109 -262
- ansys/fluent/core/services/__init__.py +3 -0
- ansys/fluent/core/services/api_upgrade.py +1 -0
- ansys/fluent/core/services/batch_ops.py +3 -1
- ansys/fluent/core/services/datamodel_se.py +37 -30
- ansys/fluent/core/services/datamodel_tui.py +8 -3
- ansys/fluent/core/services/deprecated_field_data.py +691 -0
- ansys/fluent/core/services/field_data.py +67 -357
- ansys/fluent/core/services/interceptors.py +6 -4
- ansys/fluent/core/services/reduction.py +1 -2
- ansys/fluent/core/services/scheme_eval.py +2 -3
- ansys/fluent/core/services/solution_variables.py +46 -48
- ansys/fluent/core/session.py +6 -4
- ansys/fluent/core/session_meshing.pyi +5 -0
- ansys/fluent/core/session_pure_meshing.pyi +4 -1
- ansys/fluent/core/session_solver_lite.py +2 -1
- ansys/fluent/core/solver/flobject.py +179 -207
- ansys/fluent/core/solver/flunits.py +65 -56
- ansys/fluent/core/solver/function/reduction.py +9 -29
- ansys/fluent/core/solver/settings_builtin_bases.py +28 -22
- ansys/fluent/core/solver/settings_builtin_data.py +105 -1
- ansys/fluent/core/solver/settings_external.py +0 -28
- ansys/fluent/core/streaming_services/field_data_streaming.py +1 -0
- ansys/fluent/core/streaming_services/monitor_streaming.py +0 -1
- ansys/fluent/core/systemcoupling.py +145 -14
- ansys/fluent/core/utils/__init__.py +18 -2
- ansys/fluent/core/utils/dump_session_data.py +7 -4
- ansys/fluent/core/utils/execution.py +2 -2
- ansys/fluent/core/utils/file_transfer_service.py +37 -42
- ansys/fluent/core/utils/fluent_version.py +20 -2
- ansys/fluent/core/utils/networking.py +39 -1
- ansys/fluent/core/workflow.py +3 -15
- ansys/fluent/tests/conftest.py +89 -7
- ansys/fluent/tests/fluent/test_version/test.py +2 -0
- ansys/fluent/tests/fluent_fixtures.py +195 -0
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +7 -7
- ansys/fluent/tests/parametric/test_parametric_workflow.py +14 -4
- ansys/fluent/tests/test_builtin_settings.py +28 -0
- ansys/fluent/tests/test_cad_to_post_ftm.py +1 -3
- ansys/fluent/tests/test_cad_to_post_wtm.py +1 -1
- ansys/fluent/tests/test_casereader.py +1 -1
- ansys/fluent/tests/test_codegen.py +116 -6
- ansys/fluent/tests/test_data_model_cache.py +1 -1
- ansys/fluent/tests/test_datamodel_service.py +14 -19
- ansys/fluent/tests/test_field_data.py +93 -45
- ansys/fluent/tests/test_file_session.py +32 -29
- ansys/fluent/tests/test_flobject.py +16 -58
- ansys/fluent/tests/test_fluent_fixes.py +5 -5
- ansys/fluent/tests/test_fluent_session.py +11 -8
- ansys/fluent/tests/test_fluent_version.py +1 -1
- ansys/fluent/tests/test_launcher.py +22 -5
- ansys/fluent/tests/test_launcher_remote.py +80 -4
- ansys/fluent/tests/test_meshing_utilities.py +93 -44
- ansys/fluent/tests/test_meshing_workflow.py +6 -6
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +1 -1
- ansys/fluent/tests/test_new_meshing_workflow.py +42 -3
- ansys/fluent/tests/test_preferences.py +6 -6
- ansys/fluent/tests/test_reduction.py +61 -30
- ansys/fluent/tests/test_rp_vars.py +1 -1
- ansys/fluent/tests/test_search.py +53 -200
- ansys/fluent/tests/test_session.py +18 -13
- ansys/fluent/tests/test_settings_api.py +93 -29
- ansys/fluent/tests/test_settings_reader.py +1 -1
- ansys/fluent/tests/test_solver_monitors.py +1 -1
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +4 -4
- ansys/fluent/tests/test_solvermode/test_controls.py +3 -3
- ansys/fluent/tests/test_solvermode/test_methods.py +1 -1
- ansys/fluent/tests/test_solvermode/test_models.py +3 -3
- ansys/fluent/tests/test_systemcoupling.py +33 -5
- ansys/fluent/tests/test_topy.py +2 -2
- ansys/fluent/tests/test_tui_api.py +5 -5
- ansys/fluent/tests/test_utils.py +1 -1
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/METADATA +6 -17
- ansys_fluent_core-0.28.dev0.dist-info/RECORD +291 -0
- ansys/fluent/core/generated/api_tree_222.pickle +0 -0
- ansys/fluent/core/generated/api_tree_231.pickle +0 -0
- ansys/fluent/core/generated/api_tree_232.pickle +0 -0
- ansys/fluent/core/generated/api_tree_241.pickle +0 -0
- ansys/fluent/core/generated/api_tree_242.pickle +0 -0
- ansys/fluent/core/generated/api_tree_251.pickle +0 -0
- ansys/fluent/tests/test_tests_util.py +0 -47
- ansys/fluent/tests/util/__init__.py +0 -38
- ansys_fluent_core-0.27.dev1.dist-info/RECORD +0 -283
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/AUTHORS +0 -0
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/LICENSE +0 -0
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/WHEEL +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
2
4
|
|
|
5
|
+
from ansys.fluent.core.examples import download_file
|
|
3
6
|
from ansys.fluent.core.services.reduction import _locn_names_and_objs
|
|
4
|
-
from
|
|
7
|
+
from ansys.fluent.core.solver.function import reduction
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
def _test_locn_extraction(solver1, solver2):
|
|
@@ -59,7 +62,7 @@ def _test_area_average(solver):
|
|
|
59
62
|
"AreaAve(AbsolutePressure, ['inlet1'])"
|
|
60
63
|
)
|
|
61
64
|
expr_val = solver_named_expressions["test_expr_1"].get_value()
|
|
62
|
-
assert
|
|
65
|
+
assert isinstance(expr_val, float) and expr_val != 0.0
|
|
63
66
|
val = solver.fields.reduction.area_average(
|
|
64
67
|
expression="AbsolutePressure",
|
|
65
68
|
locations=solver.setup.boundary_conditions.velocity_inlet,
|
|
@@ -69,28 +72,22 @@ def _test_area_average(solver):
|
|
|
69
72
|
|
|
70
73
|
|
|
71
74
|
def _test_min(solver1, solver2):
|
|
72
|
-
solver1.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
expected_result = test_expr2.get_value()
|
|
83
|
-
result = solver1.fields.reduction.minimum(
|
|
84
|
-
expression=test_expr1.definition(),
|
|
75
|
+
s1_min = solver1.fields.reduction.minimum(
|
|
76
|
+
expression="AbsolutePressure",
|
|
77
|
+
locations=[solver1.setup.boundary_conditions.velocity_inlet],
|
|
78
|
+
)
|
|
79
|
+
s2_min = solver2.fields.reduction.minimum(
|
|
80
|
+
expression="AbsolutePressure",
|
|
81
|
+
locations=[solver2.setup.boundary_conditions.velocity_inlet],
|
|
82
|
+
)
|
|
83
|
+
result = reduction.minimum(
|
|
84
|
+
expression="AbsolutePressure",
|
|
85
85
|
locations=[
|
|
86
|
-
solver1.setup.boundary_conditions
|
|
87
|
-
solver2.setup.boundary_conditions
|
|
86
|
+
solver1.setup.boundary_conditions.velocity_inlet,
|
|
87
|
+
solver2.setup.boundary_conditions.velocity_inlet,
|
|
88
88
|
],
|
|
89
89
|
)
|
|
90
|
-
|
|
91
|
-
# assert result == expected_result
|
|
92
|
-
solver1.setup.named_expressions.pop(key="test_expr_1")
|
|
93
|
-
solver1.setup.named_expressions.pop(key="test_expr_2")
|
|
90
|
+
assert result == min(s1_min, s2_min)
|
|
94
91
|
|
|
95
92
|
|
|
96
93
|
def _test_count(solver):
|
|
@@ -260,7 +257,7 @@ def _test_area_integrated_average(solver1, solver2):
|
|
|
260
257
|
|
|
261
258
|
def _test_error_handling(solver):
|
|
262
259
|
if int(solver._version) < 241:
|
|
263
|
-
with pytest.raises(RuntimeError)
|
|
260
|
+
with pytest.raises(RuntimeError):
|
|
264
261
|
solver.fields.reduction.area_average(
|
|
265
262
|
expression="AbsoluteVelocity", # This is a wrong expression intentionally passed
|
|
266
263
|
locations=solver.setup.boundary_conditions.velocity_inlet,
|
|
@@ -333,7 +330,7 @@ def _test_sum(solver):
|
|
|
333
330
|
"Sum(AbsolutePressure, ['inlet1'], Weight=Area)"
|
|
334
331
|
)
|
|
335
332
|
expr_val = solver.setup.named_expressions["test_expr_1"].get_value()
|
|
336
|
-
assert
|
|
333
|
+
assert isinstance(expr_val, float) and expr_val != 0.0
|
|
337
334
|
|
|
338
335
|
val = solver.fields.reduction.sum(
|
|
339
336
|
expression="AbsolutePressure",
|
|
@@ -352,7 +349,7 @@ def _test_sum_if(solver):
|
|
|
352
349
|
"SumIf(AbsolutePressure, AbsolutePressure > 0[Pa], ['inlet1'], Weight=Area)"
|
|
353
350
|
)
|
|
354
351
|
expr_val = solver.setup.named_expressions["test_expr_1"].get_value()
|
|
355
|
-
assert
|
|
352
|
+
assert isinstance(expr_val, float) and expr_val != 0.0
|
|
356
353
|
|
|
357
354
|
val = solver.fields.reduction.sum_if(
|
|
358
355
|
expression="AbsolutePressure",
|
|
@@ -365,18 +362,40 @@ def _test_sum_if(solver):
|
|
|
365
362
|
solver.setup.named_expressions.pop(key="test_expr_1")
|
|
366
363
|
|
|
367
364
|
|
|
368
|
-
|
|
365
|
+
def _test_centroid_2_sources(solver1, solver2):
|
|
366
|
+
s1_cent = solver1.fields.reduction.centroid(
|
|
367
|
+
locations=[solver1.setup.boundary_conditions.velocity_inlet]
|
|
368
|
+
)
|
|
369
|
+
s2_cent = solver2.fields.reduction.centroid(
|
|
370
|
+
locations=[solver2.setup.boundary_conditions.velocity_inlet]
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
result = reduction.centroid(
|
|
374
|
+
locations=[
|
|
375
|
+
solver1.setup.boundary_conditions.velocity_inlet,
|
|
376
|
+
solver2.setup.boundary_conditions.velocity_inlet,
|
|
377
|
+
]
|
|
378
|
+
)
|
|
379
|
+
assert [round(x, 5) for x in result] == [
|
|
380
|
+
(round(x, 5) + round(y, 5)) / 2 for x, y in zip(*[s1_cent, s2_cent])
|
|
381
|
+
]
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
@pytest.fixture
|
|
385
|
+
def static_mixer_case_session2(static_mixer_case_session: Any):
|
|
386
|
+
return static_mixer_case_session
|
|
369
387
|
|
|
370
388
|
|
|
371
389
|
@pytest.mark.nightly
|
|
372
390
|
@pytest.mark.fluent_version(">=23.1")
|
|
373
|
-
def test_reductions(
|
|
391
|
+
def test_reductions(
|
|
392
|
+
static_mixer_case_session: Any, static_mixer_case_session2: Any
|
|
393
|
+
) -> None:
|
|
374
394
|
solver1 = static_mixer_case_session
|
|
375
395
|
solver2 = static_mixer_case_session2
|
|
376
396
|
_test_context(solver1)
|
|
377
397
|
_test_locn_extraction(solver1, solver2)
|
|
378
398
|
_test_area_average(solver1)
|
|
379
|
-
_test_min(solver1, solver2)
|
|
380
399
|
_test_count(solver1)
|
|
381
400
|
_test_count_if(solver1)
|
|
382
401
|
_test_centroid(solver1)
|
|
@@ -386,10 +405,23 @@ def test_reductions(static_mixer_case_session, static_mixer_case_session2) -> No
|
|
|
386
405
|
_test_moment(solver1)
|
|
387
406
|
_test_sum(solver1)
|
|
388
407
|
_test_sum_if(solver1)
|
|
408
|
+
# The case and data are changed after this point to check the functional reduction with multiple solvers
|
|
409
|
+
case_path = download_file(
|
|
410
|
+
file_name="exhaust_system.cas.h5", directory="pyfluent/exhaust_system"
|
|
411
|
+
)
|
|
412
|
+
download_file(
|
|
413
|
+
file_name="exhaust_system.dat.h5", directory="pyfluent/exhaust_system"
|
|
414
|
+
)
|
|
415
|
+
solver1.file.read_case_data(file_name=case_path)
|
|
416
|
+
case_path1 = download_file("elbow1.cas.h5", "pyfluent/file_session")
|
|
417
|
+
download_file("elbow1.dat.h5", "pyfluent/file_session")
|
|
418
|
+
solver2.file.read_case_data(file_name=case_path1)
|
|
419
|
+
_test_min(solver1, solver2)
|
|
420
|
+
_test_centroid_2_sources(solver1, solver2)
|
|
389
421
|
|
|
390
422
|
|
|
391
423
|
@pytest.mark.fluent_version(">=24.2")
|
|
392
|
-
def test_reduction_does_not_modify_case(static_mixer_case_session):
|
|
424
|
+
def test_reduction_does_not_modify_case(static_mixer_case_session: Any):
|
|
393
425
|
solver = static_mixer_case_session
|
|
394
426
|
# After reading the static-mixer case in Fluent, case-modifed? flag is somehow True
|
|
395
427
|
solver.scheme_eval.scheme_eval("(%save-case-id)")
|
|
@@ -401,9 +433,8 @@ def test_reduction_does_not_modify_case(static_mixer_case_session):
|
|
|
401
433
|
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
402
434
|
|
|
403
435
|
|
|
404
|
-
@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/2998")
|
|
405
436
|
@pytest.mark.fluent_version(">=24.2")
|
|
406
|
-
def test_fix_for_invalid_location_inputs(static_mixer_case_session):
|
|
437
|
+
def test_fix_for_invalid_location_inputs(static_mixer_case_session: Any):
|
|
407
438
|
solver = static_mixer_case_session
|
|
408
439
|
solver.solution.initialization.hybrid_initialize()
|
|
409
440
|
|
|
@@ -55,7 +55,7 @@ def test_rp_vars_allowed_values(new_solver_session) -> None:
|
|
|
55
55
|
|
|
56
56
|
assert rp_vars("number-of-iterations") == 0
|
|
57
57
|
|
|
58
|
-
with pytest.raises(RuntimeError)
|
|
58
|
+
with pytest.raises(RuntimeError):
|
|
59
59
|
rp_vars("number-of-iterat")
|
|
60
60
|
|
|
61
61
|
assert "number-of-iterations" in rp_vars.allowed_values()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
2
4
|
|
|
3
5
|
import ansys.fluent.core as pyfluent
|
|
@@ -7,9 +9,7 @@ from ansys.fluent.core.search import (
|
|
|
7
9
|
_get_close_matches_for_word_from_names,
|
|
8
10
|
_get_exact_match_for_word_from_names,
|
|
9
11
|
_get_match_case_for_word_from_names,
|
|
10
|
-
_get_version_path_prefix_from_obj,
|
|
11
12
|
_get_wildcard_matches_for_word_from_names,
|
|
12
|
-
_search,
|
|
13
13
|
_search_semantic,
|
|
14
14
|
_search_whole_word,
|
|
15
15
|
_search_wildcard,
|
|
@@ -33,7 +33,7 @@ def test_nltk_data_download():
|
|
|
33
33
|
@pytest.mark.codegen_required
|
|
34
34
|
def test_get_exact_match_for_word_from_names():
|
|
35
35
|
api_tree_data = _get_api_tree_data()
|
|
36
|
-
api_object_names =
|
|
36
|
+
api_object_names = api_tree_data["all_api_object_names"]
|
|
37
37
|
exact_match = _get_exact_match_for_word_from_names(
|
|
38
38
|
"VideoResoutionY",
|
|
39
39
|
names=api_object_names,
|
|
@@ -46,7 +46,7 @@ def test_get_exact_match_for_word_from_names():
|
|
|
46
46
|
@pytest.mark.codegen_required
|
|
47
47
|
def test_get_capitalize_match_for_word_from_names():
|
|
48
48
|
api_tree_data = _get_api_tree_data()
|
|
49
|
-
api_object_names =
|
|
49
|
+
api_object_names = api_tree_data["all_api_object_names"]
|
|
50
50
|
capitalize_match_cases = _get_capitalize_match_for_word_from_names(
|
|
51
51
|
"font",
|
|
52
52
|
names=api_object_names,
|
|
@@ -73,7 +73,7 @@ def test_get_capitalize_match_for_word_from_names():
|
|
|
73
73
|
@pytest.mark.codegen_required
|
|
74
74
|
def test_get_match_case_for_word_from_names():
|
|
75
75
|
api_tree_data = _get_api_tree_data()
|
|
76
|
-
api_object_names =
|
|
76
|
+
api_object_names = api_tree_data["all_api_object_names"]
|
|
77
77
|
match_cases = _get_match_case_for_word_from_names(
|
|
78
78
|
"font",
|
|
79
79
|
names=api_object_names,
|
|
@@ -106,7 +106,7 @@ def test_get_match_case_for_word_from_names():
|
|
|
106
106
|
@pytest.mark.codegen_required
|
|
107
107
|
def test_get_wildcard_matches_for_word_from_names():
|
|
108
108
|
api_tree_data = _get_api_tree_data()
|
|
109
|
-
api_object_names =
|
|
109
|
+
api_object_names = api_tree_data["all_api_object_names"]
|
|
110
110
|
wildcard_matches = _get_wildcard_matches_for_word_from_names(
|
|
111
111
|
"iter*",
|
|
112
112
|
names=api_object_names,
|
|
@@ -134,7 +134,7 @@ def test_get_wildcard_matches_for_word_from_names():
|
|
|
134
134
|
@pytest.mark.codegen_required
|
|
135
135
|
def test_get_close_matches_for_word_from_names():
|
|
136
136
|
api_tree_data = _get_api_tree_data()
|
|
137
|
-
api_object_names =
|
|
137
|
+
api_object_names = api_tree_data["all_api_object_names"]
|
|
138
138
|
close_matches = _get_close_matches_for_word_from_names(
|
|
139
139
|
"font",
|
|
140
140
|
names=api_object_names,
|
|
@@ -229,10 +229,7 @@ def test_whole_word_search(capsys):
|
|
|
229
229
|
lines = capsys.readouterr().out.splitlines()
|
|
230
230
|
assert "font" not in lines
|
|
231
231
|
assert "<meshing_session>.preferences.Appearance.Charts.Font (Object)" in lines
|
|
232
|
-
assert (
|
|
233
|
-
"<solver_session>.preferences.Graphics.ColormapSettings.TextFontAutomaticUnits (Parameter)"
|
|
234
|
-
in lines
|
|
235
|
-
)
|
|
232
|
+
assert "<solver_session>.preferences.Appearance.Charts.Font (Object)" in lines
|
|
236
233
|
|
|
237
234
|
|
|
238
235
|
@pytest.mark.fluent_version("==24.2")
|
|
@@ -243,14 +240,8 @@ def test_match_case_search(capsys):
|
|
|
243
240
|
for line in lines:
|
|
244
241
|
assert "Font" not in line
|
|
245
242
|
assert "font" in line
|
|
246
|
-
assert (
|
|
247
|
-
|
|
248
|
-
in lines
|
|
249
|
-
)
|
|
250
|
-
assert (
|
|
251
|
-
'<solver_session>.results.graphics.vector["<name>"].color_map.font_automatic (Parameter)'
|
|
252
|
-
in lines
|
|
253
|
-
)
|
|
243
|
+
assert "<solver_session>.tui.preferences.appearance.charts.font (Object)" in lines
|
|
244
|
+
assert "<meshing_session>.tui.preferences.appearance.charts.font (Object)" in lines
|
|
254
245
|
|
|
255
246
|
|
|
256
247
|
@pytest.mark.fluent_version("==24.2")
|
|
@@ -266,10 +257,7 @@ def test_match_whole_word_and_case_search(capsys):
|
|
|
266
257
|
"<solver_session>.preferences.Graphics.ColormapSettings.TextFontAutomaticUnits (Parameter)"
|
|
267
258
|
not in lines
|
|
268
259
|
)
|
|
269
|
-
assert (
|
|
270
|
-
'<solver_session>.results.graphics.lic["<name>"].color_map.font_name (Parameter)'
|
|
271
|
-
in lines
|
|
272
|
-
)
|
|
260
|
+
assert "<meshing_session>.tui.display.set_grid.label_font (Command)" in lines
|
|
273
261
|
|
|
274
262
|
|
|
275
263
|
@pytest.mark.fluent_version("==24.2")
|
|
@@ -312,180 +300,45 @@ def test_japanese_semantic_search(capsys):
|
|
|
312
300
|
assert "<solver_session>.tui.preferences.appearance.charts.font (Object)" in lines
|
|
313
301
|
|
|
314
302
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
assert (
|
|
344
|
-
"<
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
not in results
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
@pytest.mark.codegen_required
|
|
362
|
-
@pytest.mark.fluent_version("latest")
|
|
363
|
-
def test_get_version_path_prefix_from_obj(
|
|
364
|
-
watertight_workflow_session, new_solver_session
|
|
365
|
-
):
|
|
366
|
-
meshing = watertight_workflow_session
|
|
367
|
-
solver = new_solver_session
|
|
368
|
-
version = solver._version
|
|
369
|
-
assert _get_version_path_prefix_from_obj(meshing) == (
|
|
370
|
-
version,
|
|
371
|
-
["<meshing_session>"],
|
|
372
|
-
"<search_root>",
|
|
373
|
-
)
|
|
374
|
-
assert _get_version_path_prefix_from_obj(solver) == (
|
|
375
|
-
version,
|
|
376
|
-
["<solver_session>"],
|
|
377
|
-
"<search_root>",
|
|
378
|
-
)
|
|
379
|
-
assert _get_version_path_prefix_from_obj(meshing.tui.file.import_) == (
|
|
380
|
-
version,
|
|
381
|
-
["<meshing_session>", "tui", "file", "import_"],
|
|
382
|
-
"<search_root>",
|
|
383
|
-
)
|
|
384
|
-
assert _get_version_path_prefix_from_obj(meshing.tui.file.read_case) == (
|
|
385
|
-
None,
|
|
386
|
-
None,
|
|
387
|
-
None,
|
|
388
|
-
)
|
|
389
|
-
assert _get_version_path_prefix_from_obj(meshing.meshing) == (
|
|
390
|
-
version,
|
|
391
|
-
["<meshing_session>", "meshing"],
|
|
392
|
-
"<search_root>",
|
|
393
|
-
)
|
|
394
|
-
assert _get_version_path_prefix_from_obj(meshing.workflow) == (
|
|
395
|
-
version,
|
|
396
|
-
["<meshing_session>", "workflow"],
|
|
397
|
-
"<search_root>",
|
|
398
|
-
)
|
|
399
|
-
assert _get_version_path_prefix_from_obj(solver.workflow) == (
|
|
400
|
-
version,
|
|
401
|
-
["<meshing_session>", "workflow"],
|
|
402
|
-
"<search_root>",
|
|
403
|
-
)
|
|
404
|
-
assert _get_version_path_prefix_from_obj(meshing.workflow.TaskObject) == (
|
|
405
|
-
version,
|
|
406
|
-
["<meshing_session>", "workflow", "TaskObject:<name>"],
|
|
407
|
-
'<search_root>["<name>"]',
|
|
408
|
-
)
|
|
409
|
-
assert _get_version_path_prefix_from_obj(
|
|
410
|
-
meshing.workflow.TaskObject["Import Geometry"]
|
|
411
|
-
) == (
|
|
412
|
-
version,
|
|
413
|
-
["<meshing_session>", "workflow", "TaskObject:<name>"],
|
|
414
|
-
"<search_root>",
|
|
415
|
-
)
|
|
416
|
-
assert _get_version_path_prefix_from_obj(meshing.preferences.Appearance.Charts) == (
|
|
417
|
-
version,
|
|
418
|
-
["<solver_session>", "preferences", "Appearance", "Charts"],
|
|
419
|
-
"<search_root>",
|
|
420
|
-
)
|
|
421
|
-
assert _get_version_path_prefix_from_obj(solver.setup.models) == (
|
|
422
|
-
version,
|
|
423
|
-
["<solver_session>"],
|
|
424
|
-
"<search_root>",
|
|
425
|
-
)
|
|
426
|
-
assert _get_version_path_prefix_from_obj(solver.file.cff_files) == (
|
|
427
|
-
None,
|
|
428
|
-
None,
|
|
429
|
-
None,
|
|
430
|
-
)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
@pytest.mark.codegen_required
|
|
434
|
-
@pytest.mark.fluent_version("latest")
|
|
435
|
-
def test_search_from_root(watertight_workflow_session):
|
|
436
|
-
meshing = watertight_workflow_session
|
|
437
|
-
results = _search("display", search_root=meshing)
|
|
438
|
-
assert "<search_root>.tui.display (Object)" in results
|
|
439
|
-
results = _search("display", search_root=meshing.tui)
|
|
440
|
-
assert "<search_root>.display (Object)" in results
|
|
441
|
-
results = _search("display", search_root=meshing.tui.display)
|
|
442
|
-
assert "<search_root>.update_scene.display (Command)" in results
|
|
443
|
-
assert "<search_root>.display_states (Object)" in results
|
|
444
|
-
results = _search("cad", search_root=meshing.meshing)
|
|
445
|
-
assert "<search_root>.GlobalSettings.EnableCleanCAD (Parameter)" in results
|
|
446
|
-
assert "<search_root>.LoadCADGeometry (Command)" in results
|
|
447
|
-
results = _search("next", search_root=meshing.workflow)
|
|
448
|
-
assert '<search_root>.TaskObject["<name>"].InsertNextTask (Command)' in results
|
|
449
|
-
results = _search("next", search_root=meshing.workflow.TaskObject)
|
|
450
|
-
assert '<search_root>["<name>"].InsertNextTask (Command)' in results
|
|
451
|
-
results = _search(
|
|
452
|
-
"next", search_root=meshing.workflow.TaskObject["Import Geometry"]
|
|
453
|
-
)
|
|
454
|
-
assert "<search_root>.InsertNextTask (Command)" in results
|
|
455
|
-
results = _search("timeout", search_root=meshing.preferences)
|
|
456
|
-
assert "<search_root>.General.IdleTimeout (Parameter)" in results
|
|
457
|
-
results = _search("timeout", search_root=meshing.preferences.General)
|
|
458
|
-
assert "<search_root>.IdleTimeout (Parameter)" in results
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
@pytest.mark.skip("Results are varying each time.")
|
|
462
|
-
@pytest.mark.codegen_required
|
|
463
|
-
@pytest.mark.fluent_version("==23.2")
|
|
464
|
-
def test_search_settings_from_root(capsys, static_mixer_settings_session):
|
|
465
|
-
solver = static_mixer_settings_session
|
|
466
|
-
results = _search("conduction", search_root=solver)
|
|
467
|
-
assert "<search_root>.tui.define.models.shell_conduction (Object)" in results
|
|
468
|
-
assert (
|
|
469
|
-
'<search_root>.setup.boundary_conditions.wall["<name>"].phase["<name>"].thermal.enable_shell_conduction (Parameter)'
|
|
470
|
-
in results
|
|
471
|
-
)
|
|
472
|
-
results = _search("conduction", search_root=solver.setup.boundary_conditions)
|
|
473
|
-
assert (
|
|
474
|
-
'<search_root>.wall["<name>"].phase["<name>"].shell_conduction["<name>"] (Object)'
|
|
475
|
-
in results
|
|
476
|
-
)
|
|
477
|
-
results = _search("conduction", search_root=solver.setup.boundary_conditions.wall)
|
|
478
|
-
assert (
|
|
479
|
-
'<search_root>["<name>"].phase["<name>"].shell_conduction["<name>"] (Object)'
|
|
480
|
-
in results
|
|
481
|
-
)
|
|
482
|
-
results = _search(
|
|
483
|
-
"conduction", search_root=solver.setup.boundary_conditions.wall["wall"]
|
|
484
|
-
)
|
|
485
|
-
assert (
|
|
486
|
-
'<search_root>.phase["<name>"].shell_conduction["<name>"] (Object)' in results
|
|
487
|
-
)
|
|
488
|
-
results = _search(
|
|
489
|
-
"conduction", search_root=solver.setup.boundary_conditions.wall["wall"].phase
|
|
490
|
-
)
|
|
491
|
-
assert '<search_root>["<name>"].shell_conduction["<name>"] (Object)' in results
|
|
303
|
+
def test_match_whole_word(monkeypatch):
|
|
304
|
+
monkeypatch.setattr(pyfluent, "PRINT_SEARCH_RESULTS", False)
|
|
305
|
+
api_tree_data = {
|
|
306
|
+
"api_objects": [
|
|
307
|
+
"<solver_session>.parent (Object)",
|
|
308
|
+
"<solver_session>.parent.child (Parameter)",
|
|
309
|
+
"<solver_session>.first_last (Object)",
|
|
310
|
+
"<solver_session>.none (Object)",
|
|
311
|
+
],
|
|
312
|
+
"api_tui_objects": [],
|
|
313
|
+
"all_api_object_name_synsets": {
|
|
314
|
+
"parent": ["parent"],
|
|
315
|
+
"child": ["child"],
|
|
316
|
+
"first_last": ["first_last"],
|
|
317
|
+
"none": ["none"],
|
|
318
|
+
},
|
|
319
|
+
"all_api_object_names": ["parent", "child", "first_last", "none"],
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
search_module = sys.modules["ansys.fluent.core.search"]
|
|
323
|
+
monkeypatch.setattr(search_module, "_get_api_tree_data", lambda: api_tree_data)
|
|
324
|
+
|
|
325
|
+
assert _search_whole_word("parent", api_tree_data=api_tree_data) == [
|
|
326
|
+
"<solver_session>.parent (Object)"
|
|
327
|
+
]
|
|
328
|
+
assert _search_whole_word("child", api_tree_data=api_tree_data) == [
|
|
329
|
+
"<solver_session>.parent.child (Parameter)"
|
|
330
|
+
]
|
|
331
|
+
assert pyfluent.search("parent", match_whole_word=True) == [
|
|
332
|
+
"<solver_session>.parent (Object)"
|
|
333
|
+
]
|
|
334
|
+
|
|
335
|
+
assert pyfluent.search("first", match_whole_word=True) == [
|
|
336
|
+
"<solver_session>.first_last (Object)"
|
|
337
|
+
]
|
|
338
|
+
assert pyfluent.search("last", match_whole_word=True) == [
|
|
339
|
+
"<solver_session>.first_last (Object)"
|
|
340
|
+
]
|
|
341
|
+
|
|
342
|
+
assert pyfluent.search("first_last", match_whole_word=True) == [
|
|
343
|
+
"<solver_session>.first_last (Object)"
|
|
344
|
+
]
|
|
@@ -25,7 +25,6 @@ from ansys.fluent.core.utils.file_transfer_service import RemoteFileTransferStra
|
|
|
25
25
|
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
26
26
|
from ansys.fluent.core.utils.networking import get_free_port
|
|
27
27
|
from ansys.fluent.core.warnings import PyFluentDeprecationWarning
|
|
28
|
-
from tests.conftest import new_solver_session
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
class MockSettingsServicer(settings_pb2_grpc.SettingsServicer):
|
|
@@ -97,7 +96,7 @@ class MockSchemeEvalServicer(scheme_eval_pb2_grpc.SchemeEvalServicer):
|
|
|
97
96
|
|
|
98
97
|
def test_download_file():
|
|
99
98
|
with pytest.raises(examples.RemoteFileNotFoundError):
|
|
100
|
-
|
|
99
|
+
examples.download_file(
|
|
101
100
|
"mixing_elbow.cas.h5", "pyfluent/examples/DOE-ML-Mixing-Elbow"
|
|
102
101
|
)
|
|
103
102
|
|
|
@@ -113,7 +112,7 @@ def test_create_mock_session_by_passing_ip_port_password() -> None:
|
|
|
113
112
|
)
|
|
114
113
|
server.start()
|
|
115
114
|
|
|
116
|
-
with pytest.raises(PortNotProvided)
|
|
115
|
+
with pytest.raises(PortNotProvided):
|
|
117
116
|
fluent_connection = FluentConnection(
|
|
118
117
|
ip=ip, password="12345", cleanup_on_exit=False
|
|
119
118
|
)
|
|
@@ -327,16 +326,16 @@ def test_start_transcript_file_write(new_meshing_session):
|
|
|
327
326
|
file_name = Path(file_name)
|
|
328
327
|
|
|
329
328
|
file_name.touch()
|
|
330
|
-
prev_stat = file_name.stat()
|
|
331
|
-
prev_mtime = prev_stat.st_mtime
|
|
332
|
-
prev_size = prev_stat.st_size
|
|
329
|
+
# prev_stat = file_name.stat()
|
|
330
|
+
# prev_mtime = prev_stat.st_mtime
|
|
331
|
+
# prev_size = prev_stat.st_size
|
|
333
332
|
|
|
334
333
|
session = new_meshing_session
|
|
335
334
|
session.transcript.start(file_name)
|
|
336
335
|
session = session.switch_to_solver()
|
|
337
336
|
session.transcript.stop()
|
|
338
337
|
|
|
339
|
-
new_stat = file_name.stat()
|
|
338
|
+
# new_stat = file_name.stat()
|
|
340
339
|
# this assertion is invalid.
|
|
341
340
|
# assert new_stat.st_mtime > prev_mtime or new_stat.st_size > prev_size
|
|
342
341
|
|
|
@@ -360,8 +359,8 @@ def test_read_case_using_lightweight_mode():
|
|
|
360
359
|
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
361
360
|
)
|
|
362
361
|
if pyfluent.USE_FILE_TRANSFER_SERVICE:
|
|
363
|
-
container_dict = {"mount_source": file_transfer_service.MOUNT_SOURCE}
|
|
364
362
|
file_transfer_service = RemoteFileTransferStrategy()
|
|
363
|
+
container_dict = {"mount_source": file_transfer_service.MOUNT_SOURCE}
|
|
365
364
|
solver = pyfluent.launch_fluent(
|
|
366
365
|
case_file_name=import_file_name,
|
|
367
366
|
lightweight_mode=True,
|
|
@@ -380,7 +379,7 @@ def test_read_case_using_lightweight_mode():
|
|
|
380
379
|
idle_period=1,
|
|
381
380
|
)
|
|
382
381
|
timeout_loop(
|
|
383
|
-
solver.setup.models.energy.enabled()
|
|
382
|
+
not solver.setup.models.energy.enabled(),
|
|
384
383
|
timeout=60,
|
|
385
384
|
idle_period=1,
|
|
386
385
|
)
|
|
@@ -391,7 +390,9 @@ def test_help_does_not_throw(new_solver_session):
|
|
|
391
390
|
help(new_solver_session.file.read)
|
|
392
391
|
|
|
393
392
|
|
|
394
|
-
|
|
393
|
+
@pytest.fixture
|
|
394
|
+
def new_solver_session2(new_solver_session):
|
|
395
|
+
return new_solver_session
|
|
395
396
|
|
|
396
397
|
|
|
397
398
|
def test_build_from_fluent_connection(new_solver_session, new_solver_session2):
|
|
@@ -410,7 +411,11 @@ def test_build_from_fluent_connection(new_solver_session, new_solver_session2):
|
|
|
410
411
|
)
|
|
411
412
|
assert solver1.health_check.is_serving
|
|
412
413
|
assert solver2.health_check.is_serving
|
|
413
|
-
|
|
414
|
+
timeout_loop(
|
|
415
|
+
not health_check_service1.is_serving,
|
|
416
|
+
timeout=60,
|
|
417
|
+
idle_period=1,
|
|
418
|
+
)
|
|
414
419
|
assert solver1._fluent_connection.connection_properties.cortex_pid == cortex_pid2
|
|
415
420
|
assert solver2._fluent_connection.connection_properties.cortex_pid == cortex_pid2
|
|
416
421
|
|
|
@@ -425,7 +430,7 @@ def test_recover_grpc_error_from_launch_error(monkeypatch: pytest.MonkeyPatch):
|
|
|
425
430
|
|
|
426
431
|
monkeypatch.setattr(session, "_parse_server_info_file", mock_parse_server_info_file)
|
|
427
432
|
with pytest.raises(LaunchFluentError) as ex:
|
|
428
|
-
|
|
433
|
+
_ = pyfluent.launch_fluent()
|
|
429
434
|
# grpc.RpcError -> RuntimeError -> LaunchFluentError
|
|
430
435
|
assert ex.value.__context__.__context__.code() == grpc.StatusCode.UNAVAILABLE
|
|
431
436
|
|
|
@@ -562,7 +567,7 @@ def test_general_exception_behaviour_in_session(new_solver_session):
|
|
|
562
567
|
}
|
|
563
568
|
graphics.contour["contour-velocity"].display()
|
|
564
569
|
|
|
565
|
-
|
|
570
|
+
examples.download_file(
|
|
566
571
|
"sample_2d_mesh.msh.h5",
|
|
567
572
|
"pyfluent/surface_mesh",
|
|
568
573
|
return_without_path=False,
|