This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.

Find out moreby Sergio E. Perez, Ph.D.

Copyright 2005, 2006 Sergio E. Perez. No part of this document may be reproduced without the author’s consent. This document is intended for educational use only, and is available free of charge from www.computationalfluids.com. Comments should be addressed to perezs@usmma.edu. Revised August 2006.

TABLE OF CONTENTS

Introduction 1. Finite Differences • Forward, back and central differences • Problems 2. Governing Equations • Continuity equation • Navier-Stokes equations One dimensional General Inviscid flows Boundary layers • Energy equation • Analytical solution to high-speed Couette Flow 3. CFD Solution to High-Speed Couette Flow • Discretization • Solving simultaneous equations by Gauss-Seidel iteration • Grid size issues • Unsteady couette flow solution 4. Types of partial differential equations 5. Meshing Issues • Meshing issues • Non-orthogonal grid solution to steady couette flow • Non-orthogonal grid solution to unsteady couette flow 6. Turbulence • Turbulent continuity and momentum equations- RANS • Determining Reynolds stresses Reynolds Stress models Eddy Viscosity models 7. Wall functions • Dimensional Analysis and the Buckingham Pi Theorem • Experimental results for turbulent boundary layers Closing Remarks 3 5

8

33

43 45

53

69

78

2

INTRODUCTION

This book is written for engineers and scientists who wish to learn more about the exciting field of computational fluid dynamics (CFD). It is primarily intended for users of commercially available CFD software, so that they can understand what is happening once the mouse is clicked. This book can also be a great primer on CFD, which should make advanced studies much easier. Commercial CFD software is still not “idiot-proof”, and users still need to know quite a bit of information in order to use CFD properly. It is entirely possible to achieve beautiful 3-D, color results with very impressive looking plots of velocities and temperatures that are quite inaccurate, and sometimes physically unrealistic. Running a CFD simulation is not merely a matter of pressing a button. The user must understand some of the physics of the flow in order to properly select boundary conditions, the number of cells, the most appropriate turbulence model, and to properly interpret the results of a simulation. Running a CFD simulation is not a trivial task, at least not today. Inside, readers will find basic details about the theory and practice of modern CFD, written in a language that the author has taken great lengths to make as intuitive as possible. Covered are some of the basics of how CFD works, with topics such as governing equations, discretization techniques, turbulence modeling, meshing, and actual techniques for solutions to some very simple flow cases. CFD is rapidly evolving, and becoming more and more powerful each day. The days when engineers had to write their own programs to analyze flows are rapidly passing due to the availability and power of commercial CFD software. In fact, only in very specialized flow cases should anyone even consider writing CFD code, as commercial codes are so advanced that an individual would be hard-pressed to match their quality, not to mention the time required to come up with such a program. At the time of this writing, the cost of using CFD software is still somewhat high. This is bound to decrease as competition heats up between CFD software companies. What will probably happen is that the “high-end” software with more capabilities will remain expensive, while codes with more limited power will become extremely affordable, if not free. Reading this book may be slow-going, since there are quite a few equations. But it is the author’s hope that readers will find the derivations interesting – at the very worst, understanding the derivations will make for an excellent review of fluid mechanics principles and concepts.

3

This book is available free-of-charge from computationalfluids.com. It is copyrighted material, and may not be sold or reproduced once downloaded. The author would appreciate any comments or suggestions at perezs@usmma.edu. There is some (very limited) programming required to do the homework problems in this course. A free version of the justbasic programming language may be downloaded from www.justbasic.com.

Sergio E. Perez Department of Marine Engineering U.S. Merchant Marine Academy Kings Point, NY 11024 perezs@usmma.edu

4

**Chapter I. Finite Differences
**

As you will see in the next chapter, the study of fluid mechanics gives rise to some very complicated partial differential equations known as the Navier-Stokes equations. They can only be solved in a handful of very limited cases, some of which we will look at in this book. However, “approximate” methods can always be used to solve the NavierStokes equations, yielding solutions which can be very accurate. One technique used in commercial CFD codes to solve the formidable Navier-Stokes equations is the finite-difference approximation, or finite differences. As implied before, the term approximation is a misnomer, since these so-called approximation techniques can be quite accurate. Principles of finite differences are also used in the finite volume technique, which is used more often than finite differences in commercial CFD codes, and is covered in another chapter. The finite difference approximation is used to replace derivatives with simple algebraic expressions. For example, say you had a plot of velocity V as a function of time t, and that we mark three times on the plot: t-1, t, and t+1. These are just names we give different points in time. The space between each time will be specified as ∆t (or delta t) – the exact value is not important now, but the time intervals are equally spaced. We are interested in finding the slope of the plot at time t, or dV/dt.

Slope at t

V ∆t

t-1

t

t+1

5

As shown in the figure above, the slope is dV/dt. We could approximate the slope at time t in one of three ways. A forward difference for the slope at t would be:

dV / dt ≅ ∆ V / ∆ t = (V t + 1 − V t ) / ∆ t

where the subscripts t+1 and t denote times t+1 and t. We note that ∆V/∆t, or the slope, approximates the actual slope at t when the time interval ∆t is very small. We also note that ∆t becomes small ∆V/∆t approaches the derivative dV/dt. You can see that by finite differences we can replace a first derivative with a simple algebraic expression. A backward difference for dV/dt is given by: dV / dt ≅ ∆V / ∆t = (Vt − Vt −1 ) / ∆t A central difference for dV/dt is given by: dV / dt ≅ ∆V / ∆t = (Vt +1 − Vt −1 ) / 2∆t We note that the central difference is most likely to give the most accurate value for the slope, but as long as the time intervals are small enough, it does not matter which scheme we use – they can all be extremely accurate. We have done something very important: we have developed three ways to replace a first derivative by a very simple algebraic expression. We will now do the same with the second derivative d2V/dt2. The second derivative is nothing but the rate of change of the first derivative, or d(dV/dt)/dt, so that it may be approximated as the difference between the forward and backward differences, divided by the space between them:

d 2V / dt 2 ≅ (Vt +1 − Vt ) / ∆t − (Vt − Vt −1 ) / ∆t (Vt +1 − 2Vt + Vt −1 ) = ∆t ∆t 2

Like the first derivative, our expression for the second derivative becomes more and more accurate as the time interval becomes smaller and smaller. We now have the capability to make some very nasty looking differential equations into simple algebraic equations. It should be stated that there are more accurate approximations to the first and second derivatives using Taylor series expansions, although the given formulas can be extremely

6

accurate if the delta values are small enough. For example, a Taylor series expansion for V as a function of t leads to: ∂V (Vt +1 − Vt ) ∂ 2V ∆x ∂ 3V ∆x 3 − 2 − 3 + ..... = ∂t ∆t 6 ∂t 2 ∂t You will note that the first term is exactly like our previous forward difference. The remaining terms can give more accuracy, if desired. If only the first term of the Taylor series is used, the result is an expression that is said to be first-order accurate. If the next term is included, then the expression is said to be second-order-accurate. The expressions that we developed for the second derivative and for the central difference are both considered second-order accuracy.

-----------------------------------------------------------------------------------------------------------Exercise 1-1: Given the equation y = x3 , calculate the second derivative d2y/dx2 at x = 1, using a ∆x of 1. Compare with analytical results. -----------------------------------------------------------------------------------------------------------Solution 1-1: We make a table of values: x 0 1 2 The 2nd derivative is: (8 – 2(1) + 0 )/1 = 6 The analytical solution is: 6x, or 6. In this case the finite difference approximation gives an exact value even though a coarse grid is used (delta x of 1). This is usually not the case! -----------------------------------------------------------------------------------------------------------Exercise 1-2: Given the expression y = sinx, approximate the first and second derivatives for y in terms of x, at x = 0.1 radians, and compare with the analytical solution. -----------------------------------------------------------------------------------------------------------y 0 1 8

7

**Chapter 2. The Governing Equations
**

In this chapter we present the equations which govern fluid and energy flow. There are three sets of equations: 1) The continuity equation. 2) The Navier-Stokes equations (3 total, one for each direction x, y, and z). 3) The energy equation. We will derive expressions for each one using as simple an approach as possible. Readers desiring a more rigorous approach are directed to any of the many excellent advanced fluid mechanics textbooks available, in particular Frank White’s Viscous Fluid Flow. In the derivation of these important equations, we will be interested in property changes over small distances, using a rate of change. For example, say you knew that the pressure was changing by 10 psi every foot, we could then say that the rate of change of the pressure, or dP/dx, was 10 psi per foot. If this rate occurred over ½ foot, then the pressure change would be 5 psi. In equation form:

∆P =

dP ∆x dx

We will make extensive use of this type of expression for other flow properties in addition to the pressure, so make sure that you understand the mathematical reasoning before proceeding. Another item to note is that in fluid mechanics, u,v, and w are used to denote flow in the x,y, and z directions. In other words, if we say v = 5 m/s, it usually refers to the flow speed in the y-direction; u = 3 m/s would be the component of the velocity in the xdirection, and w = 4 m/s would refer to the velocity in the z-direction. Please consult the figure below.

8

y v

u x w

z

**2.1 The Continuity Equation
**

The continuity equation is a conservation of mass statement - all mass flow in and out of an area must be accounted for. In steady flow, the mass flow rate into an area must equal the mass flow rate out of the volume. We start the derivation by examining a small region in a steady flow, as shown below. Fluid flows into and out of this region, known as a control volume. We can imagine the entire flow field being divided into many, many similar control volumes, and that each control volume measures ∆x by ∆y by ∆z. The dimension in the z direction (into the paper) is not shown, as we will derive this equation only for two-dimensional flow.

9

Flow goes in and out of control volume ∆y y

∆x

x

We may say that the mass flow rate into the volume from the left is:

.

m = ρuA

[2.1.1]

where ρ is the fluid density, u is the flow speed in the x-direction, and A is the area of the flow. For flow in the x-direction, the area is ∆y by ∆z or ∆y by 1, since we are ignoring flow in the z-direction. As mentioned earlier, the flow speed in the x-direction is usually given the symbol u in fluid mechanics; flow in the y direction (up and down) is usually designated as v, and flow in the z-direction is designated as w. The mass flow rate exiting the control volume in the x-direction is the same as the mass flow rate entering plus whatever change occurred over the ∆x:

.

m exiting = ρuA + ∆ ( ρuA) = ρuA +

d ( ρuA)∆x dx

[2.1.2]

In a similar way, the mass flow rate entering the control volume from the bottom is:

.

m = ρvA and the mass flow rate exiting from the top is:

[2.1.3]

10

.

m = ρvA + ∆ ( ρvA) = ρvA +

d ( ρvA)∆y dy

[2.1.4]

The net flow in the x-direction is the difference between the entering mass flow and the exiting mass flow in the x-direction:

.

m = ρuA − ( ρuA +

d d ( ρuA)∆x) = − ( ρuA)∆x dx dx

The net flow in the y-direction is the difference between the entering mass flow and the exiting mass flow in the y-direction:

.

m = ρvA − ( ρvA +

d d ( ρvA)∆y ) = − ( ρvA)∆y dy dy

The net total flow is then the sum of the nets in the x and y directions, and for steady flow the total must be zero – that is, what goes in must come out. We change to partial derivatives to accommodate the fact that variables depend on both x and y : ∂ ∂ ( ρvA)∆y − ( ρuA)∆x =0 ∂y ∂x

The area of each face is a constant, as are dimensions ∆x and ∆y, finally yielding for the steady state continuity equation: ∂ ∂ ( ρu ) + ( ρv ) = 0 ∂x ∂y and for incompressible flow, where density ρ is constant: ∂u ∂v + =0 ∂x ∂y [2.1.6] [2.1.5]

The continuity equation above has been derived for 2-dimensional, incompressible flow only. The extension to three dimensions and compressible flow is straight-forward: ∂ ( ρu ) ∂ ( ρv) ∂ ( ρw) + + =0 ∂x ∂y ∂z if the flow is unsteady, the equation becomes: [2.1.7]

11

∂ρ ∂ ( ρu ) ∂ ( ρv) ∂ ( ρw) + + + =0 ∂x ∂z ∂t ∂y

[2.1.8]

