Ps9 Cfd Tutorial

34
Ansys ICEM CFD & CFX Tutorial Flow over Formula SAE Car Body Problem: In this tutorial you will be running a CFD simulation on the body of a Formula SAE racecar. CFD has become very important in motorsports because it provides a way to analyze how changes to a racecar’s body will affect the aerodynamic characteristics of the car without repeated trips to a wind tunnel. When air flows over the surface of a car, a boundary layer forms where there is a large velocity gradient. In order to capture this phenomena correctly, the mesh around the surface of the body must be very fine. To do this, a triangular surface mesh will be extruded 10 times to create a prism boundary layer of small elements. In this tutorial, each of you will be defining a different initial height for the first layer and a different height ratio. The height ratio controls how fast each prism layer increases in size. So if your initial height is X, the second extruded layer’s height will be X times the Height Ratio, the third will be X times the Height Ratio squared, etc. To perform this boundary layer study, you will be creating and solving two different meshes. All of the mesh parameters will be staying the same between the two meshes except for the boundary layer’s initial height and height ratio. The possible values for each are listed in the table below. Possible Boundary Heights and Height Ratios Height Height Ratio 0.00010 1.000 0.00025 1.025 0.00050 1.050 0.00075 1.075 0.00100 1.100 0.00125 1.125 0.00150 1.150

description

tutorial

Transcript of Ps9 Cfd Tutorial

Ansys ICEM CFD & CFX Tutorial

Flow over Formula SAE Car Body

Problem: In this tutorial you will be running a CFD simulation on the body of a Formula SAE racecar. CFD has become very important in motorsports because it provides a way to analyze how changes to a racecar’s body will affect the aerodynamic characteristics of the car without repeated trips to a wind tunnel.

When air flows over the surface of a car, a boundary layer forms where there is a large velocity gradient. In order to capture this phenomena correctly, the mesh around the surface of the body must be very fine. To do this, a triangular surface mesh will be extruded 10 times to create a prism boundary layer of small elements. In this tutorial, each of you will be defining a different initial height for the first layer and a different height ratio. The height ratio controls how fast each prism layer increases in size. So if your initial height is X, the second extruded layer’s height will be X times the Height Ratio, the third will be X times the Height Ratio squared, etc. To perform this boundary layer study, you will be creating and solving two different meshes. All of the mesh parameters will be staying the same between the two meshes except for the boundary layer’s initial height and height ratio. The possible values for each are listed in the table below.

Possible Boundary Heights and Height Ratios Height Height Ratio 0.00010 1.000 0.00025 1.025 0.00050 1.050 0.00075 1.075 0.00100 1.100 0.00125 1.125 0.00150 1.150

Tutorial Structure Pre-processing: 1. Import Geometry 2. Check Geometry 3. Apply Mesh Settings 4. Create Mesh Density Box 5. Mesh 6. Output to Ansys CFX 7. Import Mesh 8. Set up Boundary Conditions 9. Set up Fluid Properties 10. Change Solver Controls 11. Write Solver File Solution: 12. Adjust Solver Settings 13. Run Simulation Post-processing: 14. Calculate Aerodynamic Forces 15. Flow Visualization

Preprocessing Open Ansys ICEM CFD by double-clicking the icon on the desktop. Before starting the tutorial check that the product is setup correctly by selecting: Settings -> Product Under Product Setup “Default” should be selected. If it is not, select it and click Apply.

Be sure to save your project often. 1. Import Geometry Download the geometry file and save into a new folder on your desktop. Open Ansys ICEM CFD by double-clicking the icon on the desktop. Create a new project: File -> New Project… Select the folder you downloaded the geometry into name the new project “fsaeCar”.

Import the geometry by selecting: File -> Geometry -> Open Geometry… Select the geometry file you downloaded. You should be seeing a top view of the fluid domain consisting of a bounding box and a half model of the Car geometry. In the lower left hand window, there is a tree view where you can control what the program displays. Take a few minutes to get familiar with manipulating the view. You can control what type of geometry (Points, Curves, Surfaces) by selecting and deselecting the options under Geometry. You can also control what Parts are displayed by selecting and deselecting the options under Parts. 2. Check Geometry In order to mesh the geometry, the geometry must be “watertight”. This means that there are no gaps between surfaces. To check the geometry, click the Repair Geometry button under the Geometry tab on the top toolbar.

The Repair Geometry window should be displayed above the Model Tree View. To check the model, select the Build Diagnostic Topology button (it should be default selection when you first open the window). Set the Tolerance to “0.001” and click Apply.

