Ansys Fluent - Basic CFD Tutorial

Disclaimer: This tutorial introduces you to the basic steps of running CFD in Ansys. It does not explain in-depth about the choices and numerous features/variables that users can choose to optimize their simulation.

 

What is Ansys Fluent?

Ansys Fluent is a CFD software used for modelling fluid flow and heat transfer. It is extremely powerful due to its customizable and intuitive workspace. You can test all sorts of fluid flow ranging from air, water, oil, etc. It is installed with the Ansys workbench package.

 

In this page, we’ll walk through how we would conduct a CFD simulation for a UAV drone to determine it’s drag coefficient. While this type of modelling may not be very useful for quadcopters, it is much easier to model and hence it is a good introduction to Ansys Fluent.

 

Step 1: Creating a Project

Open up “Workbench”.

From the list of simulations on the left, double click on “Fluid Flow (Fluent)” which should open up a small window/schematic that you see in the white space. This essentially represents your “Project”. (You can hit CTRL + S to save your project right here if you want)

 

Step 2: Importing Model/Setting up a Geometry

The first step of running any simulation is setting up your model and orienting them.

Right click “Geometry” and click “New Design Modeler Geometry”.

  • There’s other Geometry applications as well to set up your model but this is the simplest and easiest to start off with.

 

To import our model: Go to File >> Import External Geometry File

Note: For some reason Ansys can only open STEP files so make sure to convert your SolidWorks file to a STEP file. Once that’s done, you can import the STEP.

In your Feature Tree, a feature called “Import1” will appear. Right click on this feature and select Generate (or while you have the feature selected, there is also another generate button on the top tab).

In this Design Modeler, almost everything has to be “Generated” (including sketches, extrudes, cuts, etc.).

Additional note: Expand the “2 Parts, 2 Bodies” feature and suppress the surface the duplicate drone that has a surface icon.

 

The next step is to create a boundary box. This is also known as a Computational Domain which is a region of space that is divided into grids/elements to solve the equations that are essential to analyzing fluid flow. A larger boundary box means more computational power/time is required to run your simulations.

To rotate your camera around the model, hold the scroll wheel or click on the XYZ vectors on the bottom right to select a view. Orient your view so that you are looking at the tip of the drone (not mandatory but this is easier for the sake of the tutorial).

 

Unlike SolidWorks, all of the sketching tools are located on the left. Play around with the “Draw”, “Modify”, “Dimensions, “Constraints” and “Settings” tabs to see the different things you can do.

To draw on a specific plane, click “Modelling” and select the appropriate plane feature by clicking on it once. Then go back to sketching and draw a rectangle that encloses the drone. Feel free to modify the dimensions a bit but make sure there’s some gap in all directions of the drone. To move your sketch, you can go to Modify >> Move.

In this case, we are sketching on the XY plane. Hit “Generate” once your sketch is done.

 

Now extrude your sketch to create a boundary box around the drone.

 

Feel free to copy the extrude options, but ensure that the drone is completely inside the boundary box. The general rule of thumb for the size of the boundary box is 3-10 times larger than the part that is inside.

 

The final step is to create a cavity in your boundary box using the solid model of the drone.

We can create a cavity by using the Boolean tool. Go to Create (top of the screen) >> Boolean

