ansys-fluent-core 0.28.dev0__py3-none-any.whl → 0.28.2__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 +15 -16
- ansys/fluent/core/_version.py +1 -1
- ansys/fluent/core/codegen/allapigen.py +0 -3
- ansys/fluent/core/codegen/builtin_settingsgen.py +5 -20
- ansys/fluent/core/codegen/print_fluent_version.py +9 -14
- ansys/fluent/core/codegen/walk_api.py +57 -0
- ansys/fluent/core/fluent_connection.py +26 -22
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +21 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +14 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +1451 -1396
- ansys/fluent/core/generated/solver/settings_252.py +9300 -6625
- ansys/fluent/core/generated/solver/settings_252.pyi +6625 -5423
- ansys/fluent/core/generated/solver/tui_252.py +5898 -5057
- ansys/fluent/core/journaling.py +4 -4
- ansys/fluent/core/launcher/fluent_container.py +31 -7
- ansys/fluent/core/launcher/launcher.py +3 -2
- ansys/fluent/core/launcher/launcher_utils.py +9 -0
- ansys/fluent/core/launcher/process_launch_string.py +8 -6
- ansys/fluent/core/launcher/pyfluent_enums.py +6 -3
- ansys/fluent/core/launcher/server_info.py +25 -2
- ansys/fluent/core/launcher/slurm_launcher.py +6 -3
- ansys/fluent/core/launcher/standalone_launcher.py +11 -9
- ansys/fluent/core/post_objects/post_helper.py +16 -10
- ansys/fluent/core/services/__init__.py +2 -0
- ansys/fluent/core/services/api_upgrade.py +11 -9
- ansys/fluent/core/services/app_utilities.py +408 -0
- ansys/fluent/core/services/datamodel_se.py +172 -58
- ansys/fluent/core/services/datamodel_tui.py +5 -2
- ansys/fluent/core/services/field_data.py +1 -0
- ansys/fluent/core/services/reduction.py +2 -0
- ansys/fluent/core/services/settings.py +5 -2
- ansys/fluent/core/session.py +27 -4
- ansys/fluent/core/session_pure_meshing.py +1 -1
- ansys/fluent/core/session_solver.py +0 -1
- ansys/fluent/core/solver/__init__.py +6 -0
- ansys/fluent/core/solver/flobject.py +15 -27
- ansys/fluent/core/solver/function/reduction.py +3 -0
- ansys/fluent/core/solver/settings_builtin_data.py +1 -1
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +13 -13
- ansys/fluent/core/streaming_services/events_streaming.py +336 -52
- ansys/fluent/tests/conftest.py +30 -0
- ansys/fluent/tests/test_builtin_settings.py +1 -1
- ansys/fluent/tests/test_codegen.py +0 -410
- ansys/fluent/tests/test_datamodel_api.py +429 -0
- ansys/fluent/tests/test_datamodel_service.py +64 -64
- ansys/fluent/tests/test_events_manager.py +24 -6
- ansys/fluent/tests/test_field_data.py +32 -0
- ansys/fluent/tests/test_launcher.py +30 -2
- ansys/fluent/tests/test_mapped_api.py +766 -0
- ansys/fluent/tests/test_reduction.py +30 -0
- ansys/fluent/tests/test_session.py +16 -1
- ansys/fluent/tests/test_settings_api.py +21 -0
- ansys/fluent/tests/test_solution_variables.py +27 -0
- ansys/fluent/tests/util/__init__.py +36 -0
- {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.2.dist-info}/METADATA +4 -3
- {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.2.dist-info}/RECORD +61 -58
- {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.2.dist-info}/WHEEL +1 -1
- ansys/fluent/core/codegen/settingsgen_old.py +0 -535
- ansys/fluent/tests/fluent/test_version/test.py +0 -2
- {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.2.dist-info}/AUTHORS +0 -0
- {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.2.dist-info}/LICENSE +0 -0
ansys/fluent/core/__init__.py
CHANGED
|
@@ -31,11 +31,7 @@ from ansys.fluent.core.parametric import LocalParametricStudy # noqa: F401
|
|
|
31
31
|
from ansys.fluent.core.search import search # noqa: F401
|
|
32
32
|
from ansys.fluent.core.services.batch_ops import BatchOps # noqa: F401
|
|
33
33
|
from ansys.fluent.core.session import BaseSession as Fluent # noqa: F401
|
|
34
|
-
from ansys.fluent.core.streaming_services.events_streaming import
|
|
35
|
-
Event,
|
|
36
|
-
MeshingEvent,
|
|
37
|
-
SolverEvent,
|
|
38
|
-
)
|
|
34
|
+
from ansys.fluent.core.streaming_services.events_streaming import * # noqa: F401, F403
|
|
39
35
|
from ansys.fluent.core.utils import fldoc, get_examples_download_dir
|
|
40
36
|
from ansys.fluent.core.utils.fluent_version import FluentVersion # noqa: F401
|
|
41
37
|
from ansys.fluent.core.utils.setup_for_fluent import setup_for_fluent # noqa: F401
|
|
@@ -45,12 +41,7 @@ from ansys.fluent.core.warnings import ( # noqa: F401
|
|
|
45
41
|
warning,
|
|
46
42
|
)
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
from ansys.fluent.core.generated.solver.settings_builtin import * # noqa: F401, F403
|
|
50
|
-
except (ImportError, AttributeError, SyntaxError):
|
|
51
|
-
pass
|
|
52
|
-
|
|
53
|
-
_VERSION_INFO = "Build date: November 27, 2024 17:14 UTC ShaID: 566bc31"
|
|
44
|
+
_VERSION_INFO = "Build date: January 11, 2025 20:07 UTC ShaID: 17ceff6"
|
|
54
45
|
"""Global variable indicating the version of the PyFluent package - Empty by default"""
|
|
55
46
|
|
|
56
47
|
_THIS_DIRNAME = os.path.dirname(__file__)
|
|
@@ -107,11 +98,10 @@ DATAMODEL_RETURN_STATE_CHANGES = True
|
|
|
107
98
|
# Whether to use remote gRPC file transfer service
|
|
108
99
|
USE_FILE_TRANSFER_SERVICE = False
|
|
109
100
|
|
|
110
|
-
# Directory where API files are
|
|
111
|
-
CODEGEN_OUTDIR =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
CODEGEN_ZIP_SETTINGS = os.getenv("PYFLUENT_CODEGEN_ZIP_SETTINGS", False)
|
|
101
|
+
# Directory where API files are written out during codegen
|
|
102
|
+
CODEGEN_OUTDIR = os.getenv(
|
|
103
|
+
"PYFLUENT_CODEGEN_OUTDIR", (Path(__file__) / ".." / "generated").resolve()
|
|
104
|
+
)
|
|
115
105
|
|
|
116
106
|
# Whether to show mesh in Fluent after case read
|
|
117
107
|
FLUENT_SHOW_MESH_AFTER_CASE_READ = False
|
|
@@ -141,3 +131,12 @@ LAUNCH_FLUENT_STDOUT = None
|
|
|
141
131
|
# Set stderr of the launched Fluent process
|
|
142
132
|
# Valid values are same as subprocess.Popen's stderr argument
|
|
143
133
|
LAUNCH_FLUENT_STDERR = None
|
|
134
|
+
|
|
135
|
+
# Set the IP address of the Fluent server while launching Fluent
|
|
136
|
+
LAUNCH_FLUENT_IP = None
|
|
137
|
+
|
|
138
|
+
# Set the port of the Fluent server while launching Fluent
|
|
139
|
+
LAUNCH_FLUENT_PORT = None
|
|
140
|
+
|
|
141
|
+
# Skip password check during rpc execution when Fluent is launched from PyFluent
|
|
142
|
+
LAUNCH_FLUENT_SKIP_PASSWORD_CHECK = False
|
ansys/fluent/core/_version.py
CHANGED
|
@@ -23,9 +23,6 @@ def generate(version: str, static_infos: dict):
|
|
|
23
23
|
api_tree = {"<meshing_session>": {}, "<solver_session>": {}}
|
|
24
24
|
_update_first_level(api_tree, tuigen.generate(version, static_infos))
|
|
25
25
|
_update_first_level(api_tree, datamodelgen.generate(version, static_infos))
|
|
26
|
-
if os.getenv("PYFLUENT_USE_OLD_SETTINGSGEN") == "1":
|
|
27
|
-
global settingsgen
|
|
28
|
-
from ansys.fluent.core.codegen import settingsgen_old as settingsgen
|
|
29
26
|
_update_first_level(api_tree, settingsgen.generate(version, static_infos))
|
|
30
27
|
api_tree_file = get_api_tree_file_name(version)
|
|
31
28
|
Path(api_tree_file).parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"""Generate builtin setting classes."""
|
|
2
2
|
|
|
3
|
-
import os
|
|
4
|
-
from zipimport import zipimporter
|
|
5
|
-
|
|
6
3
|
from ansys.fluent.core import CODEGEN_OUTDIR, FluentVersion
|
|
7
4
|
from ansys.fluent.core.solver.flobject import CreatableNamedObjectMixin, NamedObject
|
|
8
5
|
from ansys.fluent.core.solver.settings_builtin_data import DATA
|
|
@@ -12,24 +9,12 @@ _PYI_FILE = CODEGEN_OUTDIR / "solver" / "settings_builtin.pyi"
|
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
def _get_settings_root(version: str):
|
|
15
|
-
from ansys.fluent.core import CODEGEN_OUTDIR,
|
|
12
|
+
from ansys.fluent.core import CODEGEN_OUTDIR, utils
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
else:
|
|
23
|
-
if CODEGEN_ZIP_SETTINGS:
|
|
24
|
-
importer = zipimporter(
|
|
25
|
-
str(CODEGEN_OUTDIR / "solver" / f"settings_{version}.zip")
|
|
26
|
-
)
|
|
27
|
-
settings = importer.load_module("settings")
|
|
28
|
-
else:
|
|
29
|
-
settings = utils.load_module(
|
|
30
|
-
f"settings_{version}",
|
|
31
|
-
CODEGEN_OUTDIR / "solver" / f"settings_{version}" / "__init__.py",
|
|
32
|
-
)
|
|
14
|
+
settings = utils.load_module(
|
|
15
|
+
f"settings_{version}",
|
|
16
|
+
CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
|
|
17
|
+
)
|
|
33
18
|
return settings.root
|
|
34
19
|
|
|
35
20
|
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
"""Module to write Fluent version information."""
|
|
2
2
|
|
|
3
|
-
from ansys.fluent.core import CODEGEN_OUTDIR, launch_fluent
|
|
4
|
-
from ansys.fluent.core.utils.fluent_version import get_version_for_file_name
|
|
3
|
+
from ansys.fluent.core import CODEGEN_OUTDIR, FluentVersion, launch_fluent
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
def print_fluent_version(
|
|
6
|
+
def print_fluent_version(app_utilities):
|
|
8
7
|
"""Write Fluent version information to file."""
|
|
8
|
+
version = FluentVersion(app_utilities.get_product_version()).number
|
|
9
|
+
build_info = app_utilities.get_build_info()
|
|
9
10
|
version_file = (CODEGEN_OUTDIR / f"fluent_version_{version}.py").resolve()
|
|
10
11
|
with open(version_file, "w", encoding="utf8") as f:
|
|
11
12
|
f.write(f'FLUENT_VERSION = "{version}"\n')
|
|
12
|
-
f.write(f'FLUENT_BUILD_TIME = "{
|
|
13
|
-
f.write(f'FLUENT_BUILD_ID = "{
|
|
14
|
-
f.write(f'FLUENT_REVISION = "{
|
|
15
|
-
f.write(f'FLUENT_BRANCH = "{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def generate(version: str, scheme_eval):
|
|
19
|
-
"""Write Fluent version information."""
|
|
20
|
-
print_fluent_version(version, scheme_eval)
|
|
13
|
+
f.write(f'FLUENT_BUILD_TIME = "{build_info["build_time"]}"\n')
|
|
14
|
+
f.write(f'FLUENT_BUILD_ID = "{build_info["build_id"]}"\n')
|
|
15
|
+
f.write(f'FLUENT_REVISION = "{build_info["vcs_revision"]}"\n')
|
|
16
|
+
f.write(f'FLUENT_BRANCH = "{build_info["vcs_branch"]}"\n')
|
|
21
17
|
|
|
22
18
|
|
|
23
19
|
if __name__ == "__main__":
|
|
24
20
|
solver = launch_fluent()
|
|
25
|
-
|
|
26
|
-
generate(version, solver.scheme_eval.scheme_eval)
|
|
21
|
+
print_fluent_version(solver._app_utilities)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Module containing tool for walking (generated) API class hierarchy.
|
|
2
|
+
|
|
3
|
+
Example
|
|
4
|
+
-------
|
|
5
|
+
|
|
6
|
+
.. code-block:: python
|
|
7
|
+
|
|
8
|
+
>>> from ansys.fluent.core.codegen import walk_api
|
|
9
|
+
>>> from ansys.fluent.core.generated.solver import settings_252
|
|
10
|
+
>>> walk_api.walk_api(settings_252.root, lambda p: print(p), current_path=[])
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from typing import List
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def walk_api(api_root_cls, on_each_path, current_path: str | List[str] = ""):
|
|
18
|
+
"""
|
|
19
|
+
Recursively traverse the API hierarchy, calling `on_each_path` for each item.
|
|
20
|
+
|
|
21
|
+
Parameters:
|
|
22
|
+
- api_root_cls: The root class of the API hierarchy.
|
|
23
|
+
- on_each_path: A callback function to call for each path.
|
|
24
|
+
- current_path: The current path in the hierarchy (default: empty string).
|
|
25
|
+
Paths can be either dot-separated strings or string lists. The type is
|
|
26
|
+
determined by the client.
|
|
27
|
+
"""
|
|
28
|
+
# Skip the root path
|
|
29
|
+
if current_path:
|
|
30
|
+
on_each_path(current_path)
|
|
31
|
+
|
|
32
|
+
# Get child names and their respective classes
|
|
33
|
+
all_names = [
|
|
34
|
+
name
|
|
35
|
+
for attr in ("child_names", "argument_names", "command_names", "query_names")
|
|
36
|
+
for name in getattr(api_root_cls, attr, [])
|
|
37
|
+
]
|
|
38
|
+
child_classes = getattr(api_root_cls, "_child_classes", {})
|
|
39
|
+
|
|
40
|
+
# Traverse each child
|
|
41
|
+
for child_name in all_names:
|
|
42
|
+
if child_name in child_classes:
|
|
43
|
+
child_cls = child_classes[child_name]
|
|
44
|
+
# Construct the new path
|
|
45
|
+
if isinstance(current_path, list):
|
|
46
|
+
new_path = current_path + [child_name]
|
|
47
|
+
else:
|
|
48
|
+
new_path = (
|
|
49
|
+
f"{current_path}.{child_name}" if current_path else child_name
|
|
50
|
+
)
|
|
51
|
+
# Recursively walk the child
|
|
52
|
+
walk_api(child_cls, on_each_path, new_path)
|
|
53
|
+
|
|
54
|
+
# Delegate directly to any child_object_type (relevant for named objects)
|
|
55
|
+
child_object_type = getattr(api_root_cls, "child_object_type", None)
|
|
56
|
+
if child_object_type:
|
|
57
|
+
walk_api(child_cls, on_each_path, current_path)
|
|
@@ -21,6 +21,10 @@ import grpc
|
|
|
21
21
|
|
|
22
22
|
import ansys.fluent.core as pyfluent
|
|
23
23
|
from ansys.fluent.core.services import service_creator
|
|
24
|
+
from ansys.fluent.core.services.app_utilities import (
|
|
25
|
+
AppUtilitiesOld,
|
|
26
|
+
AppUtilitiesService,
|
|
27
|
+
)
|
|
24
28
|
from ansys.fluent.core.services.scheme_eval import SchemeEvalService
|
|
25
29
|
from ansys.fluent.core.utils.execution import timeout_exec, timeout_loop
|
|
26
30
|
from ansys.fluent.core.utils.file_transfer_service import RemoteFileTransferStrategy
|
|
@@ -246,15 +250,24 @@ class _ConnectionInterface:
|
|
|
246
250
|
self.scheme_eval = service_creator("scheme_eval").create(
|
|
247
251
|
self._scheme_eval_service
|
|
248
252
|
)
|
|
253
|
+
if (
|
|
254
|
+
pyfluent.FluentVersion(self.scheme_eval.version)
|
|
255
|
+
< pyfluent.FluentVersion.v252
|
|
256
|
+
):
|
|
257
|
+
self._app_utilities = AppUtilitiesOld(self.scheme_eval)
|
|
258
|
+
else:
|
|
259
|
+
self._app_utilities_service = create_grpc_service(
|
|
260
|
+
AppUtilitiesService, error_state
|
|
261
|
+
)
|
|
262
|
+
self._app_utilities = service_creator("app_utilities").create(
|
|
263
|
+
self._app_utilities_service
|
|
264
|
+
)
|
|
249
265
|
|
|
250
266
|
@property
|
|
251
267
|
def product_build_info(self) -> str:
|
|
252
268
|
"""Get Fluent build information."""
|
|
253
|
-
|
|
254
|
-
build_id
|
|
255
|
-
rev = self.scheme_eval.scheme_eval("(inquire-src-vcs-id)")
|
|
256
|
-
branch = self.scheme_eval.scheme_eval("(inquire-src-vcs-branch)")
|
|
257
|
-
return f"Build Time: {build_time} Build Id: {build_id} Revision: {rev} Branch: {branch}"
|
|
269
|
+
build_info = self._app_utilities.get_build_info()
|
|
270
|
+
return f'Build Time: {build_info["build_time"]} Build Id: {build_info["build_id"]} Revision: {build_info["vcs_revision"]} Branch: {build_info["vcs_branch"]}'
|
|
258
271
|
|
|
259
272
|
def get_cortex_connection_properties(self):
|
|
260
273
|
"""Get connection properties of Fluent."""
|
|
@@ -263,10 +276,12 @@ class _ConnectionInterface:
|
|
|
263
276
|
try:
|
|
264
277
|
logger.info(self.product_build_info)
|
|
265
278
|
logger.debug("Obtaining Cortex connection properties...")
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
279
|
+
cortex_info = self._app_utilities.get_controller_process_info()
|
|
280
|
+
solver_info = self._app_utilities.get_solver_process_info()
|
|
281
|
+
fluent_host_pid = solver_info["process_id"]
|
|
282
|
+
cortex_host = cortex_info["hostname"]
|
|
283
|
+
cortex_pid = cortex_info["process_id"]
|
|
284
|
+
cortex_pwd = cortex_info["working_directory"]
|
|
270
285
|
logger.debug("Cortex connection properties successfully obtained.")
|
|
271
286
|
except _InactiveRpcError:
|
|
272
287
|
logger.warning(
|
|
@@ -282,22 +297,11 @@ class _ConnectionInterface:
|
|
|
282
297
|
|
|
283
298
|
def get_mode(self):
|
|
284
299
|
"""Get the mode of a running fluent session."""
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if self.scheme_eval.scheme_eval("(cx-solver-mode?)"):
|
|
288
|
-
mode_str = self.scheme_eval.scheme_eval('(getenv "PRJAPP_APP")')
|
|
289
|
-
if mode_str == "flaero_server":
|
|
290
|
-
return FluentMode.SOLVER_AERO
|
|
291
|
-
elif mode_str == "flicing":
|
|
292
|
-
return FluentMode.SOLVER_ICING
|
|
293
|
-
else:
|
|
294
|
-
return FluentMode.SOLVER
|
|
295
|
-
else:
|
|
296
|
-
return FluentMode.MESHING
|
|
300
|
+
return self._app_utilities.get_app_mode()
|
|
297
301
|
|
|
298
302
|
def exit_server(self):
|
|
299
303
|
"""Exits the server."""
|
|
300
|
-
self.
|
|
304
|
+
self._app_utilities.exit()
|
|
301
305
|
|
|
302
306
|
|
|
303
307
|
def _pid_exists(pid):
|