ansys-fluent-core 0.31.dev1__py3-none-any.whl → 0.32.dev0__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 (57) hide show
  1. ansys/fluent/core/__init__.py +11 -3
  2. ansys/fluent/core/codegen/settingsgen.py +6 -0
  3. ansys/fluent/core/codegen/tuigen.py +1 -2
  4. ansys/fluent/core/docker/docker_compose.py +243 -0
  5. ansys/fluent/core/field_data_interfaces.py +6 -0
  6. ansys/fluent/core/file_session.py +158 -128
  7. ansys/fluent/core/filereader/data_file.py +11 -0
  8. ansys/fluent/core/filereader/pre_processor.py +22 -0
  9. ansys/fluent/core/fluent_connection.py +48 -20
  10. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  11. ansys/fluent/core/generated/datamodel_231/flicing.py +20 -20
  12. ansys/fluent/core/generated/datamodel_231/meshing.py +228 -228
  13. ansys/fluent/core/generated/datamodel_232/flicing.py +40 -40
  14. ansys/fluent/core/generated/datamodel_232/meshing.py +203 -203
  15. ansys/fluent/core/generated/datamodel_241/flicing.py +20 -20
  16. ansys/fluent/core/generated/datamodel_241/meshing.py +303 -303
  17. ansys/fluent/core/generated/datamodel_242/flicing.py +35 -35
  18. ansys/fluent/core/generated/datamodel_242/meshing.py +334 -334
  19. ansys/fluent/core/generated/datamodel_242/part_management.py +6 -6
  20. ansys/fluent/core/generated/datamodel_251/flicing.py +40 -40
  21. ansys/fluent/core/generated/datamodel_251/meshing.py +366 -366
  22. ansys/fluent/core/generated/datamodel_251/part_management.py +6 -6
  23. ansys/fluent/core/generated/datamodel_252/flicing.py +30 -30
  24. ansys/fluent/core/generated/datamodel_252/meshing.py +816 -454
  25. ansys/fluent/core/generated/datamodel_252/part_management.py +10 -10
  26. ansys/fluent/core/generated/datamodel_252/preferences.py +1 -1
  27. ansys/fluent/core/generated/fluent_version_252.py +4 -4
  28. ansys/fluent/core/generated/solver/settings_252.py +2241 -1649
  29. ansys/fluent/core/generated/solver/settings_252.pyi +1785 -1430
  30. ansys/fluent/core/generated/solver/settings_builtin.pyi +104 -0
  31. ansys/fluent/core/generated/solver/tui_252.py +126 -2
  32. ansys/fluent/core/launcher/container_launcher.py +39 -8
  33. ansys/fluent/core/launcher/fluent_container.py +60 -22
  34. ansys/fluent/core/launcher/launcher.py +24 -13
  35. ansys/fluent/core/launcher/launcher_utils.py +8 -0
  36. ansys/fluent/core/launcher/process_launch_string.py +2 -6
  37. ansys/fluent/core/report.py +2 -0
  38. ansys/fluent/core/services/deprecated_field_data.py +74 -46
  39. ansys/fluent/core/services/field_data.py +104 -69
  40. ansys/fluent/core/services/reduction.py +55 -66
  41. ansys/fluent/core/services/solution_variables.py +9 -1
  42. ansys/fluent/core/session.py +15 -12
  43. ansys/fluent/core/session_meshing.py +3 -0
  44. ansys/fluent/core/session_solver.py +20 -43
  45. ansys/fluent/core/session_utilities.py +429 -0
  46. ansys/fluent/core/solver/flobject.py +28 -0
  47. ansys/fluent/core/utils/deprecate.py +46 -0
  48. ansys/fluent/core/utils/file_transfer_service.py +19 -3
  49. ansys/fluent/core/utils/fluent_version.py +42 -11
  50. ansys/fluent/core/variable_strategies/__init__.py +29 -0
  51. ansys/fluent/core/variable_strategies/expr.py +186 -0
  52. ansys/fluent/core/variable_strategies/field.py +186 -0
  53. ansys/fluent/core/variable_strategies/svar.py +61 -0
  54. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.32.dev0.dist-info}/METADATA +7 -5
  55. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.32.dev0.dist-info}/RECORD +57 -51
  56. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.32.dev0.dist-info}/LICENSE +0 -0
  57. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.32.dev0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,429 @@
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
+
23
+ """Session utilities."""
24
+
25
+ from typing import Any, Dict
26
+
27
+ import ansys.fluent.core as pyfluent
28
+ from ansys.fluent.core.launcher.container_launcher import DockerLauncher
29
+ from ansys.fluent.core.launcher.pim_launcher import PIMLauncher
30
+ from ansys.fluent.core.launcher.pyfluent_enums import (
31
+ Dimension,
32
+ FluentLinuxGraphicsDriver,
33
+ FluentMode,
34
+ FluentWindowsGraphicsDriver,
35
+ Precision,
36
+ UIMode,
37
+ )
38
+ from ansys.fluent.core.launcher.standalone_launcher import StandaloneLauncher
39
+ from ansys.fluent.core.utils.fluent_version import FluentVersion
40
+
41
+
42
+ class SessionBase:
43
+ """Base class for Fluent sessions.
44
+
45
+ This class is not intended to be used directly. Instead, use
46
+ the `from_connection`, `from_container`, `from_install`,
47
+ or `from_pim` functions to create a session.
48
+ """
49
+
50
+ _session_mode = {
51
+ "Meshing": FluentMode.MESHING,
52
+ "PureMeshing": FluentMode.PURE_MESHING,
53
+ "PrePost": FluentMode.PRE_POST,
54
+ "Solver": FluentMode.SOLVER,
55
+ "SolverAero": FluentMode.SOLVER_AERO,
56
+ "SolverIcing": FluentMode.SOLVER_ICING,
57
+ }
58
+
59
+ @classmethod
60
+ def from_install(
61
+ cls,
62
+ ui_mode: UIMode | str | None = None,
63
+ graphics_driver: (
64
+ FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str
65
+ ) = None,
66
+ product_version: FluentVersion | str | float | int | None = None,
67
+ dimension: Dimension | int | None = None,
68
+ precision: Precision | str | None = None,
69
+ processor_count: int | None = None,
70
+ journal_file_names: None | str | list[str] = None,
71
+ start_timeout: int = 60,
72
+ additional_arguments: str = "",
73
+ env: Dict[str, Any] = {}, # noqa: B006
74
+ cleanup_on_exit: bool = True,
75
+ dry_run: bool = False,
76
+ start_transcript: bool = True,
77
+ case_file_name: str | None = None,
78
+ case_data_file_name: str | None = None,
79
+ lightweight_mode: bool | None = None,
80
+ py: bool | None = None,
81
+ gpu: bool | None = None,
82
+ cwd: str | None = None,
83
+ fluent_path: str | None = None,
84
+ topy: str | list | None = None,
85
+ start_watchdog: bool | None = None,
86
+ file_transfer_service: Any | None = None,
87
+ ):
88
+ """
89
+ Launch a Fluent session in standalone mode.
90
+
91
+ Parameters
92
+ ----------
93
+ ui_mode : UIMode
94
+ Defines the user interface mode for Fluent. Options correspond to values in the ``UIMode`` enum.
95
+ graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
96
+ Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
97
+ (for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
98
+ product_version : FluentVersion or str or float or int, optional
99
+ Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
100
+ ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``. Defaults to ``None``,
101
+ which uses the newest installed version.
102
+ dimension : Dimension or int, optional
103
+ Specifies the geometric dimensionality of the Fluent simulation. Defaults to ``None``,
104
+ which corresponds to ``Dimension.THREE``. Acceptable values are from the ``Dimension`` enum
105
+ (``Dimension.TWO`` or ``Dimension.THREE``) or integers ``2`` and ``3``.
106
+ precision : Precision or str, optional
107
+ Defines the floating point precision. Defaults to ``None``, which corresponds to
108
+ ``Precision.DOUBLE``. Acceptable values are from the ``Precision`` enum (``Precision.SINGLE``
109
+ or ``Precision.DOUBLE``) or strings ``"single"`` and ``"double"``.
110
+ processor_count : int, optional
111
+ Specifies the number of processors to use. Defaults to ``None``, which uses 1 processor.
112
+ In job scheduler environments, this value limits the total number of allocated cores.
113
+ journal_file_names : str or list of str, optional
114
+ Path(s) to a Fluent journal file(s) that Fluent will execute. Defaults to ``None``.
115
+ start_timeout : int, optional
116
+ Maximum time in seconds allowed for connecting to the Fluent server. Defaults to 60 seconds.
117
+ additional_arguments : str, optional
118
+ Additional command-line arguments for Fluent, formatted as they would be on the command line.
119
+ env : dict[str, str], optional
120
+ A mapping for modifying environment variables in Fluent. Defaults to ``None``.
121
+ cleanup_on_exit : bool, optional
122
+ Determines whether to shut down the connected Fluent session when exiting PyFluent or calling
123
+ the session's `exit()` method. Defaults to True.
124
+ dry_run : bool, optional
125
+ If True, does not launch Fluent but prints configuration information instead. The `call()` method
126
+ returns a tuple containing the launch string and server info file name. Defaults to False.
127
+ start_transcript : bool, optional
128
+ Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
129
+ streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
130
+ case_file_name : str, optional
131
+ Name of the case file to read into the Fluent session. Defaults to None.
132
+ case_data_file_name : str, optional
133
+ Name of the case data file. If both case and data files are provided, they are read into the session.
134
+ lightweight_mode : bool, optional
135
+ If True, runs in lightweight mode where mesh settings are read into a background solver session,
136
+ replacing it once complete. This parameter is only applicable when `case_file_name` is provided; defaults to False.
137
+ py : bool, optional
138
+ If True, runs Fluent in Python mode. Defaults to None.
139
+ gpu : bool, optional
140
+ If True, starts Fluent with GPU Solver enabled.
141
+ cwd : str, optional
142
+ Working directory for the Fluent client.
143
+ fluent_path: str, optional
144
+ User-specified path for Fluent installation.
145
+ topy : bool or str, optional
146
+ A flag indicating whether to write equivalent Python journals from provided journal files; can also specify
147
+ a filename for the new Python journal.
148
+ start_watchdog : bool, optional
149
+ When `cleanup_on_exit` is True, defaults to True; an independent watchdog process ensures that any local
150
+ GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
151
+ file_transfer_service : Any
152
+ Service for uploading/downloading files to/from the server.
153
+
154
+ Raises
155
+ ------
156
+ UnexpectedKeywordArgument
157
+ If an unexpected keyword argument is provided.
158
+
159
+ Notes
160
+ -----
161
+ In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated,
162
+ and core counts are queried from these environments before being passed to Fluent.
163
+ """
164
+ mode = cls._session_mode[cls.__name__]
165
+ argvals = locals().copy()
166
+ argvals.pop("cls", None) # Remove the class reference from the arguments
167
+ launcher = StandaloneLauncher(**argvals)
168
+ return launcher()
169
+
170
+ @classmethod
171
+ def from_container(
172
+ cls,
173
+ ui_mode: UIMode | str | None = None,
174
+ graphics_driver: (
175
+ FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str | None
176
+ ) = None,
177
+ product_version: FluentVersion | str | float | int | None = None,
178
+ dimension: Dimension | int | None = None,
179
+ precision: Precision | str | None = None,
180
+ processor_count: int | None = None,
181
+ start_timeout: int = 60,
182
+ additional_arguments: str = "",
183
+ container_dict: dict | None = None,
184
+ dry_run: bool = False,
185
+ cleanup_on_exit: bool = True,
186
+ start_transcript: bool = True,
187
+ py: bool | None = None,
188
+ gpu: bool | None = None,
189
+ start_watchdog: bool | None = None,
190
+ file_transfer_service: Any | None = None,
191
+ ):
192
+ """
193
+ Launch a Fluent session in container mode.
194
+
195
+ Parameters
196
+ ----------
197
+ ui_mode : UIMode
198
+ Defines the user interface mode for Fluent. Options correspond to values in the ``UIMode`` enum.
199
+ graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
200
+ Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
201
+ (for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
202
+ product_version : FluentVersion or str or float or int, optional
203
+ Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
204
+ any of ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``. Defaults to ``None``,
205
+ which uses the newest installed version.
206
+ dimension : Dimension or int, optional
207
+ Specifies the geometric dimensionality of the Fluent simulation. Defaults to ``None``,
208
+ which corresponds to ``Dimension.THREE``. Acceptable values include ``Dimension.TWO``,
209
+ ``Dimension.THREE``, or integers ``2`` and ``3``.
210
+ precision : Precision or str, optional
211
+ Defines the floating point precision. Defaults to ``None``, which corresponds to
212
+ ``Precision.DOUBLE``. Acceptable values include ``Precision.SINGLE``,
213
+ ``Precision.DOUBLE``, or strings ``"single"`` and ``"double"``.
214
+ processor_count : int, optional
215
+ Specifies the number of processors to use. Defaults to ``None``, which uses 1 processor.
216
+ In job scheduler environments, this value limits the total number of allocated cores.
217
+ start_timeout : int, optional
218
+ Maximum allowable time in seconds for connecting to the Fluent server. Defaults to 60 seconds.
219
+ additional_arguments : str, optional
220
+ Additional command-line arguments for Fluent, formatted as they would be on the command line.
221
+ container_dict : dict, optional
222
+ Configuration dictionary for launching Fluent inside a Docker container. See also
223
+ :mod:`~ansys.fluent.core.launcher.fluent_container`.
224
+ dry_run : bool, optional
225
+ If True, does not launch Fluent but prints configuration information instead. If dry running a
226
+ container start, this method will return the configured ``container_dict``. Defaults to False.
227
+ cleanup_on_exit : bool
228
+ Determines whether to shut down the connected Fluent session upon exit or when calling
229
+ the session's `exit()` method. Defaults to True.
230
+ start_transcript : bool
231
+ Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
232
+ streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
233
+ py : bool, optional
234
+ If True, runs Fluent in Python mode. Defaults to None.
235
+ gpu : bool, optional
236
+ If True, starts Fluent with GPU Solver enabled.
237
+ start_watchdog : bool, optional
238
+ If True and `cleanup_on_exit` is True, an independent watchdog process is run to ensure that any local
239
+ GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
240
+ file_transfer_service : Any, optional
241
+ Service for uploading/downloading files to/from the server.
242
+
243
+ Returns
244
+ -------
245
+ Meshing | PureMeshing | Solver | SolverIcing | dict
246
+ Session object or configuration dictionary if ``dry_run`` is True.
247
+
248
+ Raises
249
+ ------
250
+ UnexpectedKeywordArgument
251
+ If an unexpected keyword argument is provided.
252
+
253
+ Notes
254
+ -----
255
+ In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated,
256
+ and core counts are queried from these environments before being passed to Fluent.
257
+ """
258
+ mode = cls._session_mode[cls.__name__]
259
+ argvals = locals().copy()
260
+ argvals.pop("cls", None)
261
+ launcher = DockerLauncher(**argvals)
262
+ return launcher()
263
+
264
+ @classmethod
265
+ def from_pim(
266
+ cls,
267
+ graphics_driver: (
268
+ FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str | None
269
+ ) = None,
270
+ product_version: FluentVersion | str | float | int | None = None,
271
+ dimension: Dimension | int | None = None,
272
+ precision: Precision | str | None = None,
273
+ processor_count: int | None = None,
274
+ start_timeout: int = 60,
275
+ additional_arguments: str = "",
276
+ cleanup_on_exit: bool = True,
277
+ start_transcript: bool = True,
278
+ gpu: bool | None = None,
279
+ start_watchdog: bool | None = None,
280
+ file_transfer_service: Any | None = None,
281
+ ):
282
+ """
283
+ Launch a Fluent session in `PIM <https://pypim.docs.pyansys.com/version/stable/>`_ mode.
284
+
285
+ Parameters
286
+ ----------
287
+ graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
288
+ Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
289
+ (for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
290
+ product_version : FluentVersion or str or float or int, optional
291
+ Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
292
+ any of ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``. Defaults to ``None``,
293
+ which uses the newest installed version.
294
+ dimension : Dimension or int, optional
295
+ Specifies the geometric dimensionality of the Fluent simulation. Defaults to ``None``,
296
+ which corresponds to ``Dimension.THREE``. Acceptable values include ``Dimension.TWO``,
297
+ ``Dimension.THREE``, or integers ``2`` and ``3``.
298
+ precision : Precision or str, optional
299
+ Defines the floating point precision. Defaults to ``None``, which corresponds to
300
+ ``Precision.DOUBLE``. Acceptable values include ``Precision.SINGLE``,
301
+ ``Precision.DOUBLE``, or strings ``"single"`` and ``"double"``.
302
+ processor_count : int, optional
303
+ Specifies the number of processors to use. Defaults to ``None``, which uses 1 processor.
304
+ In job scheduler environments, this value limits the total number of allocated cores.
305
+ start_timeout : int, optional
306
+ Maximum allowable time in seconds for connecting to the Fluent server. Defaults to 60 seconds.
307
+ additional_arguments : str, optional
308
+ Additional command-line arguments for Fluent, formatted as they would be on the command line.
309
+ cleanup_on_exit : bool
310
+ Determines whether to shut down the connected Fluent session upon exit or when calling
311
+ the session's `exit()` method. Defaults to True.
312
+ start_transcript : bool
313
+ Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
314
+ streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
315
+ gpu : bool, optional
316
+ If True, starts Fluent with GPU Solver enabled.
317
+ start_watchdog : bool, optional
318
+ If True and `cleanup_on_exit` is True, an independent watchdog process is run to ensure that any local
319
+ GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
320
+ file_transfer_service : Any, optional
321
+ Service for uploading/downloading files to/from the server.
322
+
323
+ Returns
324
+ -------
325
+ Union[Meshing, PureMeshing, Solver, SolverIcing, dict]
326
+ Session object or configuration dictionary if ``dry_run`` is True.
327
+
328
+ Raises
329
+ ------
330
+ UnexpectedKeywordArgument
331
+ If an unexpected keyword argument is provided.
332
+
333
+ Notes
334
+ -----
335
+ In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated,
336
+ and core counts are queried from these environments before being passed to Fluent.
337
+ """
338
+ mode = cls._session_mode[cls.__name__]
339
+ argvals = locals().copy()
340
+ argvals.pop("cls", None)
341
+ launcher = PIMLauncher(**argvals)
342
+ return launcher()
343
+
344
+ @classmethod
345
+ def from_connection(
346
+ cls,
347
+ ip: str | None = None,
348
+ port: int | None = None,
349
+ server_info_file_name: str | None = None,
350
+ password: str | None = None,
351
+ ):
352
+ """Connect to an existing Fluent server instance.
353
+
354
+ Parameters
355
+ ----------
356
+ ip : str, optional
357
+ IP address for connecting to an existing Fluent instance. The
358
+ IP address defaults to ``"127.0.0.1"``. You can also use the environment
359
+ variable ``PYFLUENT_FLUENT_IP=<ip>`` to set this parameter.
360
+ The explicit value of ``ip`` takes precedence over ``PYFLUENT_FLUENT_IP=<ip>``.
361
+ port : int, optional
362
+ Port to listen on for an existing Fluent instance. You can use the
363
+ environment variable ``PYFLUENT_FLUENT_PORT=<port>`` to set a default
364
+ value. The explicit value of ``port`` takes precedence over
365
+ ``PYFLUENT_FLUENT_PORT=<port>``.
366
+ server_info_file_name: str
367
+ Path to server-info file written out by Fluent server. The default is
368
+ ``None``. PyFluent uses the connection information in the file to
369
+ connect to a running Fluent session.
370
+ password : str, optional
371
+ Password to connect to existing Fluent instance.
372
+
373
+ Raises
374
+ ------
375
+ TypeError
376
+ If the session type does not match the expected session type.
377
+ """
378
+ session = pyfluent.connect_to_fluent(
379
+ ip=ip,
380
+ port=port,
381
+ server_info_file_name=server_info_file_name,
382
+ password=password,
383
+ )
384
+
385
+ expected = "Solver" if cls.__name__ == "PrePost" else cls.__name__
386
+ actual = session.__class__.__name__
387
+
388
+ if actual != expected:
389
+ raise TypeError(
390
+ f"Session type mismatch: expected {expected}, got {actual}."
391
+ )
392
+
393
+ return session
394
+
395
+
396
+ class Meshing(SessionBase):
397
+ """Encapsulates a Fluent server for meshing session connection."""
398
+
399
+ pass
400
+
401
+
402
+ class PureMeshing(SessionBase):
403
+ """Encapsulates a Fluent server for pure meshing session connection."""
404
+
405
+ pass
406
+
407
+
408
+ class PrePost(SessionBase):
409
+ """Encapsulates a Fluent server for pre-post session connection."""
410
+
411
+ pass
412
+
413
+
414
+ class Solver(SessionBase):
415
+ """Encapsulates a Fluent server for solver session connection."""
416
+
417
+ pass
418
+
419
+
420
+ class SolverAero(SessionBase):
421
+ """Encapsulates a Fluent server for solver aero session connection."""
422
+
423
+ pass
424
+
425
+
426
+ class SolverIcing(SessionBase):
427
+ """Encapsulates a Fluent server for solver icing session connection."""
428
+
429
+ pass
@@ -74,6 +74,9 @@ from ansys.fluent.core.pyfluent_warnings import (
74
74
  PyFluentUserWarning,
75
75
  )
76
76
  from ansys.fluent.core.utils.fluent_version import FluentVersion
77
+ from ansys.fluent.core.variable_strategies import (
78
+ FluentFieldDataNamingStrategy as naming_strategy,
79
+ )
77
80
 
78
81
  from . import _docstrings
79
82
  from .error_message import allowed_name_error_message, allowed_values_error
@@ -196,6 +199,9 @@ def to_python_name(fluent_name: str) -> str:
196
199
  return name
197
200
 
198
201
 
202
+ _to_field_name_str = naming_strategy().to_string if naming_strategy else lambda s: s
203
+
204
+
199
205
  def _get_python_path_comps(obj):
200
206
  """Get python path components for traversing class hierarchy."""
201
207
  comps = []
@@ -628,6 +634,18 @@ class RealNumerical(Numerical):
628
634
  class Textual(Property):
629
635
  """Exposes attribute accessor on settings object - specific to string objects."""
630
636
 
637
+ def set_state(self, state: StateT | None = None, **kwargs):
638
+ """Set the state of the object.
639
+
640
+ Parameters
641
+ ----------
642
+ state
643
+ Either str or VariableDescriptor.
644
+ kwargs : Any
645
+ Keyword arguments.
646
+ """
647
+ return self.base_set_state(state=_to_field_name_str(state), **kwargs)
648
+
631
649
 
632
650
  class DeprecatedSettingWarning(PyFluentDeprecationWarning):
633
651
  """Provides deprecated settings warning."""
@@ -853,6 +871,9 @@ class String(SettingsBase[str], Textual):
853
871
 
854
872
  _state_type = str
855
873
 
874
+ base_set_state = SettingsBase[str].set_state
875
+ set_state = Textual.set_state
876
+
856
877
 
857
878
  class Filename(SettingsBase[str], Textual):
858
879
  """A ``Filename`` object representing a file name."""
@@ -1164,6 +1185,10 @@ class Group(SettingsBase[DictStateType]):
1164
1185
  raise
1165
1186
 
1166
1187
  def __setattr__(self, name: str, value):
1188
+ # 'settings_source' will be set to settings object when they are created from builtin settings classes.
1189
+ # We don't allow overwriting it.
1190
+ if name == "settings_source":
1191
+ raise AttributeError("Cannot overwrite settings_source after it is set.")
1167
1192
  attr = None
1168
1193
  try:
1169
1194
  attr = getattr(self, name)
@@ -2103,6 +2128,9 @@ def get_cls(name, info, parent=None, version=None, parent_taboo=None):
2103
2128
  dct["_child_classes"] = {}
2104
2129
  cls = type(pname, bases, dct)
