Chapter 7 : Integral methods of analysis

Example 7.2 - Page No :273

In [5]:
import math 
from scipy.integrate import quad 


# Variables
# given
id_ = 4.;  			 #[m] - insid_e diameter
h = 2.;  			 #[m] - water level
ro = 0.03;  			 #[m] - radius of exit hole
rt = id_/2.;  			 #[m] - insid_e radius
g = 9.80665;  			 #[m/sec**2] - gravitational acceleration

# Calculations
# using the equation dh/h**(1/2) = -((ro**2)/(rt**2))*(2*g)**(1/2)dt and integrating between h = 2 and h = 1
def f6(h): 
	 return (1./h**(1./2))*(1./(-((ro**2)/(rt**2))*(2*g)**(1./2)))

t1 =  quad(f6,2,1)[0]

# Results
print " Time required to remove half of the contents of the tank is  t = %.2f sec = %.2f min"%(t1,t1/60);
			 #integrating between h = 2 and h = 0

def f7(h): 
	 return (1./h**(1./2))*(1./(-((ro**2)/(rt**2))*(2*g)**(1./2)))

t2 =  quad(f7,2,0)[0]

print " Time required to empty the tank fully is  t = %.1f sec = %.1f min"%(t2,t2/60);

ro2 = (h**2)*math.sqrt(h*h/g)/(10*60)
print " Ro**2 = %.6f m**2"%ro2
 Time required to remove half of the contents of the tank is  t = 831.37 sec = 13.86 min
 Time required to empty the tank fully is  t = 2838.5 sec = 47.3 min
 Ro**2 = 0.004258 m**2

Example 7.3 - Page No :274

In [23]:
# Variables
# composition of fuel gas
nH2 = 24.;
nN2 = 0.5;
nCO = 5.9;
nH2S = 1.5;
nC2H4 = 0.1;
nC2H6 = 1;
nCH4 = 64;
nCO2 = 3.0;

# Calculations
# calculating the theoritical amount of O2 required
nO2theoreq = 12+2.95+2.25+0.30+3.50+128;
# since fuel gas is burned with 40% excess O2,then O2 required is
nO2req = 1.4*nO2theoreq;
nair = nO2req/0.21;  			 # as amount of O2 in air is 21%
nN2air = nair*(0.79);  			 # as amount of N2 in air is 79%
nN2 = nN2+nN2air;
nO2 = nO2req-nO2theoreq;
nH2O = 24+1.5+0.2+3.0+128;
nCO2formed = 72.1;
nCO2 = nCO2+nCO2formed;
nSO2 = 1.5;
ntotal = nSO2+nCO2+nO2+nN2+nH2O;
mpSO2 = (nSO2/ntotal)*100;
mpCO2 = (nCO2/ntotal)*100;
mpO2 = (nO2/ntotal)*100;
mpN2 = (nN2/ntotal)*100;
mpH2O = (nH2O/ntotal)*100;


# Results
print " gas                 N2       O2         H2O         CO2       SO2";
print " moles              %.1f     %.1f      %.1f        %.1f      %.1f"%(nN2,nO2,nH2O,nCO2,nSO2);
print " mole percent       %.1f      %.1f       %.1f          %.1f      %.1f"%(mpN2,mpO2,mpH2O,mpCO2,mpSO2);
 gas                 N2       O2         H2O         CO2       SO2
 moles              785.2     59.6      156.7        75.1      1.5
 mole percent       72.8      5.5       14.5          7.0      0.1

Example 7.4 - Page No :280

In [2]:
import math
# Variables
# given
id_ = 6.;  			 #[inch] - inlet diameter
od = 4.;  			 #[inch] - outlet diameter
Q = 10.;  			 #[ft**3/sec] - water flow rate
alpha2 = math.pi/3;  #[radians] - angle of reduction of elbow
alpha1 = 0.;
p1 = 100.;  		 #[psi] - absolute inlet pressure
p2 = 29.;  			 #[psi] - absolute outlet pressure