where w denotes flow speed in the third dimension z. On occasion you may see the above equations written using the more compact, but highly confusing to the uninitiated, vector operators, for example: ∂ ( ρu ) ∂ ( ρv) ∂ ( ρw) + + = ∇ ⋅ ( ρV ) ∂x ∂z ∂y The vector operator ∇ is known as “del”, and “del dot” any vector quantity is the sum of the rates of change of that quantity in the x, y and z directions.

**2.2 The Navier-Stokes Equations
**

The continuity equation required a balancing of flows in and out of a region. The NavierStokes equations deal with a balancing of forces on a fluid region. The Navier-Stokes equations are also referred to as momentum equations. We will first derive the Navier-Stokes equation for a very simple and restricted flow situation. We will then expand on it and derive a more general equation. Here are the limitations we will initially impose on our flow: 1) The flow is laminar. This means that we can easily use the expression:

τ =µ

du dy

where τ is the shear stress, µ is the viscosity, and du/dy is the slope of the velocity plot with respect to y. An in-depth explanation of this is given in Note 1at the end of this chapter.

2) The flow is incompressible. This means the density remains constant, or close enough to constant so that the equations are greatly simplified. This is not always the case! 3) The flow is steady. This means that flow conditions do not vary with time. 4) The flow is in the x-direction only, as shown in the figure below.

12

5) The duct through which the fluid flows is rectangular, and has constant dimensions. The significance of this is that the flow speed will not vary in the flow direction. If the duct were to become smaller in the direction of the flow, then the flow speed would tend to increase. Since the velocity u is not varying with x, we may say that du/dx = 0. 6) The flow is occurring through a very wide duct, so that the side walls have negligible influence. In other words, there are no velocity gradients (changes) along the z-direction. We can then say that du/dz = 0. Please consult the figure below, and look at it carefully.

Y

Velocity gradients only in ydirection. du/dy not zero.

X

Z

7) The properties of the fluid do not change. In many real-world flows, the fluid is being heated or cooled, and can experience large temperature changes leading to viscosity and density changes, among others. That’s a large number of assumptions! Here they are again: laminar, steady, incompressible, very wide duct, constant properties, constant size duct, and flow in the xdirection only. This is obviously not a case that can be applied to a large number of realworld problems. One possible application: the flow of lava through a large fissure in rock (not exactly an every-day need!). We can now begin our analysis. We may re-draw our duct in 2-dimensions since the 3rd dimension is not being considered. Notice we have also drawn a small fluid element in the flow, below the center-line of the flow (the analysis would yield exactly the same result if the element were chosen above the center-line). There are other elements surrounding it, also moving with the flow.

13

We now look only at our element, noting that it measures a small length ∆x and height ∆y.

∆x

∆y

We will now list all the forces on the element in the x-direction.

14

As the element moves along the duct, it experiences a pressure force on the left face and on the right face. The pressure on the left face is P and acts towards the right, and that on the right face acts towards the left: Pright = P + dP ∆x dx

That is, the pressure on the right face is whatever the pressure was at the left face, plus the change in the pressure over distance ∆x. Why should the pressure be different on the right and left faces? The answer is that friction is robbing the flow of pressure – the pressure always tends to drop as a result of friction. The figure below shows it:

P

Pright = P +

dP ∆x dx

Our element is being dragged forward by the element above it, which is moving faster. The element below ours is exerting a force backwards. The force/area on the lower face of our element is τ. The force/area on the upper face can be written in terms τ as follows, in a similar manner as was done with the pressure:

τ upper = τ +

dτ ∆y dy

15

We can now label all of the forces on the element, multiplying by the area of each face, which is the same for all faces:

(τ +

dτ ∆y ) A dy

PA

(P +

dP ∆x) A dx

τΑ

**By summation of forces in the x-direction:
**

PA − ( P + dP dτ ∆ x ) A − τA + (τ + ∆y ) A = 0 dx dy

If we account for the fact that all the areas are the same, as are ∆x and ∆y:

−

dP dτ + =0 dx dy du into the equation above, and we consider that the viscosity µ dy

**We substitute τ = µ remains constant:
**

d (µ du ) dy =0 dy

−

dP + dx

For constant viscosity µ (one of our assumptions):

16

−

dP d 2u +µ 2 =0 dx dy

[2.2.1]

This is our very simple Navier-Stokes equation in the x-direction for the restricted case of incompressible, constant viscosity, steady flow through a very wide duct (no gradients in the z-direction) of constant diameter. ----------------------------------------------------------------------------------------------------------Problem 2.0.1 For the equation above (2.2.1), which term accounts for friction, and on which face of the element does the friction act? ----------------------------------------------------------------------------------------------------------Problem 2.0.2 In the derivation of Eq. 2.2.1, why is there no shear stress on the element face which lies on the same plane as the paper (or computer screen)? ----------------------------------------------------------------------------------------------------------Problem 2.0.3 Fluid flows over a flat plate. Calculate the total shearing force on the plate if it measures 2 2 m x 2m and the velocity profile over the plate follows the equation u = Cy , where u is in units of m/s and y is in units of m. The constant C has a value of 3 and has units of 2. s/m. The viscosity of the fluid is .01 N-s/m

Incoming Flow Velocity Profile

y

17

2.3 General Navier-Stokes Equation

We now extend our analysis to the more general case of steady, incompressible flow in the x-direction, with velocity gradients in any direction. In other words, the duct no longer need have constant dimensions, and we are dealing with three dimensions. Our small fluid element looks as shown below. The dotted lines indicate invisible borders: Top Face Left face

Back Face Right Face

Front Face

Bottom Face Direction of motion

Please study the diagram above indicating which face is which, as we will be looking at sets of planes individually. The orientation is as if a person were riding on the element, facing in the direction of motion, sitting on the bottom of the element. We have already determined that the forces due to shear on the top and bottom faces, and the pressure force acting on the back and front faces result in the expression below for flow in one dimension:

∑F

x

=−

dP d 2u +µ 2 dx dy

[2.3.1]

It turns out that for three dimensions, the sum of the forces on the element in incompressible flow is:

18

∑F

x

=−

dP d 2u ∂ 2u ∂ 2u +µ 2 +µ 2 +µ 2 dx dy ∂z ∂x

∂P term is due to the pressure acting on the element, and ∂x ∂ 2u we had seen it before. The µ 2 term is due to the shear forces acting on the top and ∂y Let’s look at each term. The − bottom surfaces of the element, and this is not a new term either. The µ ∂ 2u term is due ∂z 2 to shear of the element on the right and left faces, and is due to velocity gradients in the z-direction (which we now have because of three-dimensional flow). The last term, µ

∂ 2u , a little different from the other two derivative terms. If you ∂x 2 imagine a stretching rubber band, and you think that it’s broken up into small volumes, just like our flow is, you can also imagine that there is a force acting on each small volume, as drawn below:

In the same way, when a fluid element is being accelerated, it becomes subject to stresses ∂ 2u analogous to stretching. The third term, µ 2 , in the equation above then accounts for ∂x this effect.1 In our original simple case, the fluid element was moving at a steady speed since the duct diameter and the density were constant. The sum of all the forces on the element was then zero. However, we are placing no such restrictions now, so we must now apply Newton’s 2nd law:

∑ Fx = ma = VOL ⋅ { −

∂P ∂ 2u ∂ 2u ∂ 2u + µ ( 2 + 2 + 2 )} ∂x ∂x ∂y ∂z

1

The discussion here has been somewhat intuitive. Readers wishing more detail should consult a fluid mechanics text, such as Frank White’s Fluid Mechanics.

19

Please note that we multiplied the terms on the right side by the volume of the element, since we had divided through by A ⋅ ∆ (or volume of the element). Not doing this would have resulted in force/volume on the right side. We now consider the acceleration terms in F = ma. We recall that written as:

∑F

x

= ma may be

∑F

x

=m

du dt

where du/dt is the acceleration. Since velocity u is a function of four variables (t, x, y, z), we can use the chain rule to write:

du ∂u ∂u dx ∂u dy ∂u dz = + + + dt ∂t ∂x dt ∂y dt ∂z dt

[2.3.2]

We note that say:

dx dy dz is flow velocity u, is velocity v, and is velocity w. We can then dt dt dt

du ∂u ∂u ∂u ∂u = +u +v +w dt ∂t ∂z ∂x ∂y

[2.3.3]

We combine this with Newton’s law, and substitute density times volume for the mass m of the element:

∑F

x

= ma = ρ ⋅ VOL ⋅ (

∂u ∂u ∂u ∂u +u +v +w ) ∂t ∂x ∂y ∂z

We now set this equal to the forces on the element to complete F= ma, canceling the volume terms:

ρ(

∂u ∂u ∂u ∂u ∂P ∂ 2u ∂ 2u ∂ 2u +u +v +w )=− + µ( 2 + 2 + 2 ) ∂t ∂x ∂y ∂z ∂x ∂x ∂y ∂z

[2.3.4]

This is the Navier-Stokes equation for incompressible, constant viscosity, flow in the xdirection. Congratulations! You will sometimes see this equation with an additional term to account for so-called body forces. These are forces acting on the entire volume, such as magnetic or 20

gravitational forces. For flow moving in the x-direction, gravity would not be considered, but in the y-direction it should be. The equation below shows the additional term.

∂u ∂u ∂u ∂u ∂P ∂ 2u ∂ 2u ∂ 2u + µ( 2 + 2 + 2 ) ρ ( + u + v + w ) = Fx − ∂t ∂x ∂y ∂z ∂x ∂x ∂y ∂z

[2.3.5]

There are two more very similar sets of equations in the y and z directions.

You will notice the similarity of the equation (2.3.5) to our simplified Navier-Stokes dP d 2u equation 0 = − + µ 2 for one-dimensional, steady flow. dx dy ----------------------------------------------------------------------------------------------------------Problem 2-1 Beginning with equation (2.3.5), try to finish with equation (2.3.1), considering flow to occur only in the x direction, with constant velocity, with no body forces, and steady. ----------------------------------------------------------------------------------------------------------Problem 2-2 Equation (2.3.5) has 9 terms in it. The terms can be due to one of several possible factors: unsteadiness, acceleration of the fluid, body forces, pressure drop, and friction. Identify which term is due to which factor, and also identify any directions involved. -----------------------------------------------------------------------------------------------------------∂ 2u Problem 2.3 Prove that the shear along the z-y plane is µ 2 ∂z -----------------------------------------------------------------------------------------------------------Problem 2.4 dP d 2u +µ 2 =0 Derive − dx dy -----------------------------------------------------------------------------------------------------------Inviscid Flows Flows may sometimes be considered inviscid, or frictionless. For example, as long as there is not a great deal of separation of flow, airfoil coefficient of lift calculations do quite well with the inviscid assumption, greatly simplifying calculations. In some cases, the flow through a nozzle may also be considered inviscid, as can flows outside of the boundary layer. If the flow is inviscid and compressible, the Navier-Stokes equation for compressible flow in the x direction is :

21

∂ ( ρu ) ∂ ( ρu ) ∂ ( ρu ) ∂ ( ρu ) ∂P +u +v +w =− + Fx ∂t ∂x ∂y ∂z ∂x

[2.3.6]

You will notice that the viscous terms have dropped out from equation [6], and that the derivatives now include the density of the fluid ρ to account for compressibility of the fluid. The equation above is one of three for all directions. The three inviscid equations are known as the Euler equations.

**Boundary Layer Flows
**

The Navier-Stokes equations may sometimes be simplified in the boundary layer. The boundary layer is the area close to a body where the flow speed is experiencing large gradients perpendicular to the body. Outside of the boundary layer the gradients are small, and the flow may at times be considered frictionless. A plot of the velocity in the boundary layer might look as drawn below:

Body You can see that the velocity changes rapidly close to the body, while the rate of change slows as one moves further and further from the body. The edge of the boundary layer is where the velocity stops changing appreciably. If there is no significant flow separation (see figure 1 in the introduction for a good illustration of separating flow) and geometry changes are gradual, the Navier-Stokes equations can be simplified. In this case, we may say:

• • •

velocity components in main direction of flow are much greater than components in other directions pressure gradients across the flow are much smaller than pressure gradients along the flow velocity gradients are greatest in a direction perpendicular to the flow

The incompressible boundary layer momentum equation in the x-direction is then obtained by eliminating the appropriate terms from equation (2.3.5):

22

∂u ∂u ∂u ∂P µ∂ 2 u +u +v =− + ρ∂x ρ∂y 2 ∂t ∂x ∂y

[2.3.7]

