ansys-fluent-core package supports Python 3.8 through
Python 3.11 on Windows and Linux.
This page provides information for quickly installing and launching
ansys-fluent-core package. Additional PyFluent packages, which
are described later on this page, can also be installed. For
information on installing all PyFluent packages in a virtual environment,
see How do you install PyFluent? in Frequently asked questions.
Install the package#
Install the latest
ansys-fluent-core package from
PyPi with this code:
pip install ansys-fluent-core
If you plan on doing local development of PyFluent with Git, install the
ansys-fluent-core package with this code:
git clone https://github.com/ansys/pyfluent.git cd pyfluent pip install pip -U pip install -e . python codegen/allapigen.py # Generates the API files
Any changes that you make locally are reflected in your setup after you restart the Python kernel.
To launch Fluent from PyFluent, use the
import ansys.fluent.core as pyfluent solver = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver") solver.health_check_service.is_serving
To locate the latest Fluent installation, PyFluent automatically uses the
environment variable, where
<ver> is the three-digit format for the release.
AWP_ROOT231 is the environment variable for the 2023 R1 release.
On a Windows system, this environment variable is configured when a release is installed.
On a Linux system, you must configure this environment variable to point to the absolute
path of the installed release. For example, for the 2023 R1 release, you would set
AWP_ROOT231 environment variable to point to an absolute location such as
For information on other ways of specifying the Fluent location for PyFluent, see How does PyFluent infer the location to launch Fluent? in Frequently asked questions.
Once Fluent is active, you can use the
solver_session.tui interface to send
Fluent TUI commands to PyFluent. For example, this code reads a case file, updates a
setting, and iterates the solver:
solver.tui.file.read_case('elbow.cas.h5') solver.tui.define.models.unsteady_2nd_order("yes") solver.tui.solve.initialize.initialize_flow() solver.tui.solve.dual_time_iterate(2, 3)
If you want to interact with the Fluent GUI (graphical user interface), pass
session = pyfluent.launch_fluent(precision="double", processor_count=2, show_gui=True, mode="solver")
If you want to print the debug information for development, set the following environment variable:
pyfluent.set_log_level('DEBUG') # for development, by default only errors are shown
Additional PyFluent packages#
In addition to the
ansys-fluent-core package, you can install and use the
The PyFluent-Parametric package provides access to Fluent’s parametric workflows.
The PyFluent-Visualization package provides postprocessing and visualization capabilities that use pyvista and matplotlib packages.