Fluent - Flow over a 2-D Airfoil

Introduction and Instructions:

In this document is a procedure that enables students to solve a 2-D airfoil flow problem with the CFD program, Fluent. Readers should already be familiar with the notation used in this module, as described in the learning module, Fluent and Gambit - Introduction and General Information.

Note: This set of instructions assumes that the student has already run the Gambit program, and has generated a grid for the airfoil. (See the learning module, Gambit - Generation of Grid for a 2-D Airfoil.) The file airfoil.msh is assumed to exist on the student's Fluent directory on the SGI cluster.

Log on and launch Fluent:

  1. Log onto one of the SGI cluster computers. If you have just completed the Gambit learning module for generating the grid, you should already be logged in, and your working directory should be Fluent. In that case, skip to step 5 below.
  2. Create a Unix shell: Desktop-Unix shell.
  3. Enter "set path = (/disk03/local/Fluent.Inc/bin $path)" to give you access to the Fluent programs. Note: This line should be added to your .cshrc file so that you won't have to add it manually every time you log in.
  4. From your main directory, enter "cd Fluent" to change the working directory to Fluent. (Note: It is assumed that the grid file resides in the Fluent subdirectory.)
  5. Enter "fluent 2d &". After a few seconds, the main Fluent window should appear on your screen.

Read the grid points and geometry of the airfoil flow domain:

  1. Select File-Read-Case. In Select File, select airfoil.msh from the lisitng of available files shown on the right side. OK. Fluent will read in the grid geometry and mesh that was previously created by Gambit. Some information is displayed on the main screen. If all went well, it should give no errors, and the word Done should appear.
  2. Verify the integrity of the grid: Grid-Check. Look for any error messages that indicate a problem with the grid. If the grid is not valid, you will have to return to Gambit and regenerate the grid.
  3. Look at the grid: Display-Grid-Display. A new window opens up showing the grid. If this window is too big, rescale it by dragging the edges of the window. It is best if the graphical display window is small enough that both it and the Fluent window are both visible simultaneously. The Fluent window and/or the graphical display window may need to be moved to accomplish this.
  4. The graphical display can be zoomed-in or zoomed-out with the middle mouse button. If you start on the upper left and draw a rectangle with the middle mouse button towards the lower right, the display will zoom in on what is included in the rectangle. Meanwhile, the left mouse button can be used to drag the image to a new location. If you draw a rectangle backwards with the middle mouse button, i.e. from the lower right to the upper left, it will zoom out. Play with this feature until your domain is shown nicely in the window. Close the Grid Display window; the display itself will remain.

Define the boundary conditions:

  1. Now the boundary conditions need to be specified. In Gambit, the boundary conditions were declared, i.e. wall, velocity inlet, etc., but actual values for inlet velocity, etc. were never defined. This must be done in Fluent. In Fluent, Define-Boundary Conditions, and a new Boundary Conditions window will pop up.
  2. In Boundary Conditions, select inlet, which is the left side of the computational domain. Set.
  3. In Velocity Inlet, change Velocity Specification Method to Magnitude and Direction. Change Velocity Magnitude to 5 m/s. Change X-component of Flow Direction to the cosine of your angle of attack. Set Y-component of Flow Direction to the sine of your angle of attack. OK.
  4. The fluid needs to be defined. In Boundary Conditions, select fluid, and Set. The default fluid is air, which is the fluid we desire in this problem. Select air as the Material Name in the Fluid window, and OK.
  5. From the main Fluent window, Define-Materials. Air should be the default material name. Write down the density and viscosity on a piece of paper (these will be needed later on). Close the Materials window.
  6. Return to the Boundary Conditions window. At this point it may be hidden under the Fluent window, so some moving around may be required. Alternately, from Fluent, Define-Boundary Conditions to re-show the window. The default boundary conditions for the airfoil (wall) and the outlet (pressure outlet) are okay, so nothing needs done to those. It is a good idea to verify them, however.
  7. Likewise, top-and-bottom, and verify that the top and bottom edges are periodic.
  8. Finally, Close the Boundary Conditions window.

