Fluent - Laminar Flat Plate Boundary Layer
Latest revision, 26 February 2004, 4:00 p.m.
Introduction and Instructions:
This learning module contains a procedure to solve for the laminar boundary layer on a flat plate with the CFD program, Fluent.
Note: This set of instructions assumes that the student has already run Gambit, and has generated a grid for the flow: file name.msh, where name is a file name given previously.
- If a DOS shell is not already open, create a DOS shell by double clicking the icon on the computer's desktop called Command Prompt.
- From the Command Prompt line, enter "cd c:\temp" to go to the temporary subdirectory, on which you have write access.
- From the Command Prompt line, enter "fluent 2d". After a few seconds, the main Fluent window should appear on your screen.
Read the grid points and geometry of the flow domain:
- Select File-Read-Case. The file you created in Gambit (name.msh) should appear. Highlight this file, and 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 is read well, it should give no errors, and the word "Done" should appear.
Note - If you have trouble reading your grid, you probably made a mistake in Gambit somewhere. You may need to repeat the Gambit session before continuing.
- Check the validity of the grid: Grid-Check. If the grid is valid, no errors should appear. If there are errors, you may have done something wrong in the grid generation, and will have to go back and regenerate the grid.
- Look at the grid to make sure it is correct. Display-Grid-Display. A new graphical display window opens up showing the grid. If this window is too big, re-scale 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 visible simultaneously. The Fluent window and/or the graphical display window may need to be moved to accomplish this.
- The graphical display can be zoomed-in or zoomed-out with the middle mouse button. If you start on the lower left and draw a rectangle with the middle mouse button towards the upper 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 right to the left, it will zoom out. Zoom in if necessary until the grid is shown nicely in the window. Close the Grid Display window; the display itself will remain.
Generate lines at x = 0.10 m and at x = 0.30 m:
- The boundary layer profile will be examined in detail at three x locations along the flat plate, namely at x = 0.10 m, 0.30 m, and 0.50 m. The last of these is the outlet of the domain, but lines need to be defined within Fluent for the first two.
- In the main Fluent window, Surface-Line/Rake. Type in the desired starting and ending x and y locations of the vertical line, i.e. a vertical line going from (0.10,0) to (0.10,H).
- The New Surface Name should be assigned at this point. It is suggested that this line be called "profile0.10" or something descriptive of its intended purpose.
- Click on Create to create the line.
- Similarly, create a line at x = 0.30; a suggested label is "profile0.30".
- To view these newly created lines, return to the main Fluent window, and Display-Grid. Unselect (by left mouse click) the default interior, and select the newly created lines instead. Display. The lines should be visible at the appropriate locations. If not, create them again more carefully.
- Now Close both the Line/Rake Surface window and the Grid Display window.
Define the fluid as liquid water:
- The default fluid is air, which must be changed to water. In the main Fluent window, Define-Materials-Database. Select water-liquid from the Fluid Materials drop down list. Copy.
- Write down the density and viscosity of liquid water, which are needed later to calculate Reynolds numbers, etc. Close.
- Now Close the Materials window. Caution: This has added liquid water into the list of fluids available as boundary conditions, but has not actually changed the fluid from air to water. This will be done when specifying the boundary conditions.
Define the boundary conditions:
- 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 the main Fluent window, click on Define-Boundary Conditions, and a new Boundary Conditions window will pop up.
- Select fluid and Set. Choose water-liquid as the Material Name from the drop-down list of material names. OK.
- The default boundary condition for the flat plate (wall) is okay (stationary wall), so nothing needs to be done to it.
- Likewise, the default boundary conditions for the symmetry plane (symmetry) and the two pressure outlets (outlet and top) are okay, so nothing needs done to them.
- Select inlet, which is the left side of the computational domain. Set. The Velocity Specification Method should be Magnitude and Direction by default. If not, change it. Change the Velocity Magnitude to 0.10 m/s. The default is normal to the boundary, which is what is desired here, so OK.
- Boundary conditions are complete, so Close the Boundary Conditions window.
Set up some parameters and initialize:
- In the main Fluent window, Define-Models-Viscous.
Laminar flow is the default, so we really don't need to do anything here.
Later on, however, you may need to specify turbulent flow calculations; this is where the turbulence models are specified in Fluent. OK.
- 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 Fluent window, Solve-Monitors-Residual. In the Residual Monitors window that pops up, 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 the main Fluent window, and Plot causes the code to plot the residuals on the screen while the code is iterating.
- 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. Change the Convergence Criterion for all three residuals from 0.001 to 1.E-06 (highlight the number, and then type in the new value).
- To apply the changes, OK, which will also close the Residual Monitors window.
- Experience has shown that for most problems, the solution converges better if the under-relaxation factors are reduced from their default values. Without going into a lot of detail, reduced under-relaxation factors sort of "damp out" changes in the solution as it iterates. Sometimes these changes are too aggressive, and adversely affect convergence. In the main Fluent window, Solve-Controls-Solution. Reduce the Under-Relaxation Factors for pressure and momentum by a factor of two from their default values. OK.
- In the main Fluent window, Solve-Initialize-Initialize. The default initial values of velocity and gage pressure are all zero. These are good enough for this problem. Init and Close.
- At this point, and every so often, it is wise to save your work. In the main Fluent window, File-Write-Case & Data. In the Select File window which pops up, the default file name is acceptable.
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, name.cas and name.dat, where name is the name you previously assigned.
- If not on by default, turn on the option to Write Binary Files (to save disk space). To save even more disk space, the files can be compressed by adding a "gz" at the end of the file name. The complete file name should be "name.cas.gz". OK to write the file onto your directory.
Iterate towards a solution:
- In the main Fluent window, Solve-Iterate to open up the Iterate window. Change Number of Iterations to 200, and Iterate. The main screen will list the residuals after every iteration, while the graphical display window will plot the residuals as a function of iteration number. The residuals may rise at first, but should slowly start to fall. It is normal for the residuals to fluctuate up and down. Do not be concerned if there are reverse flow warnings; these will disappear in time.
- At the end of 200 iterations, check to see how the solution is progressing. In the main Fluent window, Display-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 particular, view the boundary layer near the end of the plate. Is it starting to look like a boundary layer profile?
- Iterate some more - (To restart the iteration, either find the Iterate window, which is probably hidden under some other windows at this point, or click again on Solve-Iterate to re-open the Iterate window.) In the Iterate window, set Number of Iterations to 100, Apply, and Iterate.
- Check the velocity vectors, as described above after another 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. The residuals may go up sometimes. This is normal, as the code attempts to zero in on a solution - after a while the residuals should again decay or level off. If the residuals all go below the convergence criteria, the calculations will stop. In some cases, however, the residuals reach a lower limit, and further iterations don't improve the solution.
- 200 to 300 iterations should be sufficient for the first attempt. Before iterating further, the grid must be refined.
Refine the grid:
- Our grid is not tight enough near the wall to accurately resolve the boundary layer, especially near the front of the flat plate where the boundary layer is very thin. 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.
- In the main Fluent window, Adapt-Gradient. In the new Gradient Adaption window, select Gradients of Velocity.
- Select the Compute option. Minimum and maximum velocity gradients will appear in the window.
- 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.
- Now select 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.
- Optional: If you want to see where the grid will be adapted, click Manage-Display. Areas destined for grid refinement will be highlighted. (You may need to zoom out to see this better.)
- 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.
- Optional: To see what the refined grid looks like, you can select Display-Grid from the main Fluent window, highlight default-interior, and Display. (You may need to zoom in close to the wall to see more clearly.)
You should see some new cells near the wall (especially near the leading edge of the flat plate) where velocity gradients are highest.
- 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:
- If the Iterate window is still available, go to it. If not, Solve-Iterate from the main Fluent window to re-open the Iterate window. Change Number of Iterations to about 500, Apply, and Iterate.
- At the end of these iterations, check to see how the solution is progressing. In the main Fluent window, Display-Vectors-Display. The graphical display window will show the velocity vectors.
- Under Surfaces, select only inlet, profile0.10, profile0.30, and outlet. Display.
- Zoom out and move as necessary to see all four velocity profiles.
- Change the velocity vector scale to about 10 to see the profiles more clearly. Display.
The growth of the boundary layer should be apparent.
Examine the velocity profiles in detail:
- At this point, the velocity profile at three desired downstream locations (x = 0.10, 0.30, and 0.50 m) will be plotted and examined in detail.
- In the main Fluent window, select Plot-XY Plot. A window called Solution XY Plot will open up. In this window, at the lower right corner, select (highlight) the surfaces we created above, i.e. the ones called profile0.10 and profile0.30. Also select outlet, which is at x = 0.50 m.
- In the upper left corner of the window, turn off Position on X Axis, and turn on Position on Y Axis. This will make the vertical axis the y position on the plot, as desired.
- In the upper middle part of that window, set Plot Direction to X = 0 and Y = 1. This will make the y-coordinate position appear on the vertical axis, as desired for a standard velocity profile plot.
- The upper right part of the window selects the variable to be plotted. The Y Axis Function will be set automatically to Direction Vector, and should be left alone. For the X Axis Function, select Velocity and (just below that) X-Velocity. Plot.
- The boundary layer profiles should be there, but may be hard to see since the vertical axis extends all the way to the upper boundary of the computational domain. The axes limits can be changed as follows: Axes. Choose X if necessary (X should already be the default). Unselect Auto Range, and select Major Rules.
Set Range from 0 to 0.11 m/s. Apply. (Nothing will happen to the plot yet, so don't panic.)
- Now choose the Y (vertical) axis. Unselect Auto Range and select Major Rules for this axis as well. Set the range from 0 to around 0.04 m or so, such that the entire boundary layer is visible on the plot.
- To make the scale more readable, change the Number Format to Type = Float and Precision = 3. Apply. Close.
- Back in the Solution XY Plot window, Plot. Adjust the axes and/or number format as desired to obtain a nice plot of the boundary layer profiles. If done correctly, all three profiles should be visible on the plot, and the growth of the boundary layer with downstream distance should be apparent.
Iterate towards a final solution:
- At this point, the boundary layer should be reasonable, but more grid refinement and iteration may be required. If there are less than about 10 data points within the thickness of the boundary layer at any of the three profile locations, the grid should be refined again.
- Refine the grid and re-iterate as necessary to obtain a final solution. Each time you adapt the grid, you must re-calculate the gradients (Compute), re-adjust the refine threshold (again, it should be set to about 1/10 of the maximum gradient), Mark, and Adapt-Yes.
- Iterate at least 300 to 500 iterations after each grid adaption. The residuals will rise dramatically after an adaption, but will decay as the solution adjusts itself to the newly refined grid.
- Caution: Don't adapt too much, or the computations will take too much CPU time. Note that every time you refine the grid, the computer must calculate the flow field at more grid points, requiring longer for each successive iteration.
- After refinement and iteration, look at the velocity profiles (Plot-XY Plot-Plot from the main Fluent window, or simply Plot if the Solution XY Plot window is still available).
- Adapt several times until there are at least 8 to 10 data points within each boundary layer.
You may need to lower the Refine Threshold to about 1/100 or even 1/1000 of the maximum gradient value in order to do any significant adaption.
- When finished adapting, run several hundred iterations until the residuals level off, or until the convergence criteria are reached.
Save your velocity profiles and your calculations:
- In the main Fluent window, File-Write-Case & Data. In the Select File window which pops up, the default file name should be "name.cas.gz", as previously entered. OK to write the file onto your directory. OK again since it is okay to overwrite these files.
- From the Solution X-Y Plot window, Plot. When the plot is to your liking, the plot of the boundary layer profiles will be saved as a tif file.
- Before saving the plot, your name and a short description should be added to the title.
Click with the left mouse button just below the existing title ("X Velocity") in the bottom left of the plot.
A cursor should appear.
Type your names and Group letter on the plot title.
- In the main Fluent window, File-Hardcopy, select TIFF, and Save.
Give a unique, descriptive name to the file (something like "laminar_profiles_Smith_Jones_Group_C.tif" is appropriate), OK, and Close.
The tif file just generated can be inserted into a Microsoft Word document later.
- The data points along the x = 0.50 m line will now be saved to an ASCII file for further analysis and comparison to predictions.
From the Solution XY Plot window, select only the outlet line.
Write to File, and Write.
Name the file, and OK.
- Finally, save a plot of the residuals.
In the main Fluent window, Plot-Residuals-Plot.
It is suggested that Coloring be changed to Monochrome since the printer prints in black and white only.
Save, name the file, OK, and Close.
Calculate the drag force and drag coefficient on the body:
ME 83 Students do not need to do this section - skip to the next section.
- In order to calculate drag coefficient correctly, the proper reference values for area, velocity, etc.
need to be defined.
In the main Fluent window, Report-Reference Values.
A window called Reference Values will open. The proper reference area to use is the planform area of the plate. Planform area is defined as the area seen from above, in this case L times b, where L is the plate length and b is the depth or span of the plate. Assume unit depth (b = 1.0 m) for convenience so that drag force is per unit depth. Depth should already be set to 1.0 m by default.
- Change Area to L times b, change Velocity to the freestream velocity of the flow, and change Length to L, the length of the flat plate.
- Unfortunately, the reference values for density and viscosity are those of air, the default fluid, even though we defined our working fluid as liquid water. (This is apparently a bug in Fluent.) Change Density and Viscosity to their proper values. (These values for liquid water were written down previously, but can also be found from Define-Materials, and selecting water-liquid under Fluid Materials.) All other reference values should be okay, so OK.
- In the main Fluent window, Report-Forces. In the window which pops up, the only available Wall Zone is flat-plate, which is the surface of the flat plate, 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 wall in the x-direction. In our problem, we want drag force, which is defined as parallel to the freestream direction. Enter the appropriate x and y components so that the result is the drag 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).
- Click on Print to perform the calculation. 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. The pressure component is zero. Why?
- Write down the total drag force and drag coefficient. (Remember that this is the drag on one side (the top) of the plate, all the way to the end of the computational domain, i.e. from x = 0 m to x = 0.50 m.) Does the calculated drag coefficient at this Reynolds number agree with published data?
- To exit the Force Reports window, Close.
Save your calculations and exit Fluent:
- In the main Fluent window, File-Write-Case & Data. OK. It is okay to overwrite the files, so OK again.
- Exit Fluent by File-Exit. This will return you to the DOS shell.