Learn how to control all steps of your stirred tank simulations directly in Python with PyFluent.
When it comes to modeling multiphase stirred tank systems, engineers are often faced with many operating
parameters that influence hydrodynamics, mixing, and mass transfer. Traditional CFD workflows can make systematic studies of these parameters tedious, requiring extensive manual setup and case management.
PyFluent — a Pythonic interface to ANSYS Fluent that allows users to automate, control, and extend CFD simulations programmatically. One particularly powerful feature is the ability to design and execute parametric studies, helping engineers quickly explore how different operating conditions affect performance.
The model considered here is a stirred tank reactor with:
Two Eulerian phases:
Primary: liquid water
Secondary: dispersed gas bubbles (fixed size)
Mass transfer between phases: O₂ and CO₂ are transferred between the gas bubbles and the surrounding water, allowing for realistic modeling of oxygenation and carbonation/degasification processes.
Moving reference frame (MRF) to represent the mechanical stirring, giving control over the impeller’s rotation speed.
In practice, process performance depends heavily on design and operating conditions. For example:
Impeller rotation speed affects turbulence levels, bubble breakup and dispersion, and gas–liquid contact time.
Gas injection velocity influences gas holdup, bubble residence time, and the rate of oxygen dissolution or CO₂ stripping.
Exploring these parameters systematically allows us to understand trade-offs between mixing energy, gas transfer efficiency, and operating costs.
Using PyFluent, we can script a study where rotation speed and gas injection velocity are varied automatically. The workflow typically includes:
1. Base Model Setup
Geometry and mesh are defined in Fluent.
Multiphase (Eulerian–Eulerian) and species mass transfer models are activated.
Bubble diameter is fixed, while O₂ and CO₂ transfer coefficients are assigned.
2. Looped Case Execution
For each combination of rotation speed and gas velocity, PyFluent modifies boundary conditions and solver settings, runs the simulation, and records results. In this portion of the code, we apply a full factorial approach by looping through the different parameters and applying them to the boundary conditions and moving reference zone:
3. Post-Processing Automation
PyFluent extracts key quantities like dissolved oxygen concentration, dissipation, torque and strain rates.
Rotation Speed: Higher impeller speeds improved gas dispersion and increased O₂ transfer, but at the cost of higher energy input.
Gas Injection Velocity: Increasing the gas flow enhanced O₂ availability but led to bubble coalescence at very high velocities, reducing mass transfer efficiency.
The average values of torque on the impeller walls, dissipation rate and strain rate are plotted below:
Parametric studies, design of experiments and optimization routines can be reduced to a few dozen lines of Python code, while also taking advantage of both Fluent and Python's visualization and data analysis tools. PyFluent’s capability streamlines:
Setup and execution of multiple cases
Consistent boundary condition management
Automated data extraction and visualization
Rapid design space exploration
This enables engineers and researchers to focus on efficiently interpreting results. Details about the simulation setup are shown in this video:
Parametric studies in PyFluent empower engineers to explore “what if?” scenarios in multiphase stirred tanks — whether it’s testing different stirring intensities, gas flow rates, or bubble sizes. By combining CFD’s physics fidelity with Python’s automation power, PyFluent opens the door to efficient, reproducible, and scalable design exploration.
For engineers working with bioreactors, fermenters, or chemical stirred tanks, this approach provides a clear pathway to optimize process efficiency while reducing the manual workload of CFD simulations.
Ozen Engineering Inc. leverages its extensive consulting expertise in CFD, FEA, optics, photonics, and electromagnetic simulations to achieve exceptional results across various engineering projects, addressing complex challenges like multiphase flows, erosion modeling, and channel flows using Ansys software.
We offer support, mentoring, and consulting services to enhance the performance and reliability of your systems. Trust our proven track record to accelerate projects, optimize performance, and deliver high-quality, cost-effective results for both new and existing water control systems. For more information, please visit https://ozeninc.com.
Getting Started with Ansys FreeFlow: Modeling a Stirred Tank [Link]
Simulation of metal sintering process using DEM [Link]
An overview about Mixing Processes using ANSYS CFD and Rocky-DEM [Link]
BioPharma and Downstream Process Simulation using ANSYS [Link]
Creating a Reduced Order Model for Vortex Prediction in Stirred Tank [Link]
Modeling Bubble Dynamics in a Stirred Tank Reactor Using ANSYS Fluent and Population Balance Model [Link]
Simulation of Steady Vortex in a Stirred Tank using Ansys Fluent Software Parametric Workflow [Link]
Simulation Best Practices for Mixing Equipment Webinar [Link]
Cyclone Separator CFD Analysis [Link]