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.

Files changed (82) hide show
  1. ansys/fluent/core/__init__.py +48 -84
  2. ansys/fluent/core/codegen/allapigen.py +2 -2
  3. ansys/fluent/core/codegen/builtin_settingsgen.py +54 -28
  4. ansys/fluent/core/codegen/datamodelgen.py +3 -1
  5. ansys/fluent/core/codegen/print_fluent_version.py +2 -2
  6. ansys/fluent/core/codegen/settingsgen.py +4 -1
  7. ansys/fluent/core/codegen/tuigen.py +4 -4
  8. ansys/fluent/core/data_model_cache.py +2 -2
  9. ansys/fluent/core/docker/docker_compose.py +8 -9
  10. ansys/fluent/core/docker/utils.py +2 -2
  11. ansys/fluent/core/examples/downloads.py +8 -11
  12. ansys/fluent/core/fluent_connection.py +23 -15
  13. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  14. ansys/fluent/core/generated/datamodel_231/flicing.py +50 -50
  15. ansys/fluent/core/generated/datamodel_231/meshing.py +182 -182
  16. ansys/fluent/core/generated/datamodel_232/flicing.py +45 -45
  17. ansys/fluent/core/generated/datamodel_232/meshing.py +172 -172
  18. ansys/fluent/core/generated/datamodel_241/flicing.py +45 -45
  19. ansys/fluent/core/generated/datamodel_241/meshing.py +303 -303
  20. ansys/fluent/core/generated/datamodel_242/flicing.py +50 -50
  21. ansys/fluent/core/generated/datamodel_242/meshing.py +309 -309
  22. ansys/fluent/core/generated/datamodel_242/part_management.py +3 -3
  23. ansys/fluent/core/generated/datamodel_251/flicing.py +50 -50
  24. ansys/fluent/core/generated/datamodel_251/meshing.py +327 -327
  25. ansys/fluent/core/generated/datamodel_251/part_management.py +9 -9
  26. ansys/fluent/core/generated/datamodel_252/flicing.py +30 -30
  27. ansys/fluent/core/generated/datamodel_252/meshing.py +370 -370
  28. ansys/fluent/core/generated/datamodel_252/part_management.py +15 -15
  29. ansys/fluent/core/generated/datamodel_261/flicing.py +35 -35
  30. ansys/fluent/core/generated/datamodel_261/meshing.py +444 -388
  31. ansys/fluent/core/generated/datamodel_261/part_management.py +5 -5
  32. ansys/fluent/core/generated/datamodel_261/preferences.py +28 -0
  33. ansys/fluent/core/generated/fluent_version_261.py +3 -3
  34. ansys/fluent/core/generated/meshing/tui_261.py +1247 -1136
  35. ansys/fluent/core/generated/solver/settings_261.py +9912 -4184
  36. ansys/fluent/core/generated/solver/settings_261.pyi +6779 -3312
  37. ansys/fluent/core/generated/solver/settings_builtin.py +515 -27
  38. ansys/fluent/core/generated/solver/settings_builtin.pyi +2 -18
  39. ansys/fluent/core/generated/solver/tui_261.py +4439 -3245
  40. ansys/fluent/core/launcher/container_launcher.py +19 -4
  41. ansys/fluent/core/launcher/fluent_container.py +51 -39
  42. ansys/fluent/core/launcher/launch_options.py +5 -4
  43. ansys/fluent/core/launcher/launcher.py +16 -3
  44. ansys/fluent/core/launcher/launcher_utils.py +63 -15
  45. ansys/fluent/core/launcher/pim_launcher.py +17 -3
  46. ansys/fluent/core/launcher/process_launch_string.py +3 -2
  47. ansys/fluent/core/launcher/server_info.py +7 -3
  48. ansys/fluent/core/launcher/slurm_launcher.py +4 -3
  49. ansys/fluent/core/launcher/standalone_launcher.py +6 -3
  50. ansys/fluent/core/launcher/watchdog.py +3 -3
  51. ansys/fluent/core/launcher/watchdog_exec +1 -1
  52. ansys/fluent/core/logger.py +3 -1
  53. ansys/fluent/core/module_config.py +363 -0
  54. ansys/fluent/core/pyfluent_warnings.py +2 -2
  55. ansys/fluent/core/report.py +0 -2
  56. ansys/fluent/core/search.py +43 -18
  57. ansys/fluent/core/services/api_upgrade.py +3 -2
  58. ansys/fluent/core/services/datamodel_se.py +4 -2
  59. ansys/fluent/core/services/health_check.py +3 -1
  60. ansys/fluent/core/services/interceptors.py +8 -6
  61. ansys/fluent/core/session.py +31 -3
  62. ansys/fluent/core/session_pure_meshing.py +1 -1
  63. ansys/fluent/core/session_shared.py +4 -4
  64. ansys/fluent/core/session_solver.py +13 -6
  65. ansys/fluent/core/session_utilities.py +7 -0
  66. ansys/fluent/core/solver/flobject.py +6 -4
  67. ansys/fluent/core/solver/flunits.py +2 -0
  68. ansys/fluent/core/solver/settings_builtin_bases.py +3 -3
  69. ansys/fluent/core/solver/settings_builtin_data.py +2 -14
  70. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +3 -2
  71. ansys/fluent/core/streaming_services/datamodel_streaming.py +3 -1
  72. ansys/fluent/core/streaming_services/events_streaming.py +2 -18
  73. ansys/fluent/core/system_coupling.py +3 -1
  74. ansys/fluent/core/utils/__init__.py +0 -7
  75. ansys/fluent/core/utils/data_transfer.py +3 -3
  76. ansys/fluent/core/utils/file_transfer_service.py +24 -15
  77. ansys/fluent/core/utils/fluent_version.py +3 -3
  78. ansys/fluent/core/utils/networking.py +13 -4
  79. {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/METADATA +8 -7
  80. {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/RECORD +82 -81
  81. {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info}/WHEEL +1 -1
  82. {ansys_fluent_core-0.34.2.dist-info → ansys_fluent_core-0.35.dev1.dist-info/licenses}/LICENSE +0 -0
@@ -41,16 +41,16 @@ from ansys.fluent.core.utils.fluent_version import (
41
41
 
42
42
  def _get_api_tree_data_file_path():
43
43
  """Get API tree data file."""
44
- from ansys.fluent.core import CODEGEN_OUTDIR
44
+ from ansys.fluent.core import config
45
45
 
46
- return (CODEGEN_OUTDIR / "api_tree" / "api_objects.json").resolve()
46
+ return (config.codegen_outdir / "api_tree" / "api_objects.json").resolve()
47
47
 
48
48
 
49
49
  def get_api_tree_file_name(version: str) -> Path:
50
50
  """Get API tree file name."""
51
- from ansys.fluent.core import CODEGEN_OUTDIR
51
+ from ansys.fluent.core import config
52
52
 
53
- return (CODEGEN_OUTDIR / f"api_tree_{version}.pickle").resolve()
53
+ return (config.codegen_outdir / f"api_tree_{version}.pickle").resolve()
54
54
 
55
55
 
56
56
  def _remove_suffix(input: str, suffix):
@@ -77,6 +77,7 @@ def _generate_api_data(
77
77
  """
78
78
  api_objects = set()
79
79
  api_tui_objects = set()
80
+ api_object_name_map = {"meshing_session": set(), "solver_session": set()}
80
81
  api_object_names = set()
81
82
  if version:
82
83
  version = get_version_for_file_name(version)
@@ -104,6 +105,10 @@ def _generate_api_data(
104
105
  next_path = f"{path}.{k}"
105
106
  type_ = "Object" if isinstance(v, Mapping) else v
106
107
  api_object_names.add(k)
108
+ if "meshing_session" in next_path:
109
+ api_object_name_map["meshing_session"].add(k)
110
+ if "solver_session" in next_path:
111
+ api_object_name_map["solver_session"].add(k)
107
112
  next_path = (
108
113
  next_path.replace("MeshingUtilities", "meshing_utilities")
109
114
  if "MeshingUtilities" in next_path
@@ -122,14 +127,21 @@ def _generate_api_data(
122
127
  api_tree_data["api_objects"] = sorted(list(api_objects))
123
128
  api_tree_data["api_tui_objects"] = sorted(list(api_tui_objects))
124
129
  api_tree_data["all_api_object_names"] = sorted(list(api_object_names))
130
+ api_object_name_map["meshing_session"] = sorted(
131
+ list(api_object_name_map["meshing_session"])
132
+ )
133
+ api_object_name_map["solver_session"] = sorted(
134
+ list(api_object_name_map["solver_session"])
135
+ )
136
+ api_tree_data["api_object_name_map"] = api_object_name_map
125
137
 
126
138
  def _write_api_tree_file(api_tree_data: dict, api_object_names: list):
127
139
  from nltk.corpus import wordnet as wn
128
140
 
129
141
  _download_nltk_data()
130
- from ansys.fluent.core import CODEGEN_OUTDIR
142
+ from ansys.fluent.core import config
131
143
 
132
- json_file_folder = Path(os.path.join(CODEGEN_OUTDIR, "api_tree"))
144
+ json_file_folder = Path(os.path.join(config.codegen_outdir, "api_tree"))
133
145
  json_file_folder.mkdir(parents=True, exist_ok=True)
134
146
 
135
147
  all_api_object_name_synsets = dict()
@@ -164,7 +176,10 @@ def _get_api_tree_data():
164
176
 
165
177
 
166
178
  def _print_search_results(
167
- queries: list, api_tree_data: dict | None = None, api_path: str | None = None
179
+ queries: list,
180
+ api_tree_data: dict | None = None,
181
+ api_path: str | None = None,
182
+ match_whole_word: bool | None = None,
168
183
  ):
169
184
  """
170
185
  Print search results.
@@ -178,6 +193,9 @@ def _print_search_results(
178
193
  If None, it is retrieved using _get_api_tree_data().
179
194
  api_path : str, optional
180
195
  Specific path to restrict the search to. If None, searches the entire object hierarchy.
196
+ match_whole_word : bool, optional
197
+ If True, only exact matches are returned. If False, semantic search is performed.
198
+ The default is None, which means semantic search is performed.
181
199
  """
182
200
  api_tree_data = api_tree_data or _get_api_tree_data()
183
201
  api_sources = [api_tree_data["api_objects"], api_tree_data["api_tui_objects"]]
@@ -207,18 +225,22 @@ def _print_search_results(
207
225
  for query in queries:
208
226
  if isinstance(query, tuple):
209
227
  name, score = query
228
+ if (
229
+ name in first_token
230
+ and has_query(name, substrings)
231
+ and name in substrings[-1]
232
+ ):
233
+ if score is not None:
234
+ results.add((api_object, round(score, 2)))
210
235
  else:
211
236
  name = query
212
237
  score = None
213
238
 
214
- if (
215
- name in first_token
216
- and has_query(name, substrings)
217
- and name in substrings[-1]
218
- ):
219
- if score is not None:
220
- results.add((api_object, round(score, 2)))
221
- else:
239
+ if match_whole_word and (
240
+ first_token == name or first_token.endswith(f".{name}")
241
+ ):
242
+ results.add(api_object)
243
+ elif not match_whole_word and name in first_token:
222
244
  results.add(api_object)
223
245
 
224
246
  return sorted(results)
@@ -235,7 +257,7 @@ def _print_search_results(
235
257
  )
236
258
 
237
259
  results = final_results or all_results
238
- if pyfluent.PRINT_SEARCH_RESULTS:
260
+ if pyfluent.config.print_search_results:
239
261
  for result in results:
240
262
  print(result)
241
263
  elif results:
@@ -324,7 +346,7 @@ def _get_exact_match_for_word_from_names(
324
346
  -------
325
347
  List of exact match.
326
348
  """
327
- return list({name for name in names if word == name or word in name})
349
+ return list({name for name in names if word == name})
328
350
 
329
351
 
330
352
  def _get_capitalize_match_for_word_from_names(
@@ -461,7 +483,10 @@ def _search_whole_word(
461
483
  )
462
484
  if queries:
463
485
  return _print_search_results(
464
- queries, api_tree_data=api_tree_data, api_path=api_path
486
+ queries,
487
+ api_tree_data=api_tree_data,
488
+ api_path=api_path,
489
+ match_whole_word=match_whole_word,
465
490
  )
466
491
 
467
492
 
@@ -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 os.getenv("PYFLUENT_SKIP_API_UPGRADE_ADVICE")
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 = DataModelCache() if pyfluent.DATAMODEL_USE_STATE_CACHE else None
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.DATAMODEL_USE_ATTR_CACHE:
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
 
@@ -80,7 +80,9 @@ class HealthCheckService:
80
80
  """
81
81
  request = HealthCheckModule.HealthCheckRequest()
82
82
  response = self._stub.Check(
83
- request, metadata=self._metadata, timeout=pyfluent.CHECK_HEALTH_TIMEOUT
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 log_bytes_limit or message_bytes < log_bytes_limit:
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"{log_bytes_limit} bytes limit. To see the full message, set PYFLUENT_GRPC_LOG_BYTES_LIMIT to 0."
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 os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
80
+ if not config.hide_log_secrets:
79
81
  network_logger.debug(f"GRPC_TRACE: response = {response_str}")
80
82
  return response
81
83
 
@@ -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,
@@ -151,6 +150,7 @@ class BaseSession:
151
150
  file_transfer_service,
152
151
  event_type,
153
152
  get_zones_info,
153
+ launcher_args,
154
154
  )
155
155
  self.register_finalizer_callback = fluent_connection.register_finalizer_cb
156
156
 
@@ -161,10 +161,14 @@ class BaseSession:
161
161
  file_transfer_service: Any | None = None,
162
162
  event_type=None,
163
163
  get_zones_info: weakref.WeakMethod[Callable[[], list[ZoneInfo]]] | None = None,
164
+ launcher_args: Dict[str, Any] | None = None,
164
165
  ):
165
166
  """Build a BaseSession object from fluent_connection object."""
166
167
  self._fluent_connection = fluent_connection
168
+ # Stores the backup of the fluent connection for later reference.
169
+ self._fluent_connection_backup = self._fluent_connection
167
170
  self._file_transfer_service = file_transfer_service
171
+ self._launcher_args = launcher_args
168
172
  self._error_state = fluent_connection._error_state
169
173
  self.scheme = scheme_eval
170
174
  self.rp_vars = RPVars(self.scheme.string_eval)
@@ -354,8 +358,32 @@ class BaseSession:
354
358
  return FluentVersion(self.scheme.version)
355
359
 
356
360
  def _exit_compose_service(self):
357
- if self._fluent_connection._container and is_compose():
358
- self._fluent_connection._container.stop()
361
+ args = self._launcher_args or {}
362
+ compose_config = args.get("compose_config", None)
363
+
364
+ container = self._fluent_connection._container
365
+ if compose_config and compose_config.is_compose:
366
+ container.stop()
367
+
368
+ def wait_process_finished(self, wait: float | int | bool = 60):
369
+ """Returns ``True`` if local Fluent processes have finished, ``False`` if they
370
+ are still running when wait limit (default 60 seconds) is reached. Immediately
371
+ cancels and returns ``None`` if ``wait`` is set to ``False``.
372
+
373
+ Parameters
374
+ ----------
375
+ wait : float, int or bool, optional
376
+ How long to wait for processes to finish before returning, by default 60 seconds.
377
+ Can also be set to ``True``, which will result in waiting indefinitely.
378
+
379
+ Raises
380
+ ------
381
+ UnsupportedRemoteFluentInstance
382
+ If current Fluent instance is running remotely.
383
+ WaitTypeError
384
+ If ``wait`` is specified improperly.
385
+ """
386
+ return self._fluent_connection_backup.wait_process_finished()
359
387
 
360
388
  def exit(self, **kwargs) -> None:
361
389
  """Exit session."""
@@ -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.DATAMODEL_USE_NOCOMMANDS_DIFF_STATE,
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 CODEGEN_OUTDIR
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
- CODEGEN_OUTDIR / module_name / f"tui_{session._version}.py",
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 CODEGEN_OUTDIR
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
- CODEGEN_OUTDIR / f"datamodel_{session._version}" / f"{file_name}.py",
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(fluent_connection, scheme_eval)
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
- self.events.register_callback(
160
- (SolverEvent.SOLUTION_INITIALIZED, SolverEvent.DATA_LOADED),
161
- self.monitors.refresh,
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.SUPPORT_SOLVER_INTERRUPT:
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
- os.getenv("PYFLUENT_NO_FIX_PARAMETER_LIST_RETURN") != "1"
1752
+ not config.disable_parameter_list_return_fix
1751
1753
  and FluentVersion(self._version) <= FluentVersion.v252
1752
1754
  and self.path
1753
1755
  in [
@@ -2326,16 +2328,16 @@ def get_root(
2326
2328
  RuntimeError
2327
2329
  If hash values are inconsistent.
2328
2330
  """
2329
- from ansys.fluent.core import CODEGEN_OUTDIR, utils
2331
+ from ansys.fluent.core import config, utils
2330
2332
 
2331
- if os.getenv("PYFLUENT_USE_RUNTIME_PYTHON_CLASSES") == "1":
2333
+ if config.use_runtime_python_classes:
2332
2334
  obj_info = flproxy.get_static_info()
2333
2335
  root_cls, _ = get_cls("", obj_info, version=version)
2334
2336
  else:
2335
2337
  try:
2336
2338
  settings = utils.load_module(
2337
2339
  f"settings_{version}",
2338
- CODEGEN_OUTDIR / "solver" / f"settings_{version}.py",
2340
+ config.codegen_outdir / "solver" / f"settings_{version}.py",
2339
2341
  )
2340
2342
  root_cls = settings.root
2341
2343
  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
- builtin_cls_name = builtin_settings_obj.__class__.__name__
55
+ builtin_cls_db_name = builtin_settings_obj.__class__._db_name
56
56
  obj = settings_root
57
- path = DATA[builtin_cls_name][1]
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"{builtin_cls_name} is not supported in {version}.")
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.perforated_wall",
231
+ since(FluentVersion.v241): "setup.boundary_conditions.non_reflecting_bc",
244
232
  },
245
233
  ),
246
234
  "PerforatedWallBoundary": (
247
- "NamedObject",
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 os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
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 = pyfluent.DATAMODEL_RETURN_STATE_CHANGES
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(pyfluent.EXAMPLES_PATH, scp_file_name)
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":