There should now be a number of red lines in the display. Setup the display to only view Curves, and only select Body to be viewed.

Zoom in to the body so you can see the color of the curves better. Near the rear of the body, there are a couple of blue and yellow lines. Yellow lines mean that there is only one surface connected to that line. This indicated a gap in the geometry. If you turn on the Surfaces and zoom in to a yellow line, you should be able to see that the two surfaces are not joined. There are also a couple of blue lines, which mean there are more than two surfaces sharing that line.

For the geometry to be perfect there should only be Red lines. However, there are so few yellow and blue lines that we should be able to mesh the geometry anyways. 3. Apply Mesh Settings Now we need to apply mesh settings to each Part. For this analysis we will be using an Unstructured Tetrahedral Mesh with a Prism Boundary Layer. What this means for us is that we only need to decide how big we want the element size at the surface to be and the Meshing Program will fill in the rest of the mesh for us. Under the Mesh Tab click on the Part Mesh Setting button.

The Mesh Sizes for Parts window should appear. Here we can decide what the max element size we want on each surface to be. We can also input the prism boundary layer parameters for the Body. The parameters you will be changing are the Height and the Height Ratio. Make sure the Max Size for each part is correct and enter in your first set of values for the Height and Height Ratio options. The table should look like this.

Click Apply when you are done and then close the window. 4. Create Mesh Density Box Before we can mesh the geometry, we need to create a “Mesh Density Box” behind the body. As air flows over a car, there is a region of high turbulence directly behind the car which is called a wake. To properly model the wake behind a car, the mesh size has to be finer than in other areas. A “Mesh Density Box” is used to apply a Max Element Size to an arbitrary volume in the fluid domain. This will allow the CFD Solver to solve the problem correctly. In the Model Tree View, select to view only Points and only the GEOM part. Four points should now be displayed in the View window. We need to create four more points. To do this, click the Create Points button under the Geometry tab.

The Create Points menu should now appear. Click on the Base Point and Delta button. Enter 1 in the “DX” box. Then click the Select Locations button.

Click one of the four points and then press the middle mouse button (scroll wheel). A new point should display in the view window. Repeat this step for the remaining three points. When you are done, there should be a box of points behind the body.

Now under the Mesh tab, click the Create Mesh Density button.

The Create Density window should now be displayed. For name, enter “Density”. For size (max element size in density box), enter 0.1. For ratio, enter 1.3. Click the Select Locations button and select the 8 points. Click the middle mouse button (scroll wheel) to apply the selections, then click Apply.

An orange box should now be displayed behind the car. This is the region where the Max Element Size will be applied.

5. Mesh Now all of the Meshing settings have been entered and the geometry is ready to be meshed. Under the Mesh tab, click the Compute Mesh button.

The Compute Mesh window should now be displayed. Click the Volume Mesh Button. The only change you need to make to the defaults is to click the Create Prism Layer box.

Before proceeding, be sure to save your project. Once it is saved, click the Compute button. The program will now create the mesh. This will take approximately 15 minutes. When it is done meshing, it should display the surface mesh in the View Window. Record the number of elements and the number of nodes by selecting Info -> Mesh Info The information is displayed in the Output Box at the bottom of the GUI. Be sure to save your project. Next, save a new copy of the existing project by clicking File -> Save Project As… Name this new copy fsaeCarV2. In this project, you will create the second mesh you need. Close the existing mesh by clicking File -> Mesh -> Close Mesh… Click No when it asks you if you want to save the mesh. The mesh you created is already saved under your first project, so you do not need to save it again.

Click the Part Mesh Setup button again and change the values for the “Height” and “Height Ratio” options for the Body to your second set of values. Also, set the “Max Size” for the Body to 0.015 if it is blank. At this point you can compute the mesh the same way you did the first one. Be sure to save before and after, and also to record the number of nodes and elements of your new mesh. 6. Output to CFX At this point, you should have two different meshes saved under two different projects. To output the mesh to CFX, you first need to change the Product Setup. Select Settings -> Product In this window, select “ANSYS ICEM CFD – ANSYS Solvers Version” and click Apply. Now completely close out of Ansys ICEM CFD and restart the program.

The GUI should look slightly different. You basically do not have as many tabs at the top of the GUI. Open up your first mesh project.

Click the Output to CFX button under the Output tab.

