ansys-fluent-core 0.28.2__py3-none-any.whl → 0.29.dev1__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 (103) hide show
  1. ansys/fluent/core/__init__.py +1 -1
  2. ansys/fluent/core/_version.py +2 -2
  3. ansys/fluent/core/codegen/tuigen.py +1 -1
  4. ansys/fluent/core/codegen/walk_api.py +45 -18
  5. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  6. ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
  7. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  8. ansys/fluent/core/generated/solver/settings_252.py +251 -160
  9. ansys/fluent/core/generated/solver/settings_252.pyi +146 -54
  10. ansys/fluent/core/generated/solver/tui_252.py +48 -24
  11. ansys/fluent/core/launcher/container_launcher.py +4 -3
  12. ansys/fluent/core/launcher/fluent_container.py +22 -19
  13. ansys/fluent/core/launcher/launcher.py +2 -2
  14. ansys/fluent/core/launcher/pim_launcher.py +2 -2
  15. ansys/fluent/core/launcher/slurm_launcher.py +2 -2
  16. ansys/fluent/core/launcher/standalone_launcher.py +2 -2
  17. ansys/fluent/core/logging.py +2 -0
  18. ansys/fluent/core/logging_config.yaml +3 -0
  19. ansys/fluent/core/services/datamodel_se.py +4 -1
  20. ansys/fluent/core/services/field_data.py +252 -0
  21. ansys/fluent/core/services/interceptors.py +28 -2
  22. ansys/fluent/core/session.py +7 -2
  23. ansys/fluent/core/session_solver.py +21 -0
  24. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/LICENSE +1 -1
  25. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/METADATA +53 -32
  26. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/RECORD +61 -137
  27. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/WHEEL +1 -1
  28. ansys/fluent/core/docs/README.rst +0 -155
  29. ansys/fluent/tests/conftest.py +0 -415
  30. ansys/fluent/tests/fluent_fixtures.py +0 -195
  31. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  32. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  33. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  34. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  35. ansys/fluent/tests/test_aero_session.py +0 -88
  36. ansys/fluent/tests/test_batch_ops.py +0 -39
  37. ansys/fluent/tests/test_builtin_settings.py +0 -761
  38. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  39. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  40. ansys/fluent/tests/test_casereader.py +0 -324
  41. ansys/fluent/tests/test_codegen.py +0 -783
  42. ansys/fluent/tests/test_creatable.py +0 -31
  43. ansys/fluent/tests/test_data_model_cache.py +0 -434
  44. ansys/fluent/tests/test_datamodel_api.py +0 -429
  45. ansys/fluent/tests/test_datamodel_service.py +0 -814
  46. ansys/fluent/tests/test_datareader.py +0 -103
  47. ansys/fluent/tests/test_error_handling.py +0 -24
  48. ansys/fluent/tests/test_events_manager.py +0 -214
  49. ansys/fluent/tests/test_field_data.py +0 -466
  50. ansys/fluent/tests/test_file_session.py +0 -355
  51. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  52. ansys/fluent/tests/test_fix_doc.py +0 -29
  53. ansys/fluent/tests/test_flobject.py +0 -1235
  54. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  55. ansys/fluent/tests/test_fluent_session.py +0 -270
  56. ansys/fluent/tests/test_fluent_version.py +0 -66
  57. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  58. ansys/fluent/tests/test_icing_session.py +0 -9
  59. ansys/fluent/tests/test_launcher.py +0 -529
  60. ansys/fluent/tests/test_launcher_remote.py +0 -272
  61. ansys/fluent/tests/test_lispy.py +0 -40
  62. ansys/fluent/tests/test_logging.py +0 -16
  63. ansys/fluent/tests/test_mapped_api.py +0 -766
  64. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  65. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  66. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  67. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  68. ansys/fluent/tests/test_preferences.py +0 -89
  69. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  70. ansys/fluent/tests/test_reduction.py +0 -484
  71. ansys/fluent/tests/test_rp_vars.py +0 -77
  72. ansys/fluent/tests/test_scheduler.py +0 -471
  73. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  74. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  75. ansys/fluent/tests/test_search.py +0 -344
  76. ansys/fluent/tests/test_session.py +0 -594
  77. ansys/fluent/tests/test_settings_api.py +0 -606
  78. ansys/fluent/tests/test_settings_reader.py +0 -85
  79. ansys/fluent/tests/test_slurm_future.py +0 -67
  80. ansys/fluent/tests/test_solution_variables.py +0 -241
  81. ansys/fluent/tests/test_solver_monitors.py +0 -83
  82. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  83. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  84. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  85. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  86. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  87. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  88. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  89. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  90. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  91. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  92. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  93. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  94. ansys/fluent/tests/test_streaming_services.py +0 -52
  95. ansys/fluent/tests/test_systemcoupling.py +0 -44
  96. ansys/fluent/tests/test_topy.py +0 -179
  97. ansys/fluent/tests/test_tui_api.py +0 -70
  98. ansys/fluent/tests/test_type_stub.py +0 -37
  99. ansys/fluent/tests/test_utils.py +0 -82
  100. ansys/fluent/tests/util/__init__.py +0 -36
  101. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  102. ansys/fluent/tests/util/solver.py +0 -72
  103. ansys_fluent_core-0.28.2.dist-info/AUTHORS +0 -12
