When you think of commercial engineering simulation software, you usually think of the software you are familiar with and all the workflows supported within it. You can think of these workflows as recipes to solve your engineering challenges, designed just for you by your software vendor of choice.
However, you may want to create your very own recipes to address your unique engineering challenges without being limited by packaging. Maybe you want to create automated workflows that seamlessly use additional, specialized third-party libraries or create your very own user interface (UI).
That’s why Ansys is providing direct application programming interface (API) access to the raw ingredients of these recipes, enabling the development ecosystem to build specialized solutions using the Python programming language they know and love while using Ansys functionalities at the core of their scripts. Whether you are a developer with an idea that could disrupt the market or an established company looking to customize and automate your simulation workflows to reduce time to market, PyFluent is for you.
What is PyFluent?
Python + Ansys Fluent = PyFluent
It’s that simple. When you combine the virtually limitless possibilities and flexibility of Python with the market-leading accuracy of Fluent, you unlock a new way of performing fluid-dynamic simulations. With PyFluent, developers now have access to the full breadth and depth of Fluent capabilities, from pre-processing to post-processing using Python scripting.
PyFluent combines a robust community of peers, a programming language such as Python that encourages reuse, and Ansys' state-of-the-art simulation stack to create endless possibilities.
How to get PyFluent
PyFluent is not bundled with the Fluent installation, but if you are familiar enough with Python, you can access PyFluent the same way you access all other Python libraries: on GitHub.
To minimize dependencies in the core package (making it maximally portable), the PyFluent APIs are split into three different packages:
- ansys-fluent-core — Provides access to Fluent’s meshing, solver, and post-processing capabilities.
- ansys-fluent-parametric — Provides access to Fluent’s parametric workflow capability.
- ansys-fluent-visualization — Provides a post-processing capability that works with PyVista and Matplotlib.
How to Install PyFluent
After installing a supported Python distribution, the first step is to create and activate a local virtual environment:
At this point you can install any of the three PyFluent API packages using the standard PIP procedure:
How to Use PyFluent
Once your environment is configured and the PyFluent API packages have been installed, you can create your Python scripts using the Fluent APIs in the same way you would use any other Python library, such as NumPy, TensorFlow, or Pandas. The PyFluent library module is open source, so you can fork the repository, build on it, distribute your own applications, or even share the code with Ansys.
You can also use Fluent functionalities in a Jupyter notebook — an open-source web application to create and share documents that contain live Python code, equations, text, and visualizations.
You can download a fully working Jupyter notebook for the mixing elbow simulation shown above or watch the step-by-step video.
What Do I Need to Use PyFluent?
You will need a valid license for the capabilities you are using in your Python scripts and Fluent 2022 R2 or later installed locally.