ansys-fluent-core 0.34.1__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.

Files changed (86) 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 +8 -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 +1 -1
  11. ansys/fluent/core/examples/downloads.py +9 -12
  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 +45 -45
  15. ansys/fluent/core/generated/datamodel_231/meshing.py +183 -183
  16. ansys/fluent/core/generated/datamodel_232/flicing.py +25 -25
  17. ansys/fluent/core/generated/datamodel_232/meshing.py +173 -173
  18. ansys/fluent/core/generated/datamodel_241/flicing.py +30 -30
  19. ansys/fluent/core/generated/datamodel_241/meshing.py +246 -246
  20. ansys/fluent/core/generated/datamodel_242/flicing.py +25 -25
  21. ansys/fluent/core/generated/datamodel_242/meshing.py +273 -273
  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 +361 -361
  25. ansys/fluent/core/generated/datamodel_251/part_management.py +6 -6
  26. ansys/fluent/core/generated/datamodel_252/flicing.py +30 -30
  27. ansys/fluent/core/generated/datamodel_252/meshing.py +375 -375
  28. ansys/fluent/core/generated/datamodel_252/part_management.py +10 -10
  29. ansys/fluent/core/generated/datamodel_261/flicing.py +35 -35
  30. ansys/fluent/core/generated/datamodel_261/meshing.py +463 -407
  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_252.py +1 -1
  34. ansys/fluent/core/generated/fluent_version_261.py +3 -3
  35. ansys/fluent/core/generated/meshing/tui_261.py +1198 -1133
  36. ansys/fluent/core/generated/solver/settings_261.py +7514 -2195
  37. ansys/fluent/core/generated/solver/settings_261.pyi +4800 -1015
  38. ansys/fluent/core/generated/solver/settings_builtin.py +515 -27
  39. ansys/fluent/core/generated/solver/settings_builtin.pyi +2 -18
  40. ansys/fluent/core/generated/solver/tui_261.py +2396 -2171
  41. ansys/fluent/core/launcher/container_launcher.py +19 -4
  42. ansys/fluent/core/launcher/fluent_container.py +52 -39
  43. ansys/fluent/core/launcher/launch_options.py +4 -3
  44. ansys/fluent/core/launcher/launcher.py +16 -3
  45. ansys/fluent/core/launcher/launcher_utils.py +63 -15
  46. ansys/fluent/core/launcher/pim_launcher.py +17 -3
  47. ansys/fluent/core/launcher/process_launch_string.py +1 -1
  48. ansys/fluent/core/launcher/server_info.py +7 -3
  49. ansys/fluent/core/launcher/slurm_launcher.py +4 -2
  50. ansys/fluent/core/launcher/standalone_launcher.py +6 -3
  51. ansys/fluent/core/launcher/watchdog.py +3 -3
  52. ansys/fluent/core/launcher/watchdog_exec +1 -1
  53. ansys/fluent/core/logger.py +3 -1
  54. ansys/fluent/core/module_config.py +358 -0
  55. ansys/fluent/core/pyfluent_warnings.py +2 -2
  56. ansys/fluent/core/report.py +1 -3
  57. ansys/fluent/core/search.py +43 -18
  58. ansys/fluent/core/services/__init__.py +2 -0
  59. ansys/fluent/core/services/api_upgrade.py +3 -2
  60. ansys/fluent/core/services/datamodel_se.py +4 -2
  61. ansys/fluent/core/services/field_data.py +24 -0
  62. ansys/fluent/core/services/health_check.py +3 -1
  63. ansys/fluent/core/services/interceptors.py +8 -6
  64. ansys/fluent/core/services/settings.py +1 -1
  65. ansys/fluent/core/session.py +32 -5
  66. ansys/fluent/core/session_pure_meshing.py +1 -1
  67. ansys/fluent/core/session_shared.py +4 -4
  68. ansys/fluent/core/session_solver.py +13 -6
  69. ansys/fluent/core/session_utilities.py +7 -0
  70. ansys/fluent/core/solver/flobject.py +10 -4
  71. ansys/fluent/core/solver/flunits.py +2 -0
  72. ansys/fluent/core/solver/settings_builtin_bases.py +3 -3
  73. ansys/fluent/core/solver/settings_builtin_data.py +2 -14
  74. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +3 -2
  75. ansys/fluent/core/streaming_services/datamodel_streaming.py +3 -1
  76. ansys/fluent/core/streaming_services/events_streaming.py +2 -18
  77. ansys/fluent/core/system_coupling.py +3 -1
  78. ansys/fluent/core/utils/__init__.py +0 -7
  79. ansys/fluent/core/utils/data_transfer.py +3 -3
  80. ansys/fluent/core/utils/file_transfer_service.py +24 -15
  81. ansys/fluent/core/utils/fluent_version.py +3 -3
  82. ansys/fluent/core/utils/networking.py +13 -4
  83. {ansys_fluent_core-0.34.1.dist-info → ansys_fluent_core-0.35.0.dist-info}/METADATA +8 -7
  84. {ansys_fluent_core-0.34.1.dist-info → ansys_fluent_core-0.35.0.dist-info}/RECORD +86 -85
  85. {ansys_fluent_core-0.34.1.dist-info → ansys_fluent_core-0.35.0.dist-info}/WHEEL +1 -1
  86. {ansys_fluent_core-0.34.1.dist-info → ansys_fluent_core-0.35.0.dist-info/licenses}/LICENSE +0 -0
