logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jane SimaaLaw
(5/5)

713 Answers

Hire Me
expert
Anna CarolyanLaw
(5/5)

549 Answers

Hire Me
expert
Liam PattersonEnglish
(5/5)

953 Answers

Hire Me
expert
Colin JenkinssSocial sciences
(5/5)

698 Answers

Hire Me
C Programming

You are allowed to use online resources to assist in this assignment and no collusion with other students of any kind is allowed

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

COMP1004 Semester 1, 2020 Home‐based Programming Assignment

Instructions (Read Carefully):

  1. This is an open book programming assignment. You are allowed to use online resources to assist in this assignment;

  2. This is an individual assignment and no collusion with other students of any kind is allowed;

  3. Your program has to work. That means it has to compile correctly, run according to specifications, and give correct results. The submitted assignment must also meet the following criteria:

    • Good design, including good pseudocode and algorithms; and

Adequate testing, especially the testing of data boundaries and special cases.

  1. You must observe good programming practices, including comment, documentation, and readability of your program;

  2. To facilitate program readability, you must include function calls in your program whenever possible;

  3. All names of constants, types, variables, functions, etc. must be "self‐documenting" and "self‐describing." For example, you should call a variable a name such as "total" if it is used to store a Give a function a name like "PrintList" if its job is to print a list;

Estimating the frictional pressure loss for fluid flow in straight pipes

 Background

Civil, mechanical, chemical and petroleum engineers all have to deal with the flow of fluids in pipes. For example, the Goldfields Pipeline from Perth to Kalgoorlie‐Boulder supplies around 14.1 billion litres of water per year over a distance of about 560 km. Piping alone can represent around 10% of the total capital cost of a typical chemical plant, amounting to many millions of dollars. Engineers who design and operate piping systems need to minimise the associated costs. Roughly speaking, a larger diameter pipe costs more to buy (capital cost), but is cheaper to run (operating cost) because it would have a lower frictional pressure loss. Estimating the frictional pressure loss for the flow of a gas or liquid in straight pipe is a common and important engineering task.

𝐷, 𝜖   Δ𝑝f𝑣𝜌, 𝜇𝐿

The frictional pressure loss in single‐phase, incompressible flow in a straight pipe may be found by:

fΔ𝑝 = 𝑓L 1 𝜌𝑣2 D 2

where Δ𝑝f is the frictional pressure loss (Pa), 𝑓 is the Moody friction factor (unitless), 𝐿 is the pipe length (m), 𝐷 is the pipe’s internal diameter (m), 𝜌 is the fluid density (kg/m3) and 𝑣 is the mean fluid velocity inside the pipe (m/s). The friction factor depends on a quantity called the Reynolds number, which characterizes the ratio of inertial to viscous forces in the flow, and the roughness of the pipe, which depends on the pipe’s material and method of fabrication. The Reynolds number for pipe flow is calculated using

𝑅𝑒 = Dvqµ

where 𝑅𝑒 is the Reynolds number (unitless) and 𝜇 is the fluid’s dynamic viscosity (Pa.s). When the Reynolds number is below about 2100 for pipes, the flow is laminar, while above about 4000, the flow is turbulent; in between, the flow regime is transitional: it could be laminar or turbulent, or swap randomly between them. Different equations for the friction factor are needed for the different flow regimes. One possible set of equations is  𝑓𝑜𝑟 𝑅𝑒 ≤ 2100 (𝑙𝑎𝑚𝑖𝑛𝑎𝑟)

Re𝑓 =𝑓  + (𝑓   — 𝑓 ) ( Re–2100 )  𝑓𝑜𝑟 2100 € 𝑅𝑒 ≤ 4000 (𝑡𝑟𝑎𝑛𝑠𝑖𝑡𝑖𝑜𝑛𝑎𝑙)

where 𝑓L is the laminar friction factor equation evaluated at 𝑅𝑒 = 2100, 𝑓T is the turbulent friction factor evaluated at 𝑅𝑒 = 4000 and 𝜖 is the pipe roughness (m). Some typical roughness values are:

Pipe material                                                                   Roughness (mm)

Commercial carbon or stainless steel                          0.045

Ordinary concrete                                                          1.0

Glass tube                                                                         0.0015

PVC / plastic                                                                     0.0060

Table 1 : Pipe materials and their associated roughness values. Note: These values are in mm and need to be converted to m before calculating 𝑓.

Programming Tasks

 

Your task is to develop a working C program 

  1. Read from an external file (name this file input.txt) which stores the input values for the pipe diameter, pipe length, fluid velocity, fluid density and fluid viscosity. Student can choose the format of the external file so long as it is a text file;

  2. Ask the user to select the pipe material (i.e. carbon/steel, concrete, glass or PVC/plastic) for which the program will assign the associated roughness value (in mm) according to Table 1;

  3. Calculate and print the Reynolds number, the frictional pressure loss and the flow regime (i.e. laminar, transitional or turbulent) onto the computer screen; and

  4. For a series of fluid velocity values, between 1m/s and 2m/s in step of 0.1m/s, calculate the resultant frictional pressure loss and write the pair of values (i.e. fluid velocity versus frictional pressure loss) onto an external excel spreadsheet (name this file output.csv) so that the data can be viewed and plotted on Microsoft Excel Spreadsheet.

To facilitate program readability, you must include function calls in your program whenever possible. To help with checking your program for part 3 above, you should get the following results for the following two test cases:

Inputs

Water in Goldfields Pipeline

Pipe diameter (m)

0.76

Pipe length (m)

560000.00

Fluid velocity (m/s)

1.00

Fluid density (kg/m3)

1000.00

Fluid viscosity (Pa.s)

0.001

Pipe roughness (mm)

0.045

Outputs

Reynolds number

7.60e+005

Frictional pressure loss (Pa)

4.82e+006

Flow regime

Turbulent

Test Case 1 : For water in the Goldfields pipeline

Inputs

Water in garden hose

Pipe diameter (m)

0.012

Pipe length (m)

5.00

Fluid velocity (m/s)

0.15

Fluid density (kg/m3)

1000.00

Fluid viscosity (Pa.s)

0.001

Pipe roughness (mm)

0.006

Outputs

Reynolds number

1.80e+003

Frictional pressure loss (Pa)

1.67e+002

Flow regime

Laminar

Test Case 2 : For water in a typical garden hose

What you have to submit

  1. The pseudo code documenting the design of the program. This should be submitted as a pdf naming it pdf (10%);

  2. A well‐documented, syntax‐free and correctly‐working C program source Name this file

program.c (60%);

  1. The txt and output.csv files (5%); and

  2. A report recording the set of tests (i.e. test cases) that you performed on your program to verify the correctness of the This should be submitted as a pdf naming it report.pdf (25%).

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

April
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30