ansys-fluent-core 0.28.dev0__py3-none-any.whl → 0.28.1__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 (63) hide show
  1. ansys/fluent/core/__init__.py +15 -16
  2. ansys/fluent/core/_version.py +1 -1
  3. ansys/fluent/core/codegen/allapigen.py +0 -3
  4. ansys/fluent/core/codegen/builtin_settingsgen.py +5 -20
  5. ansys/fluent/core/codegen/print_fluent_version.py +9 -14
  6. ansys/fluent/core/codegen/walk_api.py +57 -0
  7. ansys/fluent/core/fluent_connection.py +26 -22
  8. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  9. ansys/fluent/core/generated/datamodel_252/meshing.py +21 -0
  10. ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
  11. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  12. ansys/fluent/core/generated/meshing/tui_252.py +1183 -1133
  13. ansys/fluent/core/generated/solver/settings_252.py +8944 -6572
  14. ansys/fluent/core/generated/solver/settings_252.pyi +6357 -5352
  15. ansys/fluent/core/generated/solver/tui_252.py +3039 -2473
  16. ansys/fluent/core/journaling.py +4 -4
  17. ansys/fluent/core/launcher/fluent_container.py +31 -7
  18. ansys/fluent/core/launcher/launcher.py +3 -2
  19. ansys/fluent/core/launcher/launcher_utils.py +9 -0
  20. ansys/fluent/core/launcher/process_launch_string.py +8 -6
  21. ansys/fluent/core/launcher/pyfluent_enums.py +6 -3
  22. ansys/fluent/core/launcher/server_info.py +25 -2
  23. ansys/fluent/core/launcher/slurm_launcher.py +6 -3
  24. ansys/fluent/core/launcher/standalone_launcher.py +11 -9
  25. ansys/fluent/core/post_objects/post_helper.py +16 -10
  26. ansys/fluent/core/services/__init__.py +2 -0
  27. ansys/fluent/core/services/api_upgrade.py +11 -9
  28. ansys/fluent/core/services/app_utilities.py +408 -0
  29. ansys/fluent/core/services/datamodel_se.py +42 -5
  30. ansys/fluent/core/services/datamodel_tui.py +5 -2
  31. ansys/fluent/core/services/field_data.py +1 -0
  32. ansys/fluent/core/services/reduction.py +2 -0
  33. ansys/fluent/core/services/settings.py +5 -2
  34. ansys/fluent/core/session.py +27 -4
  35. ansys/fluent/core/session_pure_meshing.py +1 -1
  36. ansys/fluent/core/session_solver.py +0 -1
  37. ansys/fluent/core/solver/__init__.py +6 -0
  38. ansys/fluent/core/solver/flobject.py +15 -27
  39. ansys/fluent/core/solver/function/reduction.py +3 -0
  40. ansys/fluent/core/solver/settings_builtin_data.py +1 -1
  41. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +5 -5
  42. ansys/fluent/core/streaming_services/events_streaming.py +336 -52
  43. ansys/fluent/tests/conftest.py +30 -0
  44. ansys/fluent/tests/test_builtin_settings.py +1 -1
  45. ansys/fluent/tests/test_codegen.py +0 -410
  46. ansys/fluent/tests/test_datamodel_api.py +449 -0
  47. ansys/fluent/tests/test_datamodel_service.py +64 -64
  48. ansys/fluent/tests/test_events_manager.py +24 -6
  49. ansys/fluent/tests/test_field_data.py +32 -0
  50. ansys/fluent/tests/test_launcher.py +30 -2
  51. ansys/fluent/tests/test_mapped_api.py +774 -0
  52. ansys/fluent/tests/test_reduction.py +30 -0
  53. ansys/fluent/tests/test_session.py +16 -1
  54. ansys/fluent/tests/test_settings_api.py +21 -0
  55. ansys/fluent/tests/test_solution_variables.py +27 -0
  56. ansys/fluent/tests/util/__init__.py +36 -0
  57. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/METADATA +4 -3
  58. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/RECORD +61 -58
  59. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/WHEEL +1 -1
  60. ansys/fluent/core/codegen/settingsgen_old.py +0 -535
  61. ansys/fluent/tests/fluent/test_version/test.py +0 -2
  62. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/AUTHORS +0 -0
  63. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/LICENSE +0 -0
