Fluent - Laminar Flow into an Axisymmetric Inlet
Latest revision: 07 November, 2003, 5:40 p.m.
Introduction and Instructions:
This learning module contains a procedure to solve for laminar flow into an axisymmetric inlet 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. The file axi_inlet.msh is assumed to exist on the user's Fluent directory
Log on and launch Fluent:
- If already logged in, enter "pwd". This Unix command will print your working directory. If your working directory is not Fluent, enter "cd ~/Fluent" to make Fluent your working directory. If logged in and at the correct Fluent working directory, skip to step 4.
- Log on to a computer which has access to the Fluent software, and open a Unix shell.
- Enter "cd Fluent" to change the working directory to Fluent. (Note: It is assumed that the grid was generated from the Fluent/Gambit subdirectory, and then moved to the Fluent directory, as instructed in the Gambit learning module.)
- Enter "fluent 2d &". After a few seconds, the main Fluent window should appear on your screen. (The & symbol lets Fluent run in background mode so that the Unix shell is still usable.)
Read the grid points and geometry of the flow domain:
- File-Read-Case. There should be a file listed on the right side called axi_inlet.msh. Highlight this file (i.e. click on it), 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.
You may see some error messages concerning unbound variables - ignore these.
- 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.
- Grid-Info-Size to see how many cells are in the computational domain. There should be around 2000 cells if you followed the Gambit directions carefully.
- 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 left, it will zoom out. Zoom in or out as necessary until the grid is shown nicely in the window. Close the Grid Display window; the display window itself will remain.
Record the properties of the fluid, air:
- The default fluid is air, so we don't have to change it. However, it is wise at this point to record the fluid density and viscosity. In the main Fluent window, Define-Materials. Check that air is the default for Fluid Materials.
- Write down the density and viscosity of air, which may be needed later to calculate Reynolds numbers, pressures, etc. Be sure to write down the units of these parameters as well.
- Now Close the Materials window.
Define the boundary conditions:
- The boundary conditions need to be specified. In Gambit, the boundary condition types were declared, i.e. wall, pressure outlet, etc., but actual values for the outlet pressures, etc. were never defined. This must be done now in Fluent. In the main Fluent window, click on Define-Boundary Conditions, and a new Boundary Conditions window will pop up.
- Select the Zone called fluid and Set. Verify that the default fluid is air, as appears in the Material Name drop-down list of material names. OK.
- The default boundary condition for the top wall of the hood, called "hood wall" is okay (wall), so nothing needs to be done to it.
- For a two-dimensional slot, the default boundary condition for the symmetry plane called "axis" (symmetry) is okay, but for an axisymmetric inlet (a circular inlet), as desired here, this boundary condition will need to be changed to an axis of rotation. Fluent requires that the horizontal x-axis be the axis of rotation for axisymmetric flows. Select the Zone called axis, and change Type to axis. Yes, and OK.
- Select the Zone called far-field, which was declared in Gambit to be a pressure inlet. Set. Note that the gage pressure is zero, i.e. atmospheric pressure conditions exist in the far field. That is what we desire, so OK.
- Finally, select the Zone called face, to which we had assigned a pressure outlet in Gambit. Set. The inlet must have a negative gage pressure, i.e. a vacuum pressure, so that air is sucked into the inlet. It is desired to have an average face velocity through the inlet of 10 m/s. The Bernoulli equation can be used to estimate the required pressure at the inlet. Change the Gage Pressure to the appropriate negative gage pressure in Pascals. OK.
- Boundary conditions are complete, so Close the Boundary Conditions window.
Set up some parameters and initialize:
- In the main Fluent window, Define-Models-Solver. 2-D flow is the default, but we want axisymmetric instead; so under Space, select Axisymmetric. OK.
- 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 wish to try 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 each of these residuals from 0.001 to 0.00001 or 1.E-05.
- 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, this is explained in a simple fashion here: Sometimes as the program is iterating, changes in the solution are too aggressive, and adversely affect convergence. Reduced under-relaxation factors damp out changes in the solution as the iterations progress, often leading to better overall 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 axi_inlet.cas, which may be changed to something more descriptive ("axi_unflanged.cas" is suggested to distinguish this case from a flanged case). Note that Case & Data refers to both the case file (the grid plus all boundary conditions and other specified parameters) and the data file (the velocity and pressure fields calculated by the code.) The code will actually write out two files, axi_unflanged.cas and axi_unflanged.dat.
- 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 "axi_unflanged.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. Move the window to a blank portion of the computer screen for convenience. Change Number of Iterations to 100, and Iterate.
- While Fluent is iterating, the main screen will list the residuals after every iteration. Meanwhile, 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 usually disappear in time.
- At the end of 100 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 near the inlet in more detail. Is there any flow separation near the top corner of the inlet?
- In the main Fluent window, Display-Contours. The default is contours of pressure. Display. This shows contour lines of constant pressure (isobars).
- More interesting in this problem are the contours of constant velocity magnitude (isopleths), and contours of the stream function, (streamlines). Change Contours of to Velocity. The default value below that is Velocity Magnitude. Display. At this point, the solution has not converged sufficiently, so the isopleths are not realistic.
- Now look at the streamlines. Select Stream Function from the pull-down list right below the word Velocity under Contours of. Display. Since the solution has not yet converged, the streamlines are not yet correct.
Iterate towards a final solution:
- 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 about 200, Apply, and Iterate.
- After these iterations, check the velocity vectors and/or streamlines, as described above, to see how the flow is progressing towards a final solution.
- If the residuals have flattened out, (or if they oscillate up and down, but no longer decay), it usually means that either the solution has converged, or the grid resolution is not sufficient for an accurate solution - it may be necessary to adapt the grid. Grid adaption is a feature of Fluent which enables one to add grid points to regions in the flow where more grid points would be helpful. There are many options for the adaption process; we shall adapt by velocity gradient. In other words, a finer grid will be generated in locations where there is a large change in velocity, such as along the solid wall, and close to the inlet.
- To adapt the grid, from the main Fluent window, Adapt-Gradient. Select Gradients of to be Velocity. Under that, the default Velocity Magnitude is fine.
- In the Gradient Adaption window, Compute. This will display the minimum and maximum velocity gradients in the flow field. Change the Refine Threshold to about 1/10 of the value of the maximum gradient. Mark. The number of cells chosen for refinement are displayed in the main Fluent window.
- To see where the grid will be adapted, Manage-Display in the Grid Adaption window. Cells to be adapted will be highlighted. You may have to zoom out to see the whole domain.
- Fluent has chosen cells to be adapted, but has not actually adapted anything yet. To adapt, Adapt from the Gradient Adaption window, and Yes (Hanging nodes are acceptable).
- Back in the main Fluent window, Display-Grid-Display. See if you can spot where new cells were added to the grid.
- Iterate some more (a couple hundred iterations). The residuals will always jump up immediately after a grid adaption, as the flow needs to readjust. The residuals will quickly recover and begin to fall, hopefully to lower values than before the adaption.
- The adaption process can be repeated. Each time prior to adapting the grid, Compute to display the minimum and maximum velocity gradients in the flow field, and change the Refine Threshold to about 1/10 of the value of the maximum gradient. Keep in mind that every time the grid is refined, each iteration will take more computer time and memory. If one is not careful, the limits of the computer may be exceeded!
- Iterate and perhaps adapt some more as necessary until the solution converges. The residuals may bounce up and down. This is normal, as the code attempts to zero in on a solution. When 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.
- You should not need more than a couple thousand total iterations for this run to converge.
Note that there may sill be some reverse flow warnings. This is normal for this case.
- In the main Fluent window, File-Write-Case & Data. In the Select File window which pops up, the default file name should be the same as previously entered. OK to write the file onto your directory. OK again since it is okay to overwrite these files.
Examine the streamlines and velocity vectors in detail, and save the image files:
- Once the solution has converged, the streamlines and velocity vectors will be examined in detail. First examine the streamlines: Display-Contours, choose Contours of to be Velocity, and below that Stream Function. Display.
- Zoom out so that the entire computational domain is shown. If the solution is correct, the streamlines should look nearly like rays (spokes of a wheel), as the streamlines from "far away" should resemble those of a potential flow sink. To display more than the default 20 streamlines, change Levels to 50, and Display. When the display is to your liking, the image file will be saved for printing out later.
- Before saving the image file, add a label. Click on the area just below the title at the bottom of the plot. A cursor will appear which will allow you to enter a more descriptive title. Put your name(s) or initials here, along with the words "Axisymmetric Unflanged Inlet", if you have room.
- In the main Fluent window, File-Hardcopy.
Select the TIFF graphics format, which I have found to give the best results.
- Maximize the graphical display window so that the image files you create have the maximum possible resolution.
- Return to the main Fluent window by clicking on its box in the tool bar at the bottom of the screen.
- Change Coloring to Monochrome if your printer is black and white.
- Save, and name the file (something like "axi_unflanged_streamlines.tif" is appropriate). OK. Ignore the warning.
- Zoom in so that the field of view shows the inlet occupying about half the vertical distance of the plot window. Observe how the streamlines go into the inlet.
- Isopleths near the inlet should also be examined. In the Contours window, change the second entry under Contours Of from Stream Function to Velocity Magnitude. Display. The rapid decay of the velocity magnitude with distance from the inlet plane should be obvious.
- Also experiment with the other contour options provided in Fluent. In the Contours window, try changing Contours Of to Pressure. Display. This shows isobars, i.e. contours of constant pressure. Contours of constant residuals is an interesting plot - it can show the user where in the flowfield the solution has converged the most and the least. When done experimenting, Close the Contours window.
- Next, the velocity vector field near the inlet will be plotted and examined in detail.
- In the main Fluent window, Display-Vectors.
- In the window called Vectors, change Style to arrow, and select Vector Options. Change the default Scale Head from 0.1 to 0.3 so that the flow direction is easier to visualize. Apply and Close.
- Back in the Vectors window, Display.
- Zoom in around the hood face if necessary. The arrows may still be too small to see clearly, so change the Scale to about 2 or 3, and change Skip to 1 (i.e skip every other point), and Display.
- Play around with these velocity vector parameters such that the flow pattern can be more clearly seen, yet without much overlap from one vector to another. The flowfield should have converged enough that flow is clearly being sucked into the inlet.
- When the plot is to your liking, save the image as a TIFF file as previously (name it something like "axi_unflanged_vectors.tif"). OK.
- Also experiment with the color options provided in Fluent. In the Vectors window, try changing Color By to Pressure. Display. This enables the user to visualize the velocity field, while simultaneously viewing the pressure field, since pressure changes are indicated by color changes. Finally, Close the Vectors window.
Generate an isopleth contour plot:
- In this section, we generate isopleths (contours of constant normalized velocity magnitude).
- In the main Fluent window, Define-Custom Field Functions.
- Select Field Functions to be Velocity, and immediately below that, Velocity Magnitude. Select. Note that "|V|" appears in the Definition of the custom field function.
- Click on the "/" sign (divide) on the calculator pad, and click on "1" and "0" so that we divide the velocity magnitude by the average speed through the hood face, i.e. 10.0 m/s. Then click on "x" and "1", "0", and "0" to multiply our value by 100 to convert to percent.
- Change the name of the custom field function to "isopleths", and Define.
We have now successfully created a custom field function that is the normalized velocity magnitude, expressed as a percentage of face velocity. Close.
- In the Contours window, select Contours of to be Custom Field Functions.
- Turn off Auto Range, and enter "0" and "100" as the Min and Max limits. Change the number of contour levels to 20, and Display.
- Adjust the sizes and locations of the graphics display window and the main Fluent window such that both are clearly visible.
- Click with the right mouse button on a contour line. Its value will be displayed in the Fluent window.
- Draw a sketch of several contour values so that you can later add labels to your hardcopy printout.
- Zoom in or out as necessary so that approximately three half-slot heights are visible in front of the face of the inlet, and save the image as a TIFF file. (Be sure to name it appropriately.)
Examine the decay of velocity along the centerline:
- The velocity magnitude along the centerline of the inlet (i.e. along the x axis) 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, select axis under Surfaces. This will select the line in front of the hood face, along the centerline.
- In the upper left corner of the window, the default Position on X Axis, should be on, and Position on Y Axis should be off. This will make the x-axis the x position on the plot, and we will have to select a variable for the y-axis for plotting versus x position.
- In the upper middle part of that window, the default Plot Direction should be X = 1 and Y = 0. This will make the x-coordinate position appear on the x-axis, as desired for the plot.
- The upper right part of the window selects the variable to be plotted. Select the Y Axis Function to Custom Field Functions, and below that, Isopleths. For the X Axis Function, the default choice of Direction Vector is fine as is. Plot.
- If done properly, the plot should show the normalized velocity magnitude decaying from a face value of around 100% at the inlet face to nearly zero far away.
- The plot can be made a little nicer looking, and 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 1, which is about 5 inlet diameters away. Apply. (Nothing will happen to the plot yet, so don't panic.)
- Now choose the Y axis. Unselect Auto Range and select Major Rules for this axis as well. Set the range from 0 to around 100 (%).
- To make the scale more readable, change Type under Number Format to Float, and change Precision to 0. Apply. Close.
- Back in the Solution XY Plot window, Plot. Adjust the axes limits and/or number format as desired to obtain a nice-looking plot.
- The data points created for this plot will be written out to an ASCII (text) file for later use. For example, they can be imported into Mathcad or into a spreadsheet for further analysis. In the Solution XY Plot window, turn on the option called Write to File, and then Write.
- Type in an appropriate file name, like " axi_unflanged_data_points.txt", and OK.
- Finally, a hardcopy file of this plot will be saved. In the main Fluent window, File-Hardcopy-Save, name the file (something like "axi_unflanged_decay.tif" is appropriate). As before, OK, and 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 Unix shell.
Print the image files:
- Check that four image files exist on your directory - streamlines, velocity vectors, isopleths, and the decay of velocity magnitude along the centerline axis. Enter "ls -la" from the Unix shell to see a list of files.
- Make a printout of each of these images. You have several options here. The easiest is to print directly to the default printer in the SGI lab. Alternately, you can save the files on a floppy disk, and print them out somewhere else.
- To print to the GCL lab printer, follow these directions:
- In the tool bar on the bottom of the screen, OpenOffice.org Writer Word Processor. This is the Linux version of a word processor.
- Insert-Graphics-From File. Navigate through the directories, just as in MS Word,
and select the image file you want to insert.
- You can play around with the paper orientation, change the size of the picture, etc., just like in Microsoft Windows. You can put all four pictures on two pages if desired, to save paper.
- When the file is to your liking, File-Print.
- To write to a floppy disk, put in a floppy, right-click on the
desktop, and then Disks-Floppy. The floppy drive will then appear as a link
on the desktop, to which you can drag and drop files. NOTE: before
you eject the floppy disk, be sure to right-click the desktop, then de-select Floppy.