As a final note, sometimes the Navier-Stokes equations are referred to as momentum equations, because they account for the effect of forces on moving masses. -----------------------------------------------------------------------------------------------------------Problem 2-5 Beginning with momentum equation in the x-direction, equation(2.3.5), explain how the boundary layer equation (2.3.7) would result. -----------------------------------------------------------------------------------------------------------Problem 2-6 Beginning with momentum equation in the x-direction, equation(2.3.5), explain how the inviscid flow equation (6) (the Euler equation) would result. -----------------------------------------------------------------------------------------------------------Problem 2-7 The velocity profile for laminar flow is known to follow the relation:

u = u max (1 − r 2 / R 2 ) [2.3.8]

where umax is the flow speed at the center of the pipe, R is the radius of the pipe, and r is the distance from the pipe center at which speed u is desired. For example, for a 1 m diameter pipe with a center flow speed of 5 m/s, the velocity at a spot 0.1 m from the centerline is: u = 5(1 − 0.12 / 0.5 2 ) a) Show that equation (2.3.8) above satisfies the no slip condition (just make small r equal to the radius R). b) Calculate the force per unit area being exerted by the fluid on the pipe wall, if the dynamic viscosity of the fluid flowing is 0.001 kg/m-s. Note that you may use du τ =F/A=µ to calculate the shear stress. dr -----------------------------------------------------------------------------------------------------------Problem 2-8 Explain what the boundary layer is. Why is most of the shear happening in the boundary layer, and why is shear generally so much smaller outside of the boundary layer? ------------------------------------------------------------------------------------------------------------

23

**2.4 The Energy Equation
**

We have so far considered the continuity and Navier-Stokes equations, which must be satisfied at every point in the flow. In addition, the energy equation must be satisfied. The continuity equation accounted for the flow of mass in and out an area. The NavierStokes equations deal with the forces on a fluid element. The energy equation accounts for the flow of energy from and to a fluid element. Energy can flow from and to a fluid element in two ways: by friction, and by heat conduction with adjoining fluid elements (note we are not considering any radiation heat transfer here for simplicity). Consider a fluid element in a flow moving in the x-direction, such as the simplified flow case we have been using. Recall any element above our element is moving faster than our element, and any element below ours is moving slower.

An element above ours is putting work into our element, pushing ours along, and our element is putting work into the element below it, pushing it along. The rate at which work is done is power, and power is force multiplied by speed. The power lost from our element to the element below is then (considering our element to be the point of reference for speed): Power out = Force × Speed = τAu

24

where τ is the shear stress at the interface between the two elements, A is the area of contact, and u is the speed of the element below. The power into our element may be written as follows, using a similar scheme as was done with the pressure and the shear stress: Power in = τAu + d (τAu ) ∆y dy

If we consider that the power being put into our element is positive, and the power flowing out of our element is negative: Net power flow = τAu + d (τAu ) d (τAu ) ∆y − τAu = ∆y dy dy

Recalling that we may say τ=µdu/dy if the flow is laminar: d (µ du Au ) dy ∆y dy

Net power due to friction =

d (τAu ) ∆y = dy

For constant viscosity, considering energy flow per unit area, and applying the product rule for differentiation:

µ

Net power due to friction / A =

d du ( u) d 2u du dy dy ∆y = µ{u 2 + ( ) 2 }∆y dy dy dy

We now consider the flow of energy in and out of our element by heat conduction in the y-direction (we will only consider the flow of heat along an axis perpendicular to the flow). Fourier’s Law of Conduction for heat flow per unit area in the y direction is: q = −k dT dy

where k is the thermal conductivity of the fluid, and T is temperature. If the equation above expresses the heat flow into our element from below, we may write, for the heat flow out of our element from above:

25

q = −k

dT + dy

d (−k

dT ) dy ∆y dy

The net heat flow due to conduction will be the difference between the two expressions: d (−k dT dT ) d (k ) dy dy ∆y} = ∆y dy dy

q cond / net = − k

dT dT − {−k + dy dy

If we assume the thermal conductivity k to be constant: q cond / net = k d 2T ∆y dy 2

The net flow of energy will be the sum of the conduction and power terms, and will be zero for steady state operation: Net power flow / A = µ{u d 2u du d 2T + ( ) 2 }∆y + k 2 ∆y = 0 dy dy 2 dy

which may be simplified by considering that the dimension ∆y is constant:

µ{u

d 2u du d 2T + ( )2} + k 2 = 0 dy dy 2 dy

[2.4.1]

This is an extremely simplified version of the full-blown energy equation that considers the flow of energy in three dimensions using over 20 terms. However, our equation in 1dimension gives the big picture in that it shows that there is a flow of energy due to friction and due to any temperature differences, just like the more complete version. To summarize up to now: at any point in the flow there are three sets of equations that must be satisfied: the continuity equation, the Navier-Stokes equations in the x,y, and z directions, and the energy equation. A special note before proceeding: The equations derived above may be derived using Lagrangian or Eulerian coordinate systems. In the Lagrangian system, a moving fluid element is considered the frame of reference, while in the Eulerian, a fixed control volume in the flow is used. Some types of flow problems are easier solved using one or the other form, and it is possible to convert from one system to the other. In some simple cases the equations become identical. For the simple flow cases we will consider, we will use the equations as derived here.

26

**2.5 Analytical Solution of the Navier-Stokes equations
**

We will now analytically solve high speed Couette flow between two parallel plates at different temperatures. We want to calculate the flow speed and temperature at any point in the flow. 100 m/s T=100 C

y

Stationary Plate T = 0, u = 0

The plates are infinitely long and wide, the flow is steady and the fluid incompressible with constant properties. The upper plate moves at 100 m/s, and the bottom plate is stationary. The top plate is at a temperature of 100 degrees C, and the bottom plate at 0 degrees C. The plates are separated by a distance of 2 cm, and the space between them is filled with a fluid with viscosity µ of .001983 kg/(m-s). The thermal conductivity of the fluid is 0.02624 W/(mK). We will later solve this very same problem using computational fluid dynamics – we perform the analysis now in order to verify our CFD results. We are able to solve the problem analytically using calculus because of the problem’s relative simplicity. Realworld problems amenable to analytical solutions are almost non-existent due to the complexity of the governing equations. As stated earlier, approximate methods of solution must then be used in CFD. The governing equations for 1-D, incompressible, steady, constant property flow: Continuity: ∂v ∂u + =0 ∂y ∂x − dP d 2u +µ 2 =0 dx dy d 2u du d 2T + ( )2} + k 2 = 0 dy dy 2 dy

Navier-Stokes/Momentum:

Energy:

µ{u

27

The continuity equation is eliminated from the start since both terms are zero. We address the Navier-Stokes equation next. Normally flow experiences a pressure drop due to friction. However, in the case of Couette flow this is not the case since the moving upper plate continuously re-supplies energy to the flow. Hence the dP/dx term is zero. We are then left with: d 2u =0 dy 2 We integrate this with respect to y: du + c1 = 0 dy and we integrate again: u + c1 y + c 2 = 0 [2.5.1]

We need to find constants c1 and c2. We know that the flow speed u is zero at the lower boundary (at y = 0), and u is 100 m/s at the upper boundary (y = 0.02 m). We note that we are not considering the energy equation at all since the properties of the fluid are remaining constant. This would complicate things considerably! The energy and momentum equations are said to be uncoupled, that is, they are independent of each other. We apply the zero speed boundary condition to equation (2.5.1): 0 + c1(0) + c 2 = 0 c2 = 0 We apply the second boundary condition to equation (2.5.1): 100 + c1(0.02) = 0 c1 = −5000 We now substitute back into equation (2.5.1) and solve for u: u = 5000 y This is obviously a linear plot. We note that the result checks with the boundary conditions: at y = 0, u = 0. At y=0.02, u = 100.

28

We now consider the energy equation: d 2u du 2 d 2T µ{u 2 + ( ) } + k 2 = 0 dy dy dy We integrate this twice: [2.5.2a]

µ(

du 2 y 2 ) + kT + c3 y + c 4 = 0 dy 2

We note that the Navier-Stokes equation showed that the second derivative of the velocity with respect to y was zero, and du/dy = -c1 = 5000 per second. We now use our boundary conditions to solve for c3 and c4. At y = 0, T = 0, so c4 must be zero. We know that at y = 0.02, T = 100, which then yields: T=

µ

2k

(5000) 2 (− y 2 + y (.02)) + 5000 y

[2.5.3]

We can now make a plot for temperature as a function of location y:

29

This is a very curious result in that the temperature between the plates is higher than the temperature of the upper plate. The reason is that friction is causing heating. We again note that the momentum and energy equations were uncoupled – the temperature of the fluid is assumed to not affect the viscosity. One way of coupling the equations is by first using a fixed viscosity, then once the temperature and velocity profiles are known, the calculations are repeated using an adjusted viscosity based on the newly calculated temperatures. This procedure might be repeated until there is no further change in the temperature and velocity profiles. Clearly this would require additional computation time. The reason this point is being stressed is that when you run a CFD simulation using commercial packages, you will be given the option to run the simulation with coupled or uncoupled equations. If the temperature changes are moderate or non-existent, such as in the flow of unheated liquids or low speed, unheated gas flows, then it would not make much sense to run a coupled simulation. -------------------------------------------------------------------------------------------------------Question 2-9 Give one example each of a real-world situation where you might want to couple the equations, and one where you might not want to. ------------------------------------------------------------------------------------------------------Question 2-10 Describe the ways in which energy flows in and out of a fluid element.

30

What happened to the 2nd derivative of u in equation 2.5.2a? ------------------------------------------------------------------------------------------------------Question 2-11 Rework the problem covered in Section 2.5 above, with the viscosity being doubled and the top plate moving at 150 m/s. Make a plot of temperature as a function of distance between the plates, and compare your results with the previous results. What do you conclude? -------------------------------------------------------------------------------------------------------

31

Note 1: Explanation of τ = µ

du dy

Real flows experience shear stress, due to velocity differences between layers of flow. Consider a fluid such as air or water between two flat plates, with one plate moving and the other stationary. This is similar to what flow might be like inside a bearing, with one surface spinning relative to another, with lubricating oil in-between. Say the top plate moves at u =10 m/s. You can envision that the fluid in contact with the moving plate will be moving at the same speed as the plate, and that the fluid in contact with the stationary plate will have a speed of zero. The fact that fluid takes the velocity of the boundary it’s in contact with is called the no-slip condition, and is an extremely important concept in fluid mechanics. You can also envision that between the plates the flow speed u will vary between 10 m/s and 0 m/s. In fact the relationship is linear (a fact we will prove later), and we can make a plot of the flow speed as a function of location “y”. Please see the figure below.

10 m/s

y

Stationary Plate Note that the length of the arrows indicate the speed at that location ‘y’. The plot of the speed as a function of location, as shown above, is known as a velocity profile. The velocity profile above has a slope du/dy which is constant. We note that a linear velocity profile is the exception in nature – typical velocity profiles have a more complex curved shape, and the slope du/dy is not constant. For example, the flow through a pipe will exhibit a parabolic velocity profile. Returning to the flow above, you can envision that fluid layers are being sheared, by virtue of the difference in speeds between layers of fluid. This shearing gives rise to friction between layers. We are now interested in finding what is the shear force per unit area between layers. Experiments show that most fluids (Newtonian fluids) follow the relation:

32

τ =µ

du dy

In other words, the shear stress (or frictional force per unit area) is a function of the viscosity and the slope of the velocity profile. In the example above, if the distance between the plates 0.01 m, the slope du/dy is then 10/0.01 per second. If the viscosity is 0.001 N-s/m2, the stress required to pull the top plate is then:

τ =µ

du N = 0.001 × 1000 2 dy m

du can be used as long as the flow is dy laminar, or smoothly flowing (as opposed to turbulent or chaotic flow, which will be discussed in the section on turbulence modeling). The problem is that with turbulent flow there is no constant velocity u. The velocity is changing constantly - the exact flow speed and direction would have to be known at nearly all times and locations – a task that is practical (due to computer limits) only in simple cases with extremely powerful computers. The big restriction is that the expression τ = µ du is the greatest complicating factor in dy modeling turbulent flows, one that has yet to be fully resolved in a practical sense. This issue will be addressed in more detail in the section on turbulence. The lack of a compact expression such as τ = µ As mentioned earlier, the velocity profile does not have to be linear, as in the example above. In fact the velocity profile will almost never be linear. For example, a plot of the velocity at a pipe cross-section would show the velocity to have a parabolic profile, with a speed of zero at the wall, increasing to some maximum value at the centerline. In addition, there is nothing magical about the letters u and y! Shear stresses may be present in other planes and directions. For example, dv/dz would indicate the rate of change of the flow in the y-direction (v) with respect to the z-direction. du applies strictly to one dimensional flow. For flow in three dy dimensions, the shear stress depends on the velocity gradients in two directions. For example, the shear stress in the xy plane in three dimensions is given by: We should note that τ = µ

τ = µ(

∂u ∂v + ) ∂y ∂x

33

**Chapter 3. CFD Solution of Couette Flow
**

3.1. Discretization

We will now put together all we’ve learned and solve the previous problem by CFD and finite differences. We will use the analytical solution as a check against our CFD solution. Most real-world flows will not have an analytical solution, which is the whole point of performing CFD. The starting point is the Navier-Stokes equation in the x-direction: − dP d 2u +µ 2 =0 dx dy

and again, dP/dx is zero, so we may write: d 2u =0 dy 2 We now apply the finite difference approximation to the equation above: u y +1 − 2u y + u y −1 d 2u =0= dy 2 ∆y 2 and solving for u: u y = (u y +1 + u y −1 ) / 2 [3.1.1]

We next divide the flow geometry into 6 nodes, as shown below. This is our grid. The Navier-Stokes equation must hold at each node: 100 m/s T=100 C 1 2 y 3 4 5 6 Stationary Plate T = 0, u = 0

34

We then have the following 6 equations, one Navier-Stokes equation for each grid node in our grid: u6 = 0 u 5 = (u 6 + u 4 ) / 2 u 4 = (u 5 + u 3 ) / 2 u 3 = (u 4 + u 2 ) / 2 u 2 = (u 6 + u 4 ) / 2 u1 = 100 The result is 4 unknowns with 4 equations. We must solve these simultaneously. You can see that the number of simultaneous equations to be solved could go up astronomically if we consider more complex geometries – our grid is one-dimensional, requiring a relatively small number of grid points. A three dimensional grid or mesh can result in hundreds of thousands or even millions of grid points and simultaneous equations to be solved! You may also note something which is nothing short of miraculous: we started with a rather ugly looking partial differential equation, and using finite differences we were able to transform it into an algebraic expression with requiring only the most basic of mathematical operations! The conversion of a problem with differential equations describing the flow physics, to a problem where algebraic expressions hold at discrete points in the flow is known as discretization. There are two general ways to solve simultaneous equations, by matrices and by iteration. Most CFD programs use iterative schemes similar to the Gauss-Seidel technique, which works as shown below. Iterative techniques tend to be less sensitive that matrix techniques, and are easy to apply. } [3.1.2]

