## Thursday, August 16, 2012

### Fluid Flow Everywhere - Why not visualize them, on computers?

There is fluid all around us (planet earth, for sure :)). We experience it within ourselves and in any system that mankind has ever built. Understanding the flow pattern in a system can be crucial for feasibility studies. In the world of simulations, we call it Computational Fluid Dynamics (CFD). A lot of real world problems cannot be solved analytically because of the complexity of the flow. Plus, a solution may not exist.
CFD uses discretization methods to break down the Navier-Stokes equation (which is the momentum equation of fluid flow) into algebraic equations which can then be solved using various numerical schemes. The same is true for other fluid flow equations. The accuracy of the solution thus would depend on the mesh size. Smaller the mesh, more accurate are the results. However, the computational time is more. There is an optimal limit where you can satisfy both these conditions. It depends on what you are looking for (in terms of results). For most applications you can get away with coarse mesh in the far field and refine the mesh close to the boundary of the system. However, there is no one size that fits all. Only through experience and rigorous testing (or sensitivity analysis), a user can understand the effect of mesh on the results. Lot of computational codes use "Finite Volume" approach these days. There are other ways to model them as well like -finite element approach, finite difference and spectral element method. Some codes do not even use CFD at all but rather treat fluid as a collection of molecules.
We will focus on the finite volume approach which is used in ANSYS Fluent and CFX. The method is based on "marching" the solution in space and time in forward direction. All the variables are solved for in the "control volume" (mesh element) and passed on to the neighboring cell.

The simulation is run for user specified "iterations" and stopped when either the residual error is below the specified threshold or when the number of computational iterations is equal to what the user specified. Care must be taken to make sure the run is not stopped before it really has "converged".
ANSYS Fluent and CFX offer users with tons of capabilities. However, as the saying goes - "with power comes responsibility" is applicable in using these softwares as well. Users must be careful in applying the right boundary conditions, choosing the right physics model and applying the right mesh settings. The user will always be able to get results but whether it's junk or useful depends on various parameters. One way to test this is by comparing the results with experimental data or using engineering judgement. Sensitivity analysis can also help the user to understand how different variables affect the final result.

 Swirl flow within a valve
May the fluid force be with you!!