#CHAPTER 7_ Flow Measurement
#Caption : Flow Measurement
# Example 1# Page 406
t=293. #('Entering the temperature(in k) of pitot tube =:')
p1=0.1*10**6 #('entering the air pressure in pitot tube=:')
v=10. #('entering the velocity of air in pitot tube=:')
R=287.;
print("Density is given by:")
print("pho1=p1/(R*t);")
pho1=p1/(R*t);
# dynamic pressure
Pd=pho1*v**2/2;
#we know that v=sqrt(2Pd/pho)
# dv/dP=1/2(2/pho*Pd)**0.5
# Let the error or uncertainty in velocity is represented by Wv and in pressure by Wp
Wp=1. #('entering the uncertainty in the measurement of dynamic pressure=:')
print("Uncertainty in velocity is given by ")
print("Wv=(1/2)*(2/(pho1*Pd))**0.5*Wp;")
Wv=(1./2.)*(2/(pho1*Pd))**0.5*Wp;
per_unc=Wv*100/10;
print'So the percentage uncertainty in the measurement of velocity is d\n',per_unc
#CHAPTER 7_ Flow Measurement
#Caption : Anemometers
# Example 2# Page 426
# To derive an expression for velocity across a hot wire anemometer in terms of the wire resistance Rw, the current through the wire Iw and the empirical constants C0 and C1 and the fluid temperature.
print("C0+C1(v)**.5)(Tw-Tf)=Iw**2Rw")
print("Rw= Rr[1+a(Tw-Tr)]")
print("Rw/Rr=1+a(Tw-Tr)")
print("Tw-Tr=1/a[Rw/Rr-1]")
print("Tw=1/a[Rw/Rr-1]+Tr")
print("Co+C1(v)**0.5=Iw**2Rw/Tw-Tf")
print("so,")
print("v=1/C1[{Iw**2Rw/(1/a[Rw/Rr-1]+Tr-Tf)]}**2-C0")
#CHAPTER 7_ Flow Measurement
#Caption : Gross volume flow rate(venturi)
# Example 3# Page 438
from math import sqrt,pi
dp=0.02 #('entering the diameter of the line in which water is flowing=:')
dt=0.01 #('entering the diameter of venturi=:')
B=0.5; # given
# The discharge coefficients remains in the flat portion of the curve for reynolds numbers 10**4 to 10**6 Cd=0.95
u=8.6*10**-4 #('entering the viscosity=:')
Cd=0.95;
Rn_min=10**4;
print("Minimum flow rate is given by:")
print("mdot_min=i*dp*u*Rn_min/4")
mdot_min=pi*dp*u*Rn_min/4
g=9.81;
print'Minimum flow rate at 25 deg cent is kg/s\n',mdot_min
pf=1000 # density of water
At=78.53*10**-6 #('entering the throat area=:')
pm=13.6 #('entering the density of manometer fluid=:')
#h is the height of mercury column due to flow
print("To calculate the mercury reading corresponding to minimum flow, using-")
print("h_min=((mdot_min*sqrt(1-B**4))/((sqrt(2*g*(pm-pf/pf))*pf*At*Cd)))**2;")
h_min=((mdot_min*sqrt(1-B**4))/((sqrt(2*g*(pm-pf/pf))*pf*At*Cd)))**2;
#in mm
H_min=h_min*1000
print'So the pressure reading observed for the given flow ratre is mm of Hg\n',H_min
h_max=.25 #('entering the value of h maximum=:')
m_max=(pf*At*Cd*sqrt(2*g*(pm-pf/pf))*sqrt(h_max))/sqrt(1-B**4);
print'The maximum flow rate is kg/s\n',round(m_max,3)
#CHAPTER 7_ Flow Measurement
#Caption : Gross volume flow rate(venturi)
# Example 4# Page 439
from math import pi,sqrt
dt=0.15 #('entering the throat diameter=:')
dp=0.3 #('entering the upstream diameter=:')
Cd=0.95;
B=0.5;
pm=13600. #('entering the density of manometer fluid=:')
At=pi*dt**2/4;
g=9.81;
pf=995.8
h=0.2 #('entering the height of mercury column due to flow (in m)=:')
q=pf*At*Cd;
w=(1-B**4)**(1/2);
e=sqrt(2*g*((pm/pf)-1));
mdot_25=q*e*sqrt(h)/w
print("Mass flow is given by :")
print("mdot=pf*At*Cd*(1/(1-B**4)**(1/2))*sqrt(2*g*((pm/pf)-1)*sqrt h)")
print'So the mass flow at 25 deg cent is d kg/s\n',mdot_25
pf=999.8 #('entering density of water at 25 deg cent=:')
h=0.2 #('entering the height of mercury column due to flow (in m)=:')
q=pf*At*Cd;
w=(1-B**4)**(1./2.);
e=sqrt(2*g*((pm/pf)-1));
mdot=q*e*sqrt(h)/w
# error is mdot(25 deg cent)-mdot(t deg cent)
print' The mass flow at 0 deg cent is d kg/s\n',mdot
error1=abs(((mdot_25-mdot)/mdot_25)*100);
print' Change in temperature of water introduces insignificant error in mass flow measurement i.e. \n',error1
pf=988.8 #('entering density of water at 25 deg cent=:')
h=0.2 #('entering the height of mercury column due to flow (in m)=:')
q=pf*At*Cd;
w=(1-B**4)**(1./2.);
e=sqrt(2*g*((pm/pf)-1));
mdot=q*e*sqrt(h)/w
# error is mdot(25 deg cent)-mdot(t deg cent)
print' The mass flow at 50 deg cent is d kg/s\n',round(mdot,3)
error2=abs(((mdot_25-mdot)/mdot_25)*100);
print'Therefore, change in temperature of water introduces insignificant error in mass flow measurement i.e. \n',round(error2,3)
#CHAPTER 7_ Flow Measurement
#Caption : Gross volume flow rate(venturi)
# Example 5# Page 440
from math import pi,sqrt
dt=.1 #('entering the throat diameter=:')
dp=.2 #('entering the upstream diameter=:')
Cd=0.95;
g=9.81
B=0.5;
At=pi*dt**2./4.;
pf=780. #('entering density of oil in the pipeline =:')
pm=1000. #('entering the density of manometer fluid=:')
w=(1-B**4)**(1./2.);
e=sqrt(2*g*((pm/pf)-1));
S_ideal=At*e/w;
print('The ideal volume flow rate sensitivity is (m**3/s/h**0.5)\n',S_ideal)
# part b
print("Actual volume rate sensitivity is given by :")
print("S_actual=S_ideal/Cd")
S_actual=S_ideal/Cd;
print('The actual volume rate sensitivity is \n',round(S_actual,3))
h=.3 #('entering the manometer reading of water height=:')
print("Actual volume flow rate is given by:")
print("Q_actual=S_actual*sqrt(h)")
Q_actual=S_actual*sqrt(h);
print('The actual volume flow rate is m**3/s\n',round(Q_actual,3))
#CHAPTER 7_ Flow Measurement
#Caption : Sonic nozzle
# Example 6# Page 443
from math import sqrt
print"Let uncertainty in mass flow rate be represented by wm"
print"Let uncertainty with pressure be represented by wp"
print"Let uncertainty with temperature measurement be represented by wt"
# To calculate the uncertainty in the temperature measurement
wm_m=0.02 #('entering the uncertainty in mass flow=:')
wp_p=0.01 #('entering the uncertainty in pressure measurement=:')
print"Uncertainty in temperature is given by:"
print"wt_t=2*sqrt(wm_m**2-wp_p**2)*100"
wt_t=2*sqrt(wm_m**2-wp_p**2)*100
print'uncertainty in the temperature measurement is \n',round(wt_t,2)
#CHAPTER 7_ Flow Measurement
#Caption : Venturi
# Example 7# Page 446
from math import pi,sqrt
p1=5*10**6 #('entering the pressure of air when venturi is to be used =:')
t1=298. #('entering the temperature of air for the same=:')
m_max=1. #('entering the maximum flow rate=:')
m_min=0.3 #('entering the minimum flow rate=:')
Re_min=10**5 #('entering the throats reynold number=:')
R=287.; # for air
pho1=p1/(R*t1);
b=0.5;
mu=1.8462*10**-5 #('enter the absolute viscosity=:')
D_max=(4*m_max)/(pi*Re_min*mu);
D_min=(4*m_min)/(pi*Re_min*mu);
print'So the throat diameters for maximum and minimum flows so the reynolds number does not exceed 10**5 are m and m respectively\n',D_max,D_min
# To calculate the differential pressure
At=pi*D_max**2./4.;
C=1; # discharge coefficient
M=1.0328; # Velocity approach coefficient
Y=.9912; # Expansion factor
dP_max=(m_max)**2/(Y**2*M**2*C**2*At**2*2*pho1);
print'The differential pressure for maximum flow rate is Pa\n',round(dP_max,2)
dP_min=(m_min)**2/(Y**2*M**2*C**2*At**2*2*pho1)*1000;
print'The differential pressure for minimum flow rate is mPa\n',round(dP_min,2)
#CHAPTER 7_ Flow Measurement
#Caption : Constant-Pressure-Drop , Variable-Area Meters(Rotameters)
# Example 8# Page 455
from math import pi
Qd=.1/60 #('enter the maximum flow of water=:')
t=298. #('enter the temperature in k=:')
d=.03 #('enter the float diameter in m=:')
L=0.5 #('enter the total length of rotameter=:')
D=.03 #('enter the diameter of tube at inlet=:')
Vb=25*10**-6 #('enter the total volume of float=:')
Af=7.068*10**-4 # area of float
j=2*9.81*Vb/Af;
y=L;
print("Tube taper is given by:")
print("a=(Qd*2)/(pi*D*y*j**(1/2))")
a=(Qd*2)/(pi*D*y*j**(1./2.));
print'tube taper is m/m(taper)\n',round(a,3)
#CHAPTER 7_ Flow Measurement
#Caption : Gross volume flow rate(venturi)
# Example 9# Page 457
from math import sqrt,pi
dp=0.03 #('entering the diameter of the line in which water is flowing=:')
dt=0.02 #('entering the diameter of venturi=:')
B=0.7; # given
# The discharge coefficients remains in the flat portion of the curve for reynolds numbers 10**4 to 10**6 Cd=0.95
u=5.9*10**-4 #('entering the viscosity=:')
Cd=0.95;
Rn_min=10**4;
print("Minimum flow rate is given by:")
print("mdot_min=i*dp*u*Rn_min/4")
mdot_min=pi*dp*u*Rn_min/4
g=9.81;
print'Minimum flow rate at 25 deg cent is kg/s\n',mdot_min
pf=1000 # density of water
At=78.53*10**-6 #('entering the throat area=:')
pm=13.6 #('entering the density of manometer fluid=:')
#h is the height of mercury column due to flow
print("To calculate the mercury reading corresponding to minimum flow, using-")
print("h_min=((mdot_min*sqrt(1-B**4))/((sqrt(2*g*(pm-pf/pf))*pf*At*Cd)))**2;")
h_min=((mdot_min*sqrt(1-B**4))/((sqrt(2*g*(pm-pf/pf))*pf*At*Cd)))**2;
#in mm
H_min=h_min*1000
print'So the pressure reading observed for the given flow ratre is mm of Hg\n',H_min
h_max=.25 #('entering the value of h maximum=:')
m_max=(pf*At*Cd*sqrt(2*g*(pm-pf/pf))*sqrt(h_max))/sqrt(1-B**4);
print'The maximum flow rate is kg/s\n',round(m_max,3)
#CHAPTER 7_ Flow Measurement
#Caption : Gross volume flow rate(venturi)
# Example 10# Page 460
from math import pi,sqrt
dt=.3 #('entering the throat diameter=:')
dp=.5 #('entering the upstream diameter=:')
Cd=0.95;
g=9.81
B=0.5;
At=pi*dt**2./4.;
pf=890. #('entering density of oil in the pipeline =:')
pm=1150. #('entering the density of manometer fluid=:')
w=(1-B**4)**(1./2.);
e=sqrt(2*g*((pm/pf)-1));
S_ideal=At*e/w;
print('The ideal volume flow rate sensitivity is (m**3/s/h**0.5)\n',S_ideal)
# part b
print("Actual volume rate sensitivity is given by :")
print("S_actual=S_ideal/Cd")
S_actual=S_ideal/Cd;
print('The actual volume rate sensitivity is \n',round(S_actual,3))
h=.3 #('entering the manometer reading of water height=:')
print("Actual volume flow rate is given by:")
print("Q_actual=S_actual*sqrt(h)")
Q_actual=S_actual*sqrt(h);
print('The actual volume flow rate is m**3/s\n',round(Q_actual,3))
#CHAPTER 7_ Flow Measurement
#Caption : Constant-Pressure-Drop , Variable-Area Meters(Rotameters)
# Example 11# Page 461
from math import pi
Qd=.1/60 #('enter the maximum flow of water=:')
t=469. #('enter the temperature in k=:')
d=.25 #('enter the float diameter in m=:')
L=0.3 #('enter the total length of rotameter=:')
D=.03 #('enter the diameter of tube at inlet=:')
Vb=25*10**-6 #('enter the total volume of float=:')
Af=7.068*10**-4 # area of float
j=2*9.81*Vb/Af;
y=L;
print("Tube taper is given by:")
print("a=(Qd*2)/(pi*D*y*j**(1/2))")
a=(Qd*2)/(pi*D*y*j**(1./2.));
print'tube taper is m/m(taper)\n',round(a,3)