Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pipe Friction In C code: Determining fluid flow through pipes and tubes has great relevance in many areas of engineering and science. In mechanical and

Pipe Friction In C code:

Determining fluid flow through pipes and tubes has great relevance in many areas of engineering and science. In mechanical and aerospace engineering, typical applications include the flow of liquids and gases through cooling systems.

The resistance to flow in such conduits is parameterized by a dimensionless number called the friction factor. For turbulent flow, the Colebrook equation provides a means to calculate the friction factor,

0 = 1/sqrt(f) + 2log((e/3.7D) + 2.51/Re*sqrt(f) ) Equation 1

where

f = friction factor

e = the roughness (m),

D = conduit diameter (m),

and Re = the Reynolds number, defined by the following equation,

Re= ( pVD)/u Equation 2

where

p = the fluids density [kg/m3],

V = its velocity [m/s], and

u = dynamic viscosity [N s/m2].

In addition to appearing in Equation 2, the Reynolds number also serves as the criterion for whether flow is turbulent (Re > 4000); the Colebrook equation apply under this condition.

The various pipe parameters have values that range as follows:

Roughness e (in millimeters): 0.0001 to 3

(e.g. cement lined cast iron pipe: 1.5, Commercial steel pipe: 0.046, drawn tubing: 0.0015)

Fluid density p (in kg/m3): 0.5 (air is 1.2) to 2000 (95% sulfuric acid is 1839)

Dynamic viscosity (in N s/m2): 10-6 (air is 18.6x10-6) to 300 (peanut butter is 250)

Finding the value of friction factor f from Equation (1) using analytical means is far from trivial. Numerical methods can provide very good results by using a root finding method, that is, finding the root of the function g(f) defined as

g(f)= 1/sqrt(f) + 2log((e/3.7D) + 2.51/Re*sqrt(f) ) Equation 3

will give the friction factor f according to the Colebrook equation of Equation 1.

The velocity V (m/s) to compute the Reynolds number (Re) is related to the flow rate. The flow rate, Fr, is defined as the volume of fluid that passes a location per unit time (units used is m3/s). The relationship between the flow rate and the fluid velocity is

Fr = AV Equation 4

where Fr is the flow rate in m3/s

A is the cross sectional area of the conduit (m2)

V is the fluid velocity (m/s).

The bisection method for finding roots, which is alternatively called binary chopping, interval halving, or Bolzanos method, is one type of incremental search method in which the interval is always divided in half. If a function changes sign over an interval, the function value at the midpoint is evaluated. The location of the root is then determined as lying at the midpoint of the subinterval within which the sign change occurs. The process is repeated to obtain refined estimates. A simple algorithm for the bisection calculation to finding the root of the function f(x) consists of the following steps.

Step 1: Choose lower xL and upper xUguesses for the root such that the function changes sign over the interval. This can be checked by ensuring that f(xL)f(xU)< 0.

Step 2: An estimate of the root xRis determined by xR = (xL + xU)/2.

Step 3: Make the following evaluations to determine in which subinterval the root lies:

(a) If f(xL)f(xR)< 0, the root lies in the lower subinterval. Therefore, set xU= xRand

return to step 2.

(b) If f(xL)f(xR)> 0, the root lies in the upper subinterval. Therefore, set xL= xR and

return to step 2.

(c) If |f(xL)f(xR)| < some small tolerance value (that is, can be considered equal to 0), the root equals xR; terminate the computation.

The method can be repeated until the result is accurate enough.

Develop software that plots how the friction factor varies with change of the conduit diameter while keeping the fluid flow rate constant. The user will provide the following conduit and fluid parameters: the pipe roughness, a minimum and maximum diameter value; and the fluid density, flow rate and viscosity. (Note: the maximum diameter value will give the minimum fluid velocity for the given flow rate; thus this fluid velocity can be used to check the Re number criterion (>4000) for validating input values).

When new input values are given, the user is given the option to save them into a file; up to five sets of values can be stored. Thus when the software starts the user can elect to use one of the five stored values or enter new values.

A bisection root finding method is used to find the friction factor.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

What type of psychotherapy did Dr. Walden use with Carlos?

Answered: 1 week ago

Question

2. What are the different types of networks?

Answered: 1 week ago