@@ -1,7 +1,10 @@
1
+ from pathlib import Path
2
+
1
3
  import pytest
2
4
 
3
5
  import ansys.fluent.core as pyfluent
4
- from ansys.fluent.core import MeshingEvent, SolverEvent, examples
6
+ from ansys.fluent.core import FluentVersion, MeshingEvent, SolverEvent, examples
7
+ from ansys.fluent.core.warnings import PyFluentDeprecationWarning
5
8
 
6
9
 
7
10
  def test_receive_events_on_case_loaded(new_solver_session) -> None:
@@ -18,10 +21,19 @@ def test_receive_events_on_case_loaded(new_solver_session) -> None:
18
21
 
19
22
  def on_case_loaded(session, event_info):
20
23
  on_case_loaded.loaded = True
24
+ if session.get_fluent_version() >= FluentVersion.v232:
25
+ assert Path(event_info.case_file_name).name == Path(case_file_name).name
26
+ with pytest.warns(PyFluentDeprecationWarning):
27
+ assert Path(event_info.casefilepath).name == Path(case_file_name).name
21
28
 
22
29
  on_case_loaded.loaded = False
23
30
 
24
- def on_case_loaded_with_args(x, y, session, event_info):
31
+ def on_case_loaded_with_args_optional_first(x, y, session, event_info):
32
+ on_case_loaded_with_args_optional_first.state = dict(x=x, y=y)
33
+
34
+ on_case_loaded_with_args_optional_first.state = None
35
+
36
+ def on_case_loaded_with_args(session, event_info, x, y):
25
37
  on_case_loaded_with_args.state = dict(x=x, y=y)
26
38
 
27
39
  on_case_loaded_with_args.state = None
@@ -36,6 +48,10 @@ def test_receive_events_on_case_loaded(new_solver_session) -> None:
36
48
 
37
49
  solver.events.register_callback(SolverEvent.CASE_LOADED, on_case_loaded)
38
50
 
51
+ solver.events.register_callback(
52
+ SolverEvent.CASE_LOADED, on_case_loaded_with_args_optional_first, 12, y=42
53
+ )
54
+
39
55
  solver.events.register_callback(
40
56
  SolverEvent.CASE_LOADED, on_case_loaded_with_args, 12, y=42
41
57
  )
@@ -47,6 +63,7 @@ def test_receive_events_on_case_loaded(new_solver_session) -> None:
47
63
  assert not on_case_loaded_old.loaded
48
64
  assert not on_case_loaded.loaded
49
65
  assert not on_case_loaded_old_with_args.state
66
+ assert not on_case_loaded_with_args_optional_first.state
50
67
  assert not on_case_loaded_with_args.state
51
68
 
52
69
  try:
@@ -57,11 +74,16 @@ def test_receive_events_on_case_loaded(new_solver_session) -> None:
57
74
  assert on_case_loaded_old.loaded
58
75
  assert on_case_loaded.loaded
59
76
  assert on_case_loaded_old_with_args.state == dict(x=12, y=42)
77
+ assert on_case_loaded_with_args_optional_first.state == dict(x=12, y=42)
60
78
  assert on_case_loaded_with_args.state == dict(x=12, y=42)
61
79
 
62
80
 
63
81
  def test_receive_meshing_events_on_case_loaded(new_meshing_session) -> None:
64
82
 
83
+ case_file_name = examples.download_file(
84
+ "mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
85
+ )
86
+
65
87
  def on_case_loaded(session, event_info):
66
88
  on_case_loaded.loaded = True
67
89
 
@@ -71,10 +93,6 @@ def test_receive_meshing_events_on_case_loaded(new_meshing_session) -> None:
71
93
 
72
94
  meshing.events.register_callback(MeshingEvent.CASE_LOADED, on_case_loaded)
73
95
 
74
- case_file_name = examples.download_file(
75
- "mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
76
- )
77
-
78
96
  assert not on_case_loaded.loaded
79
97
 
80
98
  meshing.tui.file.read_case(case_file_name)
@@ -432,3 +432,35 @@ def test_field_data_does_not_modify_case(new_solver_session):
432
432
  field_name="absolute-pressure", surfaces=["cold-inlet"]