**The Gauss-Seidel technique.
**

This technique is almost mysterious in how simply it works. The scheme first assigns initial guesses to the unknowns, then updates the guesses using equation set(3.1.2) above. The procedure is repeated in a series of loops until there is no further change in the unknowns. The best way to show this is by example. Let’s give initial values of 1 to all unknown velocities: u2, u3, u4, u5. Loop 1 is then: u5 = (0+1)/2 = 0.5 u4 = (0.5 + 1)/2 = .75 “(we now have a new value for u5)” “(new u4)” 35

u3 = (.75 + 1)/2 = .875 u2 = (.875+100)/2 = 50.44

“(new u3)” “(new u2)”

We cycle again through the equations, using the values computed in the previous loop to update all values: Loop 2: u5 = (0 + .75)/2 = .375 u4 = (.375+.875)/2 = .625 u3 = (50.44+.625)/2= 25.53 u2 = (25.53+100)/2 = 62.77 Loop 3: u5 = .625/2 = .3125 u4 = (25.53+.3125)/2 = 12.92 u3 = (12.92+62.77)/2 = 37.84 u2 = (37.84+100)/2 = 68.92 Loop 5: u5 = 11.08 u4 = 28.31 u3 = 50.54 u2 = 75.27 Loop 10: u5 = 18.92 u4 = 38.59 u3 = 58.86 u2 = 79.44 Loop 15: u5 = 19.87 u4 = 39.83 u3 = 59.86 u2 = 79.93 which is approaching the exact result calculated by the analytical solution. After about 40 loops we achieve the exact (using single precision) result: u5 = 20

36

u4 = 40 u3 = 60 u2 = 80 Gauss-Seidel iteration is guaranteed to work if the simultaneous equations satisfy the Scarborough criterion. This is not normally a problem, as the equations can be easily rearranged algebraically into a proper format. Please see the appendix for more details on the Scarborough criterion. Here is some pseudo-code (a generalized computer code) to solve the problem above by computer. Comments are in quotation marks: u(1) = 100 u(6) = 0 for i = 1 to 50 for j = 2 to 5 u(j) = (u(j-1) + u(j+1))/2 next j next i

“50 Gauss-Seidel loops should be enough!” “loop through the nodes” “find the speed”

This small program solves what appears to be a complicated problem! We selected 50 Gauss-Seidel loops as enough in order to achieve convergence (that is, to get down to the correct answer). If you run a commercially available CFD package, you can specify the number of iterations after which the program will stop. Or alternately you will probably be able to specify the residuals as a criterion for convergence and stopping the execution of the program. For example, the equations above can be re-arranged as shown below: u 5 − (u 6 + u 4 ) / 2 = 0 u 4 − (u 5 + u 3 ) / 2 = 0 u 3 − (u 4 + u 2 ) / 2 = 0 u 2 − (u 3 + u1 ) / 2 = 0 If a solution has been reached, the left-side of each equation should be zero. In practice, given a very large number of equations, it will be difficult for the aggregate of all of the left-side values to be zero. The sum of these left-side values is known as the residual or residuals. Obviously, the smaller the value of the residuals the better the solution. For this reason, CFD packages will tell you what the residuals are as the program runs. The residuals should approach zero, but in reality will almost never do so. Once the residuals bottom out and stop changing, you can be sure you’re not making any further progress and can stop the program at that point.

37

If the residuals remain large, then your solution is suspect. This topic will be discussed in more detail in the second part of this book. Convergence may be sped up (the number of loops reduced) by applying a procedure known as successive over-relaxation or SOR. In this technique, the rate at which an unknown is changing per loop is calculated, and that rate is then used to extrapolate a value of that unknown. The result is that convergence is sped up by eliminating the need to cycle through intermediate iterations. A relaxation factor governs the magnitude of the extrapolation, and there is an optimal value for each problem. Consider the problem we were solving before. It took about 15 loops to get close to the solution, but by about the 5th loop we had a rough idea of the trend. The rate of change could have been used to leap-frog to values closer to the final result. The issue of computation time is an important one – running CFD programs on modest 3D grids with about 300,000 control volumes can take over-night on desktop computers with processors of about 1 GHz speed. At times, the solution in intermediate iterations may be fluctuating. In this case, underrelaxation may be used to slow down the speed of convergence and eliminate the fluctuations.

**Grid size issues
**

A good question to ask is: how does one know if the grid is small enough? From the section on finite differences we learned that the smaller the grid the more accurate the solution, but how small is small enough? In the previous problem we had the luxury of knowing what the final answer should be, so we knew that the 5 control volumes we used were appropriate. The best way to know if the grid is small enough is to repeat the problem using a smaller grid. If the solution changes appreciably, then you have to go smaller. If the solution is the same or very close, you know that the grid size is not an issue. ---------------------------------------------------------------------------------------------------------Problem 3.1 Calculate the velocity profile for flow between parallel plates (no energy equation) as specified in Section 2.5. Use 50 loops of Gauss-Seidel iteration, and calculate the residuals at the end. ---------------------------------------------------------------------------------------------------------Problem 3.2 Write a program that uses finite differences with Gauss-Seidel iteration to calculate the temperature distribution in the problem above, as specified in Section 2.5. Compare your result with the analytical result derived earlier. ----------------------------------------------------------------------------------------------------------

38

**3.2 Unsteady flow problems
**

Consider the Couette flow case discussed before, but let’s suppose that both plates are initially at rest. At time t = 0, the top plate is given an instantaneous velocity of 100 m/s. You can envision that the disturbance will take some time to work its way down towards the lower plate, and that after some time, the result will be the steady solution. The velocity profiles might look as sketched below:

t=0

t=1 s

t=2 s

t=3 s (steady flow)

We wish now to know what the velocity of the flow is at different locations as time elapses. We also wish to know the final velocity profile. We again note that the final solution (after some time has elapsed) to this problem will be the same as the steady flow problem. There are situations where it is desirable to solve a steady flow problem as an unsteady problem, for example a space capsule re-entering the atmosphere at high speed in inviscid flow. This will be discussed in more detail in the next section. We begin our analysis with the unsteady Navier-Stokes equation in the x-direction:

ρ(

∂u ∂u ∂u ∂u ∂P ∂ 2u ∂ 2u ∂ 2u +u +v + w ) = Fx − + µ( 2 + 2 + 2 ) ∂t ∂x ∂y ∂z ∂x ∂x ∂y ∂z

We eliminate all unnecessary terms, considering that the flow is only in the x-direction, there is no pressure drop nor body force, and flow occurs in a constant diameter duct:

ρ

∂u ∂ 2u =µ 2 ∂t ∂y

We now apply the finite difference approximation to the equation above, using a forward difference for the time derivative:

ρ

u y +1 − 2u y + u y −1 u t +1 − u t =µ ∆t ∆y 2

There’s just one small detail to work out now. Notice that the left-side expression is in terms of time t, and the right-side is in terms of length coordinate y. In other words, we 39

are dealing with a partial differential equation where u is varying with both time and location y. When a derivative is taken of a partial differential equation with respect to one of the independent variables, we hold one of the independent variables constant. We then hold y constant for the left-side of the equation, and t constant for the right-side, and account for this in our equation:

ρ

u y ,t +1 − u y ,t ∆t

=µ

u y +1,t − 2u y ,t + u y −1,t ∆y 2

We now solve the equation above for uy,t+1: ∆tµ u y ,t +1 = u y +1,t − 2u y ,t + u y −1,t ] + u y ,t ρ∆y 2

[

[3.2.1]

By solving for uy,t+1 we have an expression for the flow speed u that depends on u at a previous time step, allowing us to march forward in time from our known initial conditions! ∆tµ is a constant, which we ρ∆y 2 will call C for convenience. We now illustrate how to proceed, assuming for the sake of argument that C is 0.1. All velocity u values are zero at time t = 0. We note that the first term on the right-side of the equation Assuming that ∆t is 0.1 and ∆y is 0.005 m (resulting in 4 control volumes over the entire height of 0.02 m), we track u as a function of y and t: t=0 u1 = 100 (top plate starts moving) u2 = 0 u3 = 0 u4 = 0 u5 = 0 t = 0.1 s u1 = 100 (note the top node’s speed is constant) u2 = 0.1(0 – 0 + 100) + 0 = 10 u3 = 0 u4 = 0 u5 = 0 t = 0.2 s u1 = 100 u2 = 0.1(0 – 2(10) + 100) + 10 = 18

40

u3 = 0.1(0 – 2(0) + 10) + 0 = 1 u4 = 0 u5 = 0 t = 0.3 s u1 = 100 u2 = 0.1(1 – 2(18) + 100)) + 18 = 24.5 u3 = 0.1(0 – 2(1) + 18) + 1 = 2.6 u4 = 0.1(0 – 2(0) + 1) + 0 = 0.1 u5 = 0 After 150 iterations we obtain the linear velocity profile obtained with the steady solution: u1 = 100 u2 = 74.994 u3 = 49.993 u4 = 24.995 u5 = 0 Below is some pseudo-code showing how to program this process: “Set all velocities to zero at t=0” For i = 1 To 5 u(i, 0) = 0 Next i “Set boundary values to 0 or 100 at all times” For t = 1 To 200 u(1, t) = 100 u(5, t) = 0 Next t “March forward in time 150 time steps” For t = 0 To 150 “Loop through the control volumes” For i = 2 To 4 u(i, t + 1) = 0.1 * (u(i + 1, t) - 2 * u(i, t) + u(i - 1, t)) + u(i, t) Print u(i, t), t Next i Next t

Notice that we did not have to solve simultaneous equations for the unsteady solution. We were able to solve all of the equations by simply marching forward in time, using the