@@ -1,272 +0,0 @@
1
- """Test the PyPIM integration."""
2
-
3
- from concurrent import futures
4
- import os
5
- from pathlib import Path
6
- import shutil
7
- from unittest.mock import create_autospec
8
- import uuid
9
-
10
- import grpc
11
- from grpc_health.v1 import health_pb2_grpc
12
- import pytest
13
- from test_session import MockHealthServicer, MockSchemeEvalServicer
14
-
15
- from ansys.api.fluent.v0 import scheme_eval_pb2_grpc
16
- import ansys.fluent.core as pyfluent
17
- from ansys.fluent.core import EXAMPLES_PATH, examples
18
- from ansys.fluent.core.fluent_connection import (
19
- FluentConnection,
20
- UnsupportedRemoteFluentInstance,
21
- )
22
- from ansys.fluent.core.launcher import launcher
23
- from ansys.fluent.core.session import BaseSession
24
- from ansys.fluent.core.session_pure_meshing import PureMeshing
25
- from ansys.fluent.core.session_solver import Solver
26
- from ansys.fluent.core.utils.file_transfer_service import PimFileTransferService
27
- import ansys.fluent.core.utils.fluent_version as docker_image_version
28
- from ansys.fluent.core.utils.fluent_version import FluentVersion
29
- from ansys.fluent.core.utils.networking import get_free_port
30
- import ansys.platform.instancemanagement as pypim
31
-
32
-
33
- def test_launch_remote_instance(monkeypatch, new_solver_session):
34
- monkeypatch.setattr(pyfluent, "CHECK_HEALTH", False)
35
- fluent = new_solver_session
36
- # Create a mock pypim pretending it is configured and returning a channel to an already running Fluent
37
- mock_instance = pypim.Instance(
38
- definition_name="definitions/fake-fluent",
39
- name="instances/fake-fluent",
40
- ready=True,
41
- status_message=None,
42
- services={
43
- "grpc": pypim.Service(
44
- uri=fluent._fluent_connection._channel_str, headers={}
45
- )
46
- },
47
- )
48
- pim_channel = grpc.insecure_channel(
49
- fluent._fluent_connection._channel_str,
50
- )
51
- mock_instance.wait_for_ready = create_autospec(mock_instance.wait_for_ready)
52
- mock_instance.build_grpc_channel = create_autospec(
53
- mock_instance.build_grpc_channel, return_value=pim_channel
54
- )
55
- mock_instance.delete = create_autospec(mock_instance.delete)
56
-
57
- mock_client = pypim.Client(channel=grpc.insecure_channel("localhost:12345"))
58
- mock_client.create_instance = create_autospec(
59
- mock_client.create_instance, return_value=mock_instance
60
- )
61
-
62
- mock_connect = create_autospec(pypim.connect, return_value=mock_client)
63
- mock_is_configured = create_autospec(pypim.is_configured, return_value=True)
64
- monkeypatch.setattr(pypim, "connect", mock_connect)
65
- monkeypatch.setattr(pypim, "is_configured", mock_is_configured)
66
-
67
- if os.getenv("FLUENT_IMAGE_TAG"):
68
- monkeypatch.setattr(
69
- FluentVersion,
70
- "get_latest_installed",
71
- lambda: docker_image_version.get_version(),
72
- )
73
-
74
- # Start fluent with launch_fluent
75
- # Note: This is mocking to start Fluent, but actually reusing the common one
76
- # Thus cleanup_on_exit is set to false
77
- fluent = launcher.launch_fluent(cleanup_on_exit=False, mode="solver")
78
-
79
- # Assert: PyFluent went through the pypim workflow
80
- assert mock_is_configured.called
81
- assert mock_connect.called
82
-
83
- mock_client.create_instance.assert_called_with("fluent-3ddp", product_version=None)
84
- assert mock_instance.wait_for_ready.called
85
- mock_instance.build_grpc_channel.assert_called_with()
86
-
87
- # And it connected using the channel created by PyPIM
88
- assert fluent._fluent_connection._channel == pim_channel
89
-
90
- # and it kept track of the instance to be able to delete it
91
- assert fluent._fluent_connection._remote_instance == mock_instance
92
-
93
- server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
94
- ip = "127.0.0.1"
95
- port = get_free_port()
96
- server.add_insecure_port(f"{ip}:{port}")
97
- health_pb2_grpc.add_HealthServicer_to_server(MockHealthServicer(), server)
98
- scheme_eval_pb2_grpc.add_SchemeEvalServicer_to_server(
99
- MockSchemeEvalServicer(), server
100
- )
101
- server.start()
102
-
103
- with pytest.raises(UnsupportedRemoteFluentInstance):
104
- fluent_connection = FluentConnection(
105
- ip=ip,
106
- port=port,
107
- password="12345",
108
- remote_instance=mock_instance,
109
- cleanup_on_exit=False,
110
- )
111
- session = BaseSession(
112
- fluent_connection=fluent_connection,
113
- scheme_eval=fluent_connection._connection_interface.scheme_eval,
114
- )
115
-
116
- file_transfer_service = PimFileTransferService(pim_instance=mock_instance)
117
- assert not file_transfer_service.file_service
118
- assert file_transfer_service.is_configured()
119
- assert file_transfer_service.pim_instance
120
- assert file_transfer_service.upload_server
121
-
122
- session.exit(wait=60)
123
- session._fluent_connection.wait_process_finished(wait=60)
124
-
125
-
126
- class TransferRequestRecorder:
127
- def __init__(self):
128
- self.uploaded_files = list()
129
- self.downloaded_files = list()
130
-
131
- def uploads(self):
132
- return self.uploaded_files
133
-
134
- def downloads(self):
135
- return self.downloaded_files
136
-
137
- def upload(self, file_name: str):
138
- self.uploaded_files.append(file_name)
139
-
140
- def download(self, file_name: str):
141
- self.downloaded_files.append(file_name)
142
-
143
- def is_configured(self):
144
- return True
145
-
146
-
147
- def rename_downloaded_file(file_path: str, suffix: str) -> str:
148
- """Rename downloaded file by appending a suffix to the file name.
149
-
150
- Parameters
151
- ----------
152
- file_path : str
153
- Downloaded file path. Can be absolute or relative.
154
- suffix : str
155
- Suffix to append to the file name.
156
-
157
- Returns:
158
- --------
159
- str
160
- New file path with the suffix appended to the file name.
161
- """
162
- ext = "".join(Path(file_path).suffixes)
163
- orig_path = Path(file_path)
164
- file_path = file_path.removesuffix(ext)
165
- file_path = Path(file_path)
166
- if file_path.is_absolute():
167
- new_stem = f"{file_path.stem}{suffix}"
168
- new_path = file_path.with_stem(new_stem)
169
- new_path = new_path.with_suffix(ext)
170
- orig_path.rename(new_path)
171
- return str(new_path)
172
- else:
173
- orig_abs_path = Path(EXAMPLES_PATH) / orig_path
174
- abs_path = Path(EXAMPLES_PATH) / file_path
175
- new_stem = f"{file_path.stem}{suffix}"
176
- new_path = abs_path.with_stem(new_stem)
177
- new_path = new_path.with_suffix(ext)
178
- orig_abs_path.rename(new_path)
179
- return str(file_path.with_stem(new_stem).with_suffix(ext))
180
-
181
-
182
- @pytest.mark.parametrize(
183
- "ext,a,b,c,d",
184
- [(".cas", "a1", "b1", "c1", "d1"), (".cas.gz", "a2", "b2", "c2", "d2")],
185
- )
186
- def test_rename_downloaded_file(ext, a, b, c, d):
187
- try:
188
- file_path = Path(EXAMPLES_PATH) / f"{a}{ext}"
189
- file_path.touch()
190
- file_path = str(file_path)
191
- new_file_path = rename_downloaded_file(file_path, "_1")
192
- assert new_file_path == str(Path(EXAMPLES_PATH) / f"{a}_1{ext}")
193
- except Exception:
194
- raise
195
- finally:
196
- Path(new_file_path).unlink(missing_ok=True)
197
-
198
- try:
199
- file_path = f"{b}{ext}"
200
- (Path(EXAMPLES_PATH) / file_path).touch()
201
- new_file_path = rename_downloaded_file(file_path, "_1")
202
- assert new_file_path == f"{b}_1{ext}"
203
- except Exception:
204
- raise
205
- finally:
206
- (Path(EXAMPLES_PATH) / new_file_path).unlink(missing_ok=True)
207
-
208
- try:
209
- dir_path = Path(EXAMPLES_PATH) / c
210
- dir_path.mkdir()
211
- file_path = dir_path / f"{d}{ext}"
212
- file_path.touch()
213
- file_path = str(Path(c) / f"{d}{ext}")
214
- new_file_path = rename_downloaded_file(file_path, "_1")
215
- assert new_file_path == str(Path(c) / f"{d}_1{ext}")
216
- except Exception:
217
- raise
218
- finally:
219
- shutil.rmtree(dir_path, ignore_errors=True)
220
-
221
-
222
- @pytest.mark.codegen_required
223
- @pytest.mark.fluent_version(">=24.2")
224
- def test_file_purpose_on_remote_instance(
225
- monkeypatch, new_solver_session, new_meshing_session
226
- ):
227
- solver = new_solver_session
228
-
229
- file_service = TransferRequestRecorder()
230
-
231
- solver_session = Solver(
232
- fluent_connection=solver._fluent_connection,
233
- scheme_eval=solver._fluent_connection._connection_interface.scheme_eval,
234
- file_transfer_service=file_service,
235
- )
236
-
237
- import_file_name = examples.download_file(
238
- "mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
239
- )
240
- suffix = uuid.uuid4().hex
241
- import_file_name = rename_downloaded_file(import_file_name, f"_{suffix}")
242
-
243
- solver_session.file.read_case(file_name=import_file_name)
244
- assert file_service.is_configured()
245
- assert file_service.uploads()
246
- assert len(file_service.uploads()) == 1
247
- assert file_service.uploads()[0] == import_file_name
248
-
249
- solver_session.file.write_case(file_name=import_file_name)
250
- assert file_service.downloads()
251
- assert len(file_service.downloads()) == 1
252
- assert file_service.downloads()[0] == import_file_name
253
-
254
- solver_session.exit()
255
-
256
- meshing = new_meshing_session
257
-
258
- meshing_session = PureMeshing(
259
- fluent_connection=meshing._fluent_connection,
260
- scheme_eval=meshing._fluent_connection._connection_interface.scheme_eval,
261
- file_transfer_service=file_service,
262
- )
263
-
264
- meshing_session.meshing.File.ReadMesh(FileName=import_file_name)
265
- assert len(file_service.uploads()) == 2
266
- assert file_service.uploads()[1] == import_file_name
267
-
268
- meshing_session.meshing.File.WriteMesh(FileName=import_file_name)
269
- assert len(file_service.downloads()) == 2
270
- assert file_service.downloads()[1] == import_file_name
271
-
272
- meshing_session.exit()
@@ -1,40 +0,0 @@
1
- from ansys.fluent.core.filereader import lispy
2
-
3
- scm_pys = (
4
- ("()", []),
5
- ("1", 1),
6
- ('""', '""'),
7
- ("(1)", [1]),
8
- ("(1 2)", [1, 2]),
9
- ("(1 (2))", [1, [2]]),
10
- ("(1 . 2)", (1, 2)),
11
- ("(1 2 3)", [1, 2, 3]),
12
- # In fact, (1 2 . 3) = (1 . (2 . 3))
13
- ("(1 2 . 3)", (1, (2, 3)), "(1 . (2 . 3))"),
14
- ("(1 (2 . 3))", [1, (2, 3)]),
15
- ("((1 . 2) . 3)", ((1, 2), 3)),
16
- ("(1 . (2 . 3))", (1, (2, 3))),
17
- ("((1 . 2) (3 . 4))", [(1, 2), (3, 4)]),
18
- ("((1 . 2) (3 . 4) (5 . 6))", [(1, 2), (3, 4), (5, 6)]),
19
- ("((1 . 2) . (3 . 4))", ((1, 2), (3, 4))),
20
- ("((1 . 2) . 3)", ((1, 2), 3)),
21
- ("(x 1)", ["x", 1]),
22
- ('(x . "1.0 [m/s]")', ("x", '"1.0 [m/s]"')),
23
- ("(define x 1)", ["define", "x", 1]),
24
- )
25
-
26
- extra_scm_pys = (
27
- ("(define x)", ["define", "x", None]),
28
- ('(define "x")', []),
29
- )
30
-
31
-
32
- def test_scm_to_py():
33
- for scm_py in scm_pys + extra_scm_pys:
34
- assert lispy.parse(scm_py[0]) == scm_py[1]
35
-
36
-
37
- def test_py_to_scm():
38
- for scm_py in scm_pys:
39
- expected = scm_py[2] if len(scm_py) == 3 else scm_py[0]
40
- assert lispy.to_string(scm_py[1]) == expected
@@ -1,16 +0,0 @@
1
- import logging
2
-
3
- import pytest
4
-
5
- import ansys.fluent.core as pyfluent
6
-
7
-
8
- @pytest.mark.standalone
9
- def test_set_console_logging_level(caplog):
10
- settings_logger = logging.getLogger("pyfluent.settings_api")
11
- settings_logger.warning("ABC")
12
- assert len(caplog.records) == 1
13
- caplog.clear()
14
- pyfluent.set_console_logging_level("ERROR")
15
- settings_logger.warning("ABC")
16
- assert len(caplog.records) == 0