433
433
  )
434
434
  assert not solver.scheme_eval.scheme_eval("(case-modified?)")
435
+
436
+
437
+ @pytest.mark.fluent_version(">=24.1")
438
+ def test_field_data_streaming_in_meshing_mode(new_meshing_session):
439
+ meshing = new_meshing_session
440
+ import_file_name = examples.download_file(
441
+ "mixing_elbow.pmdb", "pyfluent/mixing_elbow"
442
+ )
443
+
444
+ mesh_data = {}
445
+
446
+ def plot_mesh(index, field_name, data):
447
+ if data is not None:
448
+ if index in mesh_data:
449
+ mesh_data[index].update({field_name: data})
450
+ else:
451
+ mesh_data[index] = {field_name: data}
452
+
453
+ meshing.fields.field_data_streaming.register_callback(plot_mesh)
454
+ meshing.fields.field_data_streaming.start(provideBytesStream=True, chunkSize=1024)
455
+
456
+ meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
457
+ meshing.workflow.TaskObject["Import Geometry"].Arguments = {
458
+ "FileName": import_file_name,
459
+ "LengthUnit": "in",
460
+ }
461
+ meshing.workflow.TaskObject["Import Geometry"].Execute()
462
+
463
+ assert len(mesh_data[5]["vertices"]) == 66
464
+ assert len(mesh_data[5]["faces"]) == 80
465
+
466
+ assert list(mesh_data[12].keys()) == ["vertices", "faces"]
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  import platform
4
+ import tempfile
4
5
  from tempfile import TemporaryDirectory
5
6
 
6
7
  import pytest
@@ -412,9 +413,8 @@ def test_build_journal_argument(topy, journal_file_names, result, raises):
412
413
  assert _build_journal_argument(topy, journal_file_names) == result
413
414
 
414
415
 
415
- @pytest.mark.filterwarnings("error::FutureWarning")
416
416
  def test_show_gui_raises_warning():
417
- with pytest.raises(PyFluentDeprecationWarning):
417
+ with pytest.warns(PyFluentDeprecationWarning):
418
418
  pyfluent.launch_fluent(show_gui=True)
419
419
 
420
420
 
@@ -499,3 +499,31 @@ def test_fluent_automatic_transcript(monkeypatch):
499
499
  with TemporaryDirectory(dir=pyfluent.EXAMPLES_PATH) as tmp_dir:
500
500
  with pyfluent.launch_fluent(container_dict=dict(working_dir=tmp_dir)):
501
501
  assert not list(Path(tmp_dir).glob("*.trn"))
502
+
503
+
504
+ def test_standalone_launcher_dry_run(monkeypatch):
505
+ monkeypatch.setenv("PYFLUENT_LAUNCH_CONTAINER", "0")
506
+ fluent_path = r"\x\y\z\fluent.exe"
507
+ fluent_launch_string, server_info_file_name = pyfluent.launch_fluent(
508
+ fluent_path=fluent_path, dry_run=True, ui_mode="no_gui"
509
+ )
510
+ assert str(Path(server_info_file_name).parent) == tempfile.gettempdir()
511
+ assert (
512
+ fluent_launch_string
513
+ == f"{fluent_path} 3ddp -gu -sifile={server_info_file_name} -nm"
514
+ )
515
+
516
+
517
+ def test_standalone_launcher_dry_run_with_server_info_dir(monkeypatch):
518
+ monkeypatch.setenv("PYFLUENT_LAUNCH_CONTAINER", "0")
519
+ with tempfile.TemporaryDirectory() as tmp_dir:
520
+ monkeypatch.setenv("SERVER_INFO_DIR", tmp_dir)
521
+ fluent_path = r"\x\y\z\fluent.exe"
522
+ fluent_launch_string, server_info_file_name = pyfluent.launch_fluent(
523
+ fluent_path=fluent_path, dry_run=True, ui_mode="no_gui"
524
+ )
525
+ assert str(Path(server_info_file_name).parent) == tmp_dir
526
+ assert (
527
+ fluent_launch_string
528
+ == f"{fluent_path} 3ddp -gu -sifile={Path(server_info_file_name).name} -nm"
529
+ )