ansys-fluent-core 0.34.2__py3-none-any.whl → 0.35.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.
- ansys/fluent/core/__init__.py +48 -84
- ansys/fluent/core/codegen/allapigen.py +2 -2
- ansys/fluent/core/codegen/builtin_settingsgen.py +54 -28
- ansys/fluent/core/codegen/datamodelgen.py +3 -1
- ansys/fluent/core/codegen/print_fluent_version.py +2 -2
- ansys/fluent/core/codegen/settingsgen.py +4 -1
- ansys/fluent/core/codegen/tuigen.py +4 -4
- ansys/fluent/core/data_model_cache.py +2 -2
- ansys/fluent/core/docker/docker_compose.py +8 -9
- ansys/fluent/core/docker/utils.py +2 -2
- ansys/fluent/core/examples/downloads.py +8 -11
- ansys/fluent/core/fluent_connection.py +23 -15
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_231/flicing.py +50 -50
- ansys/fluent/core/generated/datamodel_231/meshing.py +182 -182
- ansys/fluent/core/generated/datamodel_232/flicing.py +45 -45
- ansys/fluent/core/generated/datamodel_232/meshing.py +172 -172
- ansys/fluent/core/generated/datamodel_241/flicing.py +45 -45
- ansys/fluent/core/generated/datamodel_241/meshing.py +303 -303
- ansys/fluent/core/generated/datamodel_242/flicing.py +50 -50
- ansys/fluent/core/generated/datamodel_242/meshing.py +309 -309
- ansys/fluent/core/generated/datamodel_242/part_management.py +3 -3
- ansys/fluent/core/generated/datamodel_251/flicing.py +50 -50
- ansys/fluent/core/generated/datamodel_251/meshing.py +327 -327
- ansys/fluent/core/generated/datamodel_251/part_management.py +9 -9
- ansys/fluent/core/generated/datamodel_252/flicing.py +30 -30
- ansys/fluent/core/generated/datamodel_252/meshing.py +370 -370
- ansys/fluent/core/generated/datamodel_252/part_management.py +15 -15
- ansys/fluent/core/generated/datamodel_261/flicing.py +35 -35
- ansys/fluent/core/generated/datamodel_261/meshing.py +444 -388
- ansys/fluent/core/generated/datamodel_261/part_management.py +5 -5
- ansys/fluent/core/generated/datamodel_261/preferences.py +28 -0
- ansys/fluent/core/generated/fluent_version_261.py +3 -3
- ansys/fluent/core/generated/meshing/tui_261.py +1247 -1136
- ansys/fluent/core/generated/solver/settings_261.py +9912 -4184
- ansys/fluent/core/generated/solver/settings_261.pyi +6779 -3312
- ansys/fluent/core/generated/solver/settings_builtin.py +515 -27
- ansys/fluent/core/generated/solver/settings_builtin.pyi +2 -18
- ansys/fluent/core/generated/solver/tui_261.py +4439 -3245
- ansys/fluent/core/launcher/container_launcher.py +19 -4
- ansys/fluent/core/launcher/fluent_container.py +51 -39
- ansys/fluent/core/launcher/launch_options.py +5 -4
- ansys/fluent/core/launcher/launcher.py +16 -3
- ansys/fluent/core/launcher/launcher_utils.py +63 -15
- ansys/fluent/core/launcher/pim_launcher.py +17 -3
- ansys/fluent/core/launcher/process_launch_string.py +3 -2
- ansys/fluent/core/launcher/server_info.py +7 -3
- ansys/fluent/core/launcher/slurm_launcher.py +4 -3
- ansys/fluent/core/launcher/standalone_launcher.py +6 -3
- ansys/fluent/core/launcher/watchdog.py +3 -3
- ansys/fluent/core/launcher/watchdog_exec +1 -1
- ansys/fluent/core/logger.py +3 -1
- ansys/fluent/core/module_config.py +363 -0
- ansys/fluent/core/pyfluent_warnings.py +2 -2
- ansys/fluent/core/report.py +0 -2
- ansys/fluent/core/search.py +43 -18
- ansys/fluent/core/services/api_upgrade.py +3 -2
- ansys/fluent/core/services/datamodel_se.py +4 -2
- ansys/fluent/core/services/health_check.py +3 -1
- ansys/fluent/core/services/interceptors.py +8 -6
- ansys/fluent/core/session.py +31 -3
- ansys/fluent/core/session_pure_meshing.py +1 -1
- ansys/fluent/core/session_shared.py +4 -4
- ansys/fluent/core/session_solver.py +13 -6
- ansys/fluent/core/session_utilities.py +7 -0
- ansys/fluent/core/solver/flobject.py +6 -4
- ansys/fluent/core/solver/flunits.py +2 -0
- ansys/fluent/core/solver/settings_builtin_bases.py +3 -3
- ansys/fluent/core/solver/settings_builtin_data.py +2 -14
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +3 -2
- ansys/fluent/core/streaming_services/datamodel_streaming.py +3 -1
- ansys/fluent/core/streaming_services/events_streaming.py +2 -18
- ansys/fluent/core/system_coupling.py +3 -1
- ansys/fluent/core/utils/__init__.py +0 -7
- ansys/fluent/core/utils/data_transfer.py +3 -3
- ansys/fluent/core/utils/file_transfer_service.py +24 -15
- ansys/fluent/core/utils/fluent_version.py +3 -3
- ansys/fluent/core/utils/networking.py +13 -4
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/METADATA +8 -7
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/RECORD +82 -81
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/WHEEL +1 -1
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info/licenses}/LICENSE +0 -0
|
@@ -53,7 +53,9 @@ def _get_server_info_file_names(use_tmpdir=True) -> tuple[str, str]:
|
|
|
53
53
|
temporary directory if ``use_tmpdir`` is True, otherwise it is created in the current working
|
|
54
54
|
directory.
|
|
55
55
|
"""
|
|
56
|
-
|
|
56
|
+
from ansys.fluent.core import config
|
|
57
|
+
|
|
58
|
+
server_info_dir = config.fluent_server_info_dir
|
|
57
59
|
dir_ = (
|
|
58
60
|
Path(server_info_dir)
|
|
59
61
|
if server_info_dir
|
|
@@ -95,6 +97,8 @@ def _get_server_info(
|
|
|
95
97
|
password: str | None = None,
|
|
96
98
|
):
|
|
97
99
|
"""Get server connection information of an already running session."""
|
|
100
|
+
from ansys.fluent.core import config
|
|
101
|
+
|
|
98
102
|
if not (ip and port) and not server_info_file_name:
|
|
99
103
|
raise IpPortNotProvided()
|
|
100
104
|
if (ip or port) and server_info_file_name:
|
|
@@ -105,8 +109,8 @@ def _get_server_info(
|
|
|
105
109
|
else:
|
|
106
110
|
if server_info_file_name:
|
|
107
111
|
ip, port, password = _parse_server_info_file(server_info_file_name)
|
|
108
|
-
ip = ip or
|
|
109
|
-
port = port or
|
|
112
|
+
ip = ip or config.launch_fluent_ip or "127.0.0.1"
|
|
113
|
+
port = port or config.launch_fluent_port
|
|
110
114
|
|
|
111
115
|
_check_ip_port(ip=ip, port=port)
|
|
112
116
|
|
|
@@ -64,7 +64,6 @@ are optional and should be specified in a similar manner to Fluent's scheduler o
|
|
|
64
64
|
from concurrent.futures import Future, ThreadPoolExecutor
|
|
65
65
|
import inspect
|
|
66
66
|
import logging
|
|
67
|
-
import os
|
|
68
67
|
from pathlib import Path
|
|
69
68
|
import shutil
|
|
70
69
|
import subprocess
|
|
@@ -414,6 +413,8 @@ class SlurmLauncher:
|
|
|
414
413
|
The allocated machines and core counts are queried from the scheduler environment and
|
|
415
414
|
passed to Fluent.
|
|
416
415
|
"""
|
|
416
|
+
from ansys.fluent.core import config
|
|
417
|
+
|
|
417
418
|
if not _SlurmWrapper.is_available():
|
|
418
419
|
raise RuntimeError("Slurm is not available.")
|
|
419
420
|
locals_ = locals().copy()
|
|
@@ -423,7 +424,7 @@ class SlurmLauncher:
|
|
|
423
424
|
}
|
|
424
425
|
self._argvals, self._new_session = _get_argvals_and_session(argvals)
|
|
425
426
|
self.file_transfer_service = file_transfer_service
|
|
426
|
-
if
|
|
427
|
+
if config.show_fluent_gui:
|
|
427
428
|
ui_mode = UIMode.GUI
|
|
428
429
|
self._argvals["ui_mode"] = UIMode(ui_mode)
|
|
429
430
|
if self._argvals["start_timeout"] is None:
|
|
@@ -459,7 +460,7 @@ class SlurmLauncher:
|
|
|
459
460
|
launch_cmd += _build_journal_argument(
|
|
460
461
|
self._argvals["topy"], self._argvals["journal_file_names"]
|
|
461
462
|
)
|
|
462
|
-
launch_cmd += '
|
|
463
|
+
launch_cmd += ' --setenv="FLUENT_ALLOW_REMOTE_GRPC_CONNECTION=1"'
|
|
463
464
|
|
|
464
465
|
logger.debug(f"Launching Fluent with command: {launch_cmd}")
|
|
465
466
|
proc = subprocess.Popen(launch_cmd, **kwargs)
|
|
@@ -193,7 +193,7 @@ class StandaloneLauncher:
|
|
|
193
193
|
}
|
|
194
194
|
self.argvals, self.new_session = _get_argvals_and_session(argvals)
|
|
195
195
|
self.file_transfer_service = file_transfer_service
|
|
196
|
-
if
|
|
196
|
+
if pyfluent.config.show_fluent_gui:
|
|
197
197
|
ui_mode = UIMode.GUI
|
|
198
198
|
self.argvals["ui_mode"] = UIMode(ui_mode)
|
|
199
199
|
if self.argvals["start_timeout"] is None:
|
|
@@ -211,7 +211,7 @@ class StandaloneLauncher:
|
|
|
211
211
|
):
|
|
212
212
|
self.argvals["py"] = True
|
|
213
213
|
|
|
214
|
-
if
|
|
214
|
+
if pyfluent.config.fluent_debug:
|
|
215
215
|
self.argvals["fluent_debug"] = True
|
|
216
216
|
|
|
217
217
|
server_info_file_name_for_server, server_info_file_name_for_client = (
|
|
@@ -234,7 +234,10 @@ class StandaloneLauncher:
|
|
|
234
234
|
)
|
|
235
235
|
|
|
236
236
|
if is_windows():
|
|
237
|
-
if
|
|
237
|
+
if (
|
|
238
|
+
pyfluent.config.launch_fluent_stdout
|
|
239
|
+
or pyfluent.config.launch_fluent_stderr
|
|
240
|
+
):
|
|
238
241
|
self._launch_cmd = self._launch_string
|
|
239
242
|
else:
|
|
240
243
|
# Using 'start.exe' is better; otherwise Fluent is more susceptible to bad termination attempts.
|
|
@@ -76,7 +76,7 @@ def launch(
|
|
|
76
76
|
)
|
|
77
77
|
)
|
|
78
78
|
|
|
79
|
-
debug_watchdog =
|
|
79
|
+
debug_watchdog = pyfluent.config.watchdog_debug
|
|
80
80
|
if debug_watchdog:
|
|
81
81
|
logger.debug(
|
|
82
82
|
f"PYFLUENT_WATCHDOG_DEBUG environment variable found, "
|
|
@@ -194,13 +194,13 @@ def launch(
|
|
|
194
194
|
err_content = "Watchdog - %s" % f.read().replace("\n", "")
|
|
195
195
|
watchdog_err.unlink()
|
|
196
196
|
logger.error(err_content)
|
|
197
|
-
if
|
|
197
|
+
if pyfluent.config.watchdog_exception_on_error:
|
|
198
198
|
raise UnsuccessfulWatchdogLaunch(err_content)
|
|
199
199
|
|
|
200
200
|
logger.warning(
|
|
201
201
|
"PyFluent Watchdog did not initialize correctly, proceeding without it..."
|
|
202
202
|
)
|
|
203
|
-
if
|
|
203
|
+
if pyfluent.config.watchdog_exception_on_error:
|
|
204
204
|
raise UnsuccessfulWatchdogLaunch(
|
|
205
205
|
"PyFluent Watchdog did not initialize correctly."
|
|
206
206
|
)
|
|
@@ -34,7 +34,7 @@ if __name__ == "__main__":
|
|
|
34
34
|
|
|
35
35
|
logger = pyfluent.logger.get_logger("pyfluent.watchdog")
|
|
36
36
|
|
|
37
|
-
if
|
|
37
|
+
if pyfluent.config.watchdog_debug:
|
|
38
38
|
pyfluent.logger.enable(custom_config=log_config)
|
|
39
39
|
logger.setLevel("DEBUG")
|
|
40
40
|
logger.handlers = pyfluent.logger.get_logger(
|
ansys/fluent/core/logger.py
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
import logging.config
|
|
26
26
|
import os
|
|
27
27
|
|
|
28
|
+
from ansys.fluent.core import config
|
|
29
|
+
|
|
28
30
|
_logging_file_enabled = False
|
|
29
31
|
|
|
30
32
|
|
|
@@ -250,7 +252,7 @@ def configure_env_var() -> None:
|
|
|
250
252
|
If logging debug output to file by default is desired, without having to use :func:`enable()` every time,
|
|
251
253
|
set environment variable ``PYFLUENT_LOGGING`` to ``DEBUG``.
|
|
252
254
|
"""
|
|
253
|
-
env_logging_level =
|
|
255
|
+
env_logging_level = config.logging_level_default
|
|
254
256
|
if env_logging_level:
|
|
255
257
|
if env_logging_level.isdigit():
|
|
256
258
|
env_logging_level = int(env_logging_level)
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
#
|
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
# furnished to do so, subject to the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
# copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
# SOFTWARE.
|
|
22
|
+
"""Configuration variables for PyFluent."""
|
|
23
|
+
import inspect
|
|
24
|
+
import os
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from typing import Any, Callable, Generic, TypeVar
|
|
27
|
+
import warnings
|
|
28
|
+
|
|
29
|
+
TConfig = TypeVar("TConfig", bound="Config")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class _ConfigDescriptor(Generic[TConfig]):
|
|
33
|
+
"""Descriptor for managing configuration attributes."""
|
|
34
|
+
|
|
35
|
+
def __init__(
|
|
36
|
+
self, default_fn: Callable[[TConfig], Any], deprecated_var: str | None = None
|
|
37
|
+
):
|
|
38
|
+
self._default_fn = default_fn
|
|
39
|
+
self._deprecated_var = deprecated_var
|
|
40
|
+
|
|
41
|
+
def _get_config(self, instance: TConfig) -> Any:
|
|
42
|
+
if not hasattr(instance, self._backing_field):
|
|
43
|
+
setattr(instance, self._backing_field, self._default_fn(instance))
|
|
44
|
+
return getattr(instance, self._backing_field)
|
|
45
|
+
|
|
46
|
+
def _set_config(self, instance: TConfig, value: Any):
|
|
47
|
+
setattr(instance, self._backing_field, value)
|
|
48
|
+
|
|
49
|
+
def __set_name__(self, owner: type[TConfig], name: str):
|
|
50
|
+
self._backing_field = "_" + name
|
|
51
|
+
|
|
52
|
+
def __get__(self, instance: TConfig, owner: type[TConfig]) -> Any:
|
|
53
|
+
import ansys.fluent.core as pyfluent
|
|
54
|
+
|
|
55
|
+
if self._deprecated_var is not None and self._deprecated_var in vars(pyfluent):
|
|
56
|
+
return getattr(pyfluent, self._deprecated_var)
|
|
57
|
+
return self._get_config(instance)
|
|
58
|
+
|
|
59
|
+
def __set__(self, instance: TConfig, value: Any):
|
|
60
|
+
import ansys.fluent.core as pyfluent
|
|
61
|
+
|
|
62
|
+
if self._deprecated_var is not None and self._deprecated_var in vars(pyfluent):
|
|
63
|
+
warnings.warn(
|
|
64
|
+
f"Deleting deprecated module-level variable '{self._deprecated_var}' which was previously set."
|
|
65
|
+
)
|
|
66
|
+
delattr(pyfluent, self._deprecated_var)
|
|
67
|
+
self._set_config(instance, value)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _get_default_examples_path(instance: "Config") -> str:
|
|
71
|
+
"""Get the default examples path."""
|
|
72
|
+
parent_path = Path.home() / "Downloads"
|
|
73
|
+
parent_path.mkdir(exist_ok=True)
|
|
74
|
+
return str(parent_path / "ansys_fluent_core_examples")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Config:
|
|
78
|
+
"""Set the global configuration variables for PyFluent."""
|
|
79
|
+
|
|
80
|
+
#: Directory where example files are downloaded.
|
|
81
|
+
examples_path = _ConfigDescriptor["Config"](
|
|
82
|
+
_get_default_examples_path, "EXAMPLES_PATH"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
#: Host path which is mounted to the container, defaults to the value of ``PYFLUENT_CONTAINER_MOUNT_SOURCE`` environment variable.
|
|
86
|
+
container_mount_source = _ConfigDescriptor["Config"](
|
|
87
|
+
lambda instance: instance._env.get("PYFLUENT_CONTAINER_MOUNT_SOURCE"),
|
|
88
|
+
"CONTAINER_MOUNT_SOURCE",
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
#: Path inside the container where the host path is mounted, defaults to "/home/container/workdir".
|
|
92
|
+
container_mount_target = _ConfigDescriptor["Config"](
|
|
93
|
+
lambda instance: "/home/container/workdir", "CONTAINER_MOUNT_TARGET"
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
#: Set this to False to stop automatically inferring and setting REMOTING_SERVER_ADDRESS, defaults to True.
|
|
97
|
+
infer_remoting_ip = _ConfigDescriptor["Config"](
|
|
98
|
+
lambda instance: True, "INFER_REMOTING_IP"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Time in seconds to wait for response for each ip while inferring remoting ip, defaults to 2.
|
|
102
|
+
infer_remoting_ip_timeout_per_ip = _ConfigDescriptor["Config"](
|
|
103
|
+
lambda instance: 2, "INFER_REMOTING_IP_TIMEOUT_PER_IP"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
#: Whether to use datamodel state caching, defaults to True.
|
|
107
|
+
datamodel_use_state_cache = _ConfigDescriptor["Config"](
|
|
108
|
+
lambda instance: True, "DATAMODEL_USE_STATE_CACHE"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
#: Whether to use datamodel attribute caching, defaults to True.
|
|
112
|
+
datamodel_use_attr_cache = _ConfigDescriptor["Config"](
|
|
113
|
+
lambda instance: True, "DATAMODEL_USE_ATTR_CACHE"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
#: Whether to stream and cache commands state, defaults to True.
|
|
117
|
+
datamodel_use_nocommands_diff_state = _ConfigDescriptor["Config"](
|
|
118
|
+
lambda instance: True, "DATAMODEL_USE_NOCOMMANDS_DIFF_STATE"
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
#: Whether to return the state changes on mutating datamodel RPCs, defaults to True.
|
|
122
|
+
datamodel_return_state_changes = _ConfigDescriptor["Config"](
|
|
123
|
+
lambda instance: True, "DATAMODEL_RETURN_STATE_CHANGES"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
#: Whether to use remote gRPC file transfer service, defaults to False.
|
|
127
|
+
use_file_transfer_service = _ConfigDescriptor["Config"](
|
|
128
|
+
lambda instance: False, "USE_FILE_TRANSFER_SERVICE"
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
#: Directory where API files are written out during codegen.
|
|
132
|
+
codegen_outdir = _ConfigDescriptor["Config"](
|
|
133
|
+
lambda instance: instance._env.get(
|
|
134
|
+
"PYFLUENT_CODEGEN_OUTDIR", (Path(__file__) / ".." / "generated").resolve()
|
|
135
|
+
),
|
|
136
|
+
"CODEGEN_OUTDIR",
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
#: Whether to show mesh in Fluent after case read, defaults to False.
|
|
140
|
+
fluent_show_mesh_after_case_read = _ConfigDescriptor["Config"](
|
|
141
|
+
lambda instance: False, "FLUENT_SHOW_MESH_AFTER_CASE_READ"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
#: Whether to write the automatic transcript in Fluent, defaults to the value of ``PYFLUENT_FLUENT_AUTOMATIC_TRANSCRIPT`` environment variable.
|
|
145
|
+
fluent_automatic_transcript = _ConfigDescriptor["Config"](
|
|
146
|
+
lambda instance: instance._env.get("PYFLUENT_FLUENT_AUTOMATIC_TRANSCRIPT")
|
|
147
|
+
== "1",
|
|
148
|
+
"FLUENT_AUTOMATIC_TRANSCRIPT",
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
#: Whether to interrupt Fluent solver from PyFluent, defaults to False.
|
|
152
|
+
support_solver_interrupt = _ConfigDescriptor["Config"](
|
|
153
|
+
lambda instance: False, "SUPPORT_SOLVER_INTERRUPT"
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
#: Whether to start watchdog.
|
|
157
|
+
start_watchdog = _ConfigDescriptor["Config"](
|
|
158
|
+
lambda instance: None, "START_WATCHDOG"
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
#: Whether to enable debug logging for the watchdog, defaults to the value of ``PYFLUENT_WATCHDOG_DEBUG`` environment variable.
|
|
162
|
+
watchdog_debug = _ConfigDescriptor["Config"](
|
|
163
|
+
lambda instance: instance._env.get("PYFLUENT_WATCHDOG_DEBUG") == "1",
|
|
164
|
+
"WATCHDOG_DEBUG",
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
#: Whether to raise an exception when the watchdog encounters an error, defaults to the value of ``PYFLUENT_WATCHDOG_EXCEPTION_ON_ERROR`` environment variable.
|
|
168
|
+
watchdog_exception_on_error = _ConfigDescriptor["Config"](
|
|
169
|
+
lambda instance: instance._env.get("PYFLUENT_WATCHDOG_EXCEPTION_ON_ERROR")
|
|
170
|
+
== "1",
|
|
171
|
+
"WATCHDOG_EXCEPTION_ON_ERROR",
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
#: Health check timeout in seconds, defaults to 60 seconds.
|
|
175
|
+
check_health_timeout = _ConfigDescriptor["Config"](
|
|
176
|
+
lambda instance: 60, "CHECK_HEALTH_TIMEOUT"
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
#: Whether to skip health check, defaults to True.
|
|
180
|
+
check_health = _ConfigDescriptor["Config"](lambda instance: True, "CHECK_HEALTH")
|
|
181
|
+
|
|
182
|
+
#: Whether to print search results, defaults to True.
|
|
183
|
+
print_search_results = _ConfigDescriptor["Config"](
|
|
184
|
+
lambda instance: True, "PRINT_SEARCH_RESULTS"
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
#: Whether to clear environment variables related to Fluent parallel mode, defaults to False.
|
|
188
|
+
clear_fluent_para_envs = _ConfigDescriptor["Config"](
|
|
189
|
+
lambda instance: False, "CLEAR_FLUENT_PARA_ENVS"
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
#: Set stdout of the launched Fluent process.
|
|
193
|
+
#: Valid values are the same as subprocess.Popen's stdout argument.
|
|
194
|
+
launch_fluent_stdout = _ConfigDescriptor["Config"](
|
|
195
|
+
lambda instance: None, "LAUNCH_FLUENT_STDOUT"
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
#: Set stderr of the launched Fluent process.
|
|
199
|
+
#: Valid values are the same as subprocess.Popen's stderr argument.
|
|
200
|
+
launch_fluent_stderr = _ConfigDescriptor["Config"](
|
|
201
|
+
lambda instance: None, "LAUNCH_FLUENT_STDERR"
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
#: Set the IP address of the Fluent server while launching Fluent, defaults to the value of ``PYFLUENT_FLUENT_IP`` environment variable.
|
|
205
|
+
launch_fluent_ip = _ConfigDescriptor["Config"](
|
|
206
|
+
lambda instance: instance._env.get("PYFLUENT_FLUENT_IP"), "LAUNCH_FLUENT_IP"
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
#: Set the port of the Fluent server while launching Fluent, defaults to the value of ``PYFLUENT_FLUENT_PORT`` environment variable.
|
|
210
|
+
launch_fluent_port = _ConfigDescriptor["Config"](
|
|
211
|
+
lambda instance: instance._env.get("PYFLUENT_FLUENT_PORT"), "LAUNCH_FLUENT_PORT"
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
#: Skip password check during RPC execution when Fluent is launched from PyFluent, defaults to False.
|
|
215
|
+
launch_fluent_skip_password_check = _ConfigDescriptor["Config"](
|
|
216
|
+
lambda instance: False, "LAUNCH_FLUENT_SKIP_PASSWORD_CHECK"
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
#: The timeout in seconds to wait for Fluent to exit, defaults to the value of ``PYFLUENT_FORCE_EXIT_TIMEOUT`` environment variable.
|
|
220
|
+
force_exit_timeout = _ConfigDescriptor["Config"](
|
|
221
|
+
lambda instance: instance._env.get("PYFLUENT_FORCE_EXIT_TIMEOUT")
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
#: Whether to skip code generation of built-in settings, defaults to the value of ``PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS`` environment variable.
|
|
225
|
+
codegen_skip_builtin_settings = _ConfigDescriptor["Config"](
|
|
226
|
+
lambda instance: instance._env.get("PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS")
|
|
227
|
+
== "1"
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
#: Whether to launch Fluent in a container, defaults to the value of ``PYFLUENT_LAUNCH_CONTAINER`` environment variable.
|
|
231
|
+
launch_fluent_container = _ConfigDescriptor["Config"](
|
|
232
|
+
lambda instance: instance._env.get("PYFLUENT_LAUNCH_CONTAINER") == "1"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
#: The tag of the Fluent image to use when launching in a container, defaults to the value of ``FLUENT_IMAGE_TAG`` environment variable or the latest release version of Fluent.
|
|
236
|
+
fluent_image_tag = _ConfigDescriptor["Config"](
|
|
237
|
+
lambda instance: instance._env.get(
|
|
238
|
+
"FLUENT_IMAGE_TAG", f"v{instance.fluent_release_version}"
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
#: The name of the Fluent image to use when launching in a container, defaults to the value of ``FLUENT_IMAGE_NAME`` environment variable.
|
|
243
|
+
fluent_image_name = _ConfigDescriptor["Config"](
|
|
244
|
+
lambda instance: instance._env.get("FLUENT_IMAGE_NAME")
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
#: The name of the Fluent container to use when launching in a container, defaults to the value of ``FLUENT_CONTAINER_NAME`` environment variable.
|
|
248
|
+
fluent_container_name = _ConfigDescriptor["Config"](
|
|
249
|
+
lambda instance: instance._env.get("FLUENT_CONTAINER_NAME")
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
#: Whether to use Docker Compose for launching Fluent in a container, defaults to the value of ``PYFLUENT_USE_DOCKER_COMPOSE`` environment variable.
|
|
253
|
+
use_docker_compose = _ConfigDescriptor["Config"](
|
|
254
|
+
lambda instance: instance._env.get("PYFLUENT_USE_DOCKER_COMPOSE") == "1"
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
#: Whether to use Podman Compose for launching Fluent in a container, defaults to the value of ``PYFLUENT_USE_PODMAN_COMPOSE`` environment variable.
|
|
258
|
+
use_podman_compose = _ConfigDescriptor["Config"](
|
|
259
|
+
lambda instance: instance._env.get("PYFLUENT_USE_PODMAN_COMPOSE") == "1"
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
#: The timeout in seconds to wait for Fluent to launch, defaults to the value of ``PYFLUENT_LAUNCH_FLUENT_TIMEOUT`` environment variable or 60 seconds.
|
|
263
|
+
launch_fluent_timeout = _ConfigDescriptor["Config"](
|
|
264
|
+
lambda instance: int(instance._env.get("PYFLUENT_LAUNCH_FLUENT_TIMEOUT", 60))
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
#: Whether to show the Fluent GUI when launching the server, defaults to the value of ``PYFLUENT_SHOW_SERVER_GUI`` environment variable.
|
|
268
|
+
show_fluent_gui = _ConfigDescriptor["Config"](
|
|
269
|
+
lambda instance: instance._env.get("PYFLUENT_SHOW_SERVER_GUI") == "1"
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
#: Whether to launch Fluent in debug mode, defaults to the value of ``PYFLUENT_FLUENT_DEBUG`` environment variable.
|
|
273
|
+
fluent_debug = _ConfigDescriptor["Config"](
|
|
274
|
+
lambda instance: instance._env.get("PYFLUENT_FLUENT_DEBUG") == "1"
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
#: Whether to skip API upgrade advice, defaults to the value of ``PYFLUENT_SKIP_API_UPGRADE_ADVICE`` environment variable.
|
|
278
|
+
skip_api_upgrade_advice = _ConfigDescriptor["Config"](
|
|
279
|
+
lambda instance: instance._env.get("PYFLUENT_SKIP_API_UPGRADE_ADVICE") == "1"
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
#: The maximum number of bytes to log in gRPC logs, defaults to the value of ``PYFLUENT_GRPC_LOG_BYTES_LIMIT`` environment variable or 1000 bytes.
|
|
283
|
+
grpc_log_bytes_limit = _ConfigDescriptor["Config"](
|
|
284
|
+
lambda instance: int(instance._env.get("PYFLUENT_GRPC_LOG_BYTES_LIMIT", 1000))
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
#: Whether to disable the fix for returning parameter lists via settings API, defaults to the value of ``PYFLUENT_NO_FIX_PARAMETER_LIST_RETURN`` environment variable.
|
|
288
|
+
disable_parameter_list_return_fix = _ConfigDescriptor["Config"](
|
|
289
|
+
lambda instance: instance._env.get("PYFLUENT_NO_FIX_PARAMETER_LIST_RETURN")
|
|
290
|
+
== "1"
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
#: Whether to use runtime Python classes for settings, defaults to the value of ``PYFLUENT_USE_RUNTIME_PYTHON_CLASSES`` environment variable.
|
|
294
|
+
use_runtime_python_classes = _ConfigDescriptor["Config"](
|
|
295
|
+
lambda instance: instance._env.get("PYFLUENT_USE_RUNTIME_PYTHON_CLASSES") == "1"
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
#: Whether to hide sensitive information in logs, defaults to the value of ``PYFLUENT_HIDE_LOG_SECRETS`` environment variable.
|
|
299
|
+
hide_log_secrets = _ConfigDescriptor["Config"](
|
|
300
|
+
lambda instance: instance._env.get("PYFLUENT_HIDE_LOG_SECRETS") == "1"
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
#: The Fluent root directory to be used for PyFluent, defaults to the value of ``PYFLUENT_FLUENT_ROOT`` environment variable.
|
|
304
|
+
fluent_root = _ConfigDescriptor["Config"](
|
|
305
|
+
lambda instance: instance._env.get("PYFLUENT_FLUENT_ROOT")
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
#: The remoting server address to be used in Fluent, defaults to the value of ``REMOTING_SERVER_ADDRESS`` environment variable.
|
|
309
|
+
remoting_server_address = _ConfigDescriptor["Config"](
|
|
310
|
+
lambda instance: instance._env.get("REMOTING_SERVER_ADDRESS")
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
#: The directory where server info will be written from Fluent, defaults to the value of ``SERVER_INFO_DIR`` environment variable.
|
|
314
|
+
fluent_server_info_dir = _ConfigDescriptor["Config"](
|
|
315
|
+
lambda instance: instance._env.get("SERVER_INFO_DIR")
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
#: Current unit test name, defaults to the value of ``PYFLUENT_TEST_NAME`` environment variable.
|
|
319
|
+
test_name = _ConfigDescriptor["Config"](
|
|
320
|
+
lambda instance: instance._env.get("PYFLUENT_TEST_NAME")
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
#: The default logging level for PyFluent, defaults to the value of ``PYFLUENT_LOGGING`` environment variable.
|
|
324
|
+
logging_level_default = _ConfigDescriptor["Config"](
|
|
325
|
+
lambda instance: instance._env.get("PYFLUENT_LOGGING")
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
#: Whether to disable monitor refresh on solution initialization, defaults to False.
|
|
329
|
+
disable_monitor_refresh_on_init = _ConfigDescriptor["Config"](
|
|
330
|
+
lambda instance: False
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
def __init__(self):
|
|
334
|
+
"""__init__ method of Config class."""
|
|
335
|
+
# Read the environment variable once when pyfluent is imported
|
|
336
|
+
# and reuse it throughout process lifetime.
|
|
337
|
+
self._env = os.environ.copy()
|
|
338
|
+
|
|
339
|
+
@property
|
|
340
|
+
def fluent_release_version(self) -> str:
|
|
341
|
+
"""The latest released version of Fluent."""
|
|
342
|
+
return "25.2.0"
|
|
343
|
+
|
|
344
|
+
@property
|
|
345
|
+
def fluent_dev_version(self) -> str:
|
|
346
|
+
"""The latest development version of Fluent."""
|
|
347
|
+
return "26.1.0"
|
|
348
|
+
|
|
349
|
+
def print(self):
|
|
350
|
+
"""Print all configuration variables."""
|
|
351
|
+
config_dict = {}
|
|
352
|
+
for k, v in inspect.getmembers_static(self):
|
|
353
|
+
if isinstance(v, (_ConfigDescriptor, property)):
|
|
354
|
+
config_dict[k] = v.__get__(self, self.__class__)
|
|
355
|
+
max_key_length = max(len(k) for k in config_dict)
|
|
356
|
+
print("PyFluent Configuration:")
|
|
357
|
+
print("-" * (max_key_length + 20))
|
|
358
|
+
for k, v in config_dict.items():
|
|
359
|
+
print(f"{k.ljust(max_key_length)} : {v}")
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
#: Global configuration object for PyFluent
|
|
363
|
+
config = Config()
|
|
@@ -46,9 +46,9 @@ class FluentDevVersionWarning(PyFluentUserWarning):
|
|
|
46
46
|
|
|
47
47
|
def warning_for_fluent_dev_version(version):
|
|
48
48
|
"""Provides warning if Fluent develop branch is used."""
|
|
49
|
-
from ansys.fluent.core import
|
|
49
|
+
from ansys.fluent.core import FluentVersion, config
|
|
50
50
|
|
|
51
|
-
if FluentVersion(version) > FluentVersion(
|
|
51
|
+
if FluentVersion(version) > FluentVersion(config.fluent_release_version):
|
|
52
52
|
warnings.warn(
|
|
53
53
|
"⚠️ Warning: You are using PyFluent with an unreleased or development version of Fluent.\n"
|
|
54
54
|
"Compatibility is not guaranteed, and unexpected behavior may occur. Please use a released "
|