PyFluent provides Pythonic access to Ansys Fluent. Its features enable the seamless use of Fluent within the Python ecosystem and broad access to native Fluent features, including the ability to:
- Launch Fluent using a local Ansys installation
- Use Fluent's TUI (text user interface) commands for both meshing and solver features
- Use Fluent's built-in postprocessing capabilities
Documentation and issues
For comprehesive information on PyFluent, see the latest release documentation.
ansys-fluent-core package supports Python 3.7 through Python
3.10 on Windows and Linux.
Install the latest release from PyPI with:
pip install ansys-fluent-core
If you plan on doing local development of PyFluent with Git, install the latest release with:
git clone https://github.com/pyansys/pyfluent.git cd pyfluent pip install pip -U pip install -e . python codegen/allapigen.py # Generates the API files
You must have a licensed copy of Ansys Fluent installed locally. PyFluent supports Fluent 2022 R2 and later.
To launch Fluent from Python, use the
import ansys.fluent.core as pyfluent solver_session = pyfluent.launch_fluent(mode="solver") solver_session.check_health()
To use a non-default installation location, set the
environment variable to the
<version>/fluent directory, where
is the Fluent release that you would like to use. For example,
uses release 2022 R2.
You can use the
solver_session.tui interface to run all Fluent TUI commands:
solver_session.tui.file.read_case('elbow.cas.h5') solver_session.tui.define.models.unsteady_2nd_order("yes") solver_session.tui.solve.initialize.initialize_flow() solver_session.tui.solve.dual_time_iterate(2, 3)
You can also install and use these PyFluent libraries:
- PyFluent Parametric, which provides access to Fluent's parametric workflows.
- PyFluent Visualization, which provides postprocessing and visualization capabilities using the pyvista and matplotlib packages.
License and acknowledgments
PyFluent is licensed under the MIT license.
PyFluent makes no commercial claim over Ansys whatsoever. This library extends the functionality of Ansys Fluent by adding a Python interface to Fluent without changing the core behavior or license of the original software. The use of the interactive Fluent control of PyFluent requires a legally licensed local copy of Fluent.
For more information on Fluent, see the Ansys Fluent page on the Ansys website.