# Calculations
S1 = (math.pi*((id_/12)**2))/4.;
S2 = (math.pi*((od/12)**2))/4.;
U1 = Q/S1;
U2 = Q/S2;
mu = 6.72*10**-4;  	 #[lb*ft**-1*sec**-1]
p = 62.4;  			 #[lb/ft**3]
Nrei = ((id_/12.)*U1*p)/(mu);

# Results
print "Nre(inlet) = %.1e"%Nrei
Nreo = round(((od/12)*U2*p)/(mu),-4);
print "Nre(outlet) = %.1e "%Nreo

# thus
b = 1.;
w1 = p*Q;  			 #[lb/sec] - mass flow rate
w2 = w1;
gc = 32.174;

# using the equation (w/gc)*((U1)*(math.cos(alpha1))-(U2)*(math.cos(alpha2)))+p1*S1*math.cos(alpha1)-p2*S2*math.cos(alpha2)+Fextx = 0;
Fextx = -(w1/gc)*((U1)*(math.cos(alpha1))-(U2)*(math.cos(alpha2)))-p1*144*S1*math.cos(alpha1)+p2*144*S2*math.cos(alpha2);
print "Fext,x = %.0f lb"%Fextx
Fexty = -(w1/gc)*((U1)*(math.sin(alpha1))-(U2)*(math.sin(alpha2)))-p1*144*S1*math.sin(alpha1)+p2*144*S2*math.sin(alpha2);
print "Fext,y = %.0f lb "%Fexty
print "The forces Fext,x and Fext,y are the forces exerted on the fluid_ by the elbow.\
\nFext,x acts to the left and Fext,y acts in the positive y direction.\
\nNote that the elbow is  horizantal,and gravity acts in the z direction"
Nre(inlet) = 2.4e+06
Nre(outlet) = 3.6e+06 
Fext,x = -2522 lb
Fext,y = 2240 lb 
The forces Fext,x and Fext,y are the forces exerted on the fluid_ by the elbow.
Fext,x acts to the left and Fext,y acts in the positive y direction.
Note that the elbow is  horizantal,and gravity acts in the z direction

Example 7.5 - Page No : 282

In [27]:
import numpy

# Variables
Fextx = -2522.;  			 #[lb] - force in x direction
Fexty = 2240.;  			 #[lb] - force in y direction

# Calculations
# the force exerted by the elbow on the fluid is the resolution of Fext,x and Fext,y , therefore
Fext = ((Fextx)**2+(Fexty)**2)**(1./2);
alpha = 180. - 41.6

# Results
print " the force has a magnitude of %.0f lb and a direction of %.1f from \
\nthe positive x directionin the second quadrant"%(Fext,alpha);

# Note : answers in book is wrong. they have used wrong values everywhere. Please check it manually.
 the force has a magnitude of 3373 lb and a direction of 138.4 from 
the positive x directionin the second quadrant

Example 7.6 - Page No :283

In [9]:
# Variables
id_ = 6.;  			 #[inch] - inlet diameter
od = 4.;  			 #[inch] - outlet diameter
Q = 10.;  			 #[ft**3/sec] - water flow rate
alpha2 = math.pi/3;  #[radians] - angle of reduction of elbow
alpha1 = 0.;
p1 = 100.;  		 #[psi] - absolute inlet pressure
p2 = 29.;  			 #[psi] - absolute outlet pressure
patm = 14.7;  		 #[psi] - atmospheric pressure
p1gauge = p1-patm;
p2gauge = p2-patm;
S1 = (math.pi*((id_/12.)**2))/4.;
S2 = (math.pi*((od/12.)**2))/4.;
U1 = Q/S1;
U2 = Q/S2;
p = 62.4;  			 #[lb/ft**3]
b = 1.;
w1 = p*Q;  			 #[lb/sec] - mass flow rate
w2 = w1;
gc = 32.174;

