Fluent launcher#
Provides a module for launching Fluent.
This module supports both starting Fluent locally and connecting to a remote instance with gRPC.
Classes:
|
An enumeration over supported Fluent modes. |
|
An enumeration over supported Fluent versions. |
|
An enumeration over supported Fluent launch modes. |
Exceptions:
|
Exception class representing launch errors. |
Functions:
Checks whether Python Docker SDK is supported by the current system. |
|
|
Connect to an existing Fluent server instance. |
Return the version string corresponding to the most recent, available ANSYS installation. |
|
|
Get Fluent executable path. |
|
Launch Fluent locally in server mode or connect to a running Fluent server instance. |
|
Launch Fluent remotely using PyPIM <https://pypim.docs.pyansys.com>. |
|
Convert journal filenames to Python filename. |
- class ansys.fluent.core.launcher.launcher.FluentMode(value)#
Bases:
Enum
An enumeration over supported Fluent modes.
Attributes:
Methods:
get_mode
(mode)Returns the FluentMode based on the provided mode string.
- MESHING_MODE = ('meshing', <class 'ansys.fluent.core.session_meshing.Meshing'>, True, [])#
- PURE_MESHING_MODE = ('pure-meshing', <class 'ansys.fluent.core.session_pure_meshing.PureMeshing'>, True, [])#
- SOLVER = ('solver', <class 'ansys.fluent.core.session_solver.Solver'>, False, [])#
- SOLVER_ICING = ('solver-icing', <class 'ansys.fluent.core.session_solver_icing.SolverIcing'>, False, [('fluent_icing', True)])#
- static get_mode(mode)#
Returns the FluentMode based on the provided mode string.
- class ansys.fluent.core.launcher.launcher.FluentVersion(value)#
Bases:
Enum
An enumeration over supported Fluent versions.
Attributes:
- version_22R2 = '22.2.0'#
- version_23R1 = '23.1.0'#
- version_23R2 = '23.2.0'#
- version_24R1 = '24.1.0'#
- exception ansys.fluent.core.launcher.launcher.LaunchFluentError(launch_string)#
Bases:
Exception
Exception class representing launch errors.
- __init__(launch_string)#
__init__ method of LaunchFluentError class.
- class ansys.fluent.core.launcher.launcher.LaunchMode(value)#
Bases:
Enum
An enumeration over supported Fluent launch modes.
Attributes:
- CONTAINER = 3#
- PIM = 2#
- STANDALONE = 1#
- ansys.fluent.core.launcher.launcher.check_docker_support()#
Checks whether Python Docker SDK is supported by the current system.
- ansys.fluent.core.launcher.launcher.connect_to_fluent(ip=None, port=None, cleanup_on_exit=False, start_transcript=True, server_info_filepath=None, password=None, start_watchdog=None)#
Connect to an existing Fluent server instance.
- Parameters:
- ip
str
,optional
IP address for connecting to an existing Fluent instance. The IP address defaults to
"127.0.0.1"
. You can also use the environment variablePYFLUENT_FLUENT_IP=<ip>
to set this parameter.- port
int
,optional
Port to listen on for an existing Fluent instance. You can use the environment variable
PYFLUENT_FLUENT_PORT=<port>
to set a default value.- cleanup_on_exitbool,
optional
Whether to shut down the connected Fluent session when PyFluent is exited, or the
exit()
method is called on the session instance, or if the session instance becomes unreferenced. The default isFalse
.- start_transcriptbool,
optional
Whether to start streaming the Fluent transcript in the client. The default is
True
. You can stop and start the streaming of the Fluent transcript subsequently via the method calls,transcript.start()
andtranscript.stop()
on the session object.- server_info_filepath: str
Path to server-info file written out by Fluent server. The default is
None
. PyFluent uses the connection information in the file to connect to a running Fluent session.- password
str
,optional
Password to connect to existing Fluent instance.
- start_watchdog: bool, optional
When
cleanup_on_exit
is True,start_watchdog
defaults to True, which means an independent watchdog process is run to ensure that any local Fluent connections are properly closed (or terminated if frozen) when Python process ends.
- ip
- Returns:
Union
[Meshing
,PureMeshing
,Solver
,SolverIcing
]Session object.
- ansys.fluent.core.launcher.launcher.get_ansys_version()#
Return the version string corresponding to the most recent, available ANSYS installation. The returned value is the string component of one of the members of the FluentVersion class.
- ansys.fluent.core.launcher.launcher.get_fluent_exe_path(**launch_argvals)#
Get Fluent executable path. The path is searched in the following order.
product_version
parameter passed withlaunch_fluent
.The latest ANSYS version from
AWP_ROOTnnn`
environment variables.
- Returns:
Path
Fluent executable path
- ansys.fluent.core.launcher.launcher.launch_fluent(product_version=None, version=None, precision=None, processor_count=None, journal_filepath=None, start_timeout=60, additional_arguments=None, env=None, start_container=None, container_dict=None, dry_run=False, cleanup_on_exit=True, start_transcript=True, show_gui=None, case_filepath=None, case_data_filepath=None, lightweight_mode=None, mode=None, py=None, gpu=None, cwd=None, topy=None, start_watchdog=None, **kwargs)#
Launch Fluent locally in server mode or connect to a running Fluent server instance.
- Parameters:
- product_version
str
,optional
Select an installed version of ANSYS. The string must be in a format like
"23.2.0"
(for 2023 R2) matching the documented version format in the FluentVersion class. The default isNone
, in which case the newest installed version is used.- version
str
,optional
Geometric dimensionality of the Fluent simulation. The default is
None
, in which case"3d"
is used. Options are"3d"
and"2d"
.- precision
str
,optional
Floating point precision. The default is
None
, in which case"double"
is used. Options are"double"
and"single"
.- processor_count
int
,optional
Number of processors. The default is
None
, in which case1
processor is used. In job scheduler environments the total number of allocated cores is clamped to this value.- journal_filepath
str
,optional
Name of the journal file to read. The default is
None
.- start_timeout
int
,optional
Maximum allowable time in seconds for connecting to the Fluent server. The default is
60
.- additional_arguments
str
,optional
Additional arguments to send to Fluent as a string in the same format they are normally passed to Fluent on the command line.
- env
dict
[str
,str
],optional
Mapping to modify environment variables in Fluent. The default is
None
.- start_containerbool,
optional
Specifies whether to launch a Fluent Docker container image. For more details about containers, see
fluent_container
.- container_dict
dict
,optional
Dictionary for Fluent Docker container configuration. If specified, setting
start_container = True
as well is redundant. Will launch Fluent inside a Docker container using the configuration changes specified. See alsofluent_container
.- dry_runbool,
optional
Defaults to False. If True, will not launch Fluent, and will instead print configuration information that would be used as if Fluent was being launched. If dry running a container start,
launch_fluent()
will return the configuredcontainer_dict
.- cleanup_on_exitbool,
optional
Whether to shut down the connected Fluent session when PyFluent is exited, or the
exit()
method is called on the session instance, or if the session instance becomes unreferenced. The default isTrue
.- start_transcriptbool,
optional
Whether to start streaming the Fluent transcript in the client. The default is
True
. You can stop and start the streaming of the Fluent transcript subsequently via the method calls,transcript.start()
andtranscript.stop()
on the session object.- show_guibool,
optional
Whether to display the Fluent GUI. The default is
None
, which does not cause the GUI to be shown. If a value ofFalse
is not explicitly provided, the GUI will also be shown if the environment variablePYFLUENT_SHOW_SERVER_GUI
is set to 1.- case_filepath
str
,optional
If provided, the case file at
case_filepath
is read into the Fluent session.- case_data_filepath
str
,optional
If provided, the case and data files at
case_data_filepath
are read into the Fluent session.- lightweight_modebool,
optional
Whether to run in lightweight mode. In lightweight mode, the lightweight settings are read into the current Fluent solver session. The mesh is read into a background Fluent solver session which will replace the current Fluent solver session once the mesh read is complete and the lightweight settings made by the user in the current Fluent solver session have been applied in the background Fluent solver session. This is all orchestrated by PyFluent and requires no special usage. This parameter is used only when
case_filepath
is provided. The default isFalse
.- mode
str
,optional
Launch mode of Fluent to point to a specific session type. The default value is
None
. Options are"meshing"
,"pure-meshing"
and"solver"
.- pybool,
optional
If True, Fluent will run in Python mode. Default is None.
- gpubool,
optional
If True, Fluent will start with GPU Solver.
- cwd
str
,Optional
Working directory for the Fluent client.
- topy
str
orlist
,optional
The string path to a Fluent journal file, or a list of such paths. Fluent will execute the journal(s) and write the equivalent Python journal(s).
- start_watchdogbool,
optional
When
cleanup_on_exit
is True,start_watchdog
defaults to True, which means an independent watchdog process is run to ensure that any local GUI-less Fluent sessions started by PyFluent are properly closed (or killed if frozen) when the current Python process ends.
- product_version
- Returns:
Union
[Meshing
,PureMeshing
,Solver
,SolverIcing
,dict
]Session object or configuration dictionary if
dry_run = True
.
Notes
In job scheduler environments such as SLURM, LSF, PBS, etc… the allocated machines and core counts are queried from the scheduler environment and passed to Fluent.
- ansys.fluent.core.launcher.launcher.launch_remote_fluent(session_cls, start_transcript, start_timeout=100, product_version=None, cleanup_on_exit=True, meshing_mode=False, dimensionality=None, launcher_args=None)#
Launch Fluent remotely using PyPIM <https://pypim.docs.pyansys.com>.
When calling this method, you must ensure that you are in an environment where PyPIM is configured. You can use the :func: pypim.is_configured <ansys.platform.instancemanagement.is_configured> method to verify that PyPIM is configured.
- Parameters:
- session_cls: Union[type(Meshing), type(PureMeshing), type(Solver), type(SolverIcing)]
Session type.
- start_transcript: bool
Whether to start streaming the Fluent transcript in the client. The default is
True
. You can stop and start the streaming of the Fluent transcript subsequently via method calls on the session object.- start_timeout
int
,optional
Maximum allowable time in seconds for connecting to the Fluent server. The default is
100
.- product_version
str
,optional
Select an installed version of ANSYS. The string must be in a format like
"23.2.0"
(for 2023 R2) matching the documented version format in the FluentVersion class. The default isNone
, in which case the newest installed version is used.- cleanup_on_exitbool,
optional
Whether to clean up and exit Fluent when Python exits or when garbage is collected for the Fluent Python instance. The default is
True
.- meshing_modebool,
optional
Whether to launch Fluent remotely in meshing mode. The default is
False
.- dimensionality
str
,optional
Geometric dimensionality of the Fluent simulation. The default is
None
, in which case"3d"
is used. Options are"3d"
and"2d"
.
- Returns:
Union
[Meshing
,PureMeshing
,Solver
,SolverIcing
]Session object.
- ansys.fluent.core.launcher.launcher.scm_to_py(topy)#
Convert journal filenames to Python filename.