@@ -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 os.getenv("PYFLUENT_SHOW_SERVER_GUI") == "1":
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,6 +460,7 @@ class SlurmLauncher:
459
460
  launch_cmd += _build_journal_argument(
460
461
  self._argvals["topy"], self._argvals["journal_file_names"]
461
462
  )
463
+ launch_cmd += ' -setenv="FLUENT_ALLOW_REMOTE_GRPC_CONNECTION=1"'
462
464
 
463
465
  logger.debug(f"Launching Fluent with command: {launch_cmd}")
464
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 os.getenv("PYFLUENT_SHOW_SERVER_GUI") == "1":
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 os.getenv("PYFLUENT_FLUENT_DEBUG") == "1":
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 pyfluent.LAUNCH_FLUENT_STDOUT or pyfluent.LAUNCH_FLUENT_STDERR:
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 = os.getenv("PYFLUENT_WATCHDOG_DEBUG") == "1"
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 os.getenv("PYFLUENT_WATCHDOG_EXCEPTION_ON_ERROR") == "1":
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 os.getenv("PYFLUENT_WATCHDOG_EXCEPTION_ON_ERROR") == "1":
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 os.getenv("PYFLUENT_WATCHDOG_DEBUG") == "1":
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(
@@ -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 = os.getenv("PYFLUENT_LOGGING")
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,358 @@
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 True if ``PYFLUENT_SKIP_FLUENT_AUTOMATIC_TRANSCRIPT`` environment variable is not set to "1".
145
+ fluent_automatic_transcript = _ConfigDescriptor["Config"](
146
+ lambda instance: instance._env.get("PYFLUENT_SKIP_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 remoting server address to be used in Fluent, defaults to the value of ``REMOTING_SERVER_ADDRESS`` environment variable.
304
+ remoting_server_address = _ConfigDescriptor["Config"](
305
+ lambda instance: instance._env.get("REMOTING_SERVER_ADDRESS")
306
+ )
307
+
308
+ #: The directory where server info will be written from Fluent, defaults to the value of ``SERVER_INFO_DIR`` environment variable.
309
+ fluent_server_info_dir = _ConfigDescriptor["Config"](
310
+ lambda instance: instance._env.get("SERVER_INFO_DIR")
311
+ )
312
+
313
+ #: Current unit test name, defaults to the value of ``PYFLUENT_TEST_NAME`` environment variable.
314
+ test_name = _ConfigDescriptor["Config"](
315
+ lambda instance: instance._env.get("PYFLUENT_TEST_NAME")
316
+ )
317
+
318
+ #: The default logging level for PyFluent, defaults to the value of ``PYFLUENT_LOGGING`` environment variable.
319
+ logging_level_default = _ConfigDescriptor["Config"](
320
+ lambda instance: instance._env.get("PYFLUENT_LOGGING")
321
+ )
322
+
323
+ #: Whether to disable monitor refresh on solution initialization, defaults to False.
324
+ disable_monitor_refresh_on_init = _ConfigDescriptor["Config"](
325
+ lambda instance: False
326
+ )
327
+
328
+ def __init__(self):
329
+ """__init__ method of Config class."""
330
+ # Read the environment variable once when pyfluent is imported
331
+ # and reuse it throughout process lifetime.
332
+ self._env = os.environ.copy()
333
+
334
+ @property
335
+ def fluent_release_version(self) -> str:
336
+ """The latest released version of Fluent."""
337
+ return "25.2.0"
338
+
339
+ @property
340
+ def fluent_dev_version(self) -> str:
341
+ """The latest development version of Fluent."""
342
+ return "26.1.0"
343
+
344
+ def print(self):
345
+ """Print all configuration variables."""
346
+ config_dict = {}
347
+ for k, v in inspect.getmembers_static(self):
348
+ if isinstance(v, (_ConfigDescriptor, property)):
349
+ config_dict[k] = v.__get__(self, self.__class__)
350
+ max_key_length = max(len(k) for k in config_dict)
351
+ print("PyFluent Configuration:")
352
+ print("-" * (max_key_length + 20))
353
+ for k, v in config_dict.items():
354
+ print(f"{k.ljust(max_key_length)} : {v}")
355
+
356
+
357
+ #: Global configuration object for PyFluent
358
+ 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 FLUENT_RELEASE_VERSION, FluentVersion
49
+ from ansys.fluent.core import FluentVersion, config
50
50
 
51
- if FluentVersion(version) > FluentVersion(FLUENT_RELEASE_VERSION):
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 "
@@ -45,7 +45,7 @@ ANSYS_ENV_VARS = [
45
45
  "PYFLUENT_FLUENT_PORT",
46
46
  "PYFLUENT_FLUENT_ROOT",
47
47
  "PYFLUENT_FLUENT_LAUNCH_TIMEOUT",
48
- "PYFLUENT_FLUENT_AUTOMATIC_TRANSCRIPT",
48
+ "PYFLUENT_SKIP_FLUENT_AUTOMATIC_TRANSCRIPT",
49
49
  "PYFLUENT_GRPC_LOG_BYTES_LIMIT",
50
50
  "PYFLUENT_LAUNCH_CONTAINER",
51
51
  "PYFLUENT_LOGGING",
@@ -58,8 +58,6 @@ ANSYS_ENV_VARS = [
58
58
  "REMOTING_PORTS",
59
59
  "REMOTING_SERVER_ADDRESS",
60
60
  "SERVER_INFO_DIR",
61
- "PYFLUENT_USE_DOCKER_COMPOSE",
62
- "PYFLUENT_USE_PODMAN_COMPOSE",
63
61
  ]
64
62
 
65
63
 
@@ -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
 
@@ -43,6 +43,7 @@ from ansys.fluent.core.services.solution_variables import (
43
43
  SolutionVariableService,
44
44
  )
45
45
  from ansys.fluent.core.services.transcript import TranscriptService
46
+ from ansys.fluent.core.streaming_services.field_data_streaming import FieldDataStreaming
46
47
 
47
48
  _service_cls_by_name = {
48
49
  "app_utilities": AppUtilities,
@@ -61,6 +62,7 @@ _service_cls_by_name = {
61
62
  "svar_data": SolutionVariableData,
62
63
  "transcript": TranscriptService,
63
64
  "batch_ops": BatchOpsService,
65
+ "field_data_streaming": FieldDataStreaming,
64
66
  }
65
67
 
66
68