fluent_connection#

Classes:

FluentConnection([start_timeout, ip, port, ...])

Encapsulates a Fluent connection.

MonitorThread()

A class used for monitoring a Fluent session.

class ansys.fluent.core.fluent_connection.FluentConnection(start_timeout=100, ip=None, port=None, password=None, channel=None, cleanup_on_exit=True, start_transcript=True, remote_instance=None, launcher_args=None)#

Bases: object

Encapsulates a Fluent connection.

Methods

get_current_fluent_mode()

Gets the mode of the current instance of Fluent (meshing or solver).

get_fluent_version()

Gets and returns the fluent version.

exit()

Close the Fluent connection and exit Fluent.

Methods:

__init__([start_timeout, ip, port, ...])

Instantiate a Session.

check_health()

Check health of Fluent connection.

exit()

Close the Fluent connection and exit Fluent.

get_current_fluent_mode()

Gets the mode of the current instance of Fluent (meshing or solver).

get_fluent_version()

Gets and returns the fluent version.

start_journal(file_path)

Executes tui command to start journal.

start_transcript([file_path, write_to_stdout])

Start streaming of Fluent transcript.

stop_journal()

Executes tui command to stop journal.

stop_transcript()

Stop streaming of Fluent transcript.

Attributes:

id

Return the session id.

__init__(start_timeout=100, ip=None, port=None, password=None, channel=None, cleanup_on_exit=True, start_transcript=True, remote_instance=None, launcher_args=None)#

Instantiate a Session.

Parameters:
start_timeout: int, optional

Maximum allowable time in seconds for connecting to the Fluent server. The default is 100.

ipstr, optional

IP address to connect to existing Fluent instance. Used only when channel is None. Defaults to "127.0.0.1" and can also be set by the environment variable PYFLUENT_FLUENT_IP=<ip>.

portint, optional

Port to connect to existing Fluent instance. Used only when channel is None. Defaults value can be set by the environment variable PYFLUENT_FLUENT_PORT=<port>.

passwordstr, optional

Password to connect to existing Fluent instance.

channelgrpc.Channel, optional

Grpc channel to use to connect to existing Fluent instance. ip and port arguments will be ignored when channel is specified.

cleanup_on_exitbool, optional

When True, the connected Fluent session will be shut down when PyFluent is exited or exit() is called on the session instance, by default True.

start_transcriptbool, optional

The Fluent transcript is started in the client only when start_transcript is True. It can be started and stopped subsequently via method calls on the Session object.

remote_instanceansys.platform.instancemanagement.Instance

The corresponding remote instance when Fluent is launched through PyPIM. This instance will be deleted when calling Session.exit().

check_health()#

Check health of Fluent connection.

Return type:

str

exit()#

Close the Fluent connection and exit Fluent.

Return type:

None

get_current_fluent_mode()#

Gets the mode of the current instance of Fluent (meshing or solver).

get_fluent_version()#

Gets and returns the fluent version.

property id: str#

Return the session id.

start_journal(file_path)#

Executes tui command to start journal.

start_transcript(file_path=None, write_to_stdout=True)#

Start streaming of Fluent transcript.

Return type:

None

stop_journal()#

Executes tui command to stop journal.

stop_transcript()#

Stop streaming of Fluent transcript.

Return type:

None

class ansys.fluent.core.fluent_connection.MonitorThread#

Bases: Thread

A class used for monitoring a Fluent session.

Daemon thread which will ensure cleanup of session objects, shutdown of non-deamon threads etc.

Attributes:
cbsList[Callable]

Cleanup/shutdown functions

Methods:

__init__()

This constructor should always be called with keyword arguments.

run()

Method representing the thread's activity.

__init__()#

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

run()#

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

Return type:

None