In this tutorial, you will know about the comparison between CAD, CAE & CFD, CFD codes (in brief) & meaning of CFD Application Engineer and CFD Developer. Also, you will come to know about what is mesher, solver and post-processor and finally how to choose a CFD software.

**Contents:**

- CAD, CAE & CAx
- CFD Developer vs CFD Application Engineer
- What is CFD Code?
- Parts of a CFD Code
- Writing a CFD Code
- How CFD Softwares Work?
- What is Mesher?
- What is Solver?

## CAD, CAE & CAx

With improvement of the computers, the improvement in the virtual analysis of various engineering phenomenon have taken place. Some of them are described below:

**CAD: ** Computer Aided Design (CAD) is basically a way to see or visualize the product idea. For example, if someone wants to build a new kind of screw, he can draw it on a paper, as side view, top view, front view and isometric view (which we know as Engineering Drawing) and then use that picture to manufacture the screw.

Or, he can take use of a CAD software, like Solidworks, CATIA etc. and draw a 3D model of that screw on the computer and then use that model to manufacture the product.

**CAE:** Computer Aided Engineering (CAE) is basically a way to analysis or test an already designed model.

- Continuing to the previous example, someone has modeled the screw using a CAD software, but he doesn’t know if that design can bear the required stress.
- Using CAE softwares, he/she can perform analysis on that screw and tell if that screw is eligible to get used in real life.
- CAE includes, Finite Element Analysis (FEA), Computational Fluid Dynamics (CFD), Multibody Dynamics (MBD), Durability analysis and Optimization. Hence yes, CFD comes under CAE. But, note that, CAD doesn’t come under CAE.

**CAx:** Computer Aided Technologies (CAx) includes Computer Aided Design (CAD), Computer Aided Engineering (CAE) & Computer Aided Manufacturing (CAM).

## CFD Developer vs CFD Application Engineer

The following table briefly describes the difference between a “CFD Developer” and a “CFD Application Engineer”.

Features | CFD Developers | CFD Application Engineer |
---|---|---|

Definition | CFD Developers are those who are interested in developing and modifying CFD codes either for themselves or commercially. | CFD Application Engineers are those who will use CFD code (which are already available) for the analysis of various engineering problems. |

Field of Work | They’re mostly researchers, either teaching at colleges or working in a RND of a company. | 90% of them are job holders, working in a government or non government sectors. |

Preferred Softwares | OpenFoam, MATLAB etc. | Ansys Fluent, SimScale, Comsol etc. |

Working Interface | Mostly Command User Interface (CUI). | Always Graphics User Interface (GUI). |

## What is CFD Code?

Understanding the formulation of a CFD code can be described in the following way:

**Step 1:**Suppose a person is writing a C, Java or a Python script, where he gives 2 input, a and b, and in return gets an output c.

c=a+ b^{e}**Step 2:**Upgrading to the previous coding script, a new script is written where, the input is a, x, n and the output is z.

z =lim_{x→∞}∫\(\frac{(x^a-n^a)}{x-n}\)dx**Step 3:**A n^{th}degree polynomial equation is scripted, where input is n, a_{n}, a_{n-1}, …, a_{0}and the output is x.

a_{n}x^{n}+a_{n-1}x^{n-1}+…+a_{0}=0**Step 4:**A differential equation is scripted, where the input is x, n and output is y.

\(\frac{dy}{dx}\)=y^{n}

Hence, if the level of equation is increased eventually to Navier-Stokes (NS) Equation, it will become a CFD code, which can solve any given problem.

## Parts of a CFD code

A CFD code consist of the following parts:

**Input Parameters:** This section holds the number of grid points in the domain, domain dimensions, initialization profile selection, and simulation time length.

**Time Discretization Section:** Time Discretization can be done in two ways:

**Runge-Kutta Method:**In Runge-Kutta method, the time stepping section forms a mostly independent section of the code.**Crank Nicholson Method:**In Crank Nicholson Method, there is a stronger coupling between the time and space discretization parts of the code.**Space Discretization Section:**Generation of grid is done in this section, using meshing codes.**Generation**– Grid divides the problem into smaller parts where the country be can be iterated continuously over time. Grid is also known as mesh.**Initialization Profiles:**In this step, initial conditions are declared to start the code program.**Boundary Conditions:**Boundary conditions are predefined while writing the code.**Discretization Methods:**There are various discretization schemes they start with very simple once such as central differencing scheme which requires two points and can end with complex schemes that use more than 15 grid points.**Output Section:**Arranging of results are done here. Normally this part doesn’t fall under CFD code (solver).

An example of grid is shown in the following diagram:

In the above figure, the problem is to find the effect of water flow on the pipe. Hence the system becomes the pipe. Now, gridding divides the whole pipe into many small parts (as shown in the figure), so that solving of NS equation becomes much easier.

## Writing a CFD code

An example of CFD code (as pseudo code) of a 1-D convection is written below:

## How CFD Software Works?

Following are the typical activities done during analysis of any problem using CFD:

- Creating a CAD model which will define shape and size of domain in which CFD equations will be solved (CAD Modeling)
- Discretizing the domain (Grid or Mesh Generation stage)
- Setup and solution of governing equations (Solver stage)
- Visualization and extraction of results (Post-Processing stage)

Combining all, the CFD process is called as “preprocessing, solution & post processing”. And this is the basic procedure on which a normal CFD Software works.

The following diagram describes what an average CFD Analysis looks like.

- In a CFD Analysis, after making the model, it is divided into small grids (Meshing Stage).
- After that, defining of the environment (or surroundings) and solving the NS equations are done for those small grids each at a time. (Solver Stage)
- Finally, results are taken and represented like above figure. (Post-Processing Image)

## What is Mesher?

When the gridding of the problem system is very complex, a dedicated software (or a piece of code) is needed for dividing the system into small parts. These softwares are called Mesher or Mesh Generation software.

- So, in short, a mesher does space discretization to the given problem system.
- Well known mesher softwares are Gmsh, ICEM, Gambit etc.
- nx=n
_{x}and ny=n_{y} - Lx and Ly are the lengths of the domain in the x and y directions, respectively.
- The index extents, imin, imax, jmin, and jmax, provide a quick way to access the first and last computational cells. The index extents do not start at 1 because cells are to be added outside the domain to enforce boundary conditions.
- The mesh sizes are precomputed to save computational cost. Additionally, dxi = 1/dx and dyi = 1/dy are also precomputed since divisions are significantly more computationally expensive than multiplications.

A MATLAB code is written below which describes how mesh is generated by coding:

Following are some important notes about the meshing code:

## What is Solver?

Solver is a software (or piece of code), which solves the problem using NS equations.

- The pseudo code of a 1D convection described before is an example of solver code.
- Example of some Solver softwares are ANSYS, OpenFOAM, SU2, Simcenter STAR-CCM+, Altair, SimScale etc.

## Key Points to Remember

Here is the list of key points we need to remember about “CFD Softwares”.

- CFD developers code to develop CFD softwares and CFD application engineers use that software to design and develop new things.
- CAD is used to model a real life object into computer. (For e.g. making a pencil in Solidworks)
- CAE is used to analyze the 3D model made using CAD technique.
- CAE consists of CFD, MBD, FEA, Optimization and Durability Analysis.
- CAM is used to manufacture the object modelled using CAD and analyzed using CAE.
- CAx is a broader term which consists of CAD, CAE & CAM.
- A CFD Software works in a 3 Stage process, where after modelling of the object using CAD; Meshing, Solver Stage and Post-Processing Stage occurs.
- For writing a CFD code, we first simplify the NS equation using Numerical Method, then we divide the CAD model into small grids and then apply that simplified equations to get result.

**If you find any mistake above, kindly email to [email protected]**