2929import inspect
3030import logging
3131import os
32- from typing import Any , Dict
32+ from typing import Any , Literal , TypedDict , Unpack , final , overload
33+
34+ from typing_extensions import Required
3335
3436import ansys .fluent .core as pyfluent
3537from ansys .fluent .core ._types import PathType
5860from ansys .fluent .core .session_meshing import Meshing
5961from ansys .fluent .core .session_pure_meshing import PureMeshing
6062from ansys .fluent .core .session_solver import Solver
63+ from ansys .fluent .core .session_solver_aero import SolverAero
6164from ansys .fluent .core .session_solver_icing import SolverIcing
6265from ansys .fluent .core .utils .deprecate import deprecate_arguments
6366from ansys .fluent .core .utils .fluent_version import FluentVersion
@@ -127,6 +130,94 @@ def _version_to_dimension(old_arg_val):
127130 return None
128131
129132
133+ class LaunchFluentArgs (TypedDict , total = False ):
134+ product_version : FluentVersion | str | float | int | None
135+ dimension : Dimension | int
136+ precision : Precision | str
137+ processor_count : int | None
138+ journal_file_names : None | str | list [str ]
139+ start_timeout : int
140+ additional_arguments : str
141+ env : dict [str , Any ] | None
142+ start_container : bool | None
143+ container_dict : dict [str , Any ] | None
144+ cleanup_on_exit : bool
145+ start_transcript : bool
146+ ui_mode : UIMode | str | None
147+ graphics_driver : (
148+ FluentWindowsGraphicsDriver | FluentLinuxGraphicsDriver | str | None
149+ )
150+ case_file_name : str | None
151+ case_data_file_name : str | None
152+ lightweight_mode : bool | None
153+ py : bool | None
154+ gpu : bool | list [int ] | None
155+ cwd : str | None
156+ fluent_path : str | None
157+ topy : str | list | None
158+ start_watchdog : bool | None
159+ file_transfer_service : Any | None
160+ use_docker_compose : bool
161+ use_podman_compose : bool
162+
163+
164+ class SlurmSchedulerOptions (TypedDict , total = False ):
165+ scheduler : Required [Literal ["slurm" ]]
166+ scheduler_headnode : str
167+ scheduler_queue : str
168+ scheduler_account : str
169+
170+
171+ @overload
172+ def launch_fluent (
173+ * ,
174+ dry_run : Literal [False ] = False ,
175+ mode : Literal [FluentMode .MESHING , "meshing" ],
176+ ** kwargs : Unpack [LaunchFluentArgs ],
177+ ) -> Meshing : ...
178+ @overload
179+ def launch_fluent (
180+ * ,
181+ dry_run : Literal [False ] = False ,
182+ mode : Literal [FluentMode .PURE_MESHING , "pure_meshing" ],
183+ ** kwargs : Unpack [LaunchFluentArgs ],
184+ ) -> PureMeshing : ...
185+ @overload
186+ def launch_fluent (
187+ * ,
188+ dry_run : Literal [False ] = False ,
189+ mode : Literal [FluentMode .SOLVER , "solver" ] = FluentMode .SOLVER ,
190+ ** kwargs : Unpack [LaunchFluentArgs ],
191+ ) -> Solver : ...
192+ @overload
193+ def launch_fluent (
194+ * ,
195+ dry_run : Literal [False ] = False ,
196+ mode : Literal [FluentMode .SOLVER_ICING , "solver_icing" ],
197+ ** kwargs : Unpack [LaunchFluentArgs ],
198+ ) -> SolverIcing : ...
199+ @overload
200+ def launch_fluent (
201+ * ,
202+ dry_run : Literal [False ] = False ,
203+ mode : Literal [FluentMode .SOLVER_AERO , "solver_aero" ] = ...,
204+ ** kwargs : Unpack [LaunchFluentArgs ],
205+ ) -> SolverAero : ...
206+ @overload
207+ def launch_fluent (
208+ * ,
209+ dry_run : Literal [False ] = False ,
210+ scheduler_options : SlurmSchedulerOptions ,
211+ mode : FluentMode | str = FluentMode .SOLVER ,
212+ ** kwargs : Unpack [LaunchFluentArgs ],
213+ ) -> SlurmFuture : ...
214+ @overload
215+ def launch_fluent (
216+ * ,
217+ dry_run : Literal [True ],
218+ ** kwargs : Unpack [LaunchFluentArgs ],
219+ ) -> dict [str , Any ]: ...
220+
130221def _custom_converter_gui (kwargs ):
131222 old_val = kwargs .pop ("show_gui" , None )
132223 kwargs ["ui_mode" ] = _show_gui_to_ui_mode (old_val , ** kwargs )
@@ -152,14 +243,15 @@ def _custom_converter_dimension(kwargs):
152243 converter = _custom_converter_dimension ,
153244)
154245def launch_fluent (
246+ * ,
155247 product_version : FluentVersion | str | float | int | None = None ,
156- dimension : Dimension | int | None = None ,
157- precision : Precision | str | None = None ,
248+ dimension : Dimension | int = Dimension . THREE ,
249+ precision : Precision | str = Precision . DOUBLE ,
158250 processor_count : int | None = None ,
159251 journal_file_names : None | str | list [str ] = None ,
160- start_timeout : int = None ,
252+ start_timeout : int | None = None ,
161253 additional_arguments : str = "" ,
162- env : Dict [str , Any ] | None = None ,
254+ env : dict [str , Any ] | None = None ,
163255 start_container : bool | None = None ,
164256 container_dict : dict | None = None ,
165257 dry_run : bool = False ,
@@ -172,18 +264,26 @@ def launch_fluent(
172264 case_file_name : "PathType | None" = None ,
173265 case_data_file_name : "PathType | None" = None ,
174266 lightweight_mode : bool | None = None ,
175- mode : FluentMode | str | None = None ,
267+ mode : FluentMode | str = FluentMode . SOLVER ,
176268 py : bool | None = None ,
177269 gpu : bool | list [int ] | None = None ,
178270 cwd : "PathType | None" = None ,
179271 fluent_path : "PathType | None" = None ,
180272 topy : str | list | None = None ,
181273 start_watchdog : bool | None = None ,
182- scheduler_options : dict | None = None ,
274+ scheduler_options : SlurmSchedulerOptions | None = None ,
183275 file_transfer_service : Any | None = None ,
184- use_docker_compose : bool | None = None ,
185- use_podman_compose : bool | None = None ,
186- ) -> Meshing | PureMeshing | Solver | SolverIcing | SlurmFuture | dict :
276+ use_docker_compose : bool = False ,
277+ use_podman_compose : bool = False ,
278+ ) -> (
279+ Meshing
280+ | PureMeshing
281+ | Solver
282+ | SolverIcing
283+ | SolverAero
284+ | SlurmFuture
285+ | dict [Any , Any ]
286+ ):
187287 """Launch Fluent locally in server mode or connect to a running Fluent server
188288 instance.
189289
@@ -204,8 +304,7 @@ def launch_fluent(
204304 in which case ``Dimension.THREE`` is used. Options are either the values of the
205305 ``Dimension`` enum (``Dimension.TWO`` or ``Dimension.THREE``) or any of ``2`` and ``3``.
206306 precision : Precision or str, optional
207- Floating point precision. The default is ``None``, in which case ``Precision.DOUBLE``
208- is used. Options are either the values of the ``Precision`` enum (``Precision.SINGLE``
307+ Floating point precision. Options are either the values of the ``Precision`` enum (``Precision.SINGLE``
209308 or ``Precision.DOUBLE``) or any of ``"double"`` and ``"single"``.
210309 processor_count : int, optional
211310 Number of processors. The default is ``None``, in which case ``1``
@@ -270,7 +369,7 @@ def launch_fluent(
270369 This parameter is used only when ``case_file_name`` is provided. The default is ``False``.
271370 mode : FluentMode or str or None, optional
272371 Launch mode of Fluent to point to a specific session type. Can be a
273- ``FluentMode`` enum member or a string. The default value is ``None ``.
372+ ``FluentMode`` enum member or a string. The default value is ``SOLVER ``.
274373 Valid string options include ``"meshing"``, ``"pure-meshing"``, and
275374 ``"solver"``.
276375 py : bool, optional
@@ -372,6 +471,7 @@ def _mode_to_launcher_type(fluent_launch_mode: LaunchMode):
372471
373472
374473def connect_to_fluent (
474+ * ,
375475 ip : str | None = None ,
376476 port : int | None = None ,
377477 cleanup_on_exit : bool = False ,
@@ -380,7 +480,7 @@ def connect_to_fluent(
380480 password : str | None = None ,
381481 start_watchdog : bool | None = None ,
382482 file_transfer_service : Any | None = None ,
383- ) -> Meshing | PureMeshing | Solver | SolverIcing :
483+ ) -> Meshing | PureMeshing | Solver | SolverIcing | SolverAero :
384484 """Connect to an existing Fluent server instance.
385485
386486 Parameters
0 commit comments