fluent_connection#
Classes:
|
Encapsulates a Fluent connection. |
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 of Fluent connection.
exit
()Close the Fluent connection and exit Fluent.
Gets the mode of the current instance of Fluent (meshing or solver).
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.
Executes tui command to stop journal.
Stop streaming of Fluent transcript.
Attributes:
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
.- ip
str
,optional
IP address to connect to existing Fluent instance. Used only when
channel
isNone
. Defaults to"127.0.0.1"
and can also be set by the environment variablePYFLUENT_FLUENT_IP=<ip>
.- port
int
,optional
Port to connect to existing Fluent instance. Used only when
channel
isNone
. Defaults value can be set by the environment variablePYFLUENT_FLUENT_PORT=<port>
.- password
str
,optional
Password to connect to existing Fluent instance.
- channel
grpc.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_instance
ansys.platform.instancemanagement.Instance
The corresponding remote instance when Fluent is launched through PyPIM. This instance will be deleted when calling
Session.exit()
.
- 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=None, write_to_stdout=True)#
Start streaming of Fluent transcript.
- Return type:
- stop_journal()#
Executes tui command to stop journal.
- 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:
- cbs
List
[Callable
] Cleanup/shutdown functions
- cbs
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: