CFD analysis is one of the most important skills one should learn if you are aspiring to be a good Mechanical or Aerospace engineer. Computational fluid dynamics (CFD) is a branch of fluid mechanics that uses numerical analysis and data structures to analyze and solve problems that involve fluid flows. Computers are used to perform the calculations required to simulate the free-stream flow of the fluid, and the interaction of the fluid (liquids and gases) with surfaces defined by boundary conditions. With high-speed supercomputers, better solutions can be achieved, and are often required to solve the largest and most complex problems.
So why do we really need CFD? The answer is the use of computers is highly welcomed in any field as they make our job easier and faster. The same thing applies for fluid problems. Imagine you have a problem to find out the best airfoil to use for a wing. For this, you can test different physical models in wind tunnel and calculate the data of lift and drag coefficients at different angle of attack and then analyze the data. Creating different physical models and doing the test will be time consuming.
Now imagine having a computer with a CFD software installed in it and you can design a CAD model for different airfoil shapes you want to test. You can now use CFD tools to obtain approximate solutions for lift and drag coefficients much faster. Notice that CFD gives approximate solution not exact. Engineering is mostly about making approximations and the one who approximates better is a good engineer.
Different CFD tools have been developed for simple to complex fluid flow problems. There are several licensed commercial software as well as open source applications like ANSYS, OpenFoam, PowerFlow, Simscale, Comsol Multiphysics, Autodesk CFD and the list goes on. Now the question may arise on which one to use and which is the best? You have to take many factors like accuracy, availability, user interface, cost, etc in consideration to know the answer. Right now I don’t even have a rigid answer to that question since I have not used all of them yet. I also hope I can get some answers in the comment section.
How does it work?
Learning CFD is not just about learning how to use a particular CFD software. A good engineer should also try to learn about what is going on inside the software and how it works to solve any kind of fluid flow problems. There are some steps involved as follows:
1. Physical Model of the Problem:
Firstly the user should identify the problem and create a physical or geometric model of the problem. In every CFD software, one must always input a geometric model of the problem. For an example, if u have to analyze the flow over cylinder using ANSYS fluent, you can input the geometric model as shown below:
2. Mathematical Model:
Now the physical model should be converted to a mathematical model. Mathematical model of any problem comprises of two parts: governing equations and boundary conditions. Now remember all those equations for conservation of mass, momentum, energy in different forms that you studied in Fluid Dynamics or Aerodynamics. Such equations are used as the governing equations in mathematical model. The best thing about using computers is you don’t have to worry about writing down these boring equations again. They are already coded into the software.
The same governing equations of fluid flow are used for all the problems. Does that mean all problems have same mathematical model? The answer is no because there is another part in mathematical model called boundary conditions. Notice that to solve any differential equations as show above, some boundary conditions are need to be provided. For an example; if u are studying flow inside a pipe or any channel then your boundary conditions might be inlet velocity, outlet pressure, wall properties etc. Therefore, both governing equations and boundary conditions form a mathematical model,
Boundary conditions differ according to the physical model provided by the user. Hence, there is always a unique mathematical model for a unique physical model or problem.
3. Numerical Calculation and Solution:
Now you have a mathematical model which is the combination of equations along with boundary conditions, You must know that finding the exact solution of such equations is going to be intensive if the physical model is complex like real-life problems. Hence, CFD uses Finite Volume Method(FVM) to calculate approximate solutions to the problem.
Now what is FVM? Finite Volume Method is an approximation technique where the physical model is divided into infinitesimal finite volume elements. These finite volume elements is called mesh and the process of creating such mesh while calculating approximate boundary conditions for all the meshes based on initial boundary condition provided by the user is called Meshing. Meshing is one of the most important process in CFD because better mesh always generates better solution. Figure below shows a simple example of meshing;
Also note that higher the number of meshes, more accurate the solution will be. However, having large number of meshes will make the solution time-consuming and might require a powerful computer. An experienced CFD user has the ability to select right size of mesh for a particular problem. In this way, Finite volume method is used to calculate the approximate values of fluid variables like velocity, pressure, temperature, etc. in every mesh. This is the reason why smaller and large amount of meshes are used in the major areas of study. For example: mesh size is smaller around the cylinder in the figure above because analyzing the flow over cylinder is our major concern.
Also check out steps involved in finite element analysis here ; https://www.geniuserc.com/finite-element-method-introduction-and-steps-of-finite-element-analysis/
Here the numerical solutions obtained are interpreted to the user in different forms like plot, graphs, contours histograms, animations and so on. This is the final step in CFD analysis. For the problem of flow over cylinder the results can be obtained in the form of pressure contours and velocity streamlines as shown below:
To sum up, CFD analysis is a powerful skill one can learn as a Mechanical or Aerospace engineer. This post doesn’t shows you how to do a CFD analysis of a problem but gives you an overall idea about what CFD is and how it actually works. I hope you got the basic ideas about CFD analysis from this post. Feel free to give your views in the comments.
Do follow this Wikipedia link to know more about CFD; https://en.wikipedia.org/wiki/Computational_fluid_dynamics