Assignment 6 is due on Tuesday, A amazonaws com

Report 4 Downloads 59 Views
COMP 208: Computers in Engineering Winter 2010 Assignment 6 O shock, where art thou? Due Date: Assignment 6 is due on Tuesday, April 13. The cutoff is automated and is exactly at this time. Assignments submitted within the next hour will be considered late. After that time they will not be accepted at all. The assignment is to be done individually. You can collaborate on understanding the problem but you must write the solutions independently. Submissions might be subject to being checked by plagiarism detection software.

Overview: In the previous assignment, you have studied the effect of a converging-diverging nozzle on a flow of air of a given Mach number. Now the air will flow through a long pipe instead, experiencing frictional forces from its inner walls. This type of flow is known as “fanno flow”. In fanno flow, the friction either speeds up or slows down the fluid depending on its Mach number: 1. A subsonic flow (slower than the speed of sound, M < 1) would speed up. 2. A supersonic flow (faster than the speed of sound, M > 1) would slow down. As you might expect, a pipe that is long enough will eventually cause the fluid, regardless of whether it was subsonic or supersonic, to become sonic (equal the speed of sound, M = 1). The length of the pipe required to do that is known as the critical length (Lcrit). However, what would happen if the pipe was longer than Lcrit? Will the speed of the flow after reaching sonic increase or decrease? As a matter of fact, it is unknown. The flow will actually try to prevent such a situation from arising by doing the following: 1. If it was subsonic, then it would be slow enough for “information” about the length of the pipe to be passed back to the inlet, thereby adjusting the amount of flow permitted through the pipe. 2. If it was supersonic, however, then it would be really fast for that “information” to travel back. Instead, a shock wave would be formed in the pipe that will alter the properties of the fluid and prevent it from reaching sonic. Depending on the rest of the properties of the flow, including the pressure at the other end of the pipe (pback), the shock wave could be a normal shock wave. In this assignment, you are to determine whether a normal shock wave exists in the pipe, and determine its exact location (a). See Fig 1 for a visual representation of the system. The total length of the pipe is Ltotal.

Lcrit

M1 p0,1

pback

a Fig 1: Supersonic flow in a pipe

Part 1: Construct Fanno Table: In this part, you are to construct the fanno table using the following three equations: Fanno relations: i)

ii)

iii)

where γ = 1.4 The table should have 4 columns: M, T/Tcrit, p/pcrit and Val and should have values ranging from M = 0.01 to M = 10.00: 1. From M = 0.01 to M = 3.00, increment M by 0.01 2. From M = 3.00 to M = 5.00, increment M by 0.50 3. From M = 5.00 to M = 10.00, increment M by 1. Output the table to a .csv file.

Notes: 1. Tcrit and pcrit are the temperature and the pressure, respectively, that the fluid would reach if it ever attained sonic speed in the pipe. T and p are the current temperature and pressure of the fluid at the given M. 2. Val is a number that is directly proportional to the critical length.

Requirements for Part 1: 1. You are only allowed to write one integration function in your code. You will have to integrate two functions in this case, so use function pointers. 2. You are allowed to pick the number of panels of your choice. 3. See requirement in Part 2 about γ Hints: 1. There are three equations, so it would be helpful if you write one function for each equation. 2. For T/Tcrit, write two functions. One that only computes what is in the integral and another that computes T/Tcrit based on that function.

Part 2: Determine location of shock In this part, you are required to answer the following question: “You are given a pipe of length Ltotal = 60 cm, diameter D = 1 cm with a friction factor f = 0.0025. Air (γ = 1.4), having a Mach number M1 = 3.00 and a stagnation pressure p0,1 = 300 kPa, enters the pipe. The pressure of the container at the other end of the pipe pback = 50 kPa. Determine the location, a, of the normal shockwave in the pipe.” Unfortunately, there is no direct method that gives us the solution to this problem. There is a way, however, if it was the other way round: determine pback if the location was given. Therefore, the only way we could determine a is by guessing a value and comparing it with pback. For simplicity, this part will be divided into two smaller parts. In the first (A), you should attempt to write a function that returns pback,calc for a given a. After that (B), a root finding algorithm should be applied on that function to determine the a that gives the required pback. The following additional equations would be needed Fanno relation (iv)

Shock relation

Isentropic relation

Notes: 1. The shock relation shows how the Mach number of a fluid changes as it passes through a shock wave. M is the Mach number of the fluid entering the shock wave, and My is the Mach number as it leaves. 2. The isentropic relation relates the stagnation pressure of the fluid (that is, the pressure of the fluid would have if it was brought rest) to its current pressure. As a fluid is brought to rest, its pressure increases.

Part A: Implement the function calcpback (or any other name of your choice) with the following header: double calcpback = (double a); The function should determine pback as follows: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.

Using the isentropic relation and M = M1, determine p0/p Determine p1 by dividing p0,1 by the ratio gotten in step 1. Using fanno relation (ii), determine p/pcrit. Use M = M1. Determine pcrit by dividing p1 by the ratio gotten in step 3. Determine Val1 by using fanno relation (iii). Use M = M1. Using Val1, determine L1,crit by using fanno relation (iv). Determine La,x,crit by subtracting a from L 1,crit. Determine Vala,x by using fanno relation (iv). Use L1,crit = La.x.crit. Determine the supersonic Ma,x by using fanno relation (iii). Use Val = Vala. (See note below) Determine Ma,y by using the shock relation. Use M = Ma,x. Determine Vala,y by using fanno relation (iii). Use M = Ma,y. Find La,y,crit using fanno relation (iv). Use Val = Vala,y. Determine L2,crit by the following equation: L2,crit = La,y,crit - (Ltotal – a) Check L2,crit. If it is negative, exit the function immediately and return pcrit. Determine Val2 using fanno relation (iv). Use Lcrit = L2.crit Determine subsonic M2 using fanno relation (iii). Use Val = Val2. (See note below) Determine p2/pcrit using fanno relation (ii). Use M = M2. Determine p2 by multiplying the ratio from step 17 by pcrit. Return p2.

Note for steps 9 and 16: As could be seen from relation (iii), it is not possible to write M in terms of Val. Therefore, you can determine M using two ways: - Using a root finding algorithm just like in assignment 5. Note that in step 9, you are asked for the supersonic solution (M>1), while in 16 you are asked for the subsonic one (M