ansys-fluent-core 0.29.dev2__py3-none-any.whl → 0.30.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 (144) hide show
  1. ansys/fluent/core/__init__.py +26 -1
  2. ansys/fluent/core/_stand_alone_datamodel_client/_datamodel_client.py +22 -0
  3. ansys/fluent/core/_version.py +23 -1
  4. ansys/fluent/core/codegen/__init__.py +22 -0
  5. ansys/fluent/core/codegen/allapigen.py +38 -5
  6. ansys/fluent/core/codegen/builtin_settingsgen.py +22 -0
  7. ansys/fluent/core/codegen/data/__init__.py +21 -0
  8. ansys/fluent/core/codegen/data/fluent_gui_help_patch.py +22 -0
  9. ansys/fluent/core/codegen/data/meshing_utilities_examples.py +22 -0
  10. ansys/fluent/core/codegen/datamodelgen.py +40 -4
  11. ansys/fluent/core/codegen/print_fluent_version.py +22 -0
  12. ansys/fluent/core/codegen/settingsgen.py +67 -4
  13. ansys/fluent/core/codegen/tuigen.py +43 -5
  14. ansys/fluent/core/codegen/walk_api.py +22 -0
  15. ansys/fluent/core/codegen/write_settings_yaml.py +22 -0
  16. ansys/fluent/core/data_model_cache.py +22 -0
  17. ansys/fluent/core/examples/__init__.py +22 -0
  18. ansys/fluent/core/examples/downloads.py +22 -0
  19. ansys/fluent/core/exceptions.py +22 -0
  20. ansys/fluent/core/file_session.py +22 -0
  21. ansys/fluent/core/filereader/__init__.py +21 -0
  22. ansys/fluent/core/filereader/case_file.py +22 -0
  23. ansys/fluent/core/filereader/casereader.py +22 -0
  24. ansys/fluent/core/filereader/data_file.py +22 -0
  25. ansys/fluent/core/filereader/lispy.py +22 -0
  26. ansys/fluent/core/fluent_connection.py +23 -1
  27. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  28. ansys/fluent/core/generated/datamodel_252/meshing.py +31 -0
  29. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  30. ansys/fluent/core/generated/solver/settings_222.py +0 -72
  31. ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
  32. ansys/fluent/core/generated/solver/settings_231.py +0 -574
  33. ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
  34. ansys/fluent/core/generated/solver/settings_232.py +0 -527
  35. ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
  36. ansys/fluent/core/generated/solver/settings_241.py +0 -478
  37. ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
  38. ansys/fluent/core/generated/solver/settings_242.py +0 -361
  39. ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
  40. ansys/fluent/core/generated/solver/settings_251.py +0 -399
  41. ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
  42. ansys/fluent/core/generated/solver/settings_252.py +7626 -4108
  43. ansys/fluent/core/generated/solver/settings_252.pyi +6779 -3098
  44. ansys/fluent/core/generated/solver/tui_252.py +489 -157
  45. ansys/fluent/core/get_build_details.py +22 -0
  46. ansys/fluent/core/journaling.py +38 -0
  47. ansys/fluent/core/launcher/__init__.py +22 -0
  48. ansys/fluent/core/launcher/container_launcher.py +63 -55
  49. ansys/fluent/core/launcher/error_handler.py +30 -0
  50. ansys/fluent/core/launcher/fluent_container.py +23 -1
  51. ansys/fluent/core/launcher/launcher.py +51 -3
  52. ansys/fluent/core/launcher/launcher_utils.py +22 -0
  53. ansys/fluent/core/launcher/pim_launcher.py +120 -86
  54. ansys/fluent/core/launcher/process_launch_string.py +22 -0
  55. ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
  56. ansys/fluent/core/launcher/server_info.py +45 -3
  57. ansys/fluent/core/launcher/slurm_launcher.py +23 -1
  58. ansys/fluent/core/launcher/standalone_launcher.py +68 -63
  59. ansys/fluent/core/launcher/watchdog.py +22 -0
  60. ansys/fluent/core/logging.py +22 -0
  61. ansys/fluent/core/meshing/meshing_workflow.py +22 -0
  62. ansys/fluent/core/parametric.py +22 -0
  63. ansys/fluent/core/post_objects/__init__.py +21 -0
  64. ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
  65. ansys/fluent/core/post_objects/meta.py +22 -0
  66. ansys/fluent/core/post_objects/post_helper.py +22 -0
  67. ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
  68. ansys/fluent/core/post_objects/post_objects_container.py +22 -0
  69. ansys/fluent/core/post_objects/singleton_meta.py +22 -0
  70. ansys/fluent/core/post_objects/timing_decorator.py +22 -0
  71. ansys/fluent/core/report.py +77 -0
  72. ansys/fluent/core/rpvars.py +22 -0
  73. ansys/fluent/core/scheduler/__init__.py +22 -0
  74. ansys/fluent/core/scheduler/load_machines.py +22 -0
  75. ansys/fluent/core/scheduler/machine_list.py +22 -0
  76. ansys/fluent/core/search.py +22 -0
  77. ansys/fluent/core/services/__init__.py +22 -0
  78. ansys/fluent/core/services/api_upgrade.py +22 -0
  79. ansys/fluent/core/services/app_utilities.py +38 -0
  80. ansys/fluent/core/services/batch_ops.py +22 -0
  81. ansys/fluent/core/services/datamodel_se.py +22 -2
  82. ansys/fluent/core/services/datamodel_tui.py +22 -0
  83. ansys/fluent/core/services/deprecated_field_data.py +23 -1
  84. ansys/fluent/core/services/events.py +22 -0
  85. ansys/fluent/core/services/field_data.py +46 -15
  86. ansys/fluent/core/services/health_check.py +22 -0
  87. ansys/fluent/core/services/interceptors.py +22 -0
  88. ansys/fluent/core/services/monitor.py +22 -0
  89. ansys/fluent/core/services/reduction.py +22 -0
  90. ansys/fluent/core/services/scheme_eval.py +22 -0
  91. ansys/fluent/core/services/settings.py +22 -0
  92. ansys/fluent/core/services/solution_variables.py +22 -0
  93. ansys/fluent/core/services/streaming.py +22 -0
  94. ansys/fluent/core/services/transcript.py +22 -0
  95. ansys/fluent/core/session.py +32 -0
  96. ansys/fluent/core/session_base_meshing.py +22 -0
  97. ansys/fluent/core/session_meshing.py +22 -0
  98. ansys/fluent/core/session_meshing.pyi +22 -0
  99. ansys/fluent/core/session_pure_meshing.py +22 -0
  100. ansys/fluent/core/session_pure_meshing.pyi +22 -0
  101. ansys/fluent/core/session_shared.py +22 -0
  102. ansys/fluent/core/session_solver.py +22 -0
  103. ansys/fluent/core/session_solver.pyi +22 -0
  104. ansys/fluent/core/session_solver_aero.py +22 -0
  105. ansys/fluent/core/session_solver_icing.py +22 -0
  106. ansys/fluent/core/session_solver_lite.py +22 -0
  107. ansys/fluent/core/solver/__init__.py +22 -0
  108. ansys/fluent/core/solver/error_message.py +22 -0
  109. ansys/fluent/core/solver/flobject.py +22 -0
  110. ansys/fluent/core/solver/flunits.py +22 -0
  111. ansys/fluent/core/solver/function/__init__.py +22 -0
  112. ansys/fluent/core/solver/function/reduction.py +22 -0
  113. ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
  114. ansys/fluent/core/solver/settings_builtin_data.py +22 -0
  115. ansys/fluent/core/solver/settings_external.py +22 -0
  116. ansys/fluent/core/streaming_services/__init__.py +21 -0
  117. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +22 -0
  118. ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
  119. ansys/fluent/core/streaming_services/events_streaming.py +22 -0
  120. ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
  121. ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
  122. ansys/fluent/core/streaming_services/streaming.py +22 -0
  123. ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
  124. ansys/fluent/core/systemcoupling.py +22 -0
  125. ansys/fluent/core/utils/__init__.py +22 -0
  126. ansys/fluent/core/utils/data_transfer.py +22 -0
  127. ansys/fluent/core/utils/deprecate.py +24 -1
  128. ansys/fluent/core/utils/dictionary_operations.py +22 -0
  129. ansys/fluent/core/utils/dump_session_data.py +22 -0
  130. ansys/fluent/core/utils/event_loop.py +22 -0
  131. ansys/fluent/core/utils/execution.py +22 -0
  132. ansys/fluent/core/utils/file_transfer_service.py +22 -0
  133. ansys/fluent/core/utils/fix_doc.py +22 -0
  134. ansys/fluent/core/utils/fldoc.py +22 -0
  135. ansys/fluent/core/utils/fluent_version.py +22 -0
  136. ansys/fluent/core/utils/networking.py +22 -0
  137. ansys/fluent/core/utils/setup_for_fluent.py +22 -0
  138. ansys/fluent/core/warnings.py +22 -0
  139. ansys/fluent/core/workflow.py +22 -0
  140. {ansys_fluent_core-0.29.dev2.dist-info → ansys_fluent_core-0.30.dev0.dist-info}/LICENSE +8 -8
  141. {ansys_fluent_core-0.29.dev2.dist-info → ansys_fluent_core-0.30.dev0.dist-info}/METADATA +10 -8
  142. ansys_fluent_core-0.30.dev0.dist-info/RECORD +219 -0
  143. ansys_fluent_core-0.29.dev2.dist-info/RECORD +0 -218
  144. {ansys_fluent_core-0.29.dev2.dist-info → ansys_fluent_core-0.30.dev0.dist-info}/WHEEL +0 -0
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module for launching Fluent in pim mode.
2
24
 
3
25
  Examples
@@ -24,7 +46,6 @@ from ansys.fluent.core.launcher.pyfluent_enums import (
24
46
  FluentMode,
25
47
  FluentWindowsGraphicsDriver,
26
48
  Precision,
27
- UIMode,
28
49
  _get_argvals_and_session,
29
50
  )
30
51
  from ansys.fluent.core.session_meshing import Meshing
@@ -46,7 +67,6 @@ class PIMLauncher:
46
67
  def __init__(
47
68
  self,
48
69
  mode: FluentMode | str | None = None,
49
- ui_mode: UIMode | str | None = None,
50
70
  graphics_driver: (
51
71
  FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str | None
52
72
  ) = None,
@@ -55,76 +75,60 @@ class PIMLauncher:
55
75
  precision: Precision | str | None = None,
56
76
  processor_count: int | None = None,
57
77
  start_timeout: int = 60,
58
- additional_arguments: str | None = "",
78
+ additional_arguments: str = "",
59
79
  cleanup_on_exit: bool = True,
60
80
  start_transcript: bool = True,
61
- py: bool | None = None,
62
81
  gpu: bool | None = None,
63
82
  start_watchdog: bool | None = None,
64
83
  file_transfer_service: Any | None = None,
65
84
  ):
66
- """Launch Fluent session in `PIM <https://pypim.docs.pyansys.com/version/stable/>`_ mode.
85
+ """
86
+ Launch a Fluent session in `PIM <https://pypim.docs.pyansys.com/version/stable/>`_ mode.
67
87
 
68
88
  Parameters
69
89
  ----------
70
90
  mode : FluentMode
71
- Launch mode of Fluent to point to a specific session type.
72
- ui_mode : UIMode
73
- Fluent user interface mode. Options are the values of the ``UIMode`` enum.
91
+ Specifies the launch mode of Fluent for targeting a specific session type.
74
92
  graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
75
- Graphics driver of Fluent. Options are the values of the
76
- ``FluentWindowsGraphicsDriver`` enum in Windows or the values of the
77
- ``FluentLinuxGraphicsDriver`` enum in Linux.
93
+ Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
94
+ (for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
78
95
  product_version : FluentVersion or str or float or int, optional
79
- Version of Ansys Fluent to launch. To use Fluent version 2025 R1, pass
80
- ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``.
81
- The default is ``None``, in which case the newest installed version is used.
96
+ Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
97
+ any of ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``. Defaults to ``None``,
98
+ which uses the newest installed version.
82
99
  dimension : Dimension or int, optional
83
- Geometric dimensionality of the Fluent simulation. The default is ``None``,
84
- in which case ``Dimension.THREE`` is used. Options are either the values of the
85
- ``Dimension`` enum (``Dimension.TWO`` or ``Dimension.THREE``) or any of ``2`` and ``3``.
100
+ Specifies the geometric dimensionality of the Fluent simulation. Defaults to ``None``,
101
+ which corresponds to ``Dimension.THREE``. Acceptable values include ``Dimension.TWO``,
102
+ ``Dimension.THREE``, or integers ``2`` and ``3``.
86
103
  precision : Precision or str, optional
87
- Floating point precision. The default is ``None``, in which case ``Precision.DOUBLE``
88
- is used. Options are either the values of the ``Precision`` enum (``Precision.SINGLE``
89
- or ``Precision.DOUBLE``) or any of ``"double"`` and ``"single"``.
104
+ Defines the floating point precision. Defaults to ``None``, which corresponds to
105
+ ``Precision.DOUBLE``. Acceptable values include ``Precision.SINGLE``,
106
+ ``Precision.DOUBLE``, or strings ``"single"`` and ``"double"``.
90
107
  processor_count : int, optional
91
- Number of processors. The default is ``None``, in which case ``1``
92
- processor is used. In job scheduler environments the total number of
93
- allocated cores is clamped to value of ``processor_count``.
108
+ Specifies the number of processors to use. Defaults to ``None``, which uses 1 processor.
109
+ In job scheduler environments, this value limits the total number of allocated cores.
94
110
  start_timeout : int, optional
95
- Maximum allowable time in seconds for connecting to the Fluent
96
- server. The default is ``60``.
111
+ Maximum allowable time in seconds for connecting to the Fluent server. Defaults to 60 seconds.
97
112
  additional_arguments : str, optional
98
- Additional arguments to send to Fluent as a string in the same
99
- format they are normally passed to Fluent on the command line.
100
- cleanup_on_exit : bool, optional
101
- Whether to shut down the connected Fluent session when PyFluent is
102
- exited, or the ``exit()`` method is called on the session instance,
103
- or if the session instance becomes unreferenced. The default is ``True``.
104
- start_transcript : bool, optional
105
- Whether to start streaming the Fluent transcript in the client. The
106
- default is ``True``. You can stop and start the streaming of the
107
- Fluent transcript subsequently via the method calls, ``transcript.start()``
108
- and ``transcript.stop()`` on the session object.
109
- py : bool, optional
110
- If True, Fluent will run in Python mode. Default is None.
113
+ Additional command-line arguments for Fluent, formatted as they would be on the command line.
114
+ cleanup_on_exit : bool
115
+ Determines whether to shut down the connected Fluent session upon exit or when calling
116
+ the session's `exit()` method. Defaults to True.
117
+ start_transcript : bool
118
+ Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
119
+ streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
111
120
  gpu : bool, optional
112
- If True, Fluent will start with GPU Solver.
121
+ If True, starts Fluent with GPU Solver enabled.
113
122
  start_watchdog : bool, optional
114
- When ``cleanup_on_exit`` is True, ``start_watchdog`` defaults to True,
115
- which means an independent watchdog process is run to ensure
116
- that any local GUI-less Fluent sessions started by PyFluent are properly closed (or killed if frozen)
117
- when the current Python process ends.
118
- file_transfer_service : optional
119
- File transfer service. Uploads/downloads files to/from the server.
123
+ If True and `cleanup_on_exit` is True, an independent watchdog process is run to ensure that any local
124
+ GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
125
+ file_transfer_service : Any, optional
126
+ Service for uploading/downloading files to/from the server.
120
127
 
121
128
  Returns
122
129
  -------
123
- :obj:`~typing.Union` [:class:`Meshing<ansys.fluent.core.session_meshing.Meshing>`, \
124
- :class:`~ansys.fluent.core.session_pure_meshing.PureMeshing`, \
125
- :class:`~ansys.fluent.core.session_solver.Solver`, \
126
- :class:`~ansys.fluent.core.session_solver_icing.SolverIcing`, dict]
127
- Session object or configuration dictionary if ``dry_run = True``.
130
+ Union[Meshing, PureMeshing, Solver, SolverIcing, dict]
131
+ Session object or configuration dictionary if ``dry_run`` is True.
128
132
 
129
133
  Raises
130
134
  ------
@@ -133,10 +137,10 @@ class PIMLauncher:
133
137
 
134
138
  Notes
135
139
  -----
136
- Job scheduler environments such as SLURM, LSF, PBS, etc. allocates resources / compute nodes.
137
- The allocated machines and core counts are queried from the scheduler environment and
138
- passed to Fluent.
140
+ In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated,
141
+ and core counts are queried from these environments before being passed to Fluent.
139
142
  """
143
+
140
144
  if additional_arguments:
141
145
  logger.warning(
142
146
  "'additional_arguments' option for 'launch_fluent()' method is not supported "
@@ -186,9 +190,8 @@ def launch_remote_fluent(
186
190
  ) -> Meshing | PureMeshing | Solver | SolverIcing:
187
191
  """Launch Fluent remotely using `PyPIM <https://pypim.docs.pyansys.com>`.
188
192
 
189
- When calling this method, you must ensure that you are in an
190
- environment where PyPIM is configured. You can use the :func:
191
- `pypim.is_configured <ansys.platform.instancemanagement.is_configured>`
193
+ Ensure that you are in an environment where PyPIM is configured.
194
+ Use the :func:`pypim.is_configured <ansys.platform.instancemanagement.is_configured>`
192
195
  method to verify that PyPIM is configured.
193
196
 
194
197
  Parameters
@@ -196,58 +199,48 @@ def launch_remote_fluent(
196
199
  session_cls: type(Meshing) | type(PureMeshing) | type(Solver) | type(SolverIcing)
197
200
  Session type.
198
201
  start_transcript: bool
199
- Whether to start streaming the Fluent transcript in the client. The
200
- default is ``True``. You can stop and start the streaming of the
201
- Fluent transcript subsequently via method calls on the session object.
202
+ Whether to start streaming the Fluent transcript in the client.
202
203
  product_version : str, optional
203
- Version of Ansys Fluent to launch. Use ``"242"`` for 2024 R2.
204
- The default is ``None``, in which case the newest installed version is used.
204
+ Version of Ansys Fluent to launch. Default is ``None`` for the newest version.
205
205
  cleanup_on_exit : bool, optional
206
- Whether to clean up and exit Fluent when Python exits or when garbage
207
- is collected for the Fluent Python instance. The default is ``True``.
206
+ Whether to clean up and exit Fluent when Python exits. Default is ``True``.
208
207
  mode : FluentMode, optional
209
- Whether to launch Fluent remotely in meshing mode. The default is
210
- ``FluentMode.SOLVER``.
208
+ Launch Fluent in meshing mode. Default is ``FluentMode.SOLVER``.
211
209
  dimensionality : str, optional
212
- Geometric dimensionality of the Fluent simulation. The default is ``None``,
213
- in which case ``"3d"`` is used. Options are ``"3d"`` and ``"2d"``.
210
+ Geometric dimensionality of the Fluent simulation. Default is ``None`` (3D).
214
211
  file_transfer_service : optional
215
- File transfer service for uploading or downloading files to or from the server.
212
+ Service for uploading/downloading files to/from the server.
216
213
  launcher_args : Any
217
214
  Launcher arguments.
218
215
 
219
216
  Returns
220
217
  -------
221
- :obj:`~typing.Union` [:class:`Meshing<ansys.fluent.core.session_meshing.Meshing>`, \
222
- :class:`~ansys.fluent.core.session_pure_meshing.PureMeshing`, \
223
- :class:`~ansys.fluent.core.session_solver.Solver`, \
224
- :class:`~ansys.fluent.core.session_solver_icing.SolverIcing`]
218
+ Meshing | PureMeshing | Solver | SolverIcing
225
219
  Session object.
226
220
  """
221
+
227
222
  pim = pypim.connect()
228
- instance = pim.create_instance(
229
- product_name=(
230
- "fluent-meshing"
231
- if FluentMode.is_meshing(mode)
232
- else "fluent-2ddp" if dimensionality == "2d" else "fluent-3ddp"
233
- ),
223
+
224
+ instance = create_fluent_instance(
225
+ pim=pim,
226
+ mode=mode,
227
+ dimensionality=dimensionality,
234
228
  product_version=product_version,
235
229
  )
230
+
236
231
  instance.wait_for_ready()
237
- # nb pymapdl sets max msg len here:
232
+
238
233
  channel = instance.build_grpc_channel()
239
234
 
240
- fluent_connection = FluentConnection(
235
+ fluent_connection = create_fluent_connection(
241
236
  channel=channel,
242
237
  cleanup_on_exit=cleanup_on_exit,
243
- remote_instance=instance,
244
- slurm_job_id=launcher_args and launcher_args.get("slurm_job_id"),
238
+ instance=instance,
239
+ launcher_args=launcher_args,
245
240
  )
246
241
 
247
- file_transfer_service = (
248
- file_transfer_service
249
- if file_transfer_service
250
- else PimFileTransferService(pim_instance=fluent_connection._remote_instance)
242
+ file_transfer_service = get_file_transfer_service(
243
+ file_transfer_service, fluent_connection
251
244
  )
252
245
 
253
246
  return session_cls(
@@ -256,3 +249,44 @@ def launch_remote_fluent(
256
249
  file_transfer_service=file_transfer_service,
257
250
  start_transcript=start_transcript,
258
251
  )
252
+
253
+
254
+ def create_fluent_instance(
255
+ pim, mode: FluentMode, dimensionality: str | None, product_version: str | None
256
+ ):
257
+ """Create a Fluent instance based on mode and dimensionality."""
258
+
259
+ product_name = (
260
+ "fluent-meshing"
261
+ if FluentMode.is_meshing(mode)
262
+ else "fluent-2ddp" if dimensionality == Dimension.TWO else "fluent-3ddp"
263
+ )
264
+
265
+ return pim.create_instance(
266
+ product_name=product_name, product_version=product_version
267
+ )
268
+
269
+
270
+ def create_fluent_connection(
271
+ channel, cleanup_on_exit: bool, instance, launcher_args: Dict[str, Any] | None
272
+ ):
273
+ """Create a Fluent connection."""
274
+
275
+ return FluentConnection(
276
+ channel=channel,
277
+ cleanup_on_exit=cleanup_on_exit,
278
+ remote_instance=instance,
279
+ slurm_job_id=launcher_args.get("slurm_job_id") if launcher_args else None,
280
+ )
281
+
282
+
283
+ def get_file_transfer_service(
284
+ file_transfer_service: Any | None, fluent_connection
285
+ ) -> Any:
286
+ """Get the file transfer service."""
287
+
288
+ return (
289
+ file_transfer_service
290
+ if file_transfer_service
291
+ else PimFileTransferService(pim_instance=fluent_connection._remote_instance)
292
+ )
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module to process launch string."""
2
24
 
3
25
  import json
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module for enums used in the PyFluent."""
2
24
 
3
25
  from enum import Enum
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module for server information."""
2
24
 
3
25
  import os
@@ -6,7 +28,7 @@ import tempfile
6
28
 
7
29
  from ansys.fluent.core.fluent_connection import PortNotProvided
8
30
  from ansys.fluent.core.launcher import launcher_utils
9
- from ansys.fluent.core.launcher.error_handler import IpPortNotProvided
31
+ from ansys.fluent.core.launcher.error_handler import InvalidIpPort, IpPortNotProvided
10
32
  from ansys.fluent.core.session import _parse_server_info_file
11
33
 
12
34
 
@@ -45,6 +67,27 @@ def _get_server_info_file_names(use_tmpdir=True) -> tuple[str, str]:
45
67
  return file_name, file_name
46
68
 
47
69
 
70
+ def _check_ip_port(ip: str, port: int):
71
+ """Check if a port is open on a given IP address."""
72
+
73
+ if not (ip and port):
74
+ raise IpPortNotProvided()
75
+
76
+ if not port:
77
+ raise PortNotProvided()
78
+
79
+ import socket
80
+
81
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
82
+ sock.settimeout(2)
83
+ try:
84
+ result = sock.connect_ex((ip, port))
85
+ if result != 0:
86
+ raise InvalidIpPort()
87
+ finally:
88
+ sock.close()
89
+
90
+
48
91
  def _get_server_info(
49
92
  server_info_file_name: str,
50
93
  ip: str | None = None,
@@ -65,7 +108,6 @@ def _get_server_info(
65
108
  ip = ip or os.getenv("PYFLUENT_FLUENT_IP", "127.0.0.1")
66
109
  port = port or os.getenv("PYFLUENT_FLUENT_PORT")
67
110
 
68
- if not port:
69
- raise PortNotProvided()
111
+ _check_ip_port(ip=ip, port=port)
70
112
 
71
113
  return ip, port, password
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module for launching Fluent within a Slurm environment.
2
24
 
3
25
  Examples
@@ -272,7 +294,7 @@ class SlurmLauncher:
272
294
  processor_count: int | None = None,
273
295
  journal_file_names: None | str | list[str] = None,
274
296
  start_timeout: int = -1,
275
- additional_arguments: str | None = "",
297
+ additional_arguments: str = "",
276
298
  env: Dict[str, Any] | None = None,
277
299
  cleanup_on_exit: bool = True,
278
300
  start_transcript: bool = True,
@@ -1,3 +1,25 @@
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
+
1
23
  """Provides a module for launching Fluent in standalone mode.
2
24
 
3
25
  Examples
@@ -67,7 +89,7 @@ class StandaloneLauncher:
67
89
  processor_count: int | None = None,
68
90
  journal_file_names: None | str | list[str] = None,
69
91
  start_timeout: int = 60,
70
- additional_arguments: str | None = "",
92
+ additional_arguments: str = "",
71
93
  env: Dict[str, Any] | None = None,
72
94
  cleanup_on_exit: bool = True,
73
95
  dry_run: bool = False,
@@ -83,89 +105,73 @@ class StandaloneLauncher:
83
105
  start_watchdog: bool | None = None,
84
106
  file_transfer_service: Any | None = None,
85
107
  ):
86
- """Launch Fluent session in standalone mode.
108
+ """
109
+ Launch a Fluent session in standalone mode.
87
110
 
88
111
  Parameters
89
112
  ----------
90
113
  mode : FluentMode
91
- Launch mode of Fluent to point to a specific session type.
114
+ Specifies the launch mode of Fluent to target a specific session type.
92
115
  ui_mode : UIMode
93
- Fluent user interface mode. Options are the values of the ``UIMode`` enum.
116
+ Defines the user interface mode for Fluent. Options correspond to values in the ``UIMode`` enum.
94
117
  graphics_driver : FluentWindowsGraphicsDriver or FluentLinuxGraphicsDriver
95
- Graphics driver of Fluent. Options are the values of the
96
- ``FluentWindowsGraphicsDriver`` enum in Windows or the values of the
97
- ``FluentLinuxGraphicsDriver`` enum in Linux.
118
+ Specifies the graphics driver for Fluent. Options are from the ``FluentWindowsGraphicsDriver`` enum
119
+ (for Windows) or the ``FluentLinuxGraphicsDriver`` enum (for Linux).
98
120
  product_version : FluentVersion or str or float or int, optional
99
- Version of Ansys Fluent to launch. To use Fluent version 2025 R1, pass
100
- ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``.
101
- The default is ``None``, in which case the newest installed version is used.
121
+ Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
122
+ ``FluentVersion.v251``, ``"25.1.0"``, ``"25.1"``, ``25.1``, or ``251``. Defaults to ``None``,
123
+ which uses the newest installed version.
102
124
  dimension : Dimension or int, optional
103
- Geometric dimensionality of the Fluent simulation. The default is ``None``,
104
- in which case ``Dimension.THREE`` is used. Options are either the values of the
105
- ``Dimension`` enum (``Dimension.TWO`` or ``Dimension.THREE``) or any of ``2`` and ``3``.
125
+ Specifies the geometric dimensionality of the Fluent simulation. Defaults to ``None``,
126
+ which corresponds to ``Dimension.THREE``. Acceptable values are from the ``Dimension`` enum
127
+ (``Dimension.TWO`` or ``Dimension.THREE``) or integers ``2`` and ``3``.
106
128
  precision : Precision or str, optional
107
- Floating point precision. The default is ``None``, in which case ``Precision.DOUBLE``
108
- is used. Options are either the values of the ``Precision`` enum (``Precision.SINGLE``
109
- or ``Precision.DOUBLE``) or any of ``"double"`` and ``"single"``.
129
+ Defines the floating point precision. Defaults to ``None``, which corresponds to
130
+ ``Precision.DOUBLE``. Acceptable values are from the ``Precision`` enum (``Precision.SINGLE``
131
+ or ``Precision.DOUBLE``) or strings ``"single"`` and ``"double"``.
110
132
  processor_count : int, optional
111
- Number of processors. The default is ``None``, in which case ``1``
112
- processor is used. In job scheduler environments the total number of
113
- allocated cores is clamped to value of ``processor_count``.
133
+ Specifies the number of processors to use. Defaults to ``None``, which uses 1 processor.
134
+ In job scheduler environments, this value limits the total number of allocated cores.
114
135
  journal_file_names : str or list of str, optional
115
- The string path to a Fluent journal file, or a list of such paths. Fluent will execute the
116
- journal(s). The default is ``None``.
136
+ Path(s) to a Fluent journal file(s) that Fluent will execute. Defaults to ``None``.
117
137
  start_timeout : int, optional
118
- Maximum allowable time in seconds for connecting to the Fluent
119
- server. The default is ``60``.
138
+ Maximum time in seconds allowed for connecting to the Fluent server. Defaults to 60 seconds.
120
139
  additional_arguments : str, optional
121
- Additional arguments to send to Fluent as a string in the same
122
- format they are normally passed to Fluent on the command line.
140
+ Additional command-line arguments for Fluent, formatted as they would be on the command line.
123
141
  env : dict[str, str], optional
124
- Mapping to modify environment variables in Fluent. The default
125
- is ``None``.
142
+ A mapping for modifying environment variables in Fluent. Defaults to ``None``.
126
143
  cleanup_on_exit : bool, optional
127
- Whether to shut down the connected Fluent session when PyFluent is
128
- exited, or the ``exit()`` method is called on the session instance,
129
- or if the session instance becomes unreferenced. The default is ``True``.
144
+ Determines whether to shut down the connected Fluent session when exiting PyFluent or calling
145
+ the session's `exit()` method. Defaults to True.
130
146
  dry_run : bool, optional
131
- Defaults to False. If True, will not launch Fluent, and will print configuration information
132
- that would be used as if Fluent was being launched. If True, the ``call()`` method will return
133
- a tuple containing Fluent launch string and the server info file name.
147
+ If True, does not launch Fluent but prints configuration information instead. The `call()` method
148
+ returns a tuple containing the launch string and server info file name. Defaults to False.
134
149
  start_transcript : bool, optional
135
- Whether to start streaming the Fluent transcript in the client. The
136
- default is ``True``. You can stop and start the streaming of the
137
- Fluent transcript subsequently via the method calls, ``transcript.start()``
138
- and ``transcript.stop()`` on the session object.
150
+ Indicates whether to start streaming the Fluent transcript in the client. Defaults to True;
151
+ streaming can be controlled via `transcript.start()` and `transcript.stop()` methods on the session object.
139
152
  case_file_name : str, optional
140
- Name of the case file to read into the
141
- Fluent session. The default is ``None``.
153
+ Name of the case file to read into the Fluent session. Defaults to None.
142
154
  case_data_file_name : str, optional
143
- Name of the case data file. If names of both a case file and case data file are provided, they are read into the Fluent session.
155
+ Name of the case data file. If both case and data files are provided, they are read into the session.
144
156
  lightweight_mode : bool, optional
145
- Whether to run in lightweight mode. In lightweight mode, the lightweight settings are read into the
146
- current Fluent solver session. The mesh is read into a background Fluent solver session which will
147
- replace the current Fluent solver session once the mesh read is complete and the lightweight settings
148
- made by the user in the current Fluent solver session have been applied in the background Fluent
149
- solver session. This is all orchestrated by PyFluent and requires no special usage.
150
- This parameter is used only when ``case_file_name`` is provided. The default is ``False``.
157
+ If True, runs in lightweight mode where mesh settings are read into a background solver session,
158
+ replacing it once complete. This parameter is only applicable when `case_file_name` is provided; defaults to False.
151
159
  py : bool, optional
152
- If True, Fluent will run in Python mode. Default is None.
160
+ If True, runs Fluent in Python mode. Defaults to None.
153
161
  gpu : bool, optional
154
- If True, Fluent will start with GPU Solver.
155
- cwd : str, Optional
162
+ If True, starts Fluent with GPU Solver enabled.
163
+ cwd : str, optional
156
164
  Working directory for the Fluent client.
157
- fluent_path: str, Optional
158
- User provided Fluent installation path.
159
- topy : bool or str, optional
160
- A boolean flag to write the equivalent Python journal(s) from the journal(s) passed.
161
- Can optionally take the file name of the new python journal file.
165
+ fluent_path: str, optional
166
+ User-specified path for Fluent installation.
167
+ topy : bool or str, optional
168
+ A flag indicating whether to write equivalent Python journals from provided journal files; can also specify
169
+ a filename for the new Python journal.
162
170
  start_watchdog : bool, optional
163
- When ``cleanup_on_exit`` is True, ``start_watchdog`` defaults to True,
164
- which means an independent watchdog process is run to ensure
165
- that any local GUI-less Fluent sessions started by PyFluent are properly closed (or killed if frozen)
166
- when the current Python process ends.
167
- file_transfer_service : optional
168
- File transfer service. Uploads/downloads files to/from the server.
171
+ When `cleanup_on_exit` is True, defaults to True; an independent watchdog process ensures that any local
172
+ GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
173
+ file_transfer_service : Any
174
+ Service for uploading/downloading files to/from the server.
169
175
 
170
176
  Raises
171
177
  ------
@@ -174,9 +180,8 @@ class StandaloneLauncher:
174
180
 
175
181
  Notes
176
182
  -----
177
- Job scheduler environments such as SLURM, LSF, PBS, etc. allocates resources / compute nodes.
178
- The allocated machines and core counts are queried from the scheduler environment and
179
- passed to Fluent.
183
+ In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated,
184
+ and core counts are queried from these environments before being passed to Fluent.
180
185
  """
181
186
  import ansys.fluent.core as pyfluent
182
187