Click Save. Then click Done and Done in the next two windows that pop up. This will output the mesh in a file format that ANSYS CFX can use. Open your second meshing project output the mesh to CFX. 7. Import Mesh We will now be switching over to a new program for the rest of the tutorial. The new program is called Ansys CFX. It consists of a Pre-processor, a Solver, and a Post-Processor. To open the program, select Start Menu -> All Programs -> Ansys 11.0 -> CFX -> Ansys CFX 11.0 The CFX Launcher will pop up on your screen. First, change the working directory to the folder on your desktop where your projects are saved. Once you have done this, click on the CFX-Pre 11.0 button to start the pre-processor. Start a new simulation by selecting File -> New Simulation… Click General and then click OK. This GUI is similar to ANSYS ICEM CFD. There is a viewing window where you see your part and a Simulation Tree Window where all of the information about your run is displayed. To import the mesh, right-click Mesh in the Tree Window and select Import Mesh.

In the window that pops up, change the “File Type” to “ICEM CFD”. Your two meshes should now be displayed in the view. Select one of them and click Open. Save your simulation. 8. Set up Boundary Conditions We will be using six different boundary types for this simulation: a. Inlet b. Outlet c. Symm d. Wall (Free Slip) e. Wall (No Slip) f. Wall (No Slip, Moving Boundary) a. Inlet To define the Inlet Boundary Condition, click Insert -> Boundary Condition Name the Boundary “Inlet” and Click OK.

The Boundary Definition window should now be displayed. For Boundary Type select “Inlet”. For Location select INLET.

Under the Boundary Details tabs, enter 13 m/s for the Normal Speed and click OK. b. Outlet Insert a new boundary condition, but this time name it “Outlet”. Select “Outlet” for the Boundary Type and “OUTLET” as the Location.

Under the Boundary Details tab, select “Average Static Pressure” for the Option and 0 Pa as the Relative Pressure. Click OK. c. Symm

Now we will define the Symmetry plane that is cutting the body model in half. Insert a new boundary condition and name it “Symmetry”. Select “Symmetry” as the Boundary Type and “Symm” as the Location. Click OK to apply the settings. d. Wall (Free Slip) For the ROOF and the WALL we will be applying a Free Slip Wall boundary condition. Insert a new boundary condition and name it “Wall”. Select “Wall” as the Boundary Type. For the Location option, click the “…” button and ctrl select “ROOF” and “WALL”, then click OK.

Under the Boundary Details tab, for Option select “Free Slip”.

Click OK to apply the settings. e. Wall (No Slip) The Body of the car will be a No Slip Wall Boundary Condition. This Boundary Condition sets the velocity of the fluid at 0 m/s on the wall of the Body. Insert a new boundary condition and name it “Body”. Select “Wall” as the Boundary Type and “BODY” as the location. Make sure “No Slip” is selected under the Boundary Details tab and click OK. f. Wall (No Slip, Moving Boundary) To simulate the car driving on a road, the GROUND part is going to be setup as a moving wall boundary condition. To do this, insert a new boundary and name it “Ground”. Select “Wall” as the Boundary Type and select “Ground” as the Location. Under the Boundary Details tab, make sure it is set as a “No Slip” boundary. Now, click the Wall Velocity check box. Set Wall U to 0 m/s, Wall V to 13 m/s, and Wall W to 0 m/s. Click OK.

9. Set up Fluid Properties Right click “Default Domain” and select Edit. In this window that appears, you can set up the material properties for the fluid. Under the General Options tab, select “Air at 25 C” from the Fluids List.

Under the Fluid Models tab, select “Shear Stress Transport” for the Turbulence Option.

Under the Initialisation tab, select the options shown below.

Click OK to apply the settings. 10. Change Solver Controls Double click “Solver Control” in the Simulation Tree View. Set the Timescale Factor to 10. Click OK.

The rest of the information in this window controls when the solver will think it has a convergent solution and will stop the analysis. Under Convergence Criteria, it has the Residual Target as 1e-4. The residuals are a measure of imbalance in the equations the Solver is solving from one iteration to the next. So when the RMS (root mean square) of the residuals of each equation gets below 1e-4, the solution will stop. The Max. Iterations option tells the Solver that if the residuals do not reach their target in 100 iterations, stop the analysis because it is not converging.

11. Write Solver File At this point the simulation is completely defined. To write the file the solver will read, right click “Solver” from the Tree View and select Write Solver File.

Name this file fsaeCarV1. Be sure that the drop down box in the upper right says “Write Solver File”. Click Save.