41

previous time step’s velocity values to calculate the next time step’s velocities. Solutions in which we march forward in time are known as explicit solutions, while solutions in which we solve the equations simultaneously are known as implicit solutions. We have stressed the fact that it is possible to solve a steady flow problem (requiring an implicit solution that requires solving simultaneous equations) as if it were an unsteady problem (allowing an explicit solution in which solving simultaneous equations is avoided by marching forward in time). It certainly appears simpler to march forward in time, making one wonder why anyone bothers with implicit solutions at all for steady problems. However, there is a catch, and it can be a major one. Do you recall the constant C in the equations above? We arbitrarily gave it a value of 0.1, ∆tµ and it was defined as . It turns out that if C (a number very similar like it occurs in ρ∆y 2 the more complicated version of the Navier-Stokes equations, and is known as the Courant number) is greater than a certain value, the explicit technique does not converge. In our simple case, using a value of 0.75 for the Courant number results in the following velocities at nodes 1,2, and 3: 1st time step: 75 0 0 2nd time step 37.5 56.25 0 3rd time step 98.4375 0 42.1875 4th time step 25.78125 105.46875 -21.09375 5th time step 141.2109375 -49.21875 89.6484375

42

6th time step -32.51953125 197.75390625 -81.73828125 Cleary this solution is going nowhere good! The problem with having an upper limit on the size of the Courant number is that you may have to use impossibly or impracticably small time steps. Look closely at our Courant number: ∆tµ ρ∆y 2 Suppose that you had a mesh that was very small (which you need in cases where there are large gradients). This would tend to drive the Courant number up, which might require extremely small time steps in order to maintain the Courant number below its maximum allowable value. The result may be impracticably long computational times. It is very important to check that your time step and space steps are small enough – recall that finite differences require small steps for accuracy. You should run your program using smaller steps in order to determine if your current steps are small enough. -----------------------------------------------------------------------------------------------------------Problem 3.3: Run the code above and determine the limit on the size of the Courant number. -----------------------------------------------------------------------------------------------------------Problem 3.4: Determine the velocity profile as a function of time for air in Couette flow, with the upper plate at 10 m/s and a gap of 0.1 m between the plates, at t = 0.01, t = 0.05, t = 0.1, t 3 = 1, and t = 10 s. Divide the flow into 5 control volumes. The density of air is 1.2 kg/m 2 and the viscosity 1.82x10-5 N-s/m . You may consider the energy and momentum equation to be uncoupled (solve only the momentum equation). Do you think that steady state has been achieved after 10 seconds? -----------------------------------------------------------------------------------------------------------As a closing note: most commercial codes use an explicit scheme – they treat steady flow problems as if they were unsteady, and do a time-marching solution. This is done by assigning some initial values to all of the velocities, then allowing the program to march forward in time towards the real solution. For example, an object in a wind tunnel with a known inlet speed of 30 m/s could be simulated by setting the speed everywhere to 30 m/s at t = 0, then allowing the flow speed to settle to steady state values (which will be different from 30 m/s around the object) as time progresses. 43

One very good reason for using a time-marching solution is that it allows parallel processing. Imagine that you could connect ten computers together. Since in an explicit scheme each grid point requires only the velocities at the previous time step, each computer could work independently of the others (at each time step) in calculating velocities at assigned grid points. Since computing time can become such a crucial issue, this can be a very attractive feature.

44

**Chapter 4. Types of Differential equations
**

We now consider the different types of partial differential equations (PDE) you may encounter: hyperbolic, elliptic, and parabolic. Each type exhibits different behavior. Given a 2nd order (with 2nd power derivatives as highest derivative in equation) linear partial differential equation in 2 variables of the form (Partial Differential Equations, Duchateau and Zachmann, McGraw-Hill, 1986): a ∂ 2u ∂ 2u ∂ 2u ∂u ∂u + 2b +c 2 +d +e =F 2 ∂x ∂y ∂x ∂xdy ∂y

2

An equation of this form may be classified on the basis of the discriminant b -4ac: b -4ac>0 2 b -4ac = 0 2 b -4ac<0

2

hyperbolic PDE parabolic PDE elliptic PDE

For example, the time-dependent simplified Navier-Stokes equation we used:

ρ

∂ 2u ∂u =µ 2 ∂t ∂y

a = µ , b = 0, and c = 0. The discriminant is zero, making the equation parabolic. The boundary layer equation: ∂u ∂u ∂u ∂P µ∂ 2 u +u +v =− + ρ∂x ρ∂y 2 ∂t ∂x ∂y is also seen to be parabolic (note we consider only the higher order terms). Parabolic and hyperbolic equations cam be solved with marching solutions (explicitly) while elliptic equations require solution of simultaneous equations.

Types of Flows and their Governing Equations. As alluded to in the section on the governing equations, the Navier-Stokes and energy equations can be simplified depending on the problem being solved. For example, flows outside the boundary layer may at times be considered inviscid, and flows below a Mach number of about 0.3 may at times be considered incompressible. Following is a list of some flows and the resulting types of governing equations: 45

• • •

Hyperbolic: Steady, inviscid supersonic flow, unsteady inviscid flow. Parabolic: steady boundary layer flow, parabolized viscous flows (thick boundary layers with small streamwise gradients), unsteady heat conduction. Elliptic: steady, subsonic, inviscid flow, incompressible inviscid flow.

Consider the case of a blunt-body entering the earth’s atmosphere at supersonic speeds. We wish to know the location of the shock as well as the pressures and velocities. The flow field involves subsonic flow directly behind the normal shock as well as supersonic flow in areas where the shock is more oblique. As an approximation, the flow may be considered inviscid in both areas, resulting in elliptic equations in the subsonic region, and hyperbolic equations where the flow is supersonic. As you can see above, one type can be solved explicitly, the other implicitly, which leads to problems since it is not initially known where the flow is subsonic and supersonic. The blunt-body problem can be more easily solved by treating it as an unsteady flow problem, that is, starting the flow at some initial speed and increasing the speed to supersonic; the solution after some time will be the steady flow solution. Unsteady inviscid flow (whether supersonic on subsonic) is hyperbolic, allowing a time-marching solution. This has been an example illustrating how the use of a time-marching solution can be advantageous. Other advantages were covered in the previous chapter, and as mentioned, the technique of treating steady problems as unsteady is widely used in CFD. Hence, time step issues may arise even though the problem to be solved is a steady-flow problem. The full Navier-Stokes equations (as opposed to simplified forms as mentioned above) are a system of non-linear second order differential equations in four independent variables, and the classification scheme described above does not apply directly to them (Ferzinger). However, a time-marching solution works well – most of the existing CFD solutions to the full Navier-Stokes equations use a time-marching solution (Anderson).

46

**Chapter 5. Meshing Issues
**

5.1

The set of points defining the body and surrounding fluid, on which the finite difference equations are solved, is known as the mesh, or sometimes the grid. You may recall that the finite-difference approximation requires that the mesh be uniform, that is, the ∆x values between grid points must be the same throughout the mesh, ∆y values must be the same, and ∆z values must be the same. In other words, the grid must be orthogonal, meaning that the lines connecting grid points must be perpendicular. The requirement that the mesh be uniform is no problem for analyzing rectangular shapes, but what happens when we are dealing with curved shapes? The use of the finite difference approximation would then require a curved shape to be approximated by rectangular steps, as shown in the figure below:

By using a small enough grid, one could more closely approximate the shape of the object, but this would require an extremely fine a mesh that could take too long to run; you will later get a feeling for how big an issue this can be. Consider that a relatively small problem with 300,000 grid points could run over-night on a modern PC. To get around this problem, the finite difference technique is used with boundary fitted coordinate systems. In a boundary fitted coordinate system, the body being analyzed becomes a reference axis, and a non-uniform grid is wrapped around the object. Hence, the grid points automatically fall on the surface being analyzed. Such a grid might look as shown below.

47

Grid Points

Reference axis Body

Clearly, this grid in not uniform and non-orthogonal! The continuity, momentum, and energy equations must be modified, or transformed, so that the non-orthogonal grid in effect becomes orthogonal in a so-called computational plane. This is a very complicated task, beyond the scope of this book (readers wishing to learn more about transformations of coordinate systems are referred to Anderson). For example, consider the Laplace equation below: ∂ 2φ ∂ 2φ + =0 ∂x 2 ∂y 2 The transformation of this equation would result in a partial differential equation with 17 terms, as opposed to the two above. The transformed equation must then be approximated using finite differences. If you consider the large number of terms in the conservation equations, you can imagine that using a boundary-fitted coordinate system is not a trivial task. There is an easier approach. If we allow the grid to be irregular, and write the finite difference approximation at each point, based on the local grid size, we can apply finite differences to an irregular grid without using a boundary-fitted coordinate system. One technique that does this is the finite volume technique, popular for CFD software. By using irregular spacing between grid points the grid can acquire a shape more closely matching a body surface.

48

5.2 Irregular Grids

We saw how the finite difference technique was applied to the Navier-Stokes equations. The result was a series of algebraic equations that had to be solved either simultaneously or by marching forward in time. These equations applied to discrete points in the flow field. In the cases we solved, the grid was one-dimensional since the flow was also onedimensional, but in real flows the grid would have to be three-dimensional. The 1st derivative finite difference equations used were: • • • Forward: dV / dt ≅ ∆ V / ∆ t = (V t + 1 − V t ) / ∆ t Backward: dV / dt ≅ ∆V / ∆t = (Vt − Vt −1 ) / ∆t Central: dV / dt ≅ ∆V / ∆t = (Vt +1 − Vt −1 ) / 2∆t

The second derivative finite difference equation used was: • d 2V / dt 2 ≅ (Vt +1 − Vt ) / ∆t − (Vt − Vt −1 ) / ∆t (Vt +1 − 2Vt + Vt −1 ) = ∆t ∆t 2

You can see that there is only one delta t. But we could write finite differences equations at each point based on the local values of delta t, or delta x, or delta y. For example, the forward difference above could be written using the delta t used between V(t+1) and V(t). Different delta t values could be used at different points. The second derivative requires a little more thought, although not much more. Consider the plot below, showing V plot as a function of t.

49

Backward Difference V ∆t1 ∆t2

Forward Difference

t-1

t

t+1

The green backward difference line connects the curve between t and t-1. It most accurately represents the slope in-between t and t-1, at the midpoint between t and t-1. The red forward difference line connects the curve between t+1 and t-1. It most accurately represents the slope in-between t+1 and t, at the midpoint between t+1 and t. Note that the space between the two midpoints has to be ∆t1/2 + ∆t2/2. You will recall that the 2nd derivative is the rate of change of the first derivative, and that we can approximate the 2nd derivative as the difference between the forward and backwards slopes, divided by the space between them. Then: d 2V / dt 2 ≅ (Vt +1 − Vt ) / ∆t1 − (Vt − Vt −1 ) / ∆t 2 ∆t1 / 2 + ∆t 2 / 2 [5.1]

Consider Couette flow again, subject to the same restrictions as before: zero-velocity at the bottom, 10 m/s at the top, constant diameter flow, laminar, steady, incompressible, and with no gradients except in the y-direction. As shown in the figure below, we break up the flow into five points. The points can be considered to be inside control volumes, through which the properties are constant, and the same as at the node.

50

u = 10 m/s 1 2 3 4 5

Point 1 is on the upper plate surface, and point 5 is on the lower plate surface. Since the same physical laws still apply, we write the x-direction momentum equation, and eliminate all of the unnecessary terms. Of course, it looks the same as before: ∂ 2u =0 ∂y 2 We apply equation 5.1, and achieve the result ( u y +1 − u y − u y − u y −1 ) [5.3]

∆y back ∆y forward d 2u = 2 ∆y forward + ∆y back dy 2

We note that if the ∆y values are all equal we achieve exactly the same equations as before. -----------------------------------------------------------------------------------------------------------Problem 5.1 Prove that the finite volume technique gives the same result as finite differences for the second derivative, if the ∆ values are uniform -----------------------------------------------------------------------------------------------------------As an example, we now analyze unsteady Couette flow using an irregular grid. The governing momentum equation is:

51

ρ

∂u ∂ 2u =µ 2 ∂t ∂y

The left side of the equation becomes, using a forward difference in time:

ρ

∂u u t +1 − u t = ∂t ∆t

The right side becomes, as done a few paragraphs above: ( u y +1 − u y − u y − u y −1 )