Copy the settings in the image above. For the target body, select the boundary box since that is the body in which we want to make a cavity in, and for the tool body select the drone body (you can just click on the drone body in the feature manager if you cannot see it inside the boundary box.

And of course, hit ‘Generate’ to actually make the cavity.

That’s it for setting up your model! Save the geometry file and minimize the tab.

 

Step 3: Generating a Mesh

 

What is a mesh?

  • In simulation, a mesh is a network formed by cells or points. It divides an object into sets of smaller elements which are used to solve calculus equations.

Solving these equations help us to understand how our part will behave under the influence of different conditions.

An important thing to add is that the more refined/high quality your mesh is, the more time it will take to run the simulation but also the more accurate your simulation would be.

 

 

Pull up the Workbench window again and right click Mesh and click on “Edit”.

 

Before we generate a mesh, it’s a good idea to name the faces of our boundary box which will be important later on.

Right click the front front face of the boundary box and select the Create Named Selection option. Name the front face “inlet_velocity” or something to help you identify that this face is where air will be coming from.

 

Now rotate your model and select the back face, create another named selection and name this face something like “pressure_outlet” (where air will be exiting from).

Essentially, the boundary box is like a wind tunnel!

 

The next step is to name the surface of the drone. Hide one of the faces by right clicking >> Hide Face(s).

Change your mouse select mode (where it says select) by clicking on the down arrow beside ‘Mode’ and choosing “Box Select”.

Select the surface of the drone you see inside the boundary box and create a named selection and name it “drone_surface” or something to help you identify that it’s the drone body. We will need this later to compute the frontal area for calculating the drag coefficient.

 

In the feature manager, click in the “Mesh” feature. This opens up a Details box where you can manipulate specific settings to change the size of your mesh, quality, and other settings which are kind of above the scope of this tutorial. We can work with the standard settings for now and just hit “Generate” or “Generate Mesh”.

 

Hit CTRL + S and that’s it for the mesh! There are so many details you can control, like adding additional meshes in one specific region only etc. Feel free to research these in more detail.

 

Step 4: Setting up the study and defining boundary conditions

 

What are “boundary conditions”?

  • In CFD, we have to define where the fluid is entering from, the flow rate/velocity, pressure, etc. These are called boundary conditions. In this step, we’ll define wind speed, direction, and setting up the variables that will help us compute the drag coefficient of the drone travelling at a particular drone.

 

Bring up the Workbench project space, and right click ‘Setup’ >> Edit which will open up a Fluent Launcher window.

 

Before we start defining our variable, let’s see how to change the unit of measurement.

Right click General >> Units

You can select the appropriate quantity and change its measurement unit. You can hit close after clicking on ‘km/h’ but make sure it is highlighted.

 

Next, expand the ‘Models’ tree and double click ‘Viscous’. For now, select k-epsilon but you can see that there are multiple models to simulate fluid flow.

Tick the ‘Gravity’ box and add the acceleration in the appropriate box depending on your coordinate system.

 

You can also select different material for the solid and fluid that you are studying by expanding the ‘Materials’ tree. For now, we can just select air for fluid, and aluminum as the solid body.

 

Expand the ‘Cell Zone Conditions’ and ensure that air is selected.

 

Next up, we have to define our boundary conditions (inlet velocity, pressure outlet…). Double click on ‘Boundary Conditions’ and select the surface through which air will enter (we named this ‘inlet_velocity’ earlier in the meshing step).

Select the inlet_velocity and change the type to ‘velocity-inlet’. This should open a small window where you can define the speed of the air. Here, the speed of air is relative to the drone, which means that defining the air velocity as 80 km/h is the same as saying that the drone is travelling at a velocity of 80 km/h. Hit ‘Apply’ and ‘Close’.

You can also open up ‘pressure_outlet’ to see what it looks like but we do not need to change its settings for now.

 

After we’ve setup our boundary conditions, the next step is to tell the simulation what we are trying to find. In this simulation, we want to find the coefficient of drag.

where Fd = drag force

ρ = fluid density

A = frontal area of the object (vehicle, drone, etc.)

V = velocity of the object relative to the fluid (AKA speed of the object)

The drag coefficient is given by the formula above. For Ansys to be able to compute this coefficient, we must provide it with these appropriate variables.

 

In Ansys, we must manually calculate the frontal area which is used to calculate drag coefficient. We input this value in the ‘Reference Values’ section.

 

To calculate the frontal area of the drone, scroll down in the ‘Outline View’ and double click reports. Then, double click ‘Projected Areas’ which opens up a small window.

Select the appropriate axis and surface. We already named the surface of the drone so just select that and press on compute. This should bring up a new line in the Console that’s at the bottom of the screen, CTRL + C the value that is output.

Go back to ‘Reference Values’ and CTRL + V the area value. Also make sure to change the velocity value to the speed of the drone.

Now we need to tell the simulation which force/data we need to keep track of. Go to Report Definitions and select ‘Drag’ as the force that we want to keep track of.

 

We also want to define which direction the drag force is applied. Once you click ‘Drag’, a window should open. Here, we can define the force direction in Force Vector. In this case, the drag force is applied in the -Z direction which is why -1 is entered in the Z box.

Select ‘Drag Coefficient’ as the Report Output Type, and ‘drone_surface’ for the zone.

Also select ‘Report File’, ‘Report Plot’, and ‘Print to Console’ to view the drag coefficient results in the console.

 

Next, go to ‘Initialization’ and click on the ‘Initialize’ box. Here, you can select the initialization method:

  • Hybrid initialization: provide a quick approximation of the flow field by solving Laplace’s equation to estimate a flow field and pressure field.

  • Standard initialization: sets all mesh cells to a single starting value and then the calculations refine the flow to a converged steady state solution.

The next step is to finally run your calculation. Go to ‘Run Calculation’. There are some settings here that you can adjust. The number of iterations is essentially how many times the simulation will run over to narrow down to a precise value for the drag coefficient.

Generally, the greater the number of iterations the more precise the simulation but it also increase the duration of the simulation. Hit ‘Calculate’ and wait until it finishes!

 

Once the calculations are done, all the results will be in the Results section. You can visualize air velocity, pressure on the drone body, etc. For example, follow these steps if you want to visualize the pressure on the drone_surface.

 

To view specific details like the drag coefficient, drag force, expand the ‘Reports’ tab >> Forces. This should open a new window where you select the direction of the force you are trying to obtain and which zone/body that force is acting on.

Once you hit print the system will output the drag coefficient in the console.

 

The overall drag coefficient (c.d.) is the value under Total.

The C.D. is very small in this case due to a small frontal cross-section area and the aerodynamic design of this drone. While this simulation maybe valid and usable for fixed wing drones, it is not the same case for modelling the aerodynamic behaviors of quadcopters which will be covered in a later tutorial.

 

If there are any typos/feedback/questions please ping @Smile Khatri on discord. Thanks for reading!

 

 

Extra resources to learn more:

Microsoft Word - ANSYS Fluent Tutorial Part 1.docx (clarkson.edu) (older version)

Microsoft Word - ANSYS Fluent Tutorial Part 2.docx (clarkson.edu) (older version)