ansys-fluent-core 0.34.2__py3-none-any.whl → 0.35.0__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 +8 -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 +9 -12
- 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 +55 -55
- ansys/fluent/core/generated/datamodel_231/meshing.py +191 -191
- ansys/fluent/core/generated/datamodel_232/flicing.py +40 -40
- ansys/fluent/core/generated/datamodel_232/meshing.py +177 -177
- ansys/fluent/core/generated/datamodel_241/flicing.py +30 -30
- ansys/fluent/core/generated/datamodel_241/meshing.py +298 -298
- ansys/fluent/core/generated/datamodel_242/flicing.py +45 -45
- ansys/fluent/core/generated/datamodel_242/meshing.py +352 -352
- ansys/fluent/core/generated/datamodel_242/part_management.py +9 -9
- ansys/fluent/core/generated/datamodel_251/flicing.py +40 -40
- ansys/fluent/core/generated/datamodel_251/meshing.py +304 -304
- ansys/fluent/core/generated/datamodel_251/part_management.py +6 -6
- ansys/fluent/core/generated/datamodel_252/flicing.py +50 -50
- ansys/fluent/core/generated/datamodel_252/meshing.py +435 -435
- ansys/fluent/core/generated/datamodel_252/part_management.py +5 -5
- ansys/fluent/core/generated/datamodel_261/flicing.py +45 -45
- ansys/fluent/core/generated/datamodel_261/meshing.py +462 -399
- 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 +11990 -4900
- ansys/fluent/core/generated/solver/settings_261.pyi +7277 -3115
- 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 +3888 -2676
- 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 +4 -3
- 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 +1 -1
- ansys/fluent/core/launcher/server_info.py +7 -3
- ansys/fluent/core/launcher/slurm_launcher.py +3 -2
- 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 +358 -0
- ansys/fluent/core/pyfluent_warnings.py +2 -2
- ansys/fluent/core/report.py +1 -3
- ansys/fluent/core/search.py +43 -18
- ansys/fluent/core/services/__init__.py +2 -0
- ansys/fluent/core/services/api_upgrade.py +3 -2
- ansys/fluent/core/services/datamodel_se.py +4 -2
- ansys/fluent/core/services/field_data.py +24 -0
- ansys/fluent/core/services/health_check.py +3 -1
- ansys/fluent/core/services/interceptors.py +8 -6
- ansys/fluent/core/services/settings.py +1 -1
- ansys/fluent/core/session.py +32 -5
- 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 +10 -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.0.dist-info}/METADATA +8 -7
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.0.dist-info}/RECORD +85 -84
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.0.dist-info}/WHEEL +1 -1
- {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
"""Provides a module for the API upgrade advisor."""
|
|
24
24
|
|
|
25
|
-
import os
|
|
26
25
|
from typing import TypeVar
|
|
27
26
|
|
|
28
27
|
from ansys.fluent.core.services.app_utilities import AppUtilities
|
|
@@ -47,8 +46,10 @@ class ApiUpgradeAdvisor:
|
|
|
47
46
|
self._id = None
|
|
48
47
|
|
|
49
48
|
def _can_advise(self) -> bool:
|
|
49
|
+
from ansys.fluent.core import config
|
|
50
|
+
|
|
50
51
|
return (
|
|
51
|
-
not
|
|
52
|
+
not config.skip_api_upgrade_advice
|
|
52
53
|
and FluentVersion(self._version) >= FluentVersion.v231
|
|
53
54
|
and self._mode == "solver"
|
|
54
55
|
)
|
|
@@ -514,7 +514,9 @@ class DatamodelService(StreamingService):
|
|
|
514
514
|
self.event_streaming = None
|
|
515
515
|
self.subscriptions = SubscriptionList()
|
|
516
516
|
self.file_transfer_service = file_transfer_service
|
|
517
|
-
self.cache =
|
|
517
|
+
self.cache = (
|
|
518
|
+
DataModelCache() if pyfluent.config.datamodel_use_state_cache else None
|
|
519
|
+
)
|
|
518
520
|
self.version = version
|
|
519
521
|
|
|
520
522
|
def get_attribute_value(self, rules: str, path: str, attribute: str) -> ValueT:
|
|
@@ -1096,7 +1098,7 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1096
1098
|
Any
|
|
1097
1099
|
Value of the attribute.
|
|
1098
1100
|
"""
|
|
1099
|
-
if pyfluent.
|
|
1101
|
+
if pyfluent.config.datamodel_use_attr_cache:
|
|
1100
1102
|
return self._get_cached_attr(attrib)
|
|
1101
1103
|
return self._get_remote_attr(attrib)
|
|
1102
1104
|
|
|
@@ -623,6 +623,18 @@ class BatchFieldData(BaseFieldData, BaseFieldDataSource):
|
|
|
623
623
|
return self.data
|
|
624
624
|
|
|
625
625
|
|
|
626
|
+
class TransactionFieldData(BatchFieldData):
|
|
627
|
+
"""TransactionFieldData class - deprecated."""
|
|
628
|
+
|
|
629
|
+
def __init__(self, *args, **kwargs):
|
|
630
|
+
warnings.warn(
|
|
631
|
+
"'TransactionFieldData' is deprecated, use 'BatchFieldData' instead.",
|
|
632
|
+
PyFluentDeprecationWarning,
|
|
633
|
+
stacklevel=2,
|
|
634
|
+
)
|
|
635
|
+
super().__init__(*args, **kwargs)
|
|
636
|
+
|
|
637
|
+
|
|
626
638
|
class Batch(FieldBatch):
|
|
627
639
|
"""Populates Fluent field data on surfaces."""
|
|
628
640
|
|
|
@@ -1011,6 +1023,18 @@ class Batch(FieldBatch):
|
|
|
1011
1023
|
self.get_response()
|
|
1012
1024
|
|
|
1013
1025
|
|
|
1026
|
+
class Transaction(Batch):
|
|
1027
|
+
"""Transaction class - deprecated."""
|
|
1028
|
+
|
|
1029
|
+
def __init__(self, *args, **kwargs):
|
|
1030
|
+
warnings.warn(
|
|
1031
|
+
"'Transaction' is deprecated, use 'Batch' instead.",
|
|
1032
|
+
PyFluentDeprecationWarning,
|
|
1033
|
+
stacklevel=2,
|
|
1034
|
+
)
|
|
1035
|
+
super().__init__(*args, **kwargs)
|
|
1036
|
+
|
|
1037
|
+
|
|
1014
1038
|
class _FieldDataConstants:
|
|
1015
1039
|
"""Defines constants for Fluent field data."""
|
|
1016
1040
|
|
|
@@ -80,7 +80,9 @@ class HealthCheckService:
|
|
|
80
80
|
"""
|
|
81
81
|
request = HealthCheckModule.HealthCheckRequest()
|
|
82
82
|
response = self._stub.Check(
|
|
83
|
-
request,
|
|
83
|
+
request,
|
|
84
|
+
metadata=self._metadata,
|
|
85
|
+
timeout=pyfluent.config.check_health_timeout,
|
|
84
86
|
)
|
|
85
87
|
return HealthCheckService.Status(response.status)
|
|
86
88
|
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
import builtins
|
|
26
26
|
import logging
|
|
27
|
-
import os
|
|
28
27
|
from typing import Any
|
|
29
28
|
|
|
30
29
|
from google.protobuf.json_format import MessageToDict
|
|
@@ -34,8 +33,6 @@ import grpc
|
|
|
34
33
|
from ansys.fluent.core.services.batch_ops import BatchOps
|
|
35
34
|
|
|
36
35
|
network_logger: logging.Logger = logging.getLogger("pyfluent.networking")
|
|
37
|
-
log_bytes_limit: int = int(os.getenv("PYFLUENT_GRPC_LOG_BYTES_LIMIT", 1000))
|
|
38
|
-
truncate_len: int = log_bytes_limit // 5
|
|
39
36
|
|
|
40
37
|
|
|
41
38
|
def _upper_snake_case_to_camel_case(name: str) -> str:
|
|
@@ -43,14 +40,17 @@ def _upper_snake_case_to_camel_case(name: str) -> str:
|
|
|
43
40
|
|
|
44
41
|
|
|
45
42
|
def _truncate_grpc_str(message: Message) -> str:
|
|
43
|
+
from ansys.fluent.core import config
|
|
44
|
+
|
|
45
|
+
truncate_len = config.grpc_log_bytes_limit // 5
|
|
46
46
|
message_bytes = message.ByteSize()
|
|
47
47
|
message_str = str(MessageToDict(message))
|
|
48
|
-
if not
|
|
48
|
+
if not config.grpc_log_bytes_limit or message_bytes < config.grpc_log_bytes_limit:
|
|
49
49
|
return message_str
|
|
50
50
|
else:
|
|
51
51
|
network_logger.debug(
|
|
52
52
|
f"GRPC_TRACE: message partially hidden, {message_bytes} bytes > "
|
|
53
|
-
f"{
|
|
53
|
+
f"{config.grpc_log_bytes_limit} bytes limit. To see the full message, set PYFLUENT_GRPC_LOG_BYTES_LIMIT to 0."
|
|
54
54
|
)
|
|
55
55
|
return f"{message_str[:truncate_len]} < ... > {message_str[-truncate_len:]}"
|
|
56
56
|
|
|
@@ -68,6 +68,8 @@ class TracingInterceptor(grpc.UnaryUnaryClientInterceptor):
|
|
|
68
68
|
client_call_details: grpc.ClientCallDetails,
|
|
69
69
|
request: Any,
|
|
70
70
|
) -> Any:
|
|
71
|
+
from ansys.fluent.core import config
|
|
72
|
+
|
|
71
73
|
network_logger.debug(
|
|
72
74
|
f"GRPC_TRACE: RPC = {client_call_details.method}, request = {_truncate_grpc_str(request)}"
|
|
73
75
|
)
|
|
@@ -75,7 +77,7 @@ class TracingInterceptor(grpc.UnaryUnaryClientInterceptor):
|
|
|
75
77
|
if not response.exception():
|
|
76
78
|
# call _truncate_grpc_str early to get the size warning even when hiding secrets
|
|
77
79
|
response_str = _truncate_grpc_str(response.result())
|
|
78
|
-
if
|
|
80
|
+
if not config.hide_log_secrets:
|
|
79
81
|
network_logger.debug(f"GRPC_TRACE: response = {response_str}")
|
|
80
82
|
return response
|
|
81
83
|
|
|
@@ -335,7 +335,7 @@ class SettingsService:
|
|
|
335
335
|
"""
|
|
336
336
|
request = SettingsModule.GetStaticInfoRequest()
|
|
337
337
|
request.root = "fluent"
|
|
338
|
-
request.optional_attrs.
|
|
338
|
+
request.optional_attrs.extend(["allowed-values", "has-migration-adapter?"])
|
|
339
339
|
response = self._service_impl.get_static_info(request)
|
|
340
340
|
# The RPC calls no longer raise an exception. Force an exception if
|
|
341
341
|
# type is empty
|
ansys/fluent/core/session.py
CHANGED
|
@@ -33,7 +33,6 @@ from deprecated.sphinx import deprecated
|
|
|
33
33
|
|
|
34
34
|
from ansys.fluent.core.fluent_connection import FluentConnection
|
|
35
35
|
from ansys.fluent.core.journaling import Journal
|
|
36
|
-
from ansys.fluent.core.launcher.launcher_utils import is_compose
|
|
37
36
|
from ansys.fluent.core.pyfluent_warnings import (
|
|
38
37
|
PyFluentDeprecationWarning,
|
|
39
38
|
PyFluentUserWarning,
|
|
@@ -46,7 +45,6 @@ from ansys.fluent.core.streaming_services.datamodel_event_streaming import (
|
|
|
46
45
|
DatamodelEvents,
|
|
47
46
|
)
|
|
48
47
|
from ansys.fluent.core.streaming_services.events_streaming import EventsManager
|
|
49
|
-
from ansys.fluent.core.streaming_services.field_data_streaming import FieldDataStreaming
|
|
50
48
|
from ansys.fluent.core.streaming_services.transcript_streaming import Transcript
|
|
51
49
|
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
52
50
|
|
|
@@ -151,6 +149,7 @@ class BaseSession:
|
|
|
151
149
|
file_transfer_service,
|
|
152
150
|
event_type,
|
|
153
151
|
get_zones_info,
|
|
152
|
+
launcher_args,
|
|
154
153
|
)
|
|
155
154
|
self.register_finalizer_callback = fluent_connection.register_finalizer_cb
|
|
156
155
|
|
|
@@ -161,10 +160,14 @@ class BaseSession:
|
|
|
161
160
|
file_transfer_service: Any | None = None,
|
|
162
161
|
event_type=None,
|
|
163
162
|
get_zones_info: weakref.WeakMethod[Callable[[], list[ZoneInfo]]] | None = None,
|
|
163
|
+
launcher_args: Dict[str, Any] | None = None,
|
|
164
164
|
):
|
|
165
165
|
"""Build a BaseSession object from fluent_connection object."""
|
|
166
166
|
self._fluent_connection = fluent_connection
|
|
167
|
+
# Stores the backup of the fluent connection for later reference.
|
|
168
|
+
self._fluent_connection_backup = self._fluent_connection
|
|
167
169
|
self._file_transfer_service = file_transfer_service
|
|
170
|
+
self._launcher_args = launcher_args
|
|
168
171
|
self._error_state = fluent_connection._error_state
|
|
169
172
|
self.scheme = scheme_eval
|
|
170
173
|
self.rp_vars = RPVars(self.scheme.string_eval)
|
|
@@ -354,8 +357,32 @@ class BaseSession:
|
|
|
354
357
|
return FluentVersion(self.scheme.version)
|
|
355
358
|
|
|
356
359
|
def _exit_compose_service(self):
|
|
357
|
-
|
|
358
|
-
|
|
360
|
+
args = self._launcher_args or {}
|
|
361
|
+
compose_config = args.get("compose_config", None)
|
|
362
|
+
|
|
363
|
+
container = self._fluent_connection._container
|
|
364
|
+
if compose_config and compose_config.is_compose:
|
|
365
|
+
container.stop()
|
|
366
|
+
|
|
367
|
+
def wait_process_finished(self, wait: float | int | bool = 60):
|
|
368
|
+
"""Returns ``True`` if local Fluent processes have finished, ``False`` if they
|
|
369
|
+
are still running when wait limit (default 60 seconds) is reached. Immediately
|
|
370
|
+
cancels and returns ``None`` if ``wait`` is set to ``False``.
|
|
371
|
+
|
|
372
|
+
Parameters
|
|
373
|
+
----------
|
|
374
|
+
wait : float, int or bool, optional
|
|
375
|
+
How long to wait for processes to finish before returning, by default 60 seconds.
|
|
376
|
+
Can also be set to ``True``, which will result in waiting indefinitely.
|
|
377
|
+
|
|
378
|
+
Raises
|
|
379
|
+
------
|
|
380
|
+
UnsupportedRemoteFluentInstance
|
|
381
|
+
If current Fluent instance is running remotely.
|
|
382
|
+
WaitTypeError
|
|
383
|
+
If ``wait`` is specified improperly.
|
|
384
|
+
"""
|
|
385
|
+
return self._fluent_connection_backup.wait_process_finished()
|
|
359
386
|
|
|
360
387
|
def exit(self, **kwargs) -> None:
|
|
361
388
|
"""Exit session."""
|
|
@@ -488,7 +515,7 @@ class Fields:
|
|
|
488
515
|
_session.scheme,
|
|
489
516
|
get_zones_info,
|
|
490
517
|
)
|
|
491
|
-
self.field_data_streaming =
|
|
518
|
+
self.field_data_streaming = service_creator("field_data_streaming").create(
|
|
492
519
|
_session._fluent_connection._id, _session._field_data_service
|
|
493
520
|
)
|
|
494
521
|
self.field_data_old = service_creator("field_data_old").create(
|
|
@@ -120,7 +120,7 @@ class PureMeshing(BaseSession):
|
|
|
120
120
|
self.datamodel_streams[rules] = stream
|
|
121
121
|
stream.start(
|
|
122
122
|
rules=rules,
|
|
123
|
-
no_commands_diff_state=pyfluent.
|
|
123
|
+
no_commands_diff_state=pyfluent.config.datamodel_use_nocommands_diff_state,
|
|
124
124
|
)
|
|
125
125
|
self._fluent_connection.register_finalizer_cb(stream.stop)
|
|
126
126
|
|
|
@@ -47,11 +47,11 @@ tui_logger = logging.getLogger("pyfluent.tui")
|
|
|
47
47
|
|
|
48
48
|
def _make_tui_module(session, module_name):
|
|
49
49
|
try:
|
|
50
|
-
from ansys.fluent.core import
|
|
50
|
+
from ansys.fluent.core import config
|
|
51
51
|
|
|
52
52
|
tui_module = pyfluent.utils.load_module(
|
|
53
53
|
f"{module_name}_tui_{session._version}",
|
|
54
|
-
|
|
54
|
+
config.codegen_outdir / module_name / f"tui_{session._version}.py",
|
|
55
55
|
)
|
|
56
56
|
warning_for_fluent_dev_version(session._version)
|
|
57
57
|
return tui_module.main_menu(
|
|
@@ -64,13 +64,13 @@ def _make_tui_module(session, module_name):
|
|
|
64
64
|
|
|
65
65
|
def _make_datamodel_module(session, module_name):
|
|
66
66
|
try:
|
|
67
|
-
from ansys.fluent.core import
|
|
67
|
+
from ansys.fluent.core import config
|
|
68
68
|
from ansys.fluent.core.codegen.datamodelgen import datamodel_file_name_map
|
|
69
69
|
|
|
70
70
|
file_name = datamodel_file_name_map[module_name]
|
|
71
71
|
module = pyfluent.utils.load_module(
|
|
72
72
|
f"{module_name}_{session._version}",
|
|
73
|
-
|
|
73
|
+
config.codegen_outdir / f"datamodel_{session._version}" / f"{file_name}.py",
|
|
74
74
|
)
|
|
75
75
|
warning_for_fluent_dev_version(session._version)
|
|
76
76
|
return module.Root(session._se_service, module_name, [])
|
|
@@ -119,13 +119,16 @@ class Solver(BaseSession):
|
|
|
119
119
|
get_zones_info=weakref.WeakMethod(self._get_zones_info),
|
|
120
120
|
)
|
|
121
121
|
self._settings = None
|
|
122
|
-
self._build_from_fluent_connection(
|
|
122
|
+
self._build_from_fluent_connection(
|
|
123
|
+
fluent_connection, scheme_eval, launcher_args=launcher_args
|
|
124
|
+
)
|
|
123
125
|
|
|
124
126
|
def _build_from_fluent_connection(
|
|
125
127
|
self,
|
|
126
128
|
fluent_connection,
|
|
127
129
|
scheme_eval: SchemeEval,
|
|
128
130
|
file_transfer_service: Any | None = None,
|
|
131
|
+
launcher_args: Dict[str, Any] | None = None,
|
|
129
132
|
):
|
|
130
133
|
self._tui_service = self._datamodel_service_tui
|
|
131
134
|
self._se_service = self._datamodel_service_se
|
|
@@ -134,6 +137,7 @@ class Solver(BaseSession):
|
|
|
134
137
|
self._system_coupling = None
|
|
135
138
|
self._fluent_version = None
|
|
136
139
|
self._bg_session_threads = []
|
|
140
|
+
self._launcher_args = launcher_args
|
|
137
141
|
self._solution_variable_service = service_creator("svar").create(
|
|
138
142
|
fluent_connection._channel, fluent_connection._metadata
|
|
139
143
|
)
|
|
@@ -156,10 +160,11 @@ class Solver(BaseSession):
|
|
|
156
160
|
)
|
|
157
161
|
#: Manage Fluent's solution monitors.
|
|
158
162
|
self.monitors = MonitorsManager(fluent_connection._id, monitors_service)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
if not pyfluent.config.disable_monitor_refresh_on_init:
|
|
164
|
+
self.events.register_callback(
|
|
165
|
+
(SolverEvent.SOLUTION_INITIALIZED, SolverEvent.DATA_LOADED),
|
|
166
|
+
self.monitors.refresh,
|
|
167
|
+
)
|
|
163
168
|
|
|
164
169
|
fluent_connection.register_finalizer_cb(self.monitors.stop)
|
|
165
170
|
|
|
@@ -267,7 +272,7 @@ class Solver(BaseSession):
|
|
|
267
272
|
"solution/run-calculation/calculate",
|
|
268
273
|
"solution/run-calculation/dual-time-iterate",
|
|
269
274
|
]
|
|
270
|
-
if pyfluent.
|
|
275
|
+
if pyfluent.config.support_solver_interrupt:
|
|
271
276
|
if command.path in interruptible_commands:
|
|
272
277
|
command._root.solution.run_calculation.interrupt()
|
|
273
278
|
|
|
@@ -296,10 +301,12 @@ class Solver(BaseSession):
|
|
|
296
301
|
bg_session._fluent_connection,
|
|
297
302
|
bg_session._fluent_connection._connection_interface.scheme_eval,
|
|
298
303
|
event_type=SolverEvent,
|
|
304
|
+
launcher_args=launcher_args,
|
|
299
305
|
)
|
|
300
306
|
self._build_from_fluent_connection(
|
|
301
307
|
bg_session._fluent_connection,
|
|
302
308
|
bg_session._fluent_connection._connection_interface.scheme_eval,
|
|
309
|
+
launcher_args=launcher_args,
|
|
303
310
|
)
|
|
304
311
|
# TODO temporary fix till set_state at settings root is fixed
|
|
305
312
|
_set_state_safe(self.settings, state)
|
|
@@ -264,6 +264,7 @@ class SessionBase:
|
|
|
264
264
|
@classmethod
|
|
265
265
|
def from_pim(
|
|
266
266
|
cls,
|
|
267
|
+
ui_mode: UIMode | str | None = None,
|
|
267
268
|
graphics_driver: (
|
|
268
269
|
FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str | None
|
|
269
270
|
) = None,
|
|
@@ -274,6 +275,7 @@ class SessionBase:
|
|
|
274
275
|
start_timeout: int = 60,
|
|
275
276
|
additional_arguments: str = "",
|
|
276
277
|
cleanup_on_exit: bool = True,
|
|
278
|
+
dry_run: bool | None = None,
|
|
277
279
|
start_transcript: bool = True,
|
|
278
280
|
gpu: bool | None = None,
|
|
279
281
|
start_watchdog: bool | None = None,
|
|
@@ -284,6 +286,8 @@ class SessionBase:
|
|
|
284
286
|
|
|
285
287
|
Parameters
|
|
286
288
|
----------
|
|
289
|
+
ui_mode : UIMode or str, optional
|
|
290
|
+
Defines the user interface mode for Fluent. Options correspond to values in the ``UIMode`` enum.
|
|
287
291
|
graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
|
|
288
292
|
Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
|
|
289
293
|
(for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
|
|
@@ -309,6 +313,9 @@ class SessionBase:
|
|
|
309
313
|
cleanup_on_exit : bool
|
|
310
314
|
Determines whether to shut down the connected Fluent session upon exit or when calling
|
|
311
315
|
the session's `exit()` method. Defaults to True.
|
|
316
|
+
dry_run : bool, optional
|
|
317
|
+
If True, does not launch Fluent but prints configuration information instead. If dry running a
|
|
318
|
+
PIM start, this method will return a configuration dictionary. Defaults to False.
|
|
312
319
|
start_transcript : bool
|
|
313
320
|
Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
|
|
314
321
|
streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
|
|
@@ -1730,6 +1730,8 @@ class BaseCommand(Action):
|
|
|
1730
1730
|
|
|
1731
1731
|
def _execute_command(self, *args, **kwds):
|
|
1732
1732
|
"""Execute a command with the specified positional and keyword arguments."""
|
|
1733
|
+
from ansys.fluent.core import config
|
|
1734
|
+
|
|
1733
1735
|
if self.flproxy.is_interactive_mode():
|
|
1734
1736
|
prompt = self.flproxy.get_command_confirmation_prompt(
|
|
1735
1737
|
self._parent.path, self.obj_name, **kwds
|
|
@@ -1747,7 +1749,7 @@ class BaseCommand(Action):
|
|
|
1747
1749
|
with self._while_executing_command():
|
|
1748
1750
|
ret = self.flproxy.execute_cmd(self._parent.path, self.obj_name, **kwds)
|
|
1749
1751
|
if (
|
|
1750
|
-
|
|
1752
|
+
not config.disable_parameter_list_return_fix
|
|
1751
1753
|
and FluentVersion(self._version) <= FluentVersion.v252
|
|
1752
1754
|
and self.path
|
|
1753
1755
|
in [
|
|
@@ -2280,6 +2282,10 @@ def get_cls(name, info, parent=None, version=None, parent_taboo=None):
|
|
|
2280
2282
|
)
|
|
2281
2283
|
cls._allowed_values = allowed_values
|
|
2282
2284
|
|
|
2285
|
+
has_migration_adapter = info.get("has-migration-adapter?", False)
|
|
2286
|
+
if has_migration_adapter:
|
|
2287
|
+
cls._has_migration_adapter = True
|
|
2288
|
+
|
|
2283
2289
|
except Exception:
|
|
2284
2290
|
print(
|
|
2285
2291
|
f"Unable to construct class for '{name}' of "
|
|
@@ -2326,16 +2332,16 @@ def get_root(
|
|
|
2326
2332
|
RuntimeError
|
|
2327
2333
|
If hash values are inconsistent.
|
|
2328
2334
|
"""
|
|
2329
|
-
from ansys.fluent.core import
|
|
2335
|
+
from ansys.fluent.core import config, utils
|
|
2330
2336
|
|
|
2331
|
-
if
|
|
2337
|
+
if config.use_runtime_python_classes:
|
|
2332
2338
|
obj_info = flproxy.get_static_info()
|
|
2333
2339
|
root_cls, _ = get_cls("", obj_info, version=version)
|
|
2334
2340
|
else:
|
|
2335
2341
|
try:
|
|
2336
2342
|
settings = utils.load_module(
|
|
2337
2343
|
f"settings_{version}",
|
|
2338
|
-
|
|
2344
|
+
config.codegen_outdir / "solver" / f"settings_{version}.py",
|
|
2339
2345
|
)
|
|
2340
2346
|
root_cls = settings.root
|
|
2341
2347
|
warning_for_fluent_dev_version(version)
|
|
@@ -298,6 +298,8 @@ def get_si_unit_for_fluent_quantity(
|
|
|
298
298
|
# attribute only for dimensionless variables
|
|
299
299
|
if quantity is None:
|
|
300
300
|
return ""
|
|
301
|
+
if isinstance(quantity, list): # real vector
|
|
302
|
+
quantity = quantity[0]
|
|
301
303
|
if not isinstance(quantity, str):
|
|
302
304
|
raise InvalidQuantityType(quantity)
|
|
303
305
|
try:
|
|
@@ -52,9 +52,9 @@ def _get_settings_root(settings_source: SettingsBase | Solver):
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
def _get_settings_obj(settings_root, builtin_settings_obj):
|
|
55
|
-
|
|
55
|
+
builtin_cls_db_name = builtin_settings_obj.__class__._db_name
|
|
56
56
|
obj = settings_root
|
|
57
|
-
path = DATA[
|
|
57
|
+
path = DATA[builtin_cls_db_name][1]
|
|
58
58
|
found_path = None
|
|
59
59
|
if isinstance(path, dict):
|
|
60
60
|
version = FluentVersion(obj._version)
|
|
@@ -63,7 +63,7 @@ def _get_settings_obj(settings_root, builtin_settings_obj):
|
|
|
63
63
|
found_path = p
|
|
64
64
|
break
|
|
65
65
|
if found_path is None:
|
|
66
|
-
raise RuntimeError(f"{
|
|
66
|
+
raise RuntimeError(f"{builtin_cls_db_name} is not supported in {version}.")
|
|
67
67
|
elif isinstance(path, str):
|
|
68
68
|
found_path = path
|
|
69
69
|
comps = found_path.split(".")
|
|
@@ -225,26 +225,14 @@ DATA = {
|
|
|
225
225
|
"VelocityInlet": ("NamedObject", "setup.boundary_conditions.velocity_inlet"),
|
|
226
226
|
"WallBoundaries": ("Singleton", "setup.boundary_conditions.wall"),
|
|
227
227
|
"WallBoundary": ("NamedObject", "setup.boundary_conditions.wall"),
|
|
228
|
-
"NonReflectingBoundaries": (
|
|
229
|
-
"Singleton",
|
|
230
|
-
{
|
|
231
|
-
since(FluentVersion.v241): "setup.boundary_conditions.non_reflecting_bc",
|
|
232
|
-
},
|
|
233
|
-
),
|
|
234
228
|
"NonReflectingBoundary": (
|
|
235
|
-
"NamedObject",
|
|
236
|
-
{
|
|
237
|
-
since(FluentVersion.v241): "setup.boundary_conditions.non_reflecting_bc",
|
|
238
|
-
},
|
|
239
|
-
),
|
|
240
|
-
"PerforatedWallBoundaries": (
|
|
241
229
|
"Singleton",
|
|
242
230
|
{
|
|
243
|
-
since(FluentVersion.v241): "setup.boundary_conditions.
|
|
231
|
+
since(FluentVersion.v241): "setup.boundary_conditions.non_reflecting_bc",
|
|
244
232
|
},
|
|
245
233
|
),
|
|
246
234
|
"PerforatedWallBoundary": (
|
|
247
|
-
"
|
|
235
|
+
"Singleton",
|
|
248
236
|
{
|
|
249
237
|
since(FluentVersion.v241): "setup.boundary_conditions.perforated_wall",
|
|
250
238
|
},
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"""Provides a module for datamodel event streaming."""
|
|
24
24
|
|
|
25
25
|
import logging
|
|
26
|
-
import os
|
|
27
26
|
import threading
|
|
28
27
|
from typing import Callable
|
|
29
28
|
|
|
@@ -62,6 +61,8 @@ class DatamodelEvents(StreamingService):
|
|
|
62
61
|
|
|
63
62
|
def _process_streaming(self, id, stream_begin_method, started_evt, *args, **kwargs):
|
|
64
63
|
"""Processes datamodel events."""
|
|
64
|
+
from ansys.fluent.core import config
|
|
65
|
+
|
|
65
66
|
request = DataModelProtoModule.EventRequest(*args, **kwargs)
|
|
66
67
|
responses = self._streaming_service.begin_streaming(
|
|
67
68
|
request, started_evt, id=id, stream_begin_method=stream_begin_method
|
|
@@ -69,7 +70,7 @@ class DatamodelEvents(StreamingService):
|
|
|
69
70
|
while True:
|
|
70
71
|
try:
|
|
71
72
|
response: DataModelProtoModule.EventResponse = next(responses)
|
|
72
|
-
if
|
|
73
|
+
if not config.hide_log_secrets:
|
|
73
74
|
network_logger.debug(
|
|
74
75
|
f"GRPC_TRACE: RPC = /grpcRemoting.DataModel/BeginEventStreaming, response = {MessageToDict(response)}"
|
|
75
76
|
)
|
|
@@ -57,7 +57,9 @@ class DatamodelStream(StreamingService):
|
|
|
57
57
|
"""Processes datamodel events."""
|
|
58
58
|
data_model_request = datamodel_se_pb2.DataModelRequest(*args, **kwargs)
|
|
59
59
|
data_model_request.rules = rules
|
|
60
|
-
data_model_request.returnstatechanges =
|
|
60
|
+
data_model_request.returnstatechanges = (
|
|
61
|
+
pyfluent.config.datamodel_return_state_changes
|
|
62
|
+
)
|
|
61
63
|
if no_commands_diff_state:
|
|
62
64
|
data_model_request.diffstate = datamodel_se_pb2.DIFFSTATE_NOCOMMANDS
|
|
63
65
|
responses = self._streaming_service.begin_streaming(
|
|
@@ -281,30 +281,14 @@ class SolutionInitializedEventInfo(
|
|
|
281
281
|
class ReportDefinitionUpdatedEventInfo(
|
|
282
282
|
EventInfoBase, event=SolverEvent.REPORT_DEFINITION_UPDATED
|
|
283
283
|
):
|
|
284
|
-
"""Information about the event triggered when a report definition is updated.
|
|
285
|
-
|
|
286
|
-
Attributes
|
|
287
|
-
----------
|
|
288
|
-
report_name : str
|
|
289
|
-
Report name.
|
|
290
|
-
"""
|
|
291
|
-
|
|
292
|
-
report_name: str = field(metadata=dict(deprecated_name="reportdefinitionname"))
|
|
284
|
+
"""Information about the event triggered when a report definition is updated."""
|
|
293
285
|
|
|
294
286
|
|
|
295
287
|
@dataclass
|
|
296
288
|
class ReportPlotSetUpdatedEventInfo(
|
|
297
289
|
EventInfoBase, event=SolverEvent.REPORT_PLOT_SET_UPDATED
|
|
298
290
|
):
|
|
299
|
-
"""Information about the event triggered when a report plot set is updated.
|
|
300
|
-
|
|
301
|
-
Attributes
|
|
302
|
-
----------
|
|
303
|
-
plot_set_name : str
|
|
304
|
-
Plot set name.
|
|
305
|
-
"""
|
|
306
|
-
|
|
307
|
-
plot_set_name: str = field(metadata=dict(deprecated_name="plotsetname"))
|
|
291
|
+
"""Information about the event triggered when a report plot set is updated."""
|
|
308
292
|
|
|
309
293
|
|
|
310
294
|
class ResidualPlotUpdatedEventInfo(
|
|
@@ -252,7 +252,9 @@ class SystemCoupling:
|
|
|
252
252
|
# the local Fluent container working directory will correspond to
|
|
253
253
|
# pyfluent.EXAMPLES_PATH in the host, so that is where the SCP file
|
|
254
254
|
# will be written.
|
|
255
|
-
examples_path_scp = os.path.join(
|
|
255
|
+
examples_path_scp = os.path.join(
|
|
256
|
+
pyfluent.config.examples_path, scp_file_name
|
|
257
|
+
)
|
|
256
258
|
if os.path.exists(examples_path_scp):
|
|
257
259
|
scp_file_name = examples_path_scp
|
|
258
260
|
|
|
@@ -42,13 +42,6 @@ def load_module(module_name, file_path):
|
|
|
42
42
|
return module
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
def get_examples_download_dir():
|
|
46
|
-
"""Return the path to the examples download directory."""
|
|
47
|
-
parent_path = Path.home() / "Downloads"
|
|
48
|
-
parent_path.mkdir(exist_ok=True)
|
|
49
|
-
return parent_path / "ansys_fluent_core_examples"
|
|
50
|
-
|
|
51
|
-
|
|
52
45
|
def get_user_data_dir():
|
|
53
46
|
"""Return the path to the user data directory."""
|
|
54
47
|
if sys.platform == "win32":
|
|
@@ -114,7 +114,7 @@ def transfer_case(
|
|
|
114
114
|
"""
|
|
115
115
|
inside_container = source_instance.connection_properties.inside_container
|
|
116
116
|
if not workdir:
|
|
117
|
-
workdir = Path(pyfluent.
|
|
117
|
+
workdir = Path(pyfluent.config.examples_path)
|
|
118
118
|
else:
|
|
119
119
|
workdir = Path(workdir)
|
|
120
120
|
if inside_container:
|
|
@@ -122,9 +122,9 @@ def transfer_case(
|
|
|
122
122
|
network_logger.warning(
|
|
123
123
|
"Fluent is running inside a container, and no 'container_workdir' was specified for "
|
|
124
124
|
"'transfer_case'. Assuming that the default container mount path "
|
|
125
|
-
f"'{pyfluent.
|
|
125
|
+
f"'{pyfluent.config.container_mount_target}' is being used. "
|
|
126
126
|
)
|
|
127
|
-
container_workdir = PurePosixPath(pyfluent.
|
|
127
|
+
container_workdir = PurePosixPath(pyfluent.config.container_mount_target)
|
|
128
128
|
network_logger.debug(f"container_workdir: {container_workdir}")
|
|
129
129
|
else:
|
|
130
130
|
container_workdir = PurePosixPath(container_workdir)
|