Top Banner
178

36395027 Fluent Cornell Univ Tutorials Versio6 0

Oct 22, 2014

Download

Documents

rajamannar322
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Laminar Pipe FlowAuthor: Rajesh Bhaskaran E-mail: [email protected] Problem Specification 1. Create Geometry in GAMBIT 2. Mesh Geometry in GAMBIT 3. Specify Boundary Types in GAMBIT 4. Set Up Problem in FLUENT 5. Solve! 6. Analyze Results 7. Refine Mesh Problem 1 Problem 2

Problem Specification

Consider fluid flowing through a circular pipe of contant cross-section. The pipe diameter D=0.2 m and length L=8 m. The inlet velocity Vin=1 m/ s. Consider the velocity to be constant over the inlet cross-section. The fluid exhausts into the ambient atmosphere which is at a pressure of 1 atm. Take density =1 kg/ m3 and coefficient of viscosity = 2 x 10-3 kg/(ms). The Reynolds number Re based on the pipe diameter is

where Vavg is the average velocity at the inlet, which is 1m/s in this case. Solve this problem using FLUENT. Plot the centerline velocity, wall skin-friction coefficient, and velocity profile at the outlet. Validate your results. Note: The values used for the inlet velocity and flow properties are chosen for convenience rather than to reflect reality. The key parameter value to focus on is the Reynolds no.

Preliminary AnalysisWe expect the viscous boundary layer to grow along the pipe starting at the inlet. It will eventually grow to fill the pipe completely (provided that the pipe is long enough). When this happens, the flow becomes fully-developed and there is no variation of the velocity profile in the axial direction, x (see figure below). One can obtain a closed-form solution to the governing equations in the fully-developed region. You should have seen this in the Introduction to Fluid Mechanics course. We will compare the numerical results in the fully-developed region with the corresponding analytical results. So it's a good idea for you to go back to your textbook in the Intro course and review the fully-developed flow analysis. What are the values of centerline velocity and friction factor you expect in the fully-developed region based on the analytical solution? What is the solution for the velocity profile?

We'll create the geometry and mesh in GAMBIT which is the preprocessor for FLUENT, and then read the mesh into FLUENT and solve for the flow solution.

Step 1: Create Geometry in GAMBITIf you would prefer to skip the mesh generation steps, you can create a working directory (see below), download the mesh from here (right click and save as pipe.msh) into the working directory and go straight to step 4.Strategy for Creating Geometry

In order to create the rectangle, we will first create the vertices at the four corners. We'll then join adjacent vertices by straight lines to form the "edges" of the rectangle. Lastly, we'll create a "face" corresponding to the area enclosed by the edges. In Step 2, we'll mesh the face i.e. the rectangle. Note that in 3D problems, you'll have to form a "volume" from faces. So the hierarchy of geometric objects in GAMBIT is vertices -> edges -> faces -> volumes.Create a Working Directory

Create a folder called pipe in a convenient location. We'll use this as the working folder in which files created during the session will be stored. Note for ACCEL computer lab users: Each user gets his/her own 100 MB of disk space under S: at ACCEL. You can put your files in S: and it'll be accessible from any computer. This is where you should put files that you want to keep and access later on.

Start GAMBIT

Start your command prompt. Start > Programs > Lab Apps > Fluent Inc Products > Gambit 2.3.16 > Gambit 2.3.16 This brings up the GAMBIT startup window. Click Browse and select the folder that you just created. Enter -id pipe in the options box to tell GAMBIT to use pipe as the default file prefix, then click Run.

In Windows, the Exceed X-server starts up before the GAMBIT interface comes up. Exceed is a third-party application needed to render the interface in Windows (GAMBIT was originally developed under Unix). To make best use of screen real estate, move the windows and resize them so that you approximate this screen arrangement. This way you can read instructions in the browser window and implement them in GAMBIT. You can resize the text in the browser window to your taste and comfort: In Internet Explorer: Menubar > View > Text Size, then choose the appropriate font size. In Netscape: Menubar > View > Increase Font or Menubar > View > Decrease Font. The GAMBIT Interface consists of the following:y

Main Menu Bar:

Note that the job name pipe appears after ID: in the title bar of the Utility Menu.

y

Operation Toolpad:

y

We'll more or less work our way across the Operation Toolpad as we go through the solution steps. Notice that as each of the top buttons is selected, a different "sub-pad" appears. The Geometry sub-pad is shown in the above snaphot. Global Control Toolpad:

The Global Control Toolpad has options such as Fit to Screen and Undo that are very handy during the course of geometry and mesh creation.

y

GAMBIT Graphics:

y

This is the window where the graphical results of operations are displayed. GAMBIT Description Panel:

y

The Description Panel contains descriptions of buttons or objects that the mouse is pointing to. Move your mouse over some buttons and notice the corresponding text in the Description Panel. GAMBIT Transcript Window:

This is the window to which output from GAMBIT commands is written and which provides feedback on the actions taken by GAMBIT as you perform operations. If, at some point, you are not sure you clicked the right button or entered a value correctly, this is where to look to figure out what you just did. You can click on the arrow button in the upper right hand corner to make the Transcript window full-sized. You can click on the arrow again to return the window to its original size. Go ahead, give this a try.

Select Solver

If the window titlebar does not say the solver is FLUENT 5/6, then you need to specify:

Main Menu > Solver > FLUENT 5/6 Verify this has been done by looking in the Transcript Window where you should see:

The boundary types that you'll be able to select in the third step depends on the solver selected. We can assume that the flow is axisymmetric. The problem domain is:

where r and x are the radial and axial coordinates, respectively.Strategy for creating geometry

We will put the origin of the coordinate system at the lower left corner of the rectangle. The coordinates of the corners are shown in the figure below:

We will first create four vertices at the four corners and join adjacent vertices to get the edges of the rectangle. We will then form a face that covers the area of the rectangle.Create Vertices

Find the buttons described below by pointing the mouse at each of the buttons and reading the Description Window. Operation Toolpad > Geometry Command Button Vertex Notice that the Create Vertex button has already been selected by default. After you select a button under a sub-pad, it becomes the default when you go to a different sub-pad and then come back to the sub-pad. Create the vertex at the lower-left corner of the rectangle: Next to x:, enter value 0. Next to y:, enter value 0. Next to z:, enter value 0 (these values should be defaults). Click Apply. This creates the vertex (0,0,0) which is displayed in the graphics window. > Vertex Command Button > Create

In the Transcript window, GAMBIT reports that it "Created vertex: vertex.1". The vertices are numbered vertex.1, vertex.2 etc. in the order in which they are created. Repeat this process to create three more vertices: Vertex 2: (0,0.1,0) Vertex 3: (8,0.1,0) Vertex 4: (8,0,0) Note that for a 2D problem, the z-coordinate can always be left to the default value of 0. Operation Toolpad > Global Control > Fit to Window Button

This fits the four vertices of the rectangle we have created to the size of the Graphics Window.

(Click picture for larger image)Create Edges

We'll now connect appropriate pairs of vertices to form edges. To select any entity in GAMBIT, hold down the Shift key and click on the entity. Operation Toolpad > Geometry Command Button Edge Select two vertices that make up an edge of this rectangle by holding down the Shift button and clicking on the corresponding vertices. As each vertex is picked, it will appear red in the Graphics Window. Then let go of the Shift button. We can check the selected vertices by clicking on the up-arrow next to Vertices:. > Edge Command Button > Create

This will bring up a window containing the vertices that have been selected. Vertices can be moved from the Available and Picked lists by selecting them and then pressing the left or right arrow buttons.

After the correct vertices have been selected, click Close, then click Apply in the Create Straight Edge window. Repeat this process to create a rectangle.

(Click picture for larger image)Create Face

Operation Toolpad > Geometry Command Button Face

> Face Command Button

> Form

To form a face out of the area enclosed by the four lines, we need to select the four ledges that enclose this area. This can be done by holding down the Shift key, clicking on each line (notice

that the currently selected line appears red), and then releasing the Shift key after all four lines have been selected. Alternatively, an easier way to do this would be to click on the up arrow next to edges:

This will bring up the Edge List window. Click on All-> to select all of the edges at once. Click Close.

Click Apply to create the face.

Step 2: Mesh Geometry in GAMBITWe'll now create a mesh on the rectangular face with 100 divisions in the axial direction and 5 divisions in the radial direction. We'll first mesh the four edges and then the face. The desired grid spacing is specified through the edge mesh.Mesh Edges Operation Toolpad > Mesh Command Button > Edge Command Button > Mesh Edges

Shift-click or bring up the Edge List window and select both the vertical lines. If this is difficult, one can zoom in on an edge by holding down the Ctrl button, clicking and dragging the mouse to specify an area to zoom in on, and releasing the Ctrl button. To return to the main view, click on the Global Control Toolpad > Fit to Window Button again. You can also hold down Ctrl and double-click in the window to zoom out to a fitting window. To pan the view, hold down the middle mouse button and drag the mouse.

Once a vertical edge has been selected, select Interval Count from the drop down box that says Interval Size in the Mesh Edges Window. Then, in the box to the left of this combo box, enter 5 for the interval count.

Click Apply. Nodes appear on the edges showing that they are divided into 5.

(Click picture for larger image) Repeat the same process for the horizontal edges, but with an interval count of 100. Now that the edges are meshed, we are ready to create a 2-D mesh for the face.Mesh Face Operation Toolpad > Mesh Command Button > Face Command Button > Mesh Faces