**∆y forward ∆y back d u = ∆y forward + ∆y back dy 2 2
**

2

We put the pieces together into the momentum equation: u y +1 − u y u y − u y −1 ( − ) ∆y forward ∆y back u t +1 − u t ρ =µ ∆y forward + ∆yback ∆t 2 We note that on the left side the velocity is taken with respect to time t, while on the right side the velocity is taken with respect to location y. We recall that we are dealing with partial derivatives, and when performing them, if one variable is allowed to change the other must remain constant. On the left side, we then specify that changes are occurring at constant location y, and on the right side, we specify that changes are occurring at constant time t. We do this by indicating with subscripts at which location y and time step t the velocity u is being calculated: ( =µ u y +1,t − u y ,t − u y ,t − u y −1,t ) [5.9]

ρ

u y ,t +1 − u y ,t ∆t

∆y forward ∆y back ∆y forward + ∆y back

2 If we now solve for u y ,t +1 we will be able to march forward in time explicitly. -----------------------------------------------------------------------------------------------------------Problem 5.2 Solve the equation above for u y ,t +1 . Break up the flow into 5 points measuring, starting from the bottom:0 (bottom plate) , 0.1, 0.2, 0.1, 0.3 meters (top plate), and manually solve problem 3.4 (previously solved using symmetrical finite differences), for 3 time steps of 0.01 s. -----------------------------------------------------------------------------------------------------------52

There is another reason why an irregularly shaped grid may be desirable: you may need a very fine grid in some spots of the flow (the boundary layer is one example, where big changes can occur over small distances), and a fine grid may not be necessary at others (such as outside of the boundary layer, where changes may be happening less drastically). In this case it might be inefficient to use a uniformly small grid, and a large grid would not solve the problem properly – a grid that varies is the solution. In conclusion, we see that we can apply finite differences to an irregularly shaped grid, allowing better fidelity to the shape of the object being modeled, as well as more efficient modeling. We point out that the remaining governing equations (continuity and energy) must also be treated in the same way as the x-direction momentum equation.

53

Chapter 6. Turbulence

Up to now we have been dealing only with laminar flow, which allowed us to have an expression for the shear stress at any spot in the flow:

τ =µ

du dy

Unfortunately things quickly get complicated once the flow becomes turbulent, and most practical engineering flows are turbulent. The problem is that when the flow is turbulent there is no one velocity u,v, or w at any point. Rather, there is an average u, v, and w, with flow speeds fluctuating about the average. The plot below shows what the velocity might look like at any fixed location in steady, turbulent flow.

Mean Velocity u

Time

The obvious question is, “Why not use

du ? ”, where u represents the mean velocity. dy The answer is that it does not work. The shear stress in turbulent flow depends on many factors that are not fully understood or too difficult to predict, such as the magnitude of the fluctuations about the mean. The bottom line is that there is no simple, physics based expression for the shear stress like the equation above for turbulent flow. We could use du τ = µ if we know the velocity at every instant at every spot. This technique is known dy as Direct Numerical Simulation, or DNS, but is currently not workable for practical applications, requiring very small grids and impossibly long computation times with current computers. An alternative that is also still not practical, although not as badly as DNS, is Large Eddy Simulation or LES. In LES, only larger scale eddies are directly

54

solved using the Navier-Stokes equations, while eddies smaller than the mesh size are approximated using experimental data, allowing the use of a coarser mesh. The most widely used approach for modeling turbulent flows is Reynolds-Averaged Navier-Stokes, or RANS. RANS uses an averaged form of the Navier-Stokes equations, which will be covered below. In addition, it uses a variety of user-selected, experimentally obtained equations to obtain the shear stress τ. These experimentally obtained relations are the result of years of research, and include the κ − ε (K-epsilon) model, the Spalart-Allmaras model, the Realizable κ − ε (RKE) model, and the RNGκ − ε models, to name the most popular in use today. The advantages and features of each will be discussed shortly. The truly amazing thing is that given the advanced state of technology today, we still rely on experimental results to predict flows, rather than on first principles. The limitations are the speed and storage capacity of state-of-the-art computers.

**6.1 Turbulent Continuity and Momentum equations - RANS
**

In the previous paragraphs we described turbulent flow as being composed of an average or mean property (such as velocity or pressure) with fluctuations about the mean value. For example, the flow speeds u, v, and w at any point at any time could be given by:

u = u + u′ v = v + v′ w = w + w′

where u ′ is the fluctuation at that time, and u is the mean or average value of the velocity. The bar over any expression denotes the average value.

[6.1]

You can reason that if the velocity u, or any other property of the flow, is averaged over time, we can conclude that the average value of a fluctuation over and above the mean is zero (since some fluctuations will be greater then the mean, and some less than the mean). Thus,

u ′ = v ′ = w′ = 0

2

[6.2]

We note however, that quantities such as (u ′ ) are non-zero, since squaring will eliminate all values below zero that compensate for values greater than zero. In general, all average properties of products are non-zero, such as u ′v ′ . Other averaging rules we will need to use for the coming derivations:

u =u

55

u+v =u+v

u ⋅v = u ⋅v

} [6.3]

∂u ∂u = ∂x ∂x

**RANS Continuity equation
**

Let’s now take our continuity equation for incompressible, steady flow: ∂u ∂v ∂w + + =0 ∂x ∂y ∂z We substitute the turbulence equations for u, v and w into the equation above:

∂ (u ′ + u ) ∂ (v ′ + v) ∂ ( w′ + w) + + =0 ∂x ∂y ∂w

If we recognize that the derivative of a sum may be performed by splitting the sum into two separate derivatives, and we average the equation above over time, we obtain the following (remembering that the average of a primed quantity is zero):

∂ (u ) ∂ (v) ∂ ( w) + + =0 ∂x ∂y ∂z

[6.4]

This is the time-averaged continuity equation for turbulent flow, and looks pretty much like the laminar flow equation.

**RANS MOMENTUM (NAVIER-STOKES) EQUATION
**

The previous procedure was simple – a great warm-up for deriving the RANS NavierStokes equation! We will do so only for turbulent flow in the x-direction with no average component in the y or z directions, that is, the flow is through a constant diameter duct in the x-direction. There will be fluctuations in the y and z directions due to turbulence, as well as fluctuations and average motion in the x direction. The general approach we will take is to set all of the forces acting on a fluid element to zero. In the laminar flow case, these force included only the shear and pressure forces acting on the faces of an element. We will now also consider the forces associated with fluid fluctuations flowing through a control volume. If the fluid flowing through a fluid exits with a different momentum than it entered with, then there will be a force on the element.

56

. Changes in Momentum The momentum rate of a moving fluid, that is, the rate at which momentum flows, is given by:

.

momentum rate = m u

.

where m is the mass flow rate and u is the speed of the fluid. If there is a change in the momentum flow rate, then there will be a force associated with this change. In fact Newton’s 2nd law for a moving fluid is:

.

∑ Fx = ∆ m u

In words, the x-direction force generated by an accelerating fluid through a control volume will be equal to the change in the momentum rate of the fluid in the x-direction. One example of this is a fire hose. Say water enters a nozzle held by a fireman at 1 m/s, and leaves at 10 m/s, with a mass flow rate of 2 kg/s. The force generated by the accelerating water is:

& F = ∆mu =

.

2kg 10m 2kg 1m kg − m − = 18 = 18 N s s s s s2

OK, we have established that the difference between the entering and exiting momentum & rates results in a force, and that the x-direction momentum rate is mu . We recall that the & mass flow rate m in the x-direction is given by the relation:

& m = ρuA ,

where ρ is the fluid density and A is the cross-sectional area of the flow. For example, the mass flow rate of water through a 1 m wide duct, moving at 2 m/s is:

& m = ρuA = 1000

kg m 2 kg 2 π 1 / 4m 2 = 1571 3 s s m

& For flow flowing into a fluid element in the x-direction, since m = ρuA , we can say:

& Momentum rate in x-direction = mu = ρuAu = ρu 2 A

[6.5]

57

Let’s remember that formula. Again, it represents the momentum rate, and the difference between the entering and exiting momentum rates will equal the force associated with that momentum change. It is possible that fluid entering along the bottom face has a component in the x-direction as well, as shown by the figure below.

y-component

flow direction x-component

The mass flow rate into the element via the bottom face is:

& m = ρvA

The rate at which x-momentum enters via flow in the y-direction is then:

& mu = ρvAu.

where u is the x direction component of the entering flow.

[6.6]

The difference between the entering and exiting x-momentum rates due to flow in the ydirection gives rise to another force in the x-direction. And, without straining our imaginations too hard we can envision x-direction momentum entering the control volume by flow in the z-direction. The momentum rate in the zdirection is:

& mu = ρwAu.

[6.7]

Consider an area of the flow, as shown in the figure below. As before, we are concerned only with changes in the momentum flow rate in the x-direction. X-momentum enters/leaves in the x, y and z-directions (z-direction not shown on figure).

58

Momentum in the x-direction enters and leaves the left and right faces of the volume below by virtue of the flow moving from left-to-right. This momentum rate, as shown earlier in the derivation of the Navier-Stokes equations, is ρuAu. The difference between d d the entering and exiting momentum rates is − ( ρuAu )∆x = − ( ρu 2 A)∆x dx dx x-momentum from fluctuations leaves

x-momentum enters at rate of ρuAu

x-momentum leaves

x-momentum enters due to fluctuations

Momentum in the x-direction enters and leaves via the top and bottom faces due to turbulent fluctuations in the y-direction. In other words, fluctuations in the y-direction can have components in the x-direction. The rate at which momentum enters the volume is ρv ′Au , and the difference between the exiting and entering momentum rates d is − ( ρv ′Au )∆y dy In the same way, x-direction momentum enters and leaves via the face in the plane of the paper via turbulent fluctuations in the z-direction. The difference between the exiting and d entering momentum rates in the z-direction is − ( ρw′Au )∆z . dz

Further analysis.

x-direction flow. We first consider the flow in the x-direction, which resulted in a difference is momentum flow rate of

59

−

d ( ρu 2 A)∆x dx

[6.8]

As before, we will consider the fluid element to be symmetrical, so that the “A” terms may be divided out. This means the force calculated will be force per unit area. We substitute the previous expression for turbulence: u = u + u ′ into equation (6.8), and take advantage of the fact that the density and dimensions are constant to obtain: − ρ∆x

d (u + u ′) 2 dx

The quantity in parentheses is multiplied out:

− ρ∆x

d 2 (u + 2uu ′ + u ′ 2 ) dx

[6.9]

The equation above is now averaged over time. Considering the first term in the parentheses of equation(6.9), we note that, since the average speed in the x-direction is not changing (constant diameter duct), the rate of change of u must be zero, so the time average must also be zero:

ρ

d 2 (u ) = 0 dx

We now address the second term in equation(6.9). According to the averaging rules:

ρ

d d (2uu ′) = ρ 2u v ′ = 0 dx dx

We recall that the average of any fluctuation is zero, making the entire term disappear. Finally, the last term of equation(6.9) is addressed:

−ρ

du ′ 2 d = −ρ u′2 dx dx

[6.10]

This is the only term that remains for force generated in the x-direction in turbulent flow, due to flow into our control volume from the x-direction. y and z direction flow. A similar analysis for flow into the control volume in the y and z directions yields:

60

flow in y direction force per unit area: − ρ

d (u ′v ′) dy d (u ′w′) dz

[6.11]

flow in z-direction force per unit area: − ρ

[6.12]

Combining equations(6.10-6.11), we can then say that the total forces equal the total changes in momentum rates:

∑F

x

due to momentum changes = − ρ (

d 2 d d u ′ + (u ′v ′) + (u ′w′)) dx dy dz

[6.13]

All that remains is to calculate the forces due to shear and we will be finished.

RANS Continued: Forces due to shear. In the previous section we found the change in momentum rate on our fluid volume. We now consider the shear or viscous forces, which will be added to the terms calculated above. You will recall from the derivation of the Navier-Stokes equation that we were interested in the net value of the shear force on a fluid volume. The shear acts in only one way for flow through a constant diameter duct: since velocity gradients are only present in the y-direction, a fluid element is being sheared only by the elements below and above it.

τ=

d 2u Force d du = ( µ )∆y = µ 2 Area dy dy dy

where we have assumed constant viscosity, as before. We now substitute the expression for turbulent flow into the above equation to obtain:

d 2u d 2 (u + u ′) =µ dy 2 dy 2 We average this over time to obtain:

µ

τ =µ

d 2u d du = (µ ) 2 dy dy dy

[6.14]

RANS Continued: Putting it all together.

61

We now combine the shear and momentum expressions, (6.14) and (6.13) to yield our RANS equation for incompressible one-dimensional flow through a constant diameter duct, remembering that the acceleration (convective) forces are acting on fluid elements in the direction of motion, and the shear forces are acting opposing the direction of motion:

d d d d du d P - ρ ( u ′ 2 + (u ′v ′) + (u ′w′)) = 0 (µ )− dx dy dz dy dy dx

Please note that we have added a pressure drop term, which was also included in the original laminar, one-dimensional analysis. In our present case we use the average pressure. We re-write the equation above as:

d d d d du d P + ρ (− u ′ 2 − (u ′v ′) − (u ′w′)) = 0 (µ )− dx dy dz dy dy dx

[6.15]

. The terms − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ are known as turbulent or Reynolds stresses. How to handle these terms is the single biggest problem in modeling turbulent flows. For flow in the x-direction in a constant diameter duct, we can typically say that fluctuations in the direction perpendicular to the flow (y-direction) are much greater than fluctuations in the direction of flow (x-direction), and also much greater than those in the z-direction. This result is then:

−ρ

d d d u dP (u ′v ′) + ( µ )− =0 dy dy dy dx

The equation above can be re-written as:

d du dP (µ − ρ (u ′v ′)) − =0 dy dy dx

[6.17]

This last manipulation gives us a very interesting way to look at turbulence. The term du µ can be thought of as a laminar shear stress, and the term − ρ (u ′v ′) can be thought dy of as a turbulent shear stress, so that we could write:

d dP (τ la min ar + τ turbulent ) − =0 dy dx

[6.18]

62

where τ turbulent = − ρ (u ′v ′) and τ la min ar = µ

du dy

It should be noted that the turbulent stresses − ρ (u ′v ′) are positive, that is, they have the same sign as the laminar shear stress term. This can be explained by the following argument: consider a fluid particle in turbulent pipe flow moving at flow speed u, and that the particle is below the flow center-line. If the particle moves down to a lower level due to turbulent fluctuations, it must add a negative component to the layer below it (since it is moving down), making v ' negative. But since on average its speed u is greater than the speed u of the layer it moves to, u ′ will tend to be positive at the new layer, hence the average product of u ′v ′ will be negative at the new layer. Similar reasoning can be applied to a particle moving up into faster moving flow. If we were to plot the values of these shear stresses through the boundary layer, we would find that in the area very close to the wall (known as the wall layer), the laminar term dominates. In the area close to the outer edge of the boundary layer (known as the outer layer), the turbulent stresses dominate. In-between the two layers, known as the overlap layer, both types of shear are important. We will look at this more closely in the section dealing with turbulence modeling. Let’s look at the full-blown incompressible RANS equation for flow in the x-direction:

ρ

∂u ∂P ∂ ∂u ∂ ∂u ∂ ∂u = ρg x − + (µ − ρ u ′ 2 ) + (µ − ρ u ′v ′) + ( µ − ρ u ′w′) ∂y ∂y ∂z ∂z ∂t ∂x ∂x ∂x

It looks nasty, but it pays to stop and look at it one second, and compare it with the Navier-Stokes equation derived earlier (non-RANS): ∂u ∂u ∂u ∂u ∂P ∂ 2u ∂ 2u ∂ 2u ρ ( + u + v + w ) = ρg x − + µ( 2 + 2 + 2 ) ∂t ∂x ∂y ∂z ∂x ∂x ∂y ∂z We note some important things: • The same turbulent stresses are added as we added to our simple RANS equation: − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ . These come as a result of x-velocity being carried into fluid elements by fluctuations in the x, y, and z directions. Many of the terms are nearly identical between the two equations, save for the use of average values of pressure P and velocity u.

•

63

Again, the terms − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ are known the turbulent stresses, and we note that they appear right next to the laminar shear stresses: µ ∂u , etc. ∂x

The turbulent stresses are unknown at the onset of a CFD calculation, and as mentioned before, represent the major problem in performing CFD. These turbulent stresses are determined from experimentally derived equations. As mentioned in an earlier section, the Navier-Stokes equations may be simplified in the boundary layer. You may recall the two-dimensional boundary layer equation in the xdirection was: ∂u ∂u ∂u ∂P µ∂ 2 u +u +v =− + ρ∂x ρ∂y 2 ∂t ∂x ∂y [6.19]

By substituting the turbulent flow expressions for u, v, and P, and averaging over time, the result is the RANS equation for 2-dimensional boundary layer flow:

∂u ∂u ∂u ∂P d ∂u +u +v =− + (µ − ρ u ′v ′) ρ∂x ρdy ∂y ∂t ∂x ∂y

[6.19a]

-----------------------------------------------------------------------------------------------------------Problem 6.1 d Derive equation(6.11), beginning with ( ρv ′Au )∆y dy -----------------------------------------------------------------------------------------------------------Problem 6.2 Show that the average u ′v ′ is negative, for a fluid particle moving up into faster moving flow. ----------------------------------------------------------------------------------------------------------Problem 6.3 What is the momentum rate, and what is its significance? -----------------------------------------------------------------------------------------------------------Problem 6.4 Show how to go from equation(6.17) to equation(6.18). -----------------------------------------------------------------------------------------------------------Problem 6.5 What do the quantities − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ represent? Are they really shear stresses? -----------------------------------------------------------------------------------------------------------Problem 6.6 Beginning with equation(6.19), derive equation(6.19a). -----------------------------------------------------------------------------------------------------------64

65

**Determining the Reynolds Stresses/Various Turbulence Models
**

The determination of the turbulent stresses is the chief problem of CFD, and is sometimes known as turbulence modeling. At times you may hear the term “The Closure Problem”, which refers to the fact that the RANS equations themselves have no way of determining the turbulent stresses; the RANS equations can be “closed” when an expression for the Reynolds stresses is known. There are two general ways to proceed at this point. The turbulent stresses can be determined by Reynolds-Stress Models (RSM), or by Eddy-Viscosity Models (EVM). The Reynolds-Stress Models solve directly for the Reynolds stresses − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ , using very complicated equations with experimentally derived constants. The result is a more accurate and more physically sound model than EVM, particularly for complex 3-D flows with strong curvature. However RSM require more computation time and can be very difficult to converge. For these reasons, Eddy Viscosity Models are used more often than Reynolds Stress Models. Some CFD software packages, like Star-CCM+, allow you to choose between the two methods.

**Eddy Viscosity Models.
**

EVM are based on the calculation of a turbulent or eddy viscosity. As mentioned earlier, in the turbulent Navier-Stokes equation, the turbulent stresses occur alongside the laminar stresses. For example, consider the d/dy terms from equation(6.17):

∂ ∂u (µ − ρ u ′v ′) ∂y ∂y

Note that the µ

∂u term looks just like a laminar flow shear stress. We can then say that ∂y

the ρ u ′v′ term, which arose from turbulence, can be considered a turbulent shear stress, so that we can rewrite the equation above:

∂ ∂u ∂ ∂u ∂u (µ − ρ u ′v ′) = ( µ + ρµ t ) ∂y ∂y ∂y ∂y ∂y

where µt is the turbulent or eddy viscosity, and µ is the normal dynamic viscosity. We are considering only the d/dy term from equation(6.17) for the purpose of illustration – there are other similar terms!The point is that the turbulent shear stresses can be replaced by an expression similar to the shear stress for laminar flow. If we can determine some way to calculate an eddy viscosity, we will be on our way to solving turbulent flow

66

problems using the Navier-Stokes equations. This is the point of EVM: the determination of an eddy or turbulent viscosity µt . The eddy viscosity µt can be calculated many ways. Some methods use algebraic expressions or a combination of algebraic expressions and differential equations to determine µt . This has given rise to the terms zero-equation, one-equation, and twoequation models. Zero equation models use only algebraic expressions for µt (no differential equations), while one and two-equation models use one and two differential equations. You will run into this terminology frequently.

**Reynolds Stress Models:
**

Instead of solving for the turbulent viscosity µt , Reynolds-Stress Models (or RSM) solve directly for the Reynolds stresses − ρ u′2 , − ρ u ′v′ , and − ρ u ′w′ , using very complicated equations with experimentally derived constants. The result is a more accurate and more physically sound model than EVM, in the sense that EVM assume turbulence is isotropic (the same in all directions at a point). Reynolds Stress models are then more accurate than EVM, particularly for complex 3-D flows with strong curvature. However RSM require more computation time and can be very difficult to converge.

**Which model to use:
**

Which model to use when? It depends on the application, but currently, most users prefer the realizable κ−ε model. If large amounts of swirl/rotation are expected, Reynolds Stress models may be the best choice. The various popular turbulence models are outlined below: • Spalart-Allmaras Model This one equation model was designed for aerospace applications, and is best suited for flows with mild separation. Economical for large meshes (runs relatively quickly), but can perform poorly for 3-D flows. • κ−ε model (k-Epsilon, sometimes known as the Standard κ−ε model, or SKE) Has been the most widely used turbulence model for engineering applications. A twoequation model that is robust (will run without crashing), but can give some very poor results when there is strong flow separation, large streamline curvature, and high pressure gradients. For example, a non-streamlined object, such as a truck, may be a poor choice for analysis given the large amount of separation that may be experienced at the rear. Flow through a cyclone, where there may be strong curvature, would also be a problem. A differential equation is used at each point to calculate κ , which is the turbulent 1 kinetic energy, κ = (u ′ 2 + v ′ 2 + w′ 2 ) . Another differential equation is used to 2

67

calculate ε, which is the turbulent dissipation rate (the rate at which turbulence is getting destroyed, or used up). • RNG κ−ε model Modified to give better performance than the standard κ−ε model. Performs better with the types of flows that give SKE models difficulty. • Realizable κ−ε model Offers the same advantages as RNG, but is generally believed to be more accurate and easier to run than RNG. This is the default choice for Star-CCM+ if the κ−ε model is selected. • Standard κ−ω model Another two-equation model. Most widely accepted in the aerospace and turbomachinery fields. Accurate and robust for large range of boundary layer flows with pressure gradients, as well as for low Reynolds number flows. • SST κ−ω model A variation of the standard κ−ω model with similar benefits. Combines the standard κ−ω model for use near walls with the SKE model. • Reynolds Stress Models: More physically sound than eddy viscosity methods, but require longer running times and memory. Good for flows with a strong curvature/swirl. See section below for more detail. When running CFD codes, you will often be asked for the turbulence intensity at the inlet. This refers to the average fluctuation about the mean flow speed, and should be measured experimentally. If you think about this, it is quite logical that the incoming turbulence will affect the outcome of a simulation. In the absence of known turbulence intensity value, commercial CFD packages will automatically assign a turbulence intensity value to your simulation, based on the flow speed, inlet dimensions, and fluid properties. -----------------------------------------------------------------------------------------------------------Problem 6.7 Discuss under what situations it might be appropriate to use the κ−ε model. Would you use it to calculate drag force on a sphere moving through a fluid at high speed? -----------------------------------------------------------------------------------------------------------Problem 6.8 Why are turbulence models needed? -----------------------------------------------------------------------------------------------------------Problem 6.9 Discuss the pros and cons of RSM and EVM. -----------------------------------------------------------------------------------------------------------Problem 6.10 68

Define κ and ε -----------------------------------------------------------------------------------------------------------Problem 6.11 Define the turbulence intensity. Why might you need to know it experimentally? ------------------------------------------------------------------------------------------------------------

69

**Chapter 7 - Wall Functions
**

Most turbulence models are not good in the boundary layer, hence a strategy must be adopted for dealing with near-wall flows. The techniques or stratagems used to calculate flows in these areas are known as wall functions. The simplest way to deal with boundary layers is using the logarithmic overlap law, an extremely clever technique based on some pretty universal properties of flow boundary layers.

**Dimensionless Analysis and the Buckingham Pi Theorem
**

