# What is Computational Fluid Dynamics ?

Computational Fluid Dynamics is a tool widely used in design and analysis of equipments related to fluid flow and heat transfer. There are wide range of commercial softwares available in market for this purpose, which are user-friendly and using this you will be able to generate lot of colourful results. But in mean time it is also important to understand what is behind these CFD packages. This lecture is for that, to give you a basic understanding on CFD.

Detailed description of the video lecture is given below.

## Purpose of CFD

In the figure below you can see lot of colorful figures, which are output of some CFD simulations.
 Fig.1 Some flow problems solved using commercial CFD softwares
The million dollar question is what exactly CFD is searching for?. Assume the volume shown below is the domain where fluid flow occurs. Or this is the control volume.
 Fig.2 Control volume of a flow problem
In a CFD problem what I have to solve is velocity field and pressure field inside the control volume. More precisely we want to find out u, v, w and p throughout the domain. So it will be a function of x, y and z plus time, if the problem is unsteady in nature.

## Equations to solve the unknowns – Navier-Stokes Equations

If we can solve the unknowns u,v,w and p we are done with CFD. To solve 4 unknowns you have to have 4 equations. So next step is to derive these 4 equations. To formulate these equations we will use conservation principles on a small control volume. First principle is conservation of mass this will lead to one equation.

 Fig.3 Differential control volume considerred for derivation of conservative equations
Where you will say rate of increase of mass at a given point is mass flux in minus mass flux out. It can be represented in differential form like this.
Remaining 3 equations are derived from conservation of momentum, which is same as Newton’s 2nd law of motion. Since momentum is a vector quantity, there will be 3 components for it. It will generate 3 independent equations. It can be represented in differential form like this.
For each direction, there will be one equation. So in total you have got 4 equations. All these equations together known as the famous Navier-Stokes equations.

## How to Solve Navier-Stokes Equations

If you can solve N-S equations together you can find out the 4 unknowns. But there exists no analytical solution for Navier-Stokes equations. Because these are highly non linear coupled partial differential equations. The only way left is numerical method. Where instead of solving for general case, we will solve the problem for particular case at discrete points.

 Fig.4 Numerical Vs Actual solution
There are various mathematical techniques like FEM, FDM or FVM available for numerical solutions.

## Direct Numerical Simulation

If you solve N-S equations numerically that method is known as DNS. A highly accurate method, results of DNS are even more accurate than experimental results. But if you try to solve a practical flow problem using DNS even the most powerful computer will take years. So DNS is used only as a research method. We can apply this method only when flow is very basic. We will see how to solve N-S equations for practical flow problems in a separate article.

# Computational Fluid Dynamics | RANS & FVM

In this video we will learn how to solve the complex Navier-Stokes equations, within power bound of your PC. Here concepts of RANS and FVM are introduced in a logical manner.

Detailed description of video lecture is given below.

## Actual Vs Averaged Solution

As we discussed in previous article, exact solution of N-S equations is too much of accuracy.It captures every minute details of turbulent flow. But an engineer is not interested in such a solution, what he needs is an averaged solution as shown below.This is in fact averaged solution of actual solution.

 Fig.1 Actual Vs Averaged solution
Any variable in a turbulent flow can be represented as sum of mean value and fluctuating value. An example is given below for variable u.
Where averaged quantity is found out using following operation.
Here time interval of integration should be carefully selected. It should be small enough to capture any unsteadiness in flow, at the same time it should be big enough to smooth out fluctuations due to turbulence. A pictorial representation of averaging operation is shown below.
 Fig.2 Averaging operation done on a turbulent flow

## How to obtain averaged solutions ?

To obtain this averaged values, instead of solving actual N-S equations we can solve something called, averaged N-S equations. Navier Stokes equations generated after averaging operation is known as, Reynolds averaged Navier Stokes equations.

 Fig.3 Conversion of Navier-Stokes equations to Reynods Averaged N-S equations using averaging operation
The averaged equations are represented here in index notation form. Here F represents external force acting on fluid.

## Reynolds Stress - Turbulence Modeling

But RANS is not purely in terms of mean values. The last term of RANS is in terms of fluctuating components. This term is known as Reynolds stress.

There are various turbulence models available in order to represent, Reynolds stress in terms of mean quantities. Selection of proper turbulence model is one of the most important step in a CFD project.

## Solving RANS numerically

RANS is not so difficult to solve numerically. Current CFD packages use mainly 3 numerical methods. They are FEM, FDM and FVM. Some commercial packages using these methods are listed here.

 Fig.4 Different numerical schemes used in CFD and some commercial CFD packages using them
It is clear that FVM (Finite Volume Method) is the most common method of all. So in this article we will concentrate only on FVM.

## Finite Volume Method

The fundamental flow equations are derived in FVM, using integral approach. Here instead of considering a differential volume we will consider a finite volume of arbitrary shape. And we will say that when flow passes through it, rate of increase of quantity inside the volume will be same as flux in minus flux out, plus generation of quantity.

 Fig.5 Basic philosophy of FVM : Conservation of quantity
You can apply this to any quantity. Quantity can be either mass or momentum component. Such a concept will lead to conservative equations in integral form. It will have general form like this.
Where U represents quantity. So we can apply this general form to mass, so U will be density in to velocity. It will lead to conservation of mass equation. Similarly we can apply it for 3 components of momentum. We will get 3 more equations, which are conservation of momentum equations. So again we have 4 equations in total. This time in integral form.

## Meshing

Now the challenge is to solve these equations throughout the control volume numerically. Here there are surface and volume integrals. We will execute numerical integration of these equations on small non overlapping cell volumes, of arbitrary shape. So before executing numerical integration, actual control volume is split into small cells, as shown below.

 Fig.6 Conversion of Control volume in to small non-overlapping cells : Meshing
This process is known as meshing. There are various meshing schemes available in CFD.

## Solution

Now we need to execute surface and volume integrals on these cells. Such a cell is shown here. The method of surface and volume integrals are also shown pictorially.

 Fig.7 Numerical approximation of volume and surface integrals in FVM
In FVM volume integrals are approximated as volume of cell multiplied by average value of quantity at centroid of cell. Similarly surface integrals are approximated as midpoint averaged values. So for this cell we have to do same operation on all four surfaces. Now we can apply same operation throughout the cells. This will generate series of equations in terms of averaged values. We can solve them together, with help of some boundary condition. An appropriate mathematical solver will do this task for you. Usually CFD solvers use iterative method to get the solution.

## CFD at a Glance

The steps we have explained so far are summarized here in step by step manner.

 Fig.8 Step by step CFD procedure
Before winding up the lecture, we will also see a sample CFD problem.
 Fig.9 A sample CFD problem

## How to build a career in CFD?

Hope you got a good introduction to CFD from here. Now its time to get hands on experience on CFD packages. Most used CFD packages in industry and its relevance are given below.

• ICEM CFD - A perfect software to do meshing
• Gambit - Another meshing software, but has become obsolete nowadays
• Fluent - Most preferred CFD solver in industry
• CFX - Another good solver
• Icepak - Electronics thermal management

Now it is clear from range of CFD packages available in market that, it is not possible to learn all of them at a stretch. So first thing you have to do is to find out your area of interest and select a good CFD package which will suit your need. You will be able to produce colorful results from CFD, but the real challenge is in understanding physics behind the problem ( make sure you are good in fluid mechanics and mathematics ). Please keep in mind that most of the time CFD produces rubbish results. Reasons might be poor quality of mesh, wrong physics used in CFD solver, wrong solver selected or wrong boundary condition applied. So it is imperative to spend lot of hours running simulation and analyzing results of simulation in order to become a good CFD engineer.