2105
2130
 
2131
+ deprecated_version = info.get("deprecated_version", "")
2132
+ cls._deprecated_version = deprecated_version
2133
+
2106
2134
  taboo = set(dir(cls))
2107
2135
  taboo |= set(
2108
2136
  [
@@ -23,14 +23,60 @@
23
23
  """Module that provides a method to handle deprecated arguments."""
24
24
 
25
25
  import functools
26
+ from functools import wraps
26
27
  import logging
27
28
  import warnings
28
29
 
30
+ from deprecated.sphinx import deprecated
31
+
29
32
  from ansys.fluent.core.pyfluent_warnings import PyFluentDeprecationWarning
30
33
 
31
34
  logger = logging.getLogger("pyfluent.general")
32
35
 
33
36
 
37
+ def all_deprecators(
38
+ deprecate_arg_mappings,
39
+ data_type_converter,
40
+ deprecated_version,
41
+ deprecated_reason,
42
+ warn_message,
43
+ ):
44
+ """Decorator that applies multiple deprecators to a function."""
45
+
46
+ def decorator(func):
47
+ decorated = func
48
+ for mapping in deprecate_arg_mappings:
49
+ decorated = deprecate_argument(
50
+ old_arg=mapping["old_arg"],
51
+ new_arg=mapping["new_arg"],
52
+ converter=mapping.get("converter", lambda x: x),
53
+ warning_cls=PyFluentDeprecationWarning,
54
+ )(decorated)
55
+ if data_type_converter:
56
+ decorated = deprecate_arguments(
57
+ converter=data_type_converter,
58
+ warning_cls=PyFluentDeprecationWarning,
59
+ )(decorated)
60
+ decorated = deprecated(
61
+ version=deprecated_version,
62
+ reason=deprecated_reason,
63
+ )(decorated)
64
+
65
+ @wraps(decorated)
66
+ def wrapper(*args, **kwargs):
67
+ if warn_message:
68
+ warnings.warn(
69
+ warn_message,
70
+ PyFluentDeprecationWarning,
71
+ stacklevel=2,
72
+ )
73
+ return decorated(*args, **kwargs)
74
+
75
+ return wrapper
76
+
77
+ return decorator
78
+
79
+
34
80
  def deprecate_argument(
35
81
  old_arg,
36
82
  new_arg,
@@ -31,7 +31,7 @@ import warnings
31
31
 
32
32
  from ansys.fluent.core.pyfluent_warnings import PyFluentUserWarning
33
33
  from ansys.fluent.core.utils import get_user_data_dir
34
- from ansys.fluent.core.utils.deprecate import deprecate_argument
34
+ from ansys.fluent.core.utils.deprecate import all_deprecators
35
35
  import ansys.platform.instancemanagement as pypim
36
36
 
37
37
  # Host path which is mounted to the file-transfer-service container
@@ -229,8 +229,24 @@ class ContainerFileTransferStrategy(FileTransferStrategy):
229
229
  >>> solver_session.download(file_name="write_elbow.cas.h5", local_directory="<local_directory_path>")
230
230
  """
231
231
 
232
- @deprecate_argument("container_mount_path", "mount_target")
233
- @deprecate_argument("host_mount_path", "mount_source")
232
+ @all_deprecators(
233
+ deprecate_arg_mappings=[
234
+ {
235
+ "old_arg": "container_mount_path",
236
+ "new_arg": "mount_target",
237
+ "converter": lambda old_arg_val: old_arg_val,
238
+ },
239
+ {
240
+ "old_arg": "host_mount_path",
241
+ "new_arg": "mount_source",
242
+ "converter": lambda old_arg_val: old_arg_val,
243
+ },
244
+ ],
245
+ data_type_converter=None,
246
+ deprecated_version="v0.23.dev1",
247
+ deprecated_reason="'container_mount_path' and 'host_mount_path' are deprecated. Use 'mount_target' and 'mount_source' instead.",
248
+ warn_message="",
249
+ )
234
250
  def __init__(
235
251
  self,
236
252
  image_name: str | None = None,