session_utilities#
Session utilities.
Classes:
|
Encapsulates a Fluent server for meshing session connection. |
|
Encapsulates a Fluent server for pre-post session connection. |
Encapsulates a Fluent server for pure meshing session connection. |
|
Base class for Fluent sessions. |
|
|
Encapsulates a Fluent server for solver session connection. |
Encapsulates a Fluent server for solver aero session connection. |
|
Encapsulates a Fluent server for solver icing session connection. |
- class ansys.fluent.core.session_utilities.Meshing#
Bases:
SessionBaseEncapsulates a Fluent server for meshing session connection.
- class ansys.fluent.core.session_utilities.PrePost#
Bases:
SessionBaseEncapsulates a Fluent server for pre-post session connection.
- class ansys.fluent.core.session_utilities.PureMeshing#
Bases:
SessionBaseEncapsulates a Fluent server for pure meshing session connection.
- class ansys.fluent.core.session_utilities.SessionBase#
Bases:
objectBase class for Fluent sessions.
This class is not intended to be used directly. Instead, use the from_connection, from_container, from_install, or from_pim functions to create a session.
Methods:
from_connection([ip, port, ...])Connect to an existing Fluent server instance.
from_container([ui_mode, graphics_driver, ...])Launch a Fluent session in container mode.
from_install([ui_mode, graphics_driver, ...])Launch a Fluent session in standalone mode.
from_pim([ui_mode, graphics_driver, ...])Launch a Fluent session in PIM mode.
- classmethod from_connection(ip=None, port=None, server_info_file_name=None, password=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. The explicit value ofiptakes precedence overPYFLUENT_FLUENT_IP=<ip>.- 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. The explicit value ofporttakes precedence overPYFLUENT_FLUENT_PORT=<port>.- server_info_file_name: 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.
- ip
- Raises:
TypeErrorIf the session type does not match the expected session type.
- classmethod from_container(ui_mode=None, graphics_driver=None, product_version=None, dimension=None, precision=None, processor_count=None, start_timeout=60, additional_arguments='', container_dict=None, dry_run=False, cleanup_on_exit=True, start_transcript=True, py=None, gpu=None, start_watchdog=None, file_transfer_service=None)#
Launch a Fluent session in container mode.
- Parameters:
- ui_mode
UIMode Defines the user interface mode for Fluent. Options correspond to values in the
UIModeenum.- graphics_driver
FluentWindowsGraphicsDriverorFluentLinuxGraphicsDriver Specifies the graphics driver for Fluent. Options are from the
FluentWindowsGraphicsDriverenum (for Windows) or theFluentLinuxGraphicsDriverenum (for Linux).- product_version
FluentVersionorstrorfloatorint,optional Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass any of
FluentVersion.v251,"25.1.0","25.1",25.1, or251. Defaults toNone, which uses the newest installed version.- dimension
Dimensionorint,optional Specifies the geometric dimensionality of the Fluent simulation. Defaults to
None, which corresponds toDimension.THREE. Acceptable values includeDimension.TWO,Dimension.THREE, or integers2and3.- precision
Precisionorstr,optional Defines the floating point precision. Defaults to
None, which corresponds toPrecision.DOUBLE. Acceptable values includePrecision.SINGLE,Precision.DOUBLE, or strings"single"and"double".- processor_count
int,optional Specifies the number of processors to use. Defaults to
None, which uses 1 processor. In job scheduler environments, this value limits the total number of allocated cores.- start_timeout
int,optional Maximum allowable time in seconds for connecting to the Fluent server. Defaults to 60 seconds.
- additional_arguments
str,optional Additional command-line arguments for Fluent, formatted as they would be on the command line.
- container_dict
dict,optional Configuration dictionary for launching Fluent inside a Docker container. See also
fluent_container.- dry_runbool,
optional If True, does not launch Fluent but prints configuration information instead. If dry running a container start, this method will return the configured
container_dict. Defaults to False.- cleanup_on_exitbool
Determines whether to shut down the connected Fluent session upon exit or when calling the session’s exit() method. Defaults to True.
- start_transcriptbool
Indicates whether to start streaming the Fluent transcript in the client. Defaults to True; streaming can be controlled via transcript.start() and transcript.stop() methods on the session object.
- pybool,
optional If True, runs Fluent in Python mode. Defaults to None.
- gpubool,
optional If True, starts Fluent with GPU Solver enabled.
- start_watchdogbool,
optional If True and cleanup_on_exit is True, an independent watchdog process is run to ensure that any local GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
- file_transfer_service
Any,optional Service for uploading/downloading files to/from the server.
- ui_mode
- Returns:
Meshing|PureMeshing|Solver|SolverIcing|dictSession object or configuration dictionary if
dry_runis True.
- Raises:
UnexpectedKeywordArgumentIf an unexpected keyword argument is provided.
Notes
In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated, and core counts are queried from these environments before being passed to Fluent.
- classmethod from_install(ui_mode=None, graphics_driver=None, product_version=None, dimension=None, precision=None, processor_count=None, journal_file_names=None, start_timeout=60, additional_arguments='', env={}, cleanup_on_exit=True, dry_run=False, start_transcript=True, case_file_name=None, case_data_file_name=None, lightweight_mode=None, py=None, gpu=None, cwd=None, fluent_path=None, topy=None, start_watchdog=None, file_transfer_service=None)#
Launch a Fluent session in standalone mode.
- Parameters:
- ui_mode
UIMode Defines the user interface mode for Fluent. Options correspond to values in the
UIModeenum.- graphics_driver
FluentWindowsGraphicsDriverorFluentLinuxGraphicsDriver Specifies the graphics driver for Fluent. Options are from the
FluentWindowsGraphicsDriverenum (for Windows) or theFluentLinuxGraphicsDriverenum (for Linux).- product_version
FluentVersionorstrorfloatorint,optional Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass
FluentVersion.v251,"25.1.0","25.1",25.1, or251. Defaults toNone, which uses the newest installed version.- dimension
Dimensionorint,optional Specifies the geometric dimensionality of the Fluent simulation. Defaults to
None, which corresponds toDimension.THREE. Acceptable values are from theDimensionenum (Dimension.TWOorDimension.THREE) or integers2and3.- precision
Precisionorstr,optional Defines the floating point precision. Defaults to
None, which corresponds toPrecision.DOUBLE. Acceptable values are from thePrecisionenum (Precision.SINGLEorPrecision.DOUBLE) or strings"single"and"double".- processor_count
int,optional Specifies the number of processors to use. Defaults to
None, which uses 1 processor. In job scheduler environments, this value limits the total number of allocated cores.- journal_file_names
strorlistofstr,optional Path(s) to a Fluent journal file(s) that Fluent will execute. Defaults to
None.- start_timeout
int,optional Maximum time in seconds allowed for connecting to the Fluent server. Defaults to 60 seconds.
- additional_arguments
str,optional Additional command-line arguments for Fluent, formatted as they would be on the command line.
- env
dict[str,str],optional A mapping for modifying environment variables in Fluent. Defaults to
None.- cleanup_on_exitbool,
optional Determines whether to shut down the connected Fluent session when exiting PyFluent or calling the session’s exit() method. Defaults to True.
- dry_runbool,
optional If True, does not launch Fluent but prints configuration information instead. The call() method returns a tuple containing the launch string and server info file name. Defaults to False.
- start_transcriptbool,
optional Indicates whether to start streaming the Fluent transcript in the client. Defaults to True; streaming can be controlled via transcript.start() and transcript.stop() methods on the session object.
- case_file_name
str,optional Name of the case file to read into the Fluent session. Defaults to None.
- case_data_file_name
str,optional Name of the case data file. If both case and data files are provided, they are read into the session.
- lightweight_modebool,
optional If True, runs in lightweight mode where mesh settings are read into a background solver session, replacing it once complete. This parameter is only applicable when case_file_name is provided; defaults to False.
- pybool,
optional If True, runs Fluent in Python mode. Defaults to None.
- gpubool,
optional If True, starts Fluent with GPU Solver enabled.
- cwd
str,optional Working directory for the Fluent client.
- fluent_path: str, optional
User-specified path for Fluent installation.
- topybool or
str,optional A flag indicating whether to write equivalent Python journals from provided journal files; can also specify a filename for the new Python journal.
- start_watchdogbool,
optional When cleanup_on_exit is True, defaults to True; an independent watchdog process ensures that any local GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
- file_transfer_service
Any Service for uploading/downloading files to/from the server.
- ui_mode
- Raises:
UnexpectedKeywordArgumentIf an unexpected keyword argument is provided.
Notes
In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated, and core counts are queried from these environments before being passed to Fluent.
- classmethod from_pim(ui_mode=None, graphics_driver=None, product_version=None, dimension=None, precision=None, processor_count=None, start_timeout=60, additional_arguments='', cleanup_on_exit=True, dry_run=None, start_transcript=True, gpu=None, start_watchdog=None, file_transfer_service=None)#
Launch a Fluent session in PIM mode.
- Parameters:
- ui_mode
UIModeorstr,optional Defines the user interface mode for Fluent. Options correspond to values in the
UIModeenum.- graphics_driver
FluentWindowsGraphicsDriverorFluentLinuxGraphicsDriver Specifies the graphics driver for Fluent. Options are from the
FluentWindowsGraphicsDriverenum (for Windows) or theFluentLinuxGraphicsDriverenum (for Linux).- product_version
FluentVersionorstrorfloatorint,optional Indicates the version of Ansys Fluent to launch. For example, to use version 2025 R1, pass any of
FluentVersion.v251,"25.1.0","25.1",25.1, or251. Defaults toNone, which uses the newest installed version.- dimension
Dimensionorint,optional Specifies the geometric dimensionality of the Fluent simulation. Defaults to
None, which corresponds toDimension.THREE. Acceptable values includeDimension.TWO,Dimension.THREE, or integers2and3.- precision
Precisionorstr,optional Defines the floating point precision. Defaults to
None, which corresponds toPrecision.DOUBLE. Acceptable values includePrecision.SINGLE,Precision.DOUBLE, or strings"single"and"double".- processor_count
int,optional Specifies the number of processors to use. Defaults to
None, which uses 1 processor. In job scheduler environments, this value limits the total number of allocated cores.- start_timeout
int,optional Maximum allowable time in seconds for connecting to the Fluent server. Defaults to 60 seconds.
- additional_arguments
str,optional Additional command-line arguments for Fluent, formatted as they would be on the command line.
- cleanup_on_exitbool
Determines whether to shut down the connected Fluent session upon exit or when calling the session’s exit() method. Defaults to True.
- dry_runbool,
optional If True, does not launch Fluent but prints configuration information instead. If dry running a PIM start, this method will return a configuration dictionary. Defaults to False.
- start_transcriptbool
Indicates whether to start streaming the Fluent transcript in the client. Defaults to True; streaming can be controlled via transcript.start() and transcript.stop() methods on the session object.
- gpubool,
optional If True, starts Fluent with GPU Solver enabled.
- start_watchdogbool,
optional If True and cleanup_on_exit is True, an independent watchdog process is run to ensure that any local GUI-less Fluent sessions started by PyFluent are properly closed when the current Python process ends.
- file_transfer_service
Any,optional Service for uploading/downloading files to/from the server.
- ui_mode
- Returns:
Union[Meshing,PureMeshing,Solver,SolverIcing,dict]Session object or configuration dictionary if
dry_runis True.
- Raises:
UnexpectedKeywordArgumentIf an unexpected keyword argument is provided.
Notes
In job scheduler environments (e.g., SLURM, LSF, PBS), resources and compute nodes are allocated, and core counts are queried from these environments before being passed to Fluent.
- class ansys.fluent.core.session_utilities.Solver#
Bases:
SessionBaseEncapsulates a Fluent server for solver session connection.
- class ansys.fluent.core.session_utilities.SolverAero#
Bases:
SessionBaseEncapsulates a Fluent server for solver aero session connection.
- class ansys.fluent.core.session_utilities.SolverIcing#
Bases:
SessionBaseEncapsulates a Fluent server for solver icing session connection.