Now you need to make a solver file for your second mesh. To do this, right click your mesh file in the Tree View Window and click Delete Mesh.

Now, right click Mesh and select Import Mesh again. This time select your second mesh file. When you import the second mesh file, all of the settings and boundary conditions will be applied to it. So now all you have to do is write a new solver file the same way you did the first, but name it “fsaeCarV2”. Now that you have the two Solver Files, you can save and quit CFX-Pre.

Solution 12. Adjust Solver Settings Open up the solver by clicking the CFX-Solver 11.0 button. Before we run the simulations, there is one more parameter we need to change. Select Tools -> Edit Definition File… Open “fsaeCarV1.def” (or whatever you named your first definition file). Select “ADVECTION SCHEME” from the list.

Now select Edit -> Add Parameter From the drop down list, select “Blend Factor Relaxation” and enter 0.1 for the value. Click OK. Select Add Parameter again and this time choose “Gradient Relaxation” from the drop down. Enter 0.1 for this value as well. Now your window should look like this.

Save and Exit the window. Repeat the same steps for your second Solver File. 13. Run Simulation In CFX-Solver Manager, select File -> Define Run… For the Definition File, select your first Solver File. Click Start Run.

The solver will now start the CFD simulation. This will take approximately 1.5 hours, but may take as long as 2 hours. When the run completes, it will ask you if you want to Post-Process the results right away, select No. The monitor that is currently displayed shows the equation residuals vs. iterations. If all of the residuals are below the target of 1e-4, your simulation has converged. If the residuals are above the target of 1e-4 and the solver has gone through 100 iterations, the solution did not converge. Now we will check to see if the information we care about (the aerodynamic forces) has also converged. Select

Workspace -> New Monitor Name the monitor “Forces”. Select the Y (drag) and Z (lift) forces and click OK.

A plot of the forces on the Body vs. each iteration step is displayed. Right click in the plot area and select “Save As Image…”. You will need to turn this plot it. Now, select File -> Close Now you can start a new run with the second Solver file.

Post-processing For the post-processing, we will be using CFX-Post. Click on the CFX-Post 11.0 from the CFX Launcher. This program contains many valuable tools for analyzing the results. In this tutorial we will be calculating the exact aerodynamic forces on the body as well as using some of the plotting features to visualize the flow around the body. Load the results file by clicking File -> Load Results… Select your first solver file. 14. Calculate Aerodynamic Forces Click on the Tools tab and then double click the “Function Calculator” option. For Function, select “Force”. For Location select “Body”. To calculate the drag force, select “Global Y”. Click Calculate to find the drag force on the body.

Repeat this step for the “Global Z” to find the lift force. Record both of these values. Load your second results file and repeat the steps to find the lift and drag forces from the second mesh. 15. Flow Visualization We will be creating a pressure plot to visualize areas of high and low pressure on the car as well as a streamline plot to visualize some of the trailing vortices which make up the wake behind the car. a. Mirror Body First we need to reflect the body. Deselect “Wireframe” under “User Locations and Plots” from the Outline tab to remove the lines from the display. Now double click “Default Transform” to bring up the Default Transform window.

Deselect “Instancing Info From Domain” and select “Apply Reflection”. For Method select “YZ Plane”. Click Apply. b. Pressure Plot Select

Insert -> Contour from the menu bar. Name it “Body Pressure” and click OK. For Locations select “Body”. For Variable select “Pressure”. For Range select “Local” and click Apply.

Your body pressure plot should look like this

Select File -> Print Name your file “BodyPressure.png”, select “White Background” and click Print. This will save your current view as a .png file. c. Wake Visualization Deselect the “Body Pressure” plot from the Tree View so your screen is blank. Now select Insert -> Location -> Plane Name the plane VortPlane and click OK. Choose “ZX Plane” for Method. Under Plane Bounds select “Rectangular” with an X Size of 0.1 and a Z Size of 0.1.

Click Apply. Now select Insert -> Streamline Name it “Trailing Vortices”. For Start From, select the “VortPlane” you just created. For Direction, select “Forward and Backward”. Click Apply.

There should now be streamlines displayed in the view which travel under the body of the car and exit in the rear, creating some recirculation and trailing vortices. Set up the display so you can see the Body and the Streamlines. Rotate the view into a position you think shows the trailing vortices the best and print the screen to an image file. It should look something like this (since the streamline seed points are random, no two streamline plots will look exactly the same).