# Calculations
# using the equation Fpress = p1gauge*S1-p2gauge*S2*math.cos(alpha2);
Fpressx = p1gauge*144*S1-p2gauge*144*S2*math.cos(alpha2);
Fpressy = p1gauge*144*S1*math.sin(alpha1)-p2gauge*144*S2*math.sin(alpha2);
wdeltaUx = (w1/gc)*((U2)*(math.cos(alpha2))-(U1)*(math.cos(alpha1)));
wdeltaUy = (w1/gc)*((U2)*(math.sin(alpha2))-(U1)*(math.sin(alpha1)));
Fextx = wdeltaUx-Fpressx;
Fexty = wdeltaUy-Fpressy;
Fext = ((Fextx)**2+(Fexty)**2)**(1./2);
alpha = 180 - 43.4

# Results
print " The force has a magnitude of %.0f lb and a direction of %.1f from the positive x directionin the second \
quadrant"%(round(Fext,-1),alpha);
print " Also there is a force on the elbow in the z direction owing to the weight of the elbow \
 plus the weight of the fluid inside"
 The force has a magnitude of 3030 lb and a direction of 136.6 from the positive x directionin the second quadrant
 Also there is a force on the elbow in the z direction owing to the weight of the elbow  plus the weight of the fluid inside

Example 7.7 - Page No :293

In [12]:
from scipy.integrate import quad 
# Variables
Uo = 1.;  			 #[m/sec]
# using Ux/Uo = y/yo
# assuming any particular value of yo will not change the answer,therefore
yo = 1;

# Calculations
def f2(y): 
	 return (Uo*y)/yo

Uxavg =  quad(f2,0,yo)[0]


def f3(y): 
	 return ((Uo*y)/yo)**3

Ux3avg =  quad(f3,0,yo)[0]

# using the formula alpha = (Uxavg)**3/Ux3avg
alpha = (Uxavg)**3/Ux3avg;

# Results
print "alpha = ",alpha
print " Note that the kinetic correction factor  alpha has the same final value for \
 laminar pipe flow as it has for laminar flow \nbetween parallel plates."
alpha =  0.5
 Note that the kinetic correction factor  alpha has the same final value for  laminar pipe flow as it has for laminar flow 
between parallel plates.

Example 7.8 - Page No :293

In [56]:
# Variables
Q = 0.03;  			 #[m**3/sec] - volumetric flow rate
id_ = 7.;  			 #[cm] - insid_e diameter
deltaz = -7.;  		 #[m] - length of pipe
T1 = 25.;  			 #[degC] - lowere sid_e temperature
T2 = 45.;  			 #[degC] - higher sid_e temperature
g = 9.81;  			 #[m/sec**2] - acceleration due to gravity
deltaP = 4.*10**4;   #[N/m**2] - pressure loss due to friction
p = 1000.;  		 #[kg/m**3] - density of water 
w = Q*p;
C = 4184.;  		 #[J/kg*K) - heat capacity of water

# Calculations
deltaH = w*C*(T2-T1);
# using the formula Qh = deltaH+w*g*deltaz
Qh = deltaH+w*g*deltaz;

# Results
print " the duty on heat exchanger is  Q = %.2e J/sec"%(Qh);
 the duty on heat exchanger is  Q = 2.51e+06 J/sec

Example 7.10 - Page No :298

In [16]:
# Variables
d = 0.03;  			 #[m] - diameter
g = 9.784;  		 #[m/sec] - acceleration due to gravity
deltaz = -1.;

# using the equation (1/2)*(U3**2/alpha3-U1**2/alpha1)+g*deltaz = 0
# assuming
alpha1 = 1.;
alpha3 = 1.;

U1 = 0.;

# Calculations
U3 = (-2*g*deltaz+(U1**2)/alpha1)**(1/2.);
p = 1000.;  			 #[kg/m**3] - density of water
S3 = (math.pi/4)*(d)**2
w = p*U3*S3;