Shift left-click on the face or use the up arrow next to Faces to select the face. Click Apply.

(Click picture for larger image)

Step 3: Specify Boundary Types in GAMBIT

Create Boundary Types

We'll next set the boundary types in GAMBIT. The left edge is the inlet of the pipe, the right edge the outlet, the top edge the wall, and the bottom edge the axis.Operation Toolpad > Zones Command Button > Specify Boundary Types Command Button

This will bring up the Specify Boundary Types window on the Operation Panel. We will first specify that the left edge is the inlet. Under Entity:, pick Edges so that GAMBIT knows we want to pick an edge (face is default).

Now select the left edge by Shift-clicking on it. The selected edge should appear in the yellow box next to the Edges box you just worked with as well as the Label/Type list right under the Edges box.

Next to Name:, enter inlet. For Type:, select VELOCITY_INLET. (Note: Sometimes all the items in a dropdown menu will not be visible. If you cannot find the VELOCITY_INLET option in the Type menu, try maximizing the window. If it is still not visible, try auto-hiding your taskbar. Right-click on the taskbar and go to properties.) Click Apply. You should see the new entry appear under Name/Type box near the top of the window.

Repeat this process for the other three edges according to the following table:Edge Position Name Type

Left Right Top Bottom

inlet outlet wall centerline

VELOCITY_INLET PRESSURE_OUTLET WALL AXIS

You should have the following edges in the Name/Type list when finished:

Save and Export Main Menu > File > Save Main Menu > File > Export > Mesh...

Type in pipe.msh for the File Name:. Select Export 2d Mesh since this is a 2 dimensional mesh. Click Accept. Check pipe.msh has been created in your working directory (the box will be filled in red).

Step 4: Set Up Problem in FLUENTLaunch Fluent 6.0 Lab Apps > FLUENT 6.3.26

Select 2ddp from the list of options and click Run. The "2ddp" option is used to select the 2-dimensional, double-precision solver. In the doubleprecision solver, each floating point number is represented using 64 bits in contrast to the singleprecision solver which uses 32 bits. The extra bits increase not only the precision but also the range of magnitudes that can be represented. The downside of using double precision is that it requires more memory.Import Grid Main Menu > File > Read > Case...

Navigate to the working directory and select the pipe.msh file. This is the mesh file that was created using the preprocessor GAMBIT in the previous step. FLUENT reports the mesh statistics as it reads in the mesh:

Check the number of nodes, faces (of different types) and cells. There are 500 quadrilateral cells in this case. This is what we expect since we used 5 divisions in the radial direction and 100 divisions in the axial direction while generating the grid. So the total number of cells is 5*100 = 500. Also, take a look under zones. We can see the four zones inlet, outlet, wall, and centerline that we defined in GAMBIT.Check and Display Grid

First, we check the grid to make sure that there are no errors.Main Menu > Grid > Check

Any errors in the grid would be reported at this time. Check the output and make sure that there are no errors reported. Check the grid size:Main Menu > Grid > Info > Size

The following statistics should appear:

Display the grid:Main Menu > Display > Grid...

Make sure all 5 items under Surfaces is selected. Then click Display. The graphics window opens and the grid is displayed in it. You can now click Close in the Grid Display menu to get back some desktop space. The graphics window will remain. Some of the operations available in the graphics window are: Translation: The grid can be translated in any direction by holding down the Left Mouse Button and then moving the mouse in the desired direction. Zoom In: Hold down the Middle Mouse Button and drag a box from the Upper Left Hand Corner to the Lower Right Hand Corner over the area you want to zoom in on. Zoom Out: Hold down the Middle Mouse Button and drag a box anywhere from the Lower Right Hand Corner to the Upper Left Hand Corner. Use these operations to zoom into the grid to obtain the view shown below. Note: The zooming operations cannot be performed without a middle mouse button.

(Click picture for larger image)

You can also look at specific parts of the grid by choosing the boundaries you wish to view under Surfaces (click to select and click again to deselect a specific boundary). Click Display again when you have selected your boundaries. For example, the wall, outlet, and centerline boundaries have been selected in the following view:

These options will display the graph:

(Click picture for larger image) For convenience, the button next to Surfaces selects all of the boundaries while the deselects all of the boundaries at once.

Close the Grid Display Window when you are done.Define Solver Properties Main Menu > Define > Models > Solver

Choose Axisymmetric under Space. We'll use the defaults of pressure based ("segregated", in older versions) solver, implicit formulation, steady flow and absolute velocity formulation. Click OK.

Main Menu > Define > Models > Viscous

Laminar flow is the default. So we don't need to change anything in this menu. Click Cancel.Main Menu > Define > Models > Energy

For incompressible flow, the energy equation is decoupled from the continuity and momentum equations. We need to solve the energy equation only if we are interested in determining the temperature distribution. We will not deal with temperature in this example. So leave the Energy Equation unselected and click Cancel to exit the menu.Define Material Properties Main Menu > Define > Materials...

Change Density to 1.0 and Viscosity to 2e-3. These are the values that we specified under Problem Specification. We'll take both as constant.

Click Change/Create. Close the window.Define Operating Conditions Main Menu > Define > Operating Conditions...

For all flows, FLUENT uses gauge pressure internally. Any time an absolute pressure is needed, it is generated by adding the operating pressure to the gauge pressure. We'll use the default value of 1 atm (101,325 Pa) as the Operating Pressure. Click Cancel to leave the default in place.

Define Boundary Conditions

We'll now set the value of the velocity at the inlet and pressure at the outlet.Main Menu > Define > Boundary Conditions...

We note here that the four types of boundaries we defined are specified as zones on the left side of the Boundary Conditions Window. The centerline zone should be selected by default. Make sure it is, then make sure the Type of this boundary is selected as axis and click Set.... Notice that there is nothing to set for the axis. Click OK. Move down the list and select inlet under Zone. Note that FLUENT indicates that the Type of this boundary is velocity-inlet. Recall that the boundary type for the "inlet" was set in GAMBIT.

If necessary, we can change the boundary type set previously in GAMBIT in this menu by selecting a different type from the list on the right.

Click on Set.... Enter 1 for Velocity Magnitude. Click OK. This sets the velocity of the fluid entering at the left boundary. The (absolute) pressure at the outlet is 1 atm. Since the operating pressure is set to 1 atm, the outlet gauge pressure = outlet absolute pressure - operating pressure = 0. Choose outlet under Zone. The Type of this boundary is pressure-outlet. Click on Set.... The default value of the Gauge Pressure is 0. Click Cancel to leave the default in place. Lastly, click on wall under Zones and make sure Type is set as wall. Click on each of the tabs and note that only momentum can be changed under the current conditions. This will not be so under later exercises so make a note of the location of these options. Click OK. Click Close to close the Boundary Conditions menu.

Step 5: Solve!We'll use a second-order discretization scheme.Main Menu > Solve > Controls > Solution...

Change Momentum to Second Order Upwind.

Click OK.Set Initial Guess

Initialize the flow field to the values at the inlet:Main Menu > Solve > Initialize > Initialize...

In the Solution Initialization menu that comes up, choose inlet under Compute From. The Axial Velocity for all cells will be set to 1 m/s, the Radial Velocity to 0 m/s and the Gauge Pressure to 0 Pa. These values have been taken from the inlet boundary condition.

Click Init. This completes the initialization. Close the window.

Set Convergence Criteria

FLUENT reports a residual for each governing equation being solved. The residual is a measure of how well the current solution satisfies the discrete form of each governing equation. We'll iterate the solution until the residual for each equation falls below 1e-6.Main Menu > Solve > Monitors > Residual...

Change the residual under Convergence Criterion for continuity, x-velocity, and y-velocity, all to 1e-6. Also, under Options, select Plot. This will plot the residuals in the graphics window as they are calculated.

Click OK. This completes the problem specification. Save your work:Main Menu > File > Write > Case...

Type in pipe.cas for Case File. Click OK. Check that the file has been created in your working directory. If you exit FLUENT now, you can retrieve all your work at any time by reading in this case file.Iterate Until Convergence

Start the calculation by running 100 iterations:

Main Menu > Solve > Iterate...

In the Iterate Window that comes up, change the Number of Iterations to 100. Click Iterate. The residuals for each iteration is printed out as well as plotted in the graphics window as they are calculated.

(Click picture for larger image) The residuals fall below the specified convergence criterion of 1e-6 in about 46 iterations. Actual number of convergence steps may vary slightly.

Save the solution to a data file:Main Menu > File > Write > Data...

Enter pipe.dat for Data File and click OK. Check that the file has been created in your working directory. You can retrieve the current solution from this data file at any time.

Step 6: Analyze ResultsCenterline Velocity

We'll plot the variation of the axial velocity along the centerline.Main Menu > Plot > XY Plot...

Make sure that Position on X Axis is set under Options, and X is set to 1 and Y to 0 under Plot Direction. This tells FLUENT to plot the x-coordinate value on the abscissa of the graph. Under Y Axis Function, pick Velocity... and then in the box under that, pick Axial Velocity. Please note that X Axis Function and Y Axis Function describe the x and y axes of the graph, which should not be confused with the x and y directions of the pipe. Finally, select centerline under Surfaces since we are plotting the axial velocity along the centerline. This finishes setting up the plotting parameters.

Click Plot. This brings up a plot of the axial velocity as a function of the distance along the centerline of the pipe.

(Click picture for larger image)

In the graph that comes up, we can see that the velocity reaches a constant value beyond a certain distance from the inlet. This is the fully-developed flow region. Change the axes extents: In the Solution XY Plot window, click on Axes.... Under Options, deselect Auto Range. The boxes under Range should now be activated. Select X under Axis. Enter 1 for Minimum and 3 for Maximum under Range. We'll turn on the grid lines to help estimate where the flow becomes fully developed. Check the boxes next to Major Rules and Minor Rules under Options. Click Apply.

Now, pick Y under Axis and once again deselect Auto Range under Options, then enter 1.8 for Minimum and 2.0 for Maximum under Range. Also select Major Rules and Minor Rules to turn on the grid lines in the Y direction. We have now finished specifying the range for each axes, so click Apply and then Close. Go back to the Solution XY Plot menu and click Plot to replot the graph with the new axes extents. We can see that the fully-developed region starts at around x=3m and the centerline velocity in this region is 1.93 m/s.

(Click picture for larger image)Saving the Plot

Save the data from this plot: In the Solution XY Plot Window, check the Write to File box under Options. The Plot button should have changed to Write.... Click on Write.... Enter vel.xy as the XY File Name and click OK. Check that this file has been created in your FLUENT working directory. Now, save a picture of the plot: Leave the Solution XY Plot Window and the Graphics Window open and in the main FLUENT window click on:File > Hardcopy ...

Under Format, choose one of the following three options: EPS - if you have a postscript viewer, this is the best choice. EPS allows you to save the file in vector mode, which will offer the best viewable image quality. After selecting EPS, choose Vector from under File Type. TIFF - this will offer a high resolution image of your graph. However, the image file generated will be rather large, so this is not recommended if you do not have a lot of room on your storage device. JPG - this is small in size and viewable from all browsers. However, the quality of the image is not particularly good. After selecting your desired image format and associated options, click on Save...

Enter vel.eps, vel.tif, or vel.jpg depending on your format choice and click OK. Verify that the image file has been created in your working directory. You can now copy this file onto a disk or print it out for your records.Coefficient of Skin Friction

FLUENT provides a large amount of useful information in the online help that comes with the software. Let's probe the online help for information on calculating the coefficient of skin friction.Main Menu > Help > User's Guide Index...

Click on S in the links on top and scroll down to skin friction coefficient. Click on the second 965 link (normally, you would have to go through each of the links until you find what you are looking for). We can see an excerpt on the skin coefficient as well as the equation for calculating it. Click on the link for Reference Values panel, which tells us how to set the reference values used in calculating the skin coefficient.

Set the reference values:Main Menu > Report > Reference Values...

Select inlet under Compute From to tell FLUENT to calculate the reference values from the values at inlet. Check that density is 1 kg/m3 and velocity is 1 m/s. (Alternately, you could have just typed in the appropriate values). Click OK.

Go back to the Solution XY Plot menu. Uncheck Write to File under Options since we want to plot to the window right now. We can leave the other Options and Plot Direction as is since we are still plotting against the x distance along the pipe. Under the Y Axis Function, pick Wall Fluxes..., and then Skin Friction Coefficient in the box under that. Under Surfaces, select wall and unselect centerline by clicking on them. Reset axes ranges: Go to Axes... and re-select Auto-Range for the Y axis. Click Apply. Set the range of the X axis from 1 to 8 by selecting X under Axis, entering 1 under Minimum, and 8 under Maximum in the Range box (remember to de-select Auto-Range first if it is checked). Click Apply, Close, and then Plot in the Solution XY Plot Window.

(Click picture for larger image) We can see that the fully developed region is reached at around x=3.0m and the skin friction coefficient in this region is around 1.54. Compare the numerical value of 1.54 with the theoretical, fully-developed value of 0.16. Save the data from this plot: Pick Write to File under Options and click Write.... Enter cf.xy for XY File and click OK.Velocity Profile

We'll next plot the velocity at the outlet as a function of the distance from the center of the pipe. To do this, we have to set the y axis of the graph to be the y axis of the pipe (the radial direction). To plot the position variable on the y axis of the graph, uncheck Position on X Axis under Options and choose Position on Y Axis instead. To make the position variable the radial distance from the centerline, under Plot Direction, change X to 0 and Y to 1. To plot the axial velocity on the x axis of the graph, for X Axis Function, pick Velocity... and Axial Velocity under that. Since we want to plot this at the outlet boundary, pick outlet under Surfaces. Change both the x and y axes to Auto-Range. (Don't forget to click apply before selecting a different axis) Uncheck Write to File under Options so that we can see the graph. Click Plot.

(Click picture for larger image) Does this look like a parabolic profile? Save the data from this plot: Pick Write to File under Options and click Write.... Enter profile.xy for XY File and click OK. To see how the velocity profile changes in the developing region, let us add the profiles at x=0.6m (x/D=3) and x=0.12m (x/D=6) to the above plot. First, create a line at x=0.6m using the Line/Rake tool:Main Menu > Surface > Line/Rake

We'll create a straight line from (x0,y0)=(0.6,0) to (x1,y1)=(0.6,0.1). Select Line Tool under Options. Enter x0=0.6, y0=0, x1=0.6, y1=0.1. Enter line1 under New Surface Name. Click Create.

To see the line just created, selectMain Menu > Display > Grid...

Note that line1 appears in the list of surfaces. Select all surfaces except default-interior. Click Display. This displays all surfaces but not the mesh cells. Zoom into the region near the inlet to see the line created at x=0.6m. (Click here to review the zoom functionality discussion in step 4.) line1 is the white vertical line to the right in the figure below.

Similarly, create a vertical line called line2 at x=1.2; (x0,y0)=(1.2,0) to (x1,y1)=(1.2,0.1) in this case. Display it in the graphics window to check that it has been created correctly. Now we can plot the velocity profiles at x=0.6m (x/D=3) and x=0.12m (x/D=6) along with the outlet profile. In the Solution XY plot menu, use the same settings as above. Under Surfaces, in addition to outlet, select line1 and line2. Make sure Node Values is selected under Options. Click Plot. Your symbols might be different from the ones below. You can change the symbols and line styles under the Curves... button. Click on Help in the Curves menu if you have problems figuring out how to change these settings.

The profile three diameters downstream is fairly close to the fully-developed profile at the outlet. If you redo this plot using the fine grid results in the next step, you'll see that this is not actually the case. The coarse grid used here doesn't capture the boundary layer development properly and underpredicts the development length. In FLUENT, you can choose to display the computed cell-center values or values that have been interpolated to the nodes. By default, the Node Values option is turned on, and the interpolated values are displayed. Node-averaged data curves may be somewhat smoother than curves for cell values.Velocity Vectors

One can plot vectors in the entire domain, or on selected surfaces. Let us plot the velocity vectors for the entire domain to see how the flow develops downstream of the inlet.Main Menu > Display > Vectors... > Display

Zoom into the region near the inlet. (Click here to review the zoom functionality discussion in step 4.) The length and color of the arrows represent the velocity magnitude. The vector display is more intelligible if one makes the arrows shorter as follows: Change Scale to 0.4 in the Vectors menu and click Display. You can reflect the plot about the axis to get an expanded sectional view: Main Menu > Display > Views... Under Mirror Planes, only the axis surface is listed since that is the only symmetry boundary in the present case. Select axis and click Apply. Close the Views window.

The velocity vectors provide a picture of how the flow develops downstream of the inlet. As the boundary layer grows, the flow near the wall is retarded by viscous friction. Note the sloping arrows in the near wall region close to the inlet. This indicates that the slowing of the flow in the near-wall region results in an injection of fluid into the region away from the wall to satisfy mass conservation. Thus, the velocity outside the boundary layer increases. By default, one vector is drawn at the center of each cell. This can be seen by turning on the grid in the vector plot: Select Draw Grid in the Vectors menu and then click Display in the Grid Display as well as the Vectors menus. Velocity vectors are the default, but you can also plot other vector quantities. See section 27.1.3 of the user manual for more details about the vector plot functionality.

Step 7: Refine MeshIt is very important to assess the dependence of your results on the mesh used by repeating the same calculation on different meshes and comparing the results. We will re-do the previous calculation on a 100x10 mesh and compare the results with the 100x5 mesh used previously. If you prefer to skip the GAMBIT steps for modifying the mesh, download the 100x10 mesh (by right-clicking on the link) and go directly to the FLUENT analysis discussed below.Modify Mesh in GAMBIT

The 100x5 mesh is saved as pipe.dbs in your working folder. Copy and paste the file in the same folder. Rename Copy of pipe.dbs to pipe2.dbs. We will work with pipe2.dbs in order to retain pipe.dbs as is. Launch GAMBIT and browse to where pipe2.dbs is saved. Notice that under Session ID, pipe2 is now listed. Select this and click Run. Note in the main menu bar that pipe2 is the ID of this job. Files created during this session will have that prefix. We will delete the face mesh, modify the edge meshes for the vertical edges and remesh the face. To delete the original face mesh, chooseOperation Toolpad > Mesh Command Button > Face Command Button > Delete Face Meshes

In the Delete Face Meshes Window that comes up, uncheck the Remove unused lower mesh box. This tells GAMBIT to remove the face mesh only and keep the edge meshes associated with the face mesh. Since we will be changing the mesh on only two edges of the rectangle, there is no need to redo the meshes for all four edges. Select the only face of the rectangle by shift-clicking on it and then click Apply.

Modify Edge Meshes

To change the number of divisions on the vertical edges from 5 to 10, choose:Operation Toolpad > Mesh Command Button > Edge Command Button > Mesh Edges

Select the two vertical edges by holding down the Shift button, clicking on each in turn, and then releasing the Shift button. Select Interval count from the box under Spacing that says Interval size. Change the number in the box next to the Interval count box from 5 to 10. Make sure that the Remove old mesh box is checked under Options. This will make sure that the old edge meshes are erased before the new edge meshes are created. Click Apply.

Remember that you can zoom in by holding down Ctrl, dragging a box across the area you want to zoom in on, and then releasing Ctrl. Do this now and make sure that the vertical edges have 10 divisions.

(Click image for larger picture)Recreate Face Mesh Operation Toolpad > Mesh Command Button > Face Command Button > Mesh Faces

Shift-click on the face in the Graphics Window to select it. Click Apply.

(Click here for larger picture)Save & Export Main Menu > File > Save Main Menu > File > Export > Mesh...

Type in pipe2.msh for the File Name:. Select Export 2d Mesh option. Click Accept.

Finer Mesh Analysis

Repeat steps 4 and 5 of this tutorial with the 100x10 mesh (a tad on the repetitious side but consider it good practice). One you obtain the solution, plot the variation of the centerline velocity along the x-direction as described in step 6. Compare this result with that obtained on the previous mesh which is stored in the vel.xy file created earlier. To do this, after centerline velocity has been plotted, click on Load File... in the Solution XY Plot window. Navigate to your working folder if necessary and click on vel.xy and OK. Click Plot. In the graphics window, we can see both of the lines plotted in the same window. Adjust the axes so that you can zoom in on the beginning of the fully developed region.

(Click image for larger picture) In the centerline velocity plot above, the white and red symbols represent the results on the 100x10 mesh and 100x5 meshes, respectively. The centerline velocity in the fully-developed region for the finer mesh is 1.98 m/s. This value agrees better with the analytical value of 2 m/s that the value of 1.93 m/s obtained on the coarser mesh. Save the data for this plot as vel2.xy. The velocity result gets more accurate on refining the mesh as expected. Plot the skin friction coefficient as described in step 6. Compare the result with that obtained on the 100x5 mesh by loading it from cf.xy.

(Click here for larger image) The finer mesh provides a skin friction coefficient of 0.159 in the fully-developed region, which is much closer to the theoretical value of 0.16 than the corresponding coarser mesh value of 0.154. Save the data for this plot as cf2.xy. Similarly, plot the velcoity profile at the outlet and compare with the coarser grid result in out.xy. The two results compare well with the greatest deviation occurring near the centerline. Save the data for this plot as out2.xy.

(Click picture for larger image) If you repeat the calculation on a 100x20 mesh, you'll see that the results on the two finest meshes are grid-independent to a high level of accuracy. In the plots below, the white, red and green symbols correspond to the 100x20, 100x10 and 100x5 meshes, respectively.

Velocity along centerline:

(Click picture for larger image) Skin Coefficient:

(Click picture for larger image)

Outlet Velocity:

(Click picture for larger image)

Problem 1Problem

a) Consider the problem solved in this tutorial. At the exit of the pipe, we can define the error in the calculation of the centerline velocity as:

where Uc is the centerline value from FLUENT and Uexact is the exact analytical value for fullydeveloped laminar pipe flow. We expect the error to take the form:

where the coefficient K and the power p depend upon the method . Consider the solutions obtained on the 100x5, 100x10, and 100x20 meshes. Using MATLAB, perform a linear least squares fit of:

to obtain the coefficients K and p. You can look up the value of Uexact from any introductory textbook in fluid mechanics such as Fluid Mechanics by F. White. Explain why your values make sense. b) Repeat the above exercise using the "first-order upwind" scheme for the momentum equation. Contrast the value of p obtained in this case with the previous one and explain your results briefly (2-3 sentences).

Hints

Note that the first or second order discretization applies only to the convective terms in the Navier-Stokes equations. The viscous terms are always second order accurate.

Problem 2Problem

On your finest mesh (100x20), rerun the FLUENT calculation for Reynolds numbers 200 and 500 using the "second-order upwind" scheme. Note: change the Reynolds number by adjusting the molecular viscosity . Plot the centerline velocity and skin friction as a function of axial distance for Re = 100 (previous problem), 200, and 500. Plot all three cases on the same graph for comparsion. Briefly explain the trend you observe as the Reynolds number increases.Hints

If you've saved the 100x20 mesh in step 7, you can load it into FLUENT again without having to recreate it in GAMBIT. Solve for for each of the Reynolds number first and then think about what steps need to be changed.Solution

Your solution should look something like the plots below: Centerline Velocity

(Click picture for larger image)

Skin Coefficient

(Click picture for larger image)

Fluent 6.0: Turbulent Pipe FlowAuthor: Rajesh Bhaskaran E-mail: [email protected] Problem Specification 1. Create Geometry in GAMBIT 2. Mesh Geometry in GAMBIT 3. Specify Boundary Types in GAMBIT 4. Set Up Problem in FLUENT 5. Solve! 6. Analyze Results 7. Refine Mesh Problem 1

Problem Specification

Let's revisit the pipe flow example considered in the previous exercise. As before, the inlet velocity is 1 m/s, the fluid exhausts into the ambient atmosphere and density is 1 kg/m3. For = 2 x 10-5 kg/(ms), the Reynolds no. based on the pipe diameter and average velocity at the inlet is

At this Reynolds number, the flow is usually completely turbulent. A turbulent flow exhibits small-scale fluctuations in time. It is usually not possible to resolve these fluctuations in a CFD calculation. So the flow variables such as velocity, pressure, etc. are time-averaged. Unfortunately, the time-averaged governing equations are not closed i.e. they contain fluctuating quantities which need to be modeled using a turbulence model. No turbulence model is currently available that is valid for all types of flows and so it is necessary to choose and fine-tune a model for particular classes of flows. In this exercise, you'll be turned loose on variants of the k- model. But in the real world, tread with great caution: you should evaluate the validity of your calculations using a turbulence model very carefully (which, ahem, means that there is no getting away from studying fluid dynamics concepts and numerical methods very carefully). FLUENT should not be used as a black box. The k- models consist of two differential equations: one each for the turbulent kinetic energy k and turbulent dissipation . These two equations have to be solved along with the time-averaged continuity, momentum and energy equations. So turbulent flow calculations are much more difficult and time-consuming than laminar flow calculations. This is an exercise to whet your appetite for turbulent flow calculations.

Step 1: Create Geometry in GAMBITIf you would prefer to skip the mesh creation steps, you can download the mesh here (right click and select Save As...) and go straight to step 4. Since the flow is axisymmetric, the geometry is a rectangle as in the Laminar Pipe Flow tutorial. We will first use a 100x30 mesh (i.e. 100 divisions in the axial direction and 30 divisions in the radial direction). We could create this mesh from scratch, as in the Laminar Pipe Flow tutorial, but instead, we will modify the previous 100x5 to get the 100x30 mesh. This will introduce you to the art of modifying meshes in GAMBIT.

Step 2: Mesh Geometry in GAMBITLaunch GAMBIT

Create a folder called pipe2 at a convenient location to use as your working folder. Copy your pipe.dbs file containing the 100x5 mesh from the Laminar Pipe Flow tutorial to this folder. If you don't have this file, here's a copy (right-click and select Save As...). Rename this file as pipe100x30.dbs. We'll modify this file to obtain the mesh for the turbulent pipe flow simulation.

Start GAMBIT and load pipe100x30. (Refer to step 1 of the Laminar Pipe Flow tutorial if you've forgotten how to do this.) Recall that GAMBIT will use the id pipe100x30 as the default prefix for all files created during this session. To make best use of screen real estate, resize the GAMBIT and browser windows so that you approximate this screen arrangement. This way you can read instructions in the browser window and implement them in GAMBIT. The mesh from the previous tutorial should be displayed. To fit the mesh to the size of the window, select: Global Control > Fit to WindowDelete Previous Face Mesh

The first step we have to do is remove the old face mesh. Recall that the face mesh is built on top of meshed edges, thereby forming the grid. In this case, we don't want to remove the underlying edge meshes. So to delete only the face mesh, select: Operation Toolpad > Mesh Command Button Meshes Since we only have one face, shift-click any edge of the bounding rectangle to select the face mesh we want to delete. The face you have selected should become red and the name of the face listed in the Delete Face Meshes window in the drop down box. Now, because we don't want to delete the edge meshes, uncheck the Remove unused lower mesh box. > Face Command Button > Delete Face

Click Apply. Check that the face mesh has been removed in the GAMBIT Graphics Window.Remesh Edges

Since we are still going to use 100 divisions for the horizontal edges, we only need to remesh the vertical edges.

To resolve the much higher gradient near the wall for a turbulent flow, we will use smaller grid spacing near the wall by employing grid stretching. For each vertical edge, we will specify the division length next to the wall to be 0.001 and the total number of divisions to be 30. In GAMBIT, each edge has a direction associated with it as shown by an arrow. We will set this arrow to point away from the wall. Then the division next to the wall becomes the "First Length" and the division next to the axis becomes the "Last Length". We'll specify the "First Length" to be 0.001 and the total number of divisions to be 30 for the edge; GAMBIT will automatically calculate the appropriate value for the "Last Length". Operation Toolpad > Mesh Command Button > Edge Command Button

Select the vertical edges by shift-clicking on each of them. Notice the red arrow that appears on the edge when it is selected. Make sure these arrows are pointing down (towards the axis and away from the wall). If both of these arrows are pointing in the wrong direction, you can reverse them by clicking Reverse next to Pick with links. However, if only one of the edges needs to be reversed, you can do that by shift-middle clicking on that edge. You'll have to zoom in to be able to do this. (Recall that you can zoom in by holding down the Ctrl key and then dragging a box with your left mouse button. Double-click with the middle mouse button to go back to the last view.) For Type in the Mesh Edges menu, select First Length from the drop down box. Next to Length, type in 0.001. We want 30 divisions on each of the vertical edges; so select Interval Count from the drop down box under Spacing and enter 30 in the text box to its left.

Click Apply. If you zoom in on the right edge, you should see the following:

(Click picture for larger image) Note that the mesh spacing is smaller near the wall as indicated by the blue circles on the edge.Recreate Face Mesh

The next step is to recreate the face mesh on top of these edge meshes. This is the same procedure as in the previous tutorial: Operation Toolpad > Mesh Command Button > Face Command Button > Mesh Faces

Shift left-click on the face and click Apply. The meshed area should look like this after zooming in:

(Click picture for larger image)

Step 3: Specify Boundary Types in GAMBITRecall that we created the following boundary types for the 100x5 mesh in the Laminar Pipe Flow tutorial:Edge Position Left Right Top Bottom Name inlet outlet wall centerline Type VELOCITY_INLET PRESSURE_OUTLET WALL AXIS

These boundary types are still retained even if the edges are remeshed since the edges themselves were not deleted. To verify this:Operation Toolpad > Zones Command Button > Specify Boundary Types

Check that the following is in the Name/Type list:

Additionally, click on show labels. You should now be able to see each of the boundary names on the respective edges in the Graphics Window. Verify that the boundary types specification is correct.Save and Export

As in the previous tutorial, we will now save and export the mesh.Main Menu > File > Save Main Menu > File > Export > Mesh...

Type in pipe100x30.msh for the File Name:. Select Export 2d Mesh since this is a twodimensional mesh. Click Accept. Check that pipe100x30.msh has been created in your working directory. Exit GAMBIT: Main Menu > File > Exit and save the session.

Step 4: Set Up Problem in FLUENTIf you have skipped the previous mesh generation steps 1-3, you can download the mesh by right-clicking on this link. Save the file as pipe100x30.msh. You can then proceed with the flow solution steps below.Launch FLUENT Lab Apps > FLUENT 6.3.26

Select 2ddp (2D, double-precision version) from the list of options and click Run.Import File Main Menu > File > Read > Case...

Navigate to your working directory and select the pipe100x30.msh file. Click OK. The following should appear in the FLUENT window:

Check the number of nodes, faces (of different types) and cells. There are 3000 quadrilateral cells in this case. This is what we'd expect since we used 30 divisions in the radial direction and

100 divisions in the axial direction while generating the grid. So the total number of cells is 30*100 = 3000. Also, take a look under zones. We can see the four zones inlet, outlet, wall, and centerline that we defined in GAMBIT.Grid

First, we check the grid to make sure that there are no errors.Main Menu > Grid > Check

Any errors in the grid would be reported at this time. Check the output and make sure that there are no errors reported. Then select:Main Menu > Grid > Info > Size

The following summary about the grid should appear:

Let's look at the grid:Main Menu > Display > Grid...

Make sure all 5 items under Surfaces are selected. Then click Display. Remember that we can zoom in using the middle mouse button. Zoom in and admire the grid. How many divisions are there in the radial direction?

(Click picture for larger image) Recall that you can look at specific components of the grid by choosing the entities you wish to view under Surfaces (click to select and click again to deselect a specific boundary). Click Display again when you have selected your boundaries. Use this feature and make sure that the boundary labels correspond to the correct geometric entities. Close the Grid Display Window when you are done.Define Solver Properties Main Menu > Define > Models > Solver

Choose Axisymmetric under Space. As in the laminar pipe flow tutorial, we'll use the defaults of segregated solver, implicit formulation, steady flow and absolute velocity formulation. Click OK.Main Menu > Define > Models > Viscous...

Choose k-epsilon (2eqn). Notice that the window expands and additional options are displayed on choosing the k-epsilon turbulence model. Under Near-Wall Treatment, pick Enhanced Wall Treatment so that we may get a more accurate result.

Click OK.Main Menu > Define > Models > Energy...

The energy equation can be turned off since this is an incompressible flow and we are not interested in the temperature. Make sure no tick mark appears next to Energy Equation.Main Menu > Define > Materials...

Change Density to 1.0 and Viscosity to 2e-5. These are the values in the Problem Specification. We'll take both as constant.

Click Change/Create.Define Operating Conditions Main Menu > Define > Operating Conditions...

Recall that for all flows, FLUENT uses the gauge pressure internally. Any time an absolute pressure is needed, it is generated by adding the operating pressure to the gauge pressure. We'll use the default value of 1 atm (101,325 Pa) as the Operating Pressure.

Click Cancel to leave the default in place.Define Boundary Conditions

We'll now set the value of the velocity at the inlet and pressure at the outlet.Main Menu > Define > Boundary Conditions...

The four types of boundaries we defined are specified as zones on the left side of the Boundary Conditions Window. Recall that we don't need to set any parameters for the centerline and wall zones. Verify this by selecting each of these two zones and clicking on Set.... Choose inlet and click on Set.... Enter 1 for Velocity Magnitude. This indicates that the fluid is coming in normal to the inlet at the rate of 1 meter per second. Select Intensity and Hydraulic Diameter next to the Turbulence Specification Method. Then enter 1 for Turbulence Intensity and 0.2 for Hydraulic Diameter. Click OK to set the velocity.

The (absolute) pressure at the outlet is 1 atm. Since the operating pressure is set to 1 atm, the outlet gauge pressure = outlet absolute pressure - operating pressure = 0. Choose outlet under Zone. The Type of this boundary is pressure-outlet. Click on Set.... The default value of the Gauge Pressure is 0. Click Cancel to leave the defaults in place. Note: Backflow in the Pressure Outlet menu refers to flow entering through an outlet boundary. This is not likely to happen in this case. So we don't have to set the backflow parameters. This completes the boundary condition specification. Close the Boundary Conditions menu.

Step 5: Solve!

We'll use second-order discretization for the momentum equation, as in the laminar pipe flow tutorial, and also for the turbulence kinetic energy equation which is part of the k-epsilon turbulence model.Main Menu > Solve > Controls > Solution...

Change Discretization for Momentum, Turbulence Kinetic Energy and Turbulence Dissipation Rate (scroll down to see it) equations to Second Order Upwind.

Click OK. The order of discretization that we just set refers to the convective terms in the equations; the discretization of the viscous terms is always second-order accurate in FLUENT. Second-order discretization generally yields better accuracy while first-order discretization yields more robust convergence. If the second-order scheme doesn't converge, you can try starting the iterations with the first-order scheme and switching to the second-order scheme after some iterations.Set Initial Guess

We'll use an initial guess that is constant over the entire flow domain and equal to the values at the inlet:Main Menu > Solve > Initialize > Initialize...

In the Solution Initialization menu that comes up, choose inlet under Compute From. The Axial Velocity for all cells will be set to 1 m/s, the Radial Velocity to 0 m/s and the Gauge Pressure to 0 Pa. The Turbulence Kinetic Energy and Dissipation Rate (scroll down to see it) values are set from the prescribed values for the Turbulence Intensity and Hydraulic Diameter at the inlet.

Click Init. Close the Solution Initialization window.Set Convergence Criteria

Recall that FLUENT reports a residual for each governing equation being solved. The residual is a measure of how well the current solution satisfies the discrete form of each governing equation. We'll iterate the solution until the residual for each equation falls below 1e-6.Main Menu > Solve > Monitors > Residual...

Notice that Convergence Criterion has to be set for the k and epsilon equations in addition to the three equations in the last tutorial. Set the Convergence Criterion to be 1e-06 for all five equations being solved. Select Print and Plot under Options. This will print as well plot the residuals as they are calculated which you will use to monitor convergence.

Click OK. This completes the problem specification. Save your work:Main Menu > File > Write > Case...

Type in pipe100x30.cas for Case File. Click OK. Check that the file has been created in your working directory.Iterate Until Convergence

Solve for 100 iterations first.Main Menu > Solve > Iterate...

In the Iterate menu that comes up, change the Number of Iterations to 100. Click Iterate. You'll find that not all residuals have fallen below 1e-6 in 100 iterations. Solve for 200 more iterations. The solution converges in a total of 229 iterations.

(Click picture for larger image) We need a larger number of iterations for convergence than in the laminar case since we have a finer mesh and are also solving additional equations from the turbulence model. Save the solution to a data file:Main Menu > File > Write > Data...

Enter pipe100x30.dat for Data File and click OK. Check that the file has been created in your working directory.

Step 6: Analyze Resultsy+

Turbulent flows are significantly affected by the presence of walls. The k-epsilon turbulence model is primarily valid away from walls and special treatment is required to make it valid near walls. The near-wall model is sensitive to the grid resolution which is assessed in the wall unit y+ (defined in section 10.9.1 of the FLUENT user manual). We'll gloss over the details for now and use the following rule of thumb: select the near-wall resolution such that y+ > 30 or < 5 for the wall-adjacent cell. Look at section 10.9, Grid Considerations for Turbulent Flow Simulations, for details. First, we need to set the reference values needed to calculate y+.Main Menu > Report > Reference Values...

Select inlet under Compute From to tell FLUENT to use values at the pipe inlet for the reference values. Check that the reference value for density is 1 kg/m3, velocity is 1 m/s, and coefficient of

viscosity is 2e-5 kg/m-s as given in the Problem Specification. These reference values will be used to non-dimensionalize the distance of the cell center from the wall to obtain the corresponding y+ values. Click OK.

Let's plot y+ values for wall-adjacent cells to check how it compares with the recommendation mentioned above.Main Menu > Plot > XY Plot...

Make sure that Position on X Axis is set under Options, that 1 is the value next to X, and 0 is the value next to Y and Z under Plot Direction. Recall that this tells FLUENT to plot the xcoordinate value on the abscissa of the graph. Pick Turbulence... under Y Axis Function and select Wall Yplus from the drop down list under that. Since we want the y+ value for cells adjacent to the wall of the pipe, choose wall under Surfaces.

Click Plot.

(Click picture for larger image) As we can see, the wall y+ value is between 1.6 and 1.9 (ignoring the anamolous at the inlet). Since this is less than 5, the near-wall grid resolution is acceptable.Save Plot

In the Solution XY Plot Window, check the Write to File box under Options. The Plot button should have changed to the Write... button. Click on Write.... Enter yplus.xy as the filename and click OK. Check that this file has been created in your FLUENT working directory.

Centerline Velocity

Under Y Axis Function, pick Velocity... and then in the box under that, pick Axial Velocity. Finally, select centerline under Surfaces since we are plotting the axial velocity along the centerline. De-select wall under Surfaces. Click on Curves... in the Solution XY Plot window. Select the solid line option under Pattern as shown below. Change Weight to 2. Select the blank option under Symbol. Click Apply and Close.

s Turn on grid lines: In the Solution XY Plot window, click on Axes.... Turn on the grid by checking the boxes Major Rules and Minor Rules under Options. Leave Auto Range checked. Click Apply. Select Y under Axis and repeat. Click Apply and Close. Uncheck Write to File. Click Plot.

(Click picture for larger image)

We can see that the fully developed region starts around x=5m with the centerline velocity becoming constant at a value of 1.195 m/s. This is quite a bit lower than the value of 2 m/s for the laminar case. Can you explain the difference based on the physical characteristics of laminar and turbulent flows? Save the data for this plot as vel.xy.Coefficient of Skin Friction

The definition of the skin friction coefficient was discussed in the laminar pipe flow tutorial. The required reference values of density and velocity have already been set when plotting y+. Go back to the Solution XY Plot Window. Under the Y Axis Function, pick Wall Fluxes..., and then Skin Friction Coefficient in the box under that. Under Surfaces, we are plotting the friction coefficient along the wall. Uncheck centerline surface. Uncheck Write to File. Click Plot.

(Click picture for larger image) We can see that the fully-developed value is 0.0085. Compare this with what you'd expect from the Moody chart. Save the data for this plot as cf.xy.Velocity Profile

We'll plot the axial velocity at the outlet as a function of the distance from the center of the pipe. Change the plot settings so that the radial distance from the axis is plotted as the ordinate: In the Solution XY Plot window, uncheck Position on X Axis under Options and choose Position on Y

Axis instead. Under Plot Direction, change X to 0 and Y to 1. For the X Axis Function i.e. the abscissa, pick Velocity... and Axial Velocity under that. Since we want to plot this at the outlet boundary, pick only outlet under Surfaces. Uncheck Write to File. Click Plot.

(Click picture for larger image) The axial velocity is maximum at the centerline and zero at the wall to satisfy the no-slip boundary condition for viscous flow. Compare qualitatively the near-wall velocity gradient normal to the wall with the laminar case. Which is larger? From this, what can you say about the relative stregths of near-wall mixing in the laminar and turbulent cases? Save this plot as profile.xy.

Step 7: Refine MeshIn order to assess the numerical accuracy of the results obtained, it is necessary to compare results on different meshes. We'll re-do the calculation on a 100x60 mesh which has twice the number of nodes in the radial direction as the 100x30 mesh. You can download the 100x60 mesh here.File > Read > Case...

Navigate to your working directory elect the pipe100x60.msh file you have created. Click OK. Display the grid. Check its size.

Finer Mesh Analysis

Repeat steps 4, 5, and 6 of this tutorial with the finer mesh. When you get to step 6 of the tutorial, plot each of the graphs as described. However, for each of the plots, overlay the corresponding result for the coarser mesh so that we may compare them. To do this, after the plotting the finer mesh result, in the Solution XY Plot Window, click on Load File.... Navigate to your working folder, click on the appropriate filename for the previous result, eg. vel.xy for centerline velocity, and click OK. Click Plot. You'll see both results plotted in the same the graphics window.

(Click picture for larger image) In the centerline velocity plot above, the white line represents the centerline velocity of the finer mesh, while the red line represents the velocity of the coarser mesh from before. As we can see, there isn't too much of a difference between the two plots. Save this plot as vel2.xy. Now, let's take a look at the coefficient of skin friction. This time, load the cf.xy file to compare against the plot. This is the coefficient of skin friction plot:

(Click picture for larger image) Once again, we can see that due to the fine degree of each mesh, there isn't much difference between the two plots. Save this plot as cf2.xy. Now, study the velocity of the outlet by plotting and comparing to the graph in profile.xy.

(Click picture for larger image) Once again, the finer mesh in this case doesn't offer much more precision than the coarser mesh. Save this plot as profile2.xy. Now let's take a look at the YPlus plot.

(Click picture for larger image) As we can see, there is a significant increase in the accuracy of the plot from the finer mesh. Save this plot as yplus2.xy. You may want to experiment with meshes of other granularities and compare their plots with the plots saved from the 100x30 and 100x60 meshes. In Problem 1, we will be looking at the effect of coarse meshes with uniform granularity.

Problem 1Problem

Use FLUENT to resolve the developing flow in a pipe (same configuration as was done in the tutorial) for a pipe Reynolds number of 10,000 on the following meshes: 100x5, 100x20 with uniform spacing in the radial direction. Plot the skin friction cf as a function of axial location for each grid. Compare the exit value with the expected value for fully developed flow (e.g., see White pgs. 345-346). Recall that a key question for the integrity of the mesh is the nondimensional value of the first nodal point:

This should be either less than 4 (so that you resolve down into the viscous sublayer) or greater than 30 (where wall functions can accurately compensate for the poorly resolved viscous sublayer). Intermediate values can lead to greater errors. Calculate the value of y1+ for each mesh; use that to help explain (briefly) the trends in the agreement that you observe.

Hints

If you no longer have the 100x5 or 100x20 mesh, you can download them here: pipe100x5.msh, pipe100x20.msh

Supersonic Flow Over a WedgeAuthor: Rajesh Bhaskaran E-mail: [email protected] Problem Specification 1. Create Geometry in GAMBIT 2. Mesh Geometry in GAMBIT 3. Specify Boundary Types in GAMBIT 4. Set Up Problem in FLUENT 5. Solve! 6. Analyze Results 7. Verify Results

Problem Specification

Consider a 15 angle wedge at zero angle of attack. The incoming flow conditions are: M1=3, p1=1 atm, T1=300 K. Use FLUENT to obtain the flowfield over the wedge. Compare the pressure coefficient on the wedge surface with the corresponding analytical result for an oblique shock.

Step 1: Create Geometry in GAMBIT

This tutorial leads you through the steps for generating a mesh in GAMBIT for a wedge geometry. The generated mesh can then be read into FLUENT for fluid flow simulation. In an external flow such as that over a wedge, we need to define a farfield boundary and mesh the region between the wedge and the farfield boundary. It is a good idea to place the farfield boundary well away from the wedge to reduce interference with the shock that we want to observe. The overall boundary is shown below.

Where ABCDE is the farfield boundary and FE is the wedge.Start GAMBIT

Create a new directory called wedge and start GAMBIT from that directory by typing gambit -id wedge at the command prompt. Under Main Menu, select Solver > FLUENT 5/6 since the mesh to be created is to be used in FLUENT 6.0.Create Vertices

The coordinates needed for the mesh are shown belowLabel A

x0

y0

z0

B C D E F

0 0.5 1.5 1.5 0.5

1.259 1.259 1.259 0.268 0

0 0 0 0 0

Using bottom up approach, we start by creating vertices of the geometry using the coordinate given. Operation Toolpad > Geometry Command Button Create Vertex Create the vertices by entering the coordinates under Global and the label under Label: Click the FIT TO WINDOW button to scale the display so that you can see all the vertices. The resulting image should look like this: > Vertex Command Button >

(Click picture for larger image)Create Faces

Now we can create the edges using the vertices created. Operation Toolpad > Geometry Command Button Create Edge > Edge Command Button >

Create the edge AB by selecting the vertex A followed by vertex B. Enter AB for Label. Click Apply. GAMBIT will create the edge. You will see a message saying something like "Created edge: AB'' in the Transcript window. Similarly, create the edges BC, CD, DE, EF, FA and CF. Click on the to select the vertices from the list and move them to the picked list. You can also hold the shift button and mouse click the vertices for selection.The resulting image should look like this.

(Click picture for larger image)Create Faces

The edges we have created can be joined together to form faces. We will need to define two faces. Operation Toolpad > Geometry Command Button Form Face This brings up the Create Face From Wireframe menu. Recall that we had selected vertices in order to create edges. Similarly, we will select edges in order to form a face. We will call two faces face1 and face2. To create the face1, select the edges AB, BC, CF, and FA. Enter face1 for the label and click Apply. GAMBIT will tell you that it has "Created face: face1'' in the transcript window. Similarly, create the face face2 by selecting CD, DE, EF and CF. We are now ready to mesh the geometry. > Face Command Button >

Step 2: Mesh Geometry in GAMBITMesh Faces

We will mesh each of the 2 faces separately to get our final mesh. Before we mesh a face, we need to define the point of distribution for each of the edges that form the face. We will use the default setting for meshing of the edge. Operation Toolpad > Mesh Command Button Edges Select the edge AB. The edge will change color and an arrow will appear on the edge. This indicates that you are ready to mesh this edge. Select interval size under Spacing. Enter 0.04 for interval size. Next we will mesh the edge BC. Select the edge BC and enter 0.04 for interval size. Do the same for edge CD and CF. Now that the appropriate edge meshes have been specified, mesh the face face1: Operation Toolpad > Mesh Command Button Faces Select the face1. The face will change color. You can use the defaults of Quad (i.e. quadrilaterals) and Map. Click Apply. The meshed face should look as follows: > Face Command Button > Mesh > Edge Command Button > Mesh

(Click picture for larger image)

Next mesh face face2 in a similar fashion. The resultant mesh should look as follws:

(Click picture for larger image) Note that for each mesh face, we only define 2 mesh edges. Gambit will automatically define the other two mesh edge for face mesh creation. Manual mesh of all edges can be done if more control of the mesh is required. Please refer to the index of the GAMBIT User Guide and look under Edge>Meshing for explanation on other type of meshing parameters.

Step 3: Specify Boundary Types in GAMBITWe'll label the boundary ABCDE as farfield, EF as wedge and AF as symmetry. Recall that these will be the names that show up under boundary zones when the mesh is read into FLUENT.Group Edges

We'll create groups of edges and then create boundary entities from these groups. First, we will group AB, BC, CD and DE together. Operation Toolpad > Geometry Command Button > Group Command Button > Create Group Select Edges and enter farfield for Label, which is the name of the group. Select the edges AB, BC, CD and DE. Note that GAMBIT adds the edge to the list as it is selected in the GUI.

Click Apply. In the transcript window, you will see the message Created group: farfield.

Similarly, create the other two groups. You should have created a total of three groups:Group Name farfield wedge symmetry Edges in Group AB,BC,CD,DE EF EF

Define Boundary Types

Now that we have grouped each of the edges into the desired groups, we can assign appropriate boundary types to these groups.Operation Toolpad > Zones Command Button > Specify Boundary Types

Under Entity, select Groups. Click on the wedge surface. Next to Name:, enter wedge. Leave the Type as WALL.

Click Apply. In the Transcript Window, you will see a message saying "Created Boundary entity: wedge". Similarly, create boundary entities corresponding to farfield and symmetry groups. Set the Type to Pressure Farfield and symmetry in each case.Save Your Work Main Menu > File > Save

Export Mesh Main Menu > File > Export > Mesh...

Save the file as wedge.msh. Make sure that the Export 2d Mesh option is selected. Check to make sure that the file is created.

Step 4: Set Up Problem in FLUENTIf you have skipped the previous mesh generation steps 1-3, you can download the mesh by right-clicking on this link. Save the file as wedge.msh. You can then proceed with the flow solution steps below.Launch FLUENT Start > Programs > Fluent Inc > FLUENT 6.3.26

Select 2ddp from the list of options and click Run. The "2ddp" option is used to select the two-dimensional (2d), double-precision (dp) solver. In the double-precision solver, each floating point number is represented using 64 bits in contrast to the single-precision solver which uses 32 bits. The extra bits increase not only the precision but also the range of magnitudes that can be represented. The downside of using double precision is that it requires more memory.Import File Main Menu > File > Read > Case...

Navigate to your working directory and select the wedge.msh file. Click OK. Check that the displayed information is consistent with our expectations.Analyze Grid

First, we check the grid to make sure that there are no errors.Main Menu > Grid > Check

Any errors in the grid would be reported at this time. Check the output and make sure that there are no errors reported. Grid > Info > Size How many cells and nodes does the grid have?

Display > Grid You can look at specific parts of the grid by choosing the items you wish to view under Surfaces (click to select and click again to deselect a specific boundary). Click Display again when you have selected your boundaries. Note what the surfaces farfield, wedge, etc. correspond to by selecting and plotting them in turn.Define Properties

Define > Models > Solver... We see that FLUENT offers two methods ("solvers") for solving the governing equations: Pressure-Based and Density-Based. To figure out the basic difference between these two solvers, let's turn to the documentation.Main Menu > Help > User's Guide Contents ...

This should bring up FLUENT 6.3 User's Guide in your web browser. If not, access the User's Guide from the Start menu: Start > Programs > Fluent Inc Products > Fluent 6.3 Documentation > Fluent 6.3 Documentation. This will bring up the FLUENT documentation in your browser. Click on the link to the user's guide. Go to chapter 25 in the user's guide; it discusses the Pressure-Based and Density-Based solvers. Section 25.1 introduces the two solvers: "Historically speaking, the pressure-based approach was developed for low-speed incompressible flows, while the density-based approach was mainly used for high-speed compressible flows. However, recently both methods have been extended and reformulated to solve and operate for a wide range of flow conditions beyond their traditional or original intent." "In both methods the velocity field is obtained from the momentum equations. In the densitybased approach, the continuity equation is used to obtain the density field while the pressure field is determined from the equation of state." "On the other hand, in the pressure-based approach, the pressure field is extracted by solving a pressure or pressure correction equation which is obtained by manipulating continuity and momentum equations." Mull over this and the rest of this section. So which solver do we use for our wedge problem? Turn to section 25.7.1 in chapter 25: "The pressure-based solver traditionally has been used for incompressible and mildly compressible flows. The density-based approach, on the other hand, was originally designed for high-speed compressible flows. Both approaches are now applicable to a broad range of flows (from incompressible to highly compressible), but the origins of the density-based formulation

may give it an accuracy (i.e. shock resolution) advantage over the pressure-based solver for highspeed compressible flows." Since we expect an oblique shock for our problem and the density-based solver is likely to resolve the shock better, let's pick this solver. In the Solver menu, select Density Based.

Click OK. Define > Models > Viscous Select Inviscid under Model.

Click OK. This means the solver will neglect the viscous terms in the governing equations. Define > Models > Energy In compressible flow, the energy equation is coupled to the continuity and momentum equations. So we need to solve the energy equation for our problem. To turn on the energy equation, check the box next to Energy Equation and click OK. Define > Materials Make sure air is selected under Fluid Materials. Set Density to ideal-gas and make sure Cp is constant and equal to 1006.43 j/kg-k. Also make sure the Molecular Weight is constant and equal to 28.966 kg/kgmol. Selecting the ideal-gas option means that FLUENT will use the ideal gas equation of state to relate density to the static pressure and temperature.

Click Change/Create. Define > Operating Conditions To understand what the Operating Pressure is, read through the short-and-sweet section 8.14.2 in the user's guide. We see that for all flows, FLUENT uses the gauge pressure internally in order to minimize round-off errors. Any time an absolute pressure is needed, as in the ideal gas law, it is generated by adding the operating pressure to the gauge pressure: absolute pressure = gage pressure + operating pressure Round-off errors occur when pressure changes p in the flow are much smaller than the pressure values p. One then gets small differences of large numbers. For our supersonic flow, we'll get significant variation in the absolute pressure so that pressure changes p are comparable to pressure levels p. So we can work in terms of absolute pressure without being hassled by pesky

round-off errors. To have FLUENT work in terms of the absolute pressure, set the Operating Pressure to 0.

Thus, in our case, there is no difference between the gauge and absolute pressures. Click OK. Define > Boundary Conditions Set farfield to pressure-far-field boundary type. Then click Set.... Set the Gauge Pressure to 101325. Set the Mach Number to 3. Under XComponent of Flow Direction, put a value of 1 (i.e. the farfield flow isin the X direction). Next, click on the Thermal Tab. Change the temperature to 300K. We are assuming ambient temperature.

Click OK. Set wedge to wall boundary type and symmetry to symmetry type.

Step 5: Solve!

Solve > Control > Solution We'll use a second-order discretization scheme. Under Discretization, set Flow to Second Order Upwind. Under Solver Parameters, set the Courant Number to 0.1.

Click OK. Solve > Initialize > Initialize... This is where we set the initial guess values for the iterative solution. We'll use the farfield values (M=3, p=1 atm, T=300 K) as the initial guess for the entire flowfield. Select farfield under Compute From. This fills in values from the farfield boundary in the corresponding boxes. (Alternately, I could have typed in these values but I like to palm off as much grunt work as possible to the computer.)

Click Init. Now, for each cell in the mesh, M=3, p=1 atm, T=300 K. These values will of course get updated as we iterate the solution below. FLUENT reports a residual for each governing equation being solved. The residual is a measure of how well the current solution satisfies the discrete form of each governing equation. We'll iterate the solution until the residual for each equation falls below 1e-6. Solve > Monitors > Residual...

Set Absolute Criteria for all equations to 1e-6.

Also, under Options, select Plot. This will plot the residuals in the graphics window as they are calculated, giving you a visual feel for if/how the iterations are proceeding to convergence. Click OK. Main Menu > File > Write > Case... This will save your FLUENT settings and the mesh to a "case" file. Type in wedge.cas for Case File. Click OK. Solve > Iterate Set the Number of Iterations to 1000. Click Iterate. The residuals for each iteration are printed out as well as plotted in the graphics window as they are calculated. The residuals after 1000 iterations are not below the convergence criterion of 1e-6 specified before. So run the solution for 1000 more iterations. The solution converges in about 1510 iterations; the residuals for all the governing equations are below 1e-6 at this point. Save the solution to a data file: Main Menu > File > Write > Data... Enter wedge.dat for Data File and click OK. Check that the file has been created in your working directory. You can retrieve the current solution from this data file at any time.

Step 6: Analyze Results

Plot Velocity Vectors

Let's plot the velocity vectors obtained from the FLUENT solution. Display > Vectors Under Color by, select Mach Number in place of Velocity Magnitude since the former is of greater interest in compressible flow. The colors of the velocity vectors will indicate the Mach number. Use the default settings by clicking Display. This draws an arrow at the center of each cell. The direction of the arrow indicates the velocity direction and the magnitude is proportional to the velocity magnitude (not Mach number, despite the previous setting). The color indicates the corresponding Mach number value. The arrows show up a little more clearly if we reduce their lengths. Change Scale to 0.2. Click Display.

Zoom in a little using the middle mouse button to peer more closely at the velocity vectors.

(Click picture for larger image) We can see the flow turning through an oblique shock wave as expected. Behind the shock, the flow is parallel to the wedge and the Mach number is 2.2. Save this figure to a file:Main Menu > File > Hardcopy

Select JPEG and Color. Uncheck Landscape Orientation. Save the file as wedge_vv.jpg in your working directory. Check this iimage by opening this file in an image viewer. Let's investigate how many mesh cells it takes for the flow to turn. Tturn on the mesh by clicking on the Draw Grid checkbox in the Vectors menu. In the Grid Display menu that pops up, click Display. This displays the mesh in the graphics window. Close the Grid Display menu. Click Display in the Vectors menu. Zoom in further as shown below.

(Click picture for larger image)

We see that it takes 2-3 mesh cells for the flow to turn. According to inviscid theory, the shock is a discontinuity and the flow should turn instantly. In the FLUENT results, the shock is "smeared" over 2-3 cells. In the discrete equations that FLUENT solves, there are terms that act like viscosity. This introduced viscosity contributes to the smearing. A more thorough explanation would have to go into the details of the numerical solution procedure.Plot Mach Number Contours

Let's take a look at the Mach number variation in the flowfield. Display > Contours Under Contours of, choose Velocity.. and Mach Number. Select the Filled option. Increase the number of contour levels plotted: set Levels to 100.

Click Display.

We see that the Mach number behind the shockwave is uniform and equal to 2.2. Compare this to the corresponding analytical result. Plot Pressure Coefficient Contours Let's set the reference values necessary to calculate the pressure coefficient. Report > Reference Values Select farfield under Compute From.

The above reference values of density, velocity and pressure will be used to calculate the pressure coefficient from the pressure. Click OK. Display > Contours... Select Pressure... and Static Pressure from under Contours Of. Then select Pressure Coeffient.

(Click picture for larger image) The pressure coefficient after the shockwave is 0.293, very close to the theoretical value of 0.289. The pressure increases after the shockwave as we would expect.

Step 7: Verify ResultsComparing Solution for Coarse, Medium and Fine Mesh

Now that we observed the result that we are supposed to obtain, we can continue to compare the results with different mesh density. We start with creating fine and course mesh in Gambit, then obtain the solution using Fluent.

Contours of pressure coefficient for coarse mesh

Contours of pressure coefficient for medium mesh

Contours of pressure coefficient for fine mesh From the comparison of pressure coefficient for diffent mesh density, we see that the pressure coeffient values are still the same. However, the shockwave get thinner as the mesh get more refine. This suggest the solution is more accurate as the mesh is more refine.

Comparing Solutions Solved Using First Order and Second Order Method

Contours of pressure coefficient for first order discretization method

Contours of pressure coefficient using second order discretization method From comparison, both methods provide slightly different value of pressure coefficient. The oblique shockwave is thinner using second order method. This suggest that the second order

method provide a more accurate simulation of the super sonic flow over wedge. In general, second order discretization method will provide more accurate solution, but it is more difficult to obtain converged solution if the geometry is complex. So it is a good practice to start with a first order solution and then continue solving the problem using second order discretization method.

Compressible Flow in a NozzleAuthor: Rajesh Bhaskaran E-mail: [email protected] Problem Specification 1. Create Geometry in GAMBIT 2. Mesh Geometry in GAMBIT 3. Specify Boundary Types in GAMBIT 4. Set Up Problem in FLUENT 5. Solve! 6. Analyze Results 7. Refine Mesh Problem 1 Problem 2

Problem Specification

Consider air flowing at high-speed through a convergent-divergent nozzle having a circular cross-sectional area, A, that varies with axial distance from the throat, x, according to the formula A = 0.1 + x2; -0.5 < x < 0.5 where A is in square meters and x is in meters. The stagnation pressure po at the inlet is 101,325 Pa. The stagnation temperature To at the inlet is 300 K. The static pressure p at the exit is 3,738.9 Pa. We will calculate the Mach number, pressure and temperature distribution in the nozzle using FLUENT and compare the solution to quasi-1D nozzle flow results. The Reynolds number for

this high-speed flow is large. So we expect viscous effects to be confined to a small region close to the wall. So it is reasonable to model the flow as inviscid.

Step 1: Create Geometry in GAMBITSince the nozzle has a circular cross-section, it's reasonable to assume that the flow is axisymmetric. So the geometry to be created is two-dimensional.Start GAMBIT

Create a new folder called nozzle and select this as the working directory. Add -id nozzle to the startup options.Create Axis Edge

We'll create the bottom edge corresponding to the nozzle axis by creating vertices A and B shown in the problem specification and joining them by a straight line.Operation Toolpad > Geometry Command Button > Vertex Command Button > Create Vertex

Create the following two vertices: Vertex 1: (-0.5,0,0) Vertex 2: (0.5,0,0)Operation Toolpad > Geometry Command Button > Edge Command Button > Create Edge

Select vertex 1 by holding down the Shift button and clicking on it. Next, select vertex 2. Click Apply in the Create Straight Edge window.Create Wall Edge

We'll next create the bottom edge corresponding to the nozzle wall. This edge is curved. Since A=pi r2 where r(x) is the radius of the cross-section at x and A = 0.1 + x2 for the given nozzle geometry, we get r(x) = [(0.1 + x2)/pi]0.5; -0.5 < x < 0.5

This is the equation of the curved wall. Life would have been easier if GAMBIT allowed for this equation to be entered directly to create the curved edge. Instead, one has to create a file containing the coordinates of a series of points along the curved line and read in the file. The more number of points used along the curved edge, the smoother the resultant edge. The file vert.dat contains the point definitions for the nozzle wall. Take a look at this file. The first line is 21 1 which says that there are 21 points along the edge and we are defining only 1 edge. This is followed by x,r and z coordinates for each point along the edge. The r-value for each x was generated from the above equation for r(x). The z-coordinate is 0 for all points since we have a 2D geometry. Right-click on vert.dat and select Save As... to download the file to your working directory. Main Menu > File > Import > ICEM Input ... Next to File Name:, enter the path to the vert.dat file that you downloaded or browse to it by clicking on the Browse button. Then, check the Verticesand Edges boxes under Geometry to Create as we want to create the vertices as well as the curved edge.

Click Accept. This should create the curved edge. Here it is in relation to the vertices we created above:

(Click picture for larger image)Create Inlet and Outlet Edges

Create the vertical edge for the inlet:Operation Toolpad > Geometry Command Button > Edge Command Button > Create Edge

Shift-click on vertex 1 and then the vertex above it to create the inlet edge. Similarly, create the vertical edge for the outlet.

(Click picture for larger image)Create Face

Form a face out of the area enclosed by the four edges:

Operation Toolpad > Geometry Command Button

> Face Command Button

> Form Face

Recall that we have to shift-click on each of the edges enclosing the face and then click Apply to create the face.Save Your Work Main Menu > File > Save

This will create the nozzle.dbs file in your working directory. Check that it has been created so that you will able to resume from here if necessary.

Step 2: Mesh Geometry in GAMBITNow that we have the basic geometry of the nozzle created, we need to mesh it. We would like to create a 50x20 grid for this geometry.Mesh Edges

As in the previous tutorials, we will first start by meshing the edges.Operation Toolpad > Mesh Command Button > Edge Command Button > Mesh Edges

Like the Laminar Pipe Flow Tutorial, we are going to use even spacing between each of the mesh points. We won't be using the Grading this time, so deselect the box n