Set up some parameters and initialize:

  1. In Fluent, Solve-Initialize-Initialize. The default initial values of velocity and gage pressure are all zero. The convergence can be sped up slightly be giving more realistic values of the initial velocity distribution. In our problem, the velocity will be that of the uniform stream over most of the flowfield. So, it is wise to enter the x and y components of the freestream velocity here (these will depend on your assigned angle of attack). Apply, Init and Close.
  2. Back in Fluent, Define-Models-Viscous. Laminar flow is the default, so we really don't need to do anything here. Later on, however, we will try turbulent flow calculations; this is where the turbulence models are specified in Fluent. OK.
  3. Now the convergence criteria need to be set. As the code iterates, "residuals" are calculated for each flow equation. These residuals represent a kind of average error in the solution - the smaller the residual, the more converged the solution. In the main window, Solve-Monitors-Residual. In Residual Monitors, turn on Plot in the Options portion of the window. The Print option should already be on by default. Here, Print refers to text printed in Fluent, and Plot causes the code to plot the residuals on the screen while the code is iterating.
  4. Since there are three differential equations to be solved in a two-D incompressible laminar flow problem, there are three residuals to be monitored for convergence: continuity, x-velocity, and y-velocity. The default convergence criteria are 0.001 for all three of these. Experience has shown that this value is generally not low enough for proper convergence. Click on each 0.001 individually, and change it to 0.00001 (which will display as 1.E-05) on the window that pops up, each time clicking OK to set it. When all three are set, OK to exit the Residual Monitors window. Finally, the code is ready to iterate!

Save your case information:

  1. In Fluent, File-Write-Case. In Select File, the default file name should be airfoil.cas.
  2. To save disk space, it is wise to check the Write Binary Files option. To really save disk space, change the file name to "airfoil.cas.gz". On a Unix system, the ".gz" file extension automatically compresses the file.
  3. Click OK to write the file onto your directory. The case file will record the grid plus all boundary conditions and other specified parameters.

Iterate towards a solution:

  1. Solve-Iterate to open up the Iterate window. Change Number of Iterations to 50, and Iterate. The main screen will list the residuals after every iteration, while the graphics display window will plot the residuals as a function of iteration number. You should see an overall drop in the residuals, although it is normal for them to rise occasionally as the code attempts to zero in on a solution.
  2. At the end of 50 iterations, check to see how the solution is progressing. In Fluent, Display-Velocity Vectors-Display. The graphical display window will show the velocity vectors. Zoom in with the middle mouse, as described above, to view the velocity field in more detail if desired. In Velocity Vectors, adjust Scale as needed to make the velocity vectors clearly visible. The Vector Options button gives you control over the appearance of the arrows. Adjust the arrows as desired to get a nice-looking vector plot
  3. Iterate some more - (To restart the iteration, either find the Iterate window, which is probably hidden under some other windows at this point, or in Fluent, Solve-Iterate to re-open the Iterate window.) In Iterate, Change Number of Iterations to 100, change Reporting Interval to 10 since there is no need to display every iteration, and Iterate. Check the velocity vectors, as described above after every 100 iterations. It is wise to move the Iterate window someplace out of the way of the other windows so you can easily restart the iteration. After a while the residuals should level off. If the residuals all go below the convergence criteria, the calculations will stop. In most cases, however, the residuals reach a lower limit, and further iterations don't improve the solution. Do not do more than about 300 iterations.

Save your data:

  1. In Fluent, File-Write-Case & Data.
  2. Click OK to write the file onto your directory. Note that Case & Data refers to both the case (the grid plus all boundary conditions and other specified parameters) and the data (the velocity and pressure fields calculated by the code). The code will actually write out two files, airfoil.cas (or airfoil.cas.gz) and airfoil.dat (or airfoil.dat.gz). It is OK to overwrite the file.
  3. Every so often, save your data in case of a crash or a user error.

Refine the grid:

Note: In this particular problem, the grid is already very well refined near the airfoil wall. Depending on your angle of attack, grid adaption may not help. In some cases, it even makes the convergence worse.

  1. The grid may not be well-enough resolved near the wall, especially for cases with high angle of attack, in which there is flow separation. Fortunately, Fluent has an "Adapt" feature that automatically adds grid points where needed for better resolution. There are several options for grid adaptation - we shall adapt by velocity gradient.
  2. In Fluent, Adapt-Gradient. In Gradient Adaption, change Gradients of to Velocity.
  3. Select the Compute option. Minimum and maximum velocity gradients will appear in the window.
  4. As a good rule of thumb, set the Refine Threshold to about 1/10 of the maximum gradient, and the Coarsen Threshold to about 1/1000 of the Refine Threshold. Enter these values in the appropriate text boxes.
  5. Now Mark. The main Fluent window will display how many cells have been selected for refining and coarsening. The coarsening cells can be ignored since Fluent is unable to coarsen the original grid - it can only refine the original grid.
  6. Optional: If you want to see where the grid will be adapted, Manage-Display. Areas destined for grid refinement will be highlighted.
  7. Back in the Gradient Adaption window, Adapt. You will be prompted about hanging-node mode. Answer Yes to continue. The main Fluent window will display some information about the grid adaptation.
  8. Optional: To see what the refined grid looks like, you can select Display-Grid-Display from the main Fluent window, and zoom in close to the wall. You should see some new cells near the wall where velocity gradients are highest.
  9. The Gradient Adaption window can be closed at this point. Or, better yet - move it somewhere on the screen where it can be accessed again, since we will need it again later.

Iterate some more:

  1. If the Iterate window is still visible, go to it. If not, Solve-Iterate from the main Fluent window to re-open the Iterate window. Change Number of Iterations to about 200, keep the Reporting Interval at 10, Apply, and Iterate. It is normal for the residuals to jump up considerably immediately after a grid adaption, but they should soon go down again, hopefully lower than before the adaption.
  2. At the end of these iterations, check to see how the solution is progressing. In the main Fluent window, Display-Velocity Vectors-Display. The graphical display window will show the velocity vectors.
  3. It is wise at this point to save your case and data files again in case further adaption causes problems.
  4. If the residuals have leveled off or reached an oscillatory state, you may wish to adapt again. In Gradient Adaption, Compute again, and re-adjust Refine Threshold and Coarsen Threshold as described above. Mark and Adapt.
  5. Iterate some more, and adapt some more as necessary until the solution converges. Be careful that you don't adapt too much or you may reach memory limitations on the machine. Save the case and data files regularly in case something goes wrong.

Monitor the lift coefficient:

  1. A nice feature in Fluent is that certain results can be monitored as the solution progresses. Here we will set things up so that the lift coefficient is displayed on the screen and plotted in a graphics window as the iterations progress. Report-Reference Values.
  2. In Reference Values, type in the correct values of Area (the area here is actually area per unit depth, which is the chord length of the airfoil), Length (the chord length of the airfoil), and Velocity (the freestream velocity magnitude which was assigned as the velocity inlet boundary condition). The values of density and viscosity should be those of our working fluid by default.
  3. Hit OK to apply the reference values and to exit the Reference Values window. With these reference values, the lift coefficient should be calculated correctly.
  4. Now set up to monitor the lift coefficient: Solve-Monitors-Force.
  5. In the Force Monitors window, make sure the airfoil wall is highlighted, turn on Plot and Print, change Coefficient to Lift, and enter the appropriate components of the Force Vector such that the force being calculated is the lift (lift is defined as perpendicular to the freestream velocity vector).

Other options to help convergence:

  1. If the solution still seems to not want to converge, there are other options you can try. One option is to reduce the under-relaxation ratios of the variables which are not converging. For example, if continuity is not converging, the under-relaxation ratio for pressure should be reduced. Solve-Controls-Solution.
  2. In Solution Controls, try lowering the Under-Relaxation Factor for the appropriate variable by about a factor of two. You may try lowering the other under-relaxation factors as well, but not as much. OK to apply your changes.
  3. If lower under-relaxation factors seem to help, lower them some more. Low factors can sometimes help convergence in cases where there is flow separation, but the separation point is not well defined, such as on a rounded surface as in this problem. Fluent may oscillate between solutions as the separation point moves around.
  4. Another option in Solution Controls is to change the Discretization scheme for Pressure and Momentum to Second Order and Second Order Upwind, respectively. You can also try changing Pressure-Velocity Coupling to SIMPLEC. By the way, with the Help button, you can read more about these options and when they apply. OK to apply your changes.

Generate and print the velocity vector field near the airfoil:

  1. After the solution has converged adequately, some final results will be documented. The first of these is a plot of the velocity vectors. In Fluent, Display-Velocity Vectors-Display. Zoom in so that the flow is visible around the entire airfoil, plus some of the surrounding fluid. Adjust the scale as necessary to get a nice-looking plot.
  2. Add your name and angle of attack to the label at the bottom of the plot. To do this, simply click with the left mouse button just below the title at the bottom of the graphical display. A cursor will appear, where you can start typing. I suggest "A. B. Lastname, Alpha = xx degrees" as your additional label, where you substitute your name and angle of attack, of course.
  3. In Fluent, File-Hardcopy. The default graphics display window on the screen shows plots with a black background and colored objects (foreground). If your graphics display window has a black background, make sure that Reverse Foreground/Background is turned on, otherwise the printout will be white on black rather than black on white. Change Coloring to Monochrome, since the printer is only black and white.
  4. Optional: The default resolution of the hardcopy printout is set to 75 DPI. This resolution can be improved (150 DPI is recommended - do not exceed 300 DPI).
  5. Optional: At this point, if you want to preview the hardcopy, Preview. You should see a reversed image, i.e. white background with dark objects, which is the desired case for hardcopy printouts. A prompt will appear asking if you want to reset the graphics window; Yes, i.e. do reset the graphics window (to return it to its original form with the black background).
  6. Caution: Sometimes, and I don't know why, the graphical display does not return properly at this point. Sometimes even if you click on Display again from the Velocity Vectors window, it does not re-display properly. If this happens, close all the graphical windows and re-open. This usually corrects the problem.
  7. Now Save. The default file name will be airfoil.ps, but that is too non-descriptive. Name the file "air_vector.ps" or something meaningful, and OK. Finally, Close the Graphics Hardcopy window.
  8. Back in the Unix shell window (labeled winterm), Enter "lp -dinky filename.ps" where filename is the name you assigned to this vector plot in the above step. This should print out the file on the laser printer located in the SGI lab.

Examine the pressure and vorticity fields, and the streamlines:

  1. In Fluent, Display-Contours. In Contours, the default Contours of is Pressure, so we will look at pressure contours first.
  2. Increase Levels to 100 (the limit allowed by Fluent), and Display. Is the pressure lower on the top of the airfoil than on the bottom, as expected?
  3. To examine vorticity contours, change Contours of to Velocity, and right below that, Vorticity Magnitude. Display.
  4. Where is most of the vorticity in this flow? In light of this result, would the potential flow approximation be good for this problem? Why or why not?
  5. To visualize streamlines in the flow, keep Contours of as Velocity, but right below that, Stream Function. Display.

Calculate the lift and drag forces on the airfoil:

  1. In Fluent, Report-Forces. In Force Reports window, airfoil is the default surface listed under Wall Zones. This is the entire airfoil surface, so the default is okay. You will need to enter the components of the force vector, however. These are simply the x and y components of a unit vector pointing in the direction of the desired force. For example, setting the x-component to 1 and the y-component to 0 would cause Fluent to calculate the force acting on the airfoil in the x-direction. If you set both the x and y components to 0.7071 (one half of the square root of two), this would give you the component of force in a direction parallel to 45 degrees. In our problem, we want lift force, which is defined as perpendicular to the freestream direction. Enter the appropriate x and y components so that the result is the lift force. Note that the calculated force will actually be in units of N/m since this is a 2-D problem (force per unit span).
  2. To perform the calculation, Print. The results will be printed to the main Fluent window. You may need to widen that window to see the entire length of the line. Notice that the force is broken into a pressure component and a viscous component.
  3. Write down the total lift force, from which the lift coefficient will be calculated.
  4. In a similar manner, calculate and record the total drag force on the airfoil. (Drag is defined as parallel to the freestream velocity vector.)
  5. Now you may Close the Force Reports window.

Save your calculations and exit Fluent:

  1. In Fluent, File-Write-Case & Data.
  2. Click OK to write the case and data files onto your directory. Yes, it is okay to overwrite.
  3. Exit Fluent by File-Exit. This will return you to the Unix shell.
  4. To logout completely from the computer, In the Global window on the upper left of the screen, Desktop-Log Out, and Yes.