# Results
print " the mass flow rate is  w = %.2f kg/sec"%(w);


# using deltap = p*((U3**2)/2+g*deltaz)
deltap = p*((U3**2)/2+g*deltaz);
p1 = 1.01325*10**5;  			 #[N/m**2] - is equal to atmospheric pressure
p2 = p1+deltap;
vp = 0.02336*10**5;
if p2>vp:
    print " the siphon can operate since the pressure at point 2 is greater than the value at which the liquid boils";
else:
    print " the siphon cant operate since the pressuer at point 2 is less than \
     the value at which the liquid_ boils";
 the mass flow rate is  w = 3.13 kg/sec
 the siphon can operate since the pressure at point 2 is greater than the value at which the liquid boils

Example 7.11 - Page No :300

In [60]:
# Variables
sp = 1.45;  			 # specific gravity of trichloroethylene
pwater = 62.4;  			 #[lb/ft**3] - density of water
p = sp*pwater;
d1 = 1.049;  			 #[inch] - density of pipe at point 1
d2 = 0.6;  			 #[inch] - density of pipe at point 2
d3 = 1.049;  			 #[inch] - density of pipe at point 3

# Calculations
# using the formula U1*S1 = U2*S2; we get U1 = U2*(d2/d1);
# then using the bernoulli equation deltap/p = (1/2)*(U2**2-U1**2);
deltap = 4.2*(144);  			 #[lb/ft**2] - pressure difference
U2 = ((2*(deltap/p)*(1./(1.-(d2/d1)**4)))**(1./2))*(32.174)**(1./2);

# umath.sing the formula w = p*U2*S
w = p*U2*((math.pi/4)*(0.6/12)**2);
w1 = w/(2.20462);

# Results
print " the mass flow rate is  w = %.1f lb/sec or in SI units  w = %.2f kg/sec"%(w,w1);
 the mass flow rate is  w = 3.9 lb/sec or in SI units  w = 1.77 kg/sec

Example 7.12 - Page No :301

In [62]:
# Variables
Q = 50/(7.48*60);  	 #[ft/sec] - volumetric flow rate of water
d1 = 1.;  			 #[inch] - diameter of pipe
deltaz = -5;  		 #[ft] - distance between end of pipe and math.tank
g = 32.1;  			 #[ft/sec] - acceleration due to gravity
Cp = 1.;  			 #[Btu/lb*F] - heat capacity of water
p = 62.4;  			 #[lb/ft**3] - density of water
S1 = (math.pi/4)*(d1/12.)**2;
U1 = Q/S1;
w = p*Q;
U2 = 0.;
gc = 32.174;

# Calculations
# using the formula deltaH = (w/2)*((U2)**2-(U1)**2)+w*g*deltaz
deltaH = -(w/(2*gc))*((U2)**2-(U1)**2)-w*(g/gc)*deltaz;
deltaH = deltaH/778;  			 # converting from ftlb/sec to Btu/sec
deltaT = deltaH/(w*Cp);

# Results
print " The rise in temperature is %.5f degF"%(deltaT);
 The rise in temperature is 0.01475 degF

Example 7.13 - Page No :303

In [64]:
# Variables
deltaz = 30.;  		 #[ft] - distance between process and the holding math.tank
Q = 100.;  			 #[gpm] - volumetric flow rate of water
p1 = 100.;  		 #[psig]
p2 = 0.;  			 #[psig]
g = 32.1;  			 #[ft/sec] - acceleration due to gravity
sv = 0.0161;  		 #[ft**3/lb] - specific volume of water
p = 1./sv;  		 #[lb/ft**3] - density of water
e = 0.77;  			 # efficiency of centrifugal pump
deltap = (p1-p2)*(144);  			 #[lbf/ft**2]
gc = 32.174;

# Calculations
# using the equation deltap/p+g*(deltaz)+Ws = 0;
Wst = -deltap/p-(g/gc)*(deltaz);
# using the formula for efficiency e = Ws(theoritical)/Ws(actual)
# therefore
Wsa = Wst/e;
# the calulated shaft work is for a unit mass flow rate of water,therfore for given flow rate multiply it by the flow rate
w = (Q*p)/(7.48*60);
Wsactual = Wsa*w;
power = -Wsactual/(778*0.7070);

# Results
print " the required horsepower is %.2f hp"%(power);
 the required horsepower is 8.55 hp

Example 7.14 - Page No :304

In [17]:
# Variables
p1 = 5.;  			 #[atm] - initial pressure
p2 = 0.75;  		 #[atm] - final pressure after expansion through turbine
T = 450.;  			 #[K] - temperature
y = 1.4;  			 # cp/cv for nitrogen
# using the equation Ws = -(y/(y-1))*(p1/density1)*((p2/p1)**((y-1)/y)-1)
R = 8314.;  		 # gas constant

# Calculations
p1bydensity = R*T;
Ws = -(y/(y-1))*(p1bydensity)*((p2/p1)**((y-1)/y)-1);

# Results
print " the shaft work of the gas as it expands through the turbine and transmits its molecular \
 energy to the rotating blades is \n Ws = %.2e J/kmol"%(Ws);
 the shaft work of the gas as it expands through the turbine and transmits its molecular  energy to the rotating blades is 
 Ws = 5.48e+06 J/kmol

Example 7.15 - Page No :311

In [68]:
# Variables
T = 273.15+25;  		 #[K] - temperature
R = 8.314;  			 #[kPa*m**3/kmol*K] - gas constant
p = 101.325;  			 #[kPa] - pressure
M = 29.;  			     # molecular weight of gas
pa = (p*M)/(R*T);
sg = 13.45;  			 # specific gravity
pm = sg*1000;
g = 9.807;  			 #[m/sec**2] - acceleration due to gravity
deltaz = 15./100;  		 #[m]

# Calculations
# using the equation p2-p1 = deltap = (pm-pa)*g*deltaz
deltap = -(pm-pa)*g*deltaz;

# Results
print " the pressure drop is %.2e N/m**2"%(deltap);
print " the minus sign means the upstream pressure p1 is greater than p2, i.e ther is a pressure drop."
 the pressure drop is -1.98e+04 N/m**2
 the minus sign means the upstream pressure p1 is greater than p2, i.e ther is a pressure drop.

Example 7.16 - Page No :312

In [71]:
# Variables
T = 536.67;  			 #[degR]; - temperature
R = 10.73;  			 #[(lbf/in**2*ft**3)*lb*mol**-1*degR] - gas constant
p = 14.696;  			 #[lbf/in**2];
g = 9.807*3.2808;  		 #[ft/sec**2] - acceleration due to gravity
M = 29.;  			     # molecular weight of gas

# Calculations
pa = (p*M)/(R*T);
sg = 13.45;  			 # specific gravity
pm = sg*62.4;
deltaz = 15/(2.54*12);   #[ft]
gc = 32.174;

# Results
# using the equation p2-p1 = deltap = (pm-pa)*g*deltaz
deltap = (pm-pa)*(g/gc)*deltaz;
print "the pressure drop is %.0f lbf/ft**2"%(deltap);
the pressure drop is 413 lbf/ft**2

Example 7.18 - Page No :315

In [73]:
# Variables
at = 0.049;  			 #[in**2] - cross sectional area of the manometer tubing
aw = 15.5;  			 #[in**2] - cross sectional area of the well
g = 32.174;  			 #[ft/sec**2] - acceleration due to gravity
gc = 32.174;
sg = 13.45;  			 #[ specific garvity of mercury
p = 62.4;  			     #[lb/ft**3] - density of water;
pm = sg*p;
deltaz_waterleg = 45.2213;

