Вы находитесь на странице: 1из 29

1) Problem Specification : FLUENT - Supersonic Flow Over a Wedge

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.

Solution:
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

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 below Label x A 0 y 0 z 0

B C D E F

1.259 0

0.5 1.259 0 1.5 1.259 0 1.5 0.268 0 0.5 0 0

Using bottom up approach, we start by creating vertices of the geometry using the coordinate given. Operation Toolpad > Geometry Command Button Button > Create Vertex > Vertex Command

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:

Higher Resolution Image

Create Edges
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.

Higher Resolution 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. > Face Command Button

Similarly, create the face face2 by selecting CD, DE, EF and CF. We are now ready to mesh the geometry.

Step 2: Mesh Geometry in GAMBIT


Mesh 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 *> Mesh 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 Mesh 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 > > Edge Command Button **

Higher Resolution Image

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

Higher Resolution 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 GAMBIT


We'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 Edges in Group farfield wedge symmetry 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 Types Under Entity, select Groups.

> Specify Boundary

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 Type the 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 FLUENT


If 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 Displayagain 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 density-based 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 high-speed 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.

Higher Resolution Image

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 = gauge 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 the boundary condition for the pressure_farfield surface (aka zone) to the pressure-far-field boundary type by clicking on the latter. Select Yes in the pop-up window asking if it's "OK to change pressure_farfield's type from wall to pressure-farfield?".

Set the Gauge Pressure to 101325. Set the Mach Number to 3. Under XComponent of Flow Direction, enter a value of 1 (i.e. the farfield flow is in the X direction). Next, click on the Thermal Tab. Change the temperature to 300K.

Higher Resolution Image

Click OK. The pressure-far-field boundary type effectively imposes that there is no upstream propagation of disturbances if the flow at the boundary is supersonic. See section 7.9 of the FLUENT help for more details about this boundary type. Similarly, change the boundary condition for the symmetry surface to the symmetry boundary type. No user input is required for the symmetry boundary type. At any boundary set to the symmetry type, FLUENT internally sets

normal velocity = 0 normal gradients of all variables = 0

See section 7.14 of the FLUENT help for more details. The boundary type for the wedge surface is set to wall by default. There is no need to change that.

Step 5: Solve!
Solve > Controls or Solutions > Solution Controls Click on the Equations button and select Flow, then click OK. Also, set the Courant Number to 0.1.

Solve > Methods or Solutions > Solution Methods We'll use a second-order discretization scheme. Under Spatial Discretization, set Flow to Second Order Upwind.

Solve > Initialization or Solutions > Solution Initialization 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 farfieldunder 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 Initialize. 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 Select Residuals - Print and click Edit. Set Absolute Criteria for all equationsto 1e-6.

Also, click on 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 > Run Calculation... Set the Number of Iterations to 1000. Click Calculate. 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 > Graphics and Animations or Results > Graphics and Animations Select Vectors, click on the Set up button. 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.

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. To turn on the mesh do the following: Display > Graphics and AnimationsorResults > Graphics and Animations Select Vectors, click on the Set up button. Under options select the Display Mesh checkbox and a new window will pop up. Under Surfaces select defaultinterior,clickDisplayand close it.

The mesh will substitute the arrows and to display both the mesh and the arrows go back to the Vector Set up window click Display again and now the mesh and arrows will appear on the same picture. 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 > Graphics and Animations or Results > Graphics and Animations Select Contours, click on the Set up button. Under Contours of, choose Velocity.. and Mach Number. Select the Filled option. Increase the number of contour levels plotted: set Levelsto 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


Pressure Coefficient is a dimensionless parameter defined by the equation

where p is the static pressure, P r ef is the reference pressure, and q re f is the reference dynamic pressure defined by The appropriate reference values for this problem are the freestream values. Let's set the reference values necessary to calculate the pressure coefficient. Report > Reference Values Select pressure-farfield under Compute From.

This fills in the values from the farfield boundary into this panel. These reference values of density, velocity and pressure will be used to calculate the pressure coefficient from the pressure. Display > Graphics and Animations or Results > Graphics and Animations Select Contours, click on the Set up button. Select Pressure... and Static Pressure from under Contours Of. Then select Pressure Coeffient. 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.

Pressure Coefficient Along Wedge


Let's plot the pressure coefficient along the wedge. Go to: Results (left-hand side of the screen) > Plots Select XY Plot and then click on the Set up button. In the pop-up window specify the Y Axis Function to pressure and pressure coefficient. Select the wedge from the available surfaces and click Plot.Your specifications should look like the picture below.

In order to get the values to compare with the analytical solution, it is better to write this data to a file rather than try to read it off the plot. You can save the data used in this plot to a file by checking the Write to File checkbox under Options. Then click the Write... button, give the file a name and click Function. To measure the Shock Angle we can add a new line to the plot corresponding to the pressure coefficient at, say, y=0.35m. Click on New Surface and select the Line/Rakeoption. Set the first point to (0,0.35) and the second one to (1.5,0.35) name the line y=0.35 and click on Create.

The new line will be added to the available surfaces. From these select Symmetry, Wedge and y=0.35. You will notice that there is no Plot button, this happened because theWrite to file checkbox under options is still checked. Uncheck it and then click on Plot. You will now be able to see the plot. You should be able to calculate the xlocation of the shock at y=0.35 from this plot and from that back out the shock angle approximately.

Total Pressure
Next, we will plot the Total Pressure. On the Solution XY Plot pop-up window, select Total Pressure under Y Axis Function and click Plot.

Drag Coefficient
Finally, we will find out what the drag coefficient is. FLUENT will integrate the pressure over the wedge to find the net force on the wedge. We'll ask it to take the component in the x-direction to get the drag. This needs to be non-dimensionalized using the appropriate reference values, so we have to set these. Close the pop-up window if it's still open and go to

Problem Setup > Reference Values The reference values of density and velocity were already specified above. Make sure that the entry for Area is 1. FLUENT uses this as the length scale in calculating the drag coefficient (it doesn't make a distinction between 2D and 3D ... a bit sloppy IMHO). Then go to Results > Reports > Forces > Set up... > Print The drag coefficient should be the value listed in the last column of the values in the output window. (The analytical procedure to calculate the drag coefficient is given in Anderson, example 4.9).

Step 7: Verify Results


Comparing 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

Higher Resolution Image

Contours of pressure coefficient for medium mesh

Higher Resolution Image

Contours of pressure coefficient for fine mesh

Higher Resolution Image

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

Higher Resolution Image

Contours of pressure coefficient using second order discretization method

Higher Resolution Image

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.