Fluent - Particle Trajectories in a Curved Duct
Introduction and Instructions:
This learning module contains a procedure to solve for laminar flow in a two-dimensional duct with a 90-degree bend with the CFD program, Fluent. Once the flow field has been solved, particles of several diameters will be introduced so that their trajectories can be plotted.
Note: This set of instructions assumes that the student has already run Gambit, and has generated a grid for the flow. The file curve.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.
- 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:
- Select File-Read-Case. There should be a file listed on the right side called curve.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.
- 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 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 are 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 inner wall of the hood, called "inner wall" is okay (wall), so nothing needs to be done to it.
- Do the same thing for the outer wall.
- Select the Zone called outlet, which was declared in Gambit to be a pressure outlet. An outflow is less restrictive than a pressure outlet. Let us change this to an outflow. Select outflow on the column on the right side. Yes, we do want to change this boundary type. The default options here are okay, so OK.
- Finally, select the Zone called inlet, to which we had assigned a velocity inlet in Gambit. Set. Enter "2.0" as the velocity magnitude (in m/s) normal to the inlet. 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, and all the other parameters are okay as is, so 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.
- The operating pressure will now be specified. In the main Fluent window, Define-Operating Conditions. The default Operating Pressure is fine (standard atmospheric pressure), but the Pressure Reference Location is outside the computational domain. Change the Reference Pressure Location to X = 0.0 and Y = 0.45, so that the reference pressure is defined at the center of the duct outlet. OK.
- The gravity term must be included in the momentum equations. In the main Fluent window, Define-Operating Conditions, and turn on Gravity. The x and y components of the gravitational acceleration can be changed in the area of the window called Gravitational Acceleration. For the first part of this problem, gravity will be neglected, so leave both the x and y components at 0. 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.000001 or 1.E-06 (click on the number, and then on the window that pops up, type in the new value, and OK to set it).
- 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 or three 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 curve.cas, which may be changed if desired. 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, curve.cas and curve.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 "curve.cas.gz". OK to write the file onto your directory.
Iterate and check results:
- 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 400, 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 400 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. It may help to change Scale to around 0.4 so that the velocity vector arrows do not overlap.
- Select Vector Options. In the Vector Options window, change Style to arrow and change Scale Head to 0.3. Apply. This makes the arrows nicer looking. Note that the changes don't actually take effect until Display is clicked again in the Velocity Vectors window.
- Zoom in with the middle mouse, as described above, to view the velocity field near the middle region of the duct in more detail. Is there any flow separation along the inner wall of the duct? Zoom back out so that the entire flow field is visible.
- In the main Fluent window, Display-Contours. The default is contours of pressure. Display. This shows contour lines of constant pressure (isobars). Does the pressure increase towards the outer wall, as expected?
- More interesting in this problem are the contours of the stream function, (streamlines). Change Contours of to Velocity. The default value below that is Velocity Magnitude. Select Stream Function from the pull-down list right below the word Velocity under Contours of. The streamlines will be plotted on the screen.
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 100, 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, and do not seem to be decreasing anymore, it usually means that 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 walls.
- 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. Cells to be adapted will be highlighted.
- Fluent has chosen cells to be adapted, but has not actually adapted anything yet. To adapt, Adapt from the Gradient Adaption window, and Yes.
- Iterate some more (several 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. Eventually, if the solution still has not converged, the residuals will again flatten out.
- 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 level off, and further adaptions don't improve the solution. In such cases, this is the best we can do.
- You should not need more than 2000 total iterations for this problem.
- 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 in detail, and save the image file:
- 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 circular arcs. In other words, the flow follows the curve of the duct fairly well.
- 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) and date here.
- In the main Fluent window, File-Hardcopy-Save, name the file (something like "curve_streamlines.ps" is appropriate). I recommend changing Coloring to Monochrome since the default printer is black and white. The default printer resolution is 75 DPI, I like to change this to 150 DPI. If you have access to a color postscript printer, select Color. OK, and Close. The postscript file generated can be printed out from the Unix shell later. (See instructions in the SGI lab for printing postscript image files.) Alternately, you can choose one of the other image formats if you desire to print the image file from a different computer.
- 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.
Inject some particles at the inlet, and plot their trajectories:
- Now that the carrier fluid flow field has been established, particles will be injected at the centerline of the duct inlet to see how they move in this flow.
- In the main Fluent window, Define-Injections-Create. A window called Set Injection Properties will open up. In this window, at the top, specify the Injection Name as "micron-10".
- From the drop-down list under Material, select (highlight) water-liquid - we will examine the trajectories of water droplets of several different sizes (spherical particles are assumed).
- Under Point Properties, enter X-Position as 0.45 and Y-Position as 0. (This location is in the middle of the inlet - all particles will be injected from this spatial location.)
- In like manner, specify the X-Velocity component as 0 and the Y-Velocity component as 2.0, so that the particles are initially moving exactly with the fluid. As the fluid turns in the duct bend, however, the particles may follow a different path, due to their inertia.
- Specify this particle diameter as 10.E-06 meters, i.e. 10 microns. OK.
- Create three other water droplet particles in the same fashion, with diameters of 50, 100, and 500 microns, and with Injection Names "micron-50", "micron-100", and "micron-500" respectively. Note: the copy function in the Injections window is handy for this type of operation. To use the copy utility, highlight the injection name to be copied, and Copy. The only things you will need to modify are the Injection Name and the particle Diameter.
- After all four injection particles have been properly defined an labeled, Close the Injections window.
- Now the particle trajectories will be plotted. In the main Fluent window, Display-Particle Tracks. A window called Particle Tracks will open up.
- Under Color By, the default selection Particle Variables is fine, but under that, choose Particle Diameter. With this selection, Fluent will assign a different color to each particle trajectory.
- Under Release From Injections, select (i.e. highlight) all of the particles. Display. One particle trajectory should appear on the plot for each of the different diameter particles defined above. If everything is working properly, very small particles nearly follow the streamlines of the flow, but the larger (more massive) particles get flung to the outer wall.
- By default in Fluent, particles are assumed to reflect off of solid walls. If instead the particles actually "stick" to walls, this boundary condition can easily be changed. In the main Fluent window, Define-Boundary Conditions. Select the Zone called inner wall, and Set.
- Change Boundary Cond. Type (under Discrete Phase Model Conditions) from reflect to trap. OK.
- Repeat for the outer wall.
- Plot the particle trajectories again for this case using Display-Particle Tracks-Display.
- When the plot is to your satisfaction, a hardcopy file of this plot will be saved. First, edit the text you previously added to the bottom of the plot. Specifically, add the phrase "no gravity" since this is the case with no gravitational acceleration.
- In the main Fluent window, File-Hardcopy-Save, name the file (something like "curve_no_gravity_trajectories.ps" is appropriate). As before, OK, and Close.
- In the main Fluent window, File-Write-Case & Data. OK. It is okay to overwrite the files, so OK again.
Turn on gravity and re-create the particle trajectories:
- In the main Fluent window, Define-Operating Conditions. Under Gravitational Acceleration, change the Y-component to -9.81. OK.
- The addition of gravity to the flow should have no effect on the carrier fluid. Verify this by running 10 or 20 iterations. There should be no significant change in the residuals.
- Plot the particle trajectories for this case using Display-Particle Tracks-Display. Have any of the trajectories changed from the previous case?
- Edit the label on your plot to indicate that gravity is acting downward. (Instead of "no gravity", type "gravity down".)
- Save a hardcopy file as before. A suggested file name is "curve_gravity_down_trajectories.ps".
- Repeat for the case of gravity up, i.e. change the Y-component of Gravitational Acceleration in the Operating Conditions window to 9.81, and re-plot the particle trajectories. Edit the label on your plot to indicate that gravity is acting upward and save this plot as "curve_gravity_up_trajectories.ps".
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 - one a plot of streamlines of the flow field, and one file for each of the three gravity cases - no gravity, gravity down, and gravity up. Enter "ls -la" from the Unix shell to see a list of files.
- Make a printout of each of these files. You have several options here. The easiest is to print directly to the default printer in the SGI lab. See instructions posted near the printer. Alternately, you can FTP the files to a different computer to print them out somewhere else.