# Calculations
# using the equation A(well)*deltaz(well) = A(tube)*deltaz(tube)
deltazt = 70.;  			 #[cm]
deltazw = deltazt*(at/aw);
deltaz = deltazt+deltazw;
deltap_Hg = -pm*(g/gc)*(deltaz/(2.54*12));

# Results
deltazw = 45.2213;  			 #[cm]
deltap_tap = deltap_Hg+p*(g/gc)*(deltazw/(12*2.54));
print "deltap_tap = %.0f lbf/ft**2"%(deltap_tap);
print "deltap is negative and therefore p1 is greater than p2";
deltap_tap = -1841 lbf/ft**2
deltap is negative and therefore p1 is greater than p2

Example 7.19 - Page No :317

In [75]:
# Variables
p = 749./760;  			 #[atm]
T = 21.+273.15;  		 #[K]
R = 82.06;  			 #[atm*cm**3/K] - gas constant
v = (R*T)/p;  			 #[cm**3/mole] - molar volume
M = 29.;  			     #[g/mole] - molecular weight
pair = M/v;
m_air = 53.32;  			 #[g]
m_h2o = 50.22;  			 #[g]
ph2o = 0.998;  			     #[g/cm**3] - density of water

# Calculations
V = (m_air-m_h2o)/(ph2o-pair);  			 #[cm**3]
density = m_air/V;

# Results
print " The density of coin is  density = %.2f g/cm**3"%(density);
print " Consulting a handbook it is seen that this result is correct density for gold";
 The density of coin is  density = 17.15 g/cm**3
 Consulting a handbook it is seen that this result is correct density for gold

Example 7.20 - Page No :318

In [18]:
# Variables
P = 749./760;  			 #[atm] - pressure
T = 21+273.15;  		 #[K] - temperature
poak = 38*(1./62.4);  	 #[g/cm**3] - density of oak
pbrass = 534/62.4;  	 #[g/cm**3] - density of brass
m_brass = 6.7348;  		 #[g]
pair = 0.001184;  		 #[g/cm**3] - density of air

# Calculations
# using the formula m_oak = m_brass*((1-(pair/pbrass))/(1-(pair/poak)))
m_oak = m_brass*((1-(pair/pbrass))/(1-(pair/poak)));

# Results
print " True mass of wood = %.3f g"%(m_oak);
 True mass of wood = 6.747 g

Example 7.21 - Page No :320

In [78]:
# Variables
T = 545.67;  			 #[degR] - temperature
R = 1545.;  			 #[Torr*ft**3/degR*mole] - gas constant
M = 29.;  			     #[g/mole] - molecular weight
g = 9.807;  			 #[m/sec**2] - acceleration due to gravity
gc = 9.807;  
po = 760.;  			 #[Torr] - pressure
deltaz = 50.;  			 #[ft]

# Calculations
# using the equation p = po*exp(-(g/gc)*M*(deltaz/R*T))
p = po*math.e**(-(g/gc)*M*(deltaz/(R*T)));

# Results
print " p = %.1f Torr \nThus, the pressure decrease for an elevation of 50ft is very small"%(p);
 p = 758.7 Torr 
Thus, the pressure decrease for an elevation of 50ft is very small

Example 7.22 - Page No :321

In [19]:
# Variables
To = 545.67;  			 #[degR] -  air temperature at beach level
betaa = -0.00357;  		 #[degR/ft] - constant
R = 1545.;  			 #[Torr*ft**3/degR*mole] - gas constant
M = 29.;
deltaz = 25000.;  		 #[ft]
po =  760.  

# Calculations
# using the equation ln(p/po) = ((M)/(R*betaa))*ln(To/(To+betaa*deltaz)
p = po*math.exp(((M)/(R*betaa))*math.log(To/(To+betaa*deltaz)));

# Results
print " Pressure = %.2f Torr"%(p);
# using the equation T = To+betaa*deltaz
T = To+betaa*deltaz;
print " Temperature = %.2f degR"%(T);
 Pressure = 297.16 Torr
 Temperature = 456.42 degR