Question: USE PYTHON, then Implement the given given codes for plotting Problem 1 ( 5 0 = 2 5 + 1 0 + 1 5 )

USE PYTHON, then Implement the given given codes for plotting
Problem 1(50=25+10+15)
The resistance to flow in coeduits/pipes is parameterized by a dimensionless number called the friction
factor (f). For turbulent flow, the Colerook equation provides a means to calculate the friction factor:
0-172+2.0log10(lon3.7D+2.51Rc72)
where lon is roughaess in the pipe (mam),D is diameter of the pipe (in m), and Re-delVD is the Reynolds
number of the flow. V is the velocity of the flow in the pipe (ms is the dynamic viscosity of the fluid
(N,sm2), and is density of the fluid (kgm3).
(a) Write a code to Calculate the friction factor (f) for -0.003mm, for a range of Reynolds mum-
ber (Re-104-106) and pipe Diameter (D-10-1-10(m)) using the Colebrook equation Equ. (1).
Implenernt the equation-solving technique of your doice, e.g., Fixod-Point Iteration, Newton-Raphson,
Secant, or Modified-Secant. Note that friction factors (f) uswally range between 0.008 to 0.08.
(b) Use "contourf" to plot the variation of f with respect to Re and D calculated in part (a). In
addition, on the same figure also plot f approsimated using the explicit formula called the Swanse-Jain
equation:
f=1.325[ln(t5.7D+5.745t2)]2
Hint: You many refer to the following codes for the plotting,
fig.aubplota_ad juat (bottor=0.1, top-0.9, left-0.1, right-0.8,
waphese-0.4, hapace-0.1)
: Plot friction factor va. Reynolda mumber and pipe diaseter
plt.figure(figaize=(12,6))
plt. aubplot (12t)
plt. contourf (Re_range, D_range, friction_factora, cmap='viridia')
plt.xlabel ('Reynolda Samber (Re)')
plt.ylabel ('Pipe Diasater (a)')
plt.tiele('Priction Factor va. Reyzolda Muzber and Pipe Diasater')
ple.elia(-0.01,0.035)
ax = Iig.add_aubplot (131)
I Sviatee-Jain equation for compariabo
p1t.aubplot (122)
plt.colarbar (label=' Friction Factor (I)')
ple.xlabel('Beynolda Samber (Re)')
plt.ylabel('Pipe Diaseter (a)')
plt.ticle('Swasee-Jai= Priction Pactor va. Rajaolda Muzber and Pipe Diasater')
ple.elia(-0.01,0.035)
(c) For a circular pipe the pressure required per uxit length of pipe is given by
PL=f(22D3Q2)
where AFT is the pressure gradient, defined as the pressure drop per leagth of pipe, Q is the valume flow
rate (m3s-1) in the pipe, and Q-VD24. Calculate and plot pressure gradient as a function of Q
using equation 3 when D-2m, roughness lon=0.003mm,g=9.81ms2, density of water =1000kgm3,
and dynamic viscosity of water =10-3N*5m2. For calculatiag friction factor f, you may use Equ.
(1) or (2). But, please justify your choice.
 USE PYTHON, then Implement the given given codes for plotting Problem

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!