First we must speak very briefly about the advantages of using dimensionless groups in expressing experimental results. Some dimensionless numbers that readers may be VDρ V ) and the Mach number ( Ma = , familiar with are the Reynolds number ( Re = µ a where a is the speed of sound). The units in these numbers cancel – hence they are referred to as dimensionless groups of numbers, or dimensionless groups. The proper construction of dimensionless groups is known as dimensional analysis. Why bother to make dimensionless groups? The answer is that experimental results can be made much more general by expressing the results using dimensionless groups. Let’s say that we run experiments on head loss over a length of pipe, using water at flow speeds ranging from 1 m/s to 10 m/s, with a pipe diameter of .1 meter. Your results might look as shown below, the circles representing your experimental points. The line through the points is estimated:

Head Loss

Flow Speed

70

You had to perform 5 runs to generate that plot. But what if you wanted the same information for 0.05 m and .75 m diameter pipes? And what if, in addition, you wanted data for air and oil? You can imagine that you would have to spend a lot of time in the lab – 45 experimental runs would be required!

Head Loss

Flow Speed

But, it turns out that the original 5 data pairs, obtained using water in a 0.1 meter pipe could be used for other pipe diameters and for other fluids if the results are expressed using dimensionless groups! This is nothing short of astounding. For example, if the original data are expressed instead in terms of two dimensionless h D2 g VDρ groups, the Reynolds number ( Re = ) and the friction factor ( f = L 2 ), where µ LV µ = vis cos ity; L = pipe length ; ρ = density ; g = gravitational const ; D = pipe diameter and hL = head loss , then the results apply to nearly all fluids at nearly all pipe diameters! The plot would then become as shown below, ONE PLOT for many diameters and many different fluids!

71

f

Re

To estimate a pressure drop from the plot above (a simplified version of the Moody Diagram), one would first calculate the Reynolds number using a known flow velocity, viscosity, density and pipe diameter, and read the value of “f” from the plot above. The equation for friction factor f is then used to get the head loss hl. Amazing - a small number of experimental results can be extended to conditions very different from those used during the original experiment. And it’s used all of the time to express experimental results in order to make the results much more general. Any engineer has been exposed to additional dimensionless groups like drag coefficient Cd, relative roughness e/D, Weber number We, and Nusselt number Nu, to name a few. But how could anyone possibly know which dimensionless groups to use, and how many of them to use (for example, perhaps only the Reynolds number Re would have been required above)? A lot of it is intuition and experience, but the Buckingham Pi theorem is used to determine the number of dimensionless groups. One begins with a series of experimental results, and a desired output. In the example above, the desired output is some way to determine the head loss through a pipe. We then list the desired result, and the variables which might affect it. For the example above:

hL = f (V , D, L, ρ , µ )

The equation above means the head loss hl depends on (or is a function of in mathematical language) the terms inside the parentheses. To make this statement requires experience and perhaps some trial-and error!

72

One then counts all of the factors we are keeping track of, counting the one we are interested in. In the example above there are 6. The Buckingham Pi theorem, very coarsely stated, says that the number of dimensionless groups required to express experimental results is the number of factors minus the number of fundamental units involved. In the example above, the fundamental units involved are m, kg, and s. Then, the number of dimensionless groups involved is 6-3 = 3. Once the number of groups is determined, one sets about trying to make three dimensionless groups out of the factors involved, again through trial-and-error. In this case the groups are: Re =

VDρ

µ

, f =

hL D 2 g LV 2

We note that D/L is the third dimensionless group inside the expression for friction factor f. We again stress that experience and trial-and-error are required. One might try one set of dimensionless groups and see if the data collapse onto one plot, and if not, perhaps consider other groups including factors not considered. It turns out that dimensional analysis is used for developing universal velocity profiles through the boundary layer, in order to solve the problem of the boundary layer not being applicable to turbulent models.

**Experimental results for turbulent boundary layers
**

You may recall that for turbulent flow we cast our momentum equation so that we could identify turbulent and laminar shear stresses :

shear stress = d (τ la min ar + τ turbulent ) dy

[6.18]

where τ turbulent = − ρ (u ′v ′) and τ la min ar = µ

du dy

Experiments performed on turbulent boundary layers show that the boundary layer can be divided into three general regions: • • • the inner layer, where the laminar shear term dominates (that is viscous forces are greatest by far) an outer layer, where turbulent shear dominates, and an overlap layer where both viscous and turbulent shears are important.

73

Experiments also show that velocity through the boundary layer looks something like the plot below:

Pressure Gradients:

Strong, Favorable Mild Adverse Strong Adverse Very Strong Adverse Separating Flow

Velocity

Figure 7.1

Distance from Wall

The plots are for varying pressure gradients. A favorable pressure gradient refers to pressure dropping in the direction of flow – similar to having the wind at one’s back. For example, this is the situation encountered a flow moves around the forward portion of a sphere. An adverse or unfavorable pressure gradient refers to rising pressure in the direction of flow – fighting a head-wind, if you will. Flow moving around the aft portion of a sphere experiences an adverse pressure gradient, and it’s the adverse pressure gradient that causes the flow to separate, or detach from the body of the sphere in the aft portion – the flow does not have the energy to fight the rising pressure, and leaves the contour of the sphere. All blunt objects in other than creeping flow experience separation, and it’s the cause of much drag force resisting motion. Why should the pressure drop in the forward portion of a sphere, and rise in the aft portion? The answer is that the flow is speeding up in the forward portion of the sphere, and when speed goes up, pressure drops. If you imagine an island in the middle of a channel, you can imagine that the flow will speed up around the island since the same amount of water must pass through a decreased area, as shown below.

74

Increasing flow speed

Decreasing flow speed

Any object in a flow, it does not have to be in a channel, will experience a similar effect. Where the area of the object is increasing, the flow velocity is increasing, and the pressure is dropping (a favorable pressure gradient). Where the area of the object is decreasing (as in the aft portion), the velocity is decreasing and the pressure increasing (an adverse pressure gradient). It’s interesting to note that at low speeds, the boundary layer in the forward portion of an object in flow can be laminar. When the boundary layer becomes turbulent (due to a higher speed or perhaps some roughness on the surface of the object), it becomes thicker and has more energy than the laminar layer, and can punch through further into the adverse gradient in the aft portion of the object. The result is that the point of separation moves aft, and the drag on the object drops! The drag drops because the vortices/wake at the back of the object become smaller. This phenomenon only applies to non-streamlined, or blunt objects. Streamlined objects do not experience significant separation. Golf balls have dimples on them to make the boundary layer turbulent and reduce the amount of separation on the ball, resulting in longer flight distances. It’s important to note that if a golfer could hit a smooth golf ball hard enough, the dimples would be unnecessary (and would in fact slow down the ball) since the transition to turbulence would occur anyway at the faster speed. However, humans cannot make the ball go fast enough to reach the point where the boundary layer becomes turbulent using a smooth ball, hence dimples are used. Now back to Figure 7.1 and the real point of this discussion (the information above dealing with separation is useful to know when analyzing CFD results – expect flow separation if a body is blunt!). The real point of this section is that there appears to be no

75

universal velocity profile through the boundary layer. The shape of the profile seems to depend on the pressure gradient. Please see Figure 7.1 again! Enter dimensional analysis. If the following dimensionless groups are made: u + =

u , u*

u* =

τw yρu * and y + = µ ρ 1/ 2

where τ w is the shear stress at the wall, ρ is the fluid density, y is the distance from the wall, and µ is the fluid viscosity, then some very nice results can be obtained. If the experimental results of Figure 7.1 are re-plot using these dimensionless groups, then the many curves of figure 7.1 fall nicely onto one curve, at least for a good portion of the plot, as shown by the figure below:

Turbulent Boundary Layer Profile 20 18 16 14 12 u+ 10 8 6 4 2 0 0 50 100 150 200 y+ 250 300 350 400

The inner layer ranges from about y+ = 0 to y+ = 10, while the overlap layer ranges from about y+ = 35 to about y+ = 350 (corresponding to about 20% of the boundary layer). The turbulent core, not shown in the plot above does not fall onto one curve, but the figure above is a great success anyway, as will be shown below.

76

The overlap layer, also known as the logarithmic overlap layer, is very well fit by the equation:

u+ =

u 1 1 yρu * = ln y + +5 = ln( )+5 0.41 µ u * 0.41

The equation above is known as the logarithmic overlap law. Very close to the wall (up to about y+ = 5) , the following equation holds:

u+ = y+

And, another equation exists for y+ between 5 and 35. What this all means is that, if a velocity is known in the overlap layer, then the shear at the wall is known (which is very important to know in order to calculate drag forces or pressure drops), and in fact the entire velocity profile is known down to the wall. There is then no need to make a grid fine enough to capture the area closest to the wall, nor to go down any lower than the original point in the overlap layer. One point in the overlap layer is sufficient. The method presented above is a “simple” way to determine the profile and shear at the wall for turbulent boundary layers. Some commercial CFD packages give you the option to use the logarithmic overlap law, or to select more complicated wall functions. -----------------------------------------------------------------------------------------------------------Problem 7.1 A turbulent boundary layer flow has an average speed of 5 m/s, at a point .01 m from the edge of a wall. Assuming this is within the overlap layer, calculate the shear at the wall. Calculate y+ to check the assumption that we were within the overlap zone. The viscosity is 1.0E-5 m^2/s, and the density is 1.2 kg/m^3. Hint: This problem can easily be solved by iteration – that is, guess values of u* until the equation is satisfied. Solution: u* = .2627, shear at the wall = .0828 N/m^2, y+ = 315 (within the proper range). -----------------------------------------------------------------------------------------------------------Problem 7.2 Sketch the velocity profile above in the overlap layer, using points at y+ = 35, 100, and 315. Make the plot in terms of y vs speed u. -----------------------------------------------------------------------------------------------------------Problem 7.3 An engineer with the goal of reducing gas consumption decides to place dimples on the roof of a truck with a blunt shape. Is this necessarily a good idea? -----------------------------------------------------------------------------------------------------------Problem 7.4 Why are wall functions necessary? 77

-----------------------------------------------------------------------------------------------------------Problem 7.5 What is flow separation, and what is its effect? -----------------------------------------------------------------------------------------------------------Problem 7.6 What are adverse and favorable pressure gradients, and what geometries cause them? -----------------------------------------------------------------------------------------------------------Problem 7.7 The velocity in a turbulent boundary layer is a function of which factors? -----------------------------------------------------------------------------------------------------------Problem 7.8 Discuss the benefits of using dimensionless groups to express experimental results. ------------------------------------------------------------------------------------------------------------

78

Closing Remarks

There is still a lot of progress to be made in CFD. Even the best commercial codes may not give perfect solutions, and at times they may give results that are clearly inaccurate, despite the user’s best efforts. However, in general, CFD has become a very valuable design tool that can either reduce or completely eliminate the number of physical experiments required. In the last few chapters you may have gotten an appreciation for how fragile some of the turbulence modeling equations can be. While advances have been and are being made continuously, there is still a near-total reliance on parametric equations based on experimental results, rather than on physical laws. This is analogous to determining an automobile’s speed based on the intensity of the sound that the tires are making as they roll over the pavement, rather than determining speed by measuring the time it takes the automobile to cover a certain distance. The technique may give accurate results some of the time, but during inclement weather or changing road surfaces the speed predictions may be inaccurate. Turbulence modeling based on experimental results suffers from the same weakness – when flows are different from the exact conditions for which equations were developed, results may be inaccurate. Running any CFD simulation should always be done with some skepticism. Users should ask themselves: are the results reasonable? Many users still perform experiments to verify CFD solutions. Engineers can get around the modeling problem using a CFD technique known as Direct Numerical Simulation (or DNS), which involves determining the flow characteristics of even very small eddies in the flow – typically CFD results do not give such fine resolution everywhere. However, the time required to run a complicated analysis, even -9 with a hypothetical computer capable of performing a calculation every nano(10 ) second, would be in the hundreds of thousands of years (White, Viscous Fluid Flow)! It appears that turbulence will continue to be a problem for the foreseeable future.

79

Sources:

Boundary Layer Theory, by Hermann Schlichting Viscous Fluid Flow, by Frank White Fluid Mechanics , by Frank White Computational Fluid Dynamics, by John Anderson Computational Methods for Fluid Dynamics, by J.H. Ferzinger and M. Peric Partial Differential Equations, by Paul Duchateau and David Zachmann An Introduction to Computational Fluid Dynamics – the Finite Volume Method, by H.K. Versteeg and W. WMalalasekera Fluent Training Notes Star-CCM+ Training Notes

80

81

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd