Chapter 5 : First Law Applied to Flow Processes

Example 5.1 Page No : 101

In [2]:
import math 

# Variables
V1 = 0.95;
P1 = 100e03;  #initial pressure Pa
v1 = 7.;      #initial velocity m/s
V2 = 0.19;    #final velocity m/s
P2 = 700e03;  #final pressure Pa
v2 = 5.;
w = 0.5;
u21 = 90e03; 			# u21 = u2-u1
Q = -58e03; 			# As heat is added Q = dQ/dt

# Calculation and Results
W =  - w*( u21 + (P2*V2-P1*V1) + ((v2**2-v1**2)/2) ) + Q; 			# W = dW/dt  
print "The rate of work input is",round(W/1000),"kW"

# Part (b)
A = (v2/v1)*(V1/V2); 			# A = A1./A2
d = math.sqrt(A); 			# d = d1./d2
print "The ratio of the inlet pipe diameter and outer pipe diameter is %.2f"%d
The rate of work input is -122.0 kW
The ratio of the inlet pipe diameter and outer pipe diameter is 1.89

Example 5.2 Page No : 102

In [4]:
# Variables
V1 = 0.37;    #specific volume m^3/kg
P1 = 600.e03;
v1 = 16.;
V2 = 0.62; 
P2 = 100.e03;
v2 = 270.;
Z1 = 32.;
Z2 = 0;
g = 9.81; 
Q = -9.e03; 			# heat loss Q = dQ/dt
W = 135.e03; 			# Work done W = dW/dt

# Calculation
U12 = (P2*V2-P1*V1) + ((v2**2-v1**2)/2.) + (Z2-Z1)*g + W - Q; 			# U12 = U1-U2

# Results
print "The internal energy decreases by",round(U12/1000,3),"Joule"

# note : rounding off error
The internal energy decreases by 20.008 Joule

Example 5.3 Page No : 103

In [5]:
import math 

# Variables
P1 = 4e06;
t1 = 400.;
h1 = 3213e03;
V1 = 0.073;
P2 = 3.5e06;
t2 = 392.;
h2 = 3202e03;
V2 = 0.084;
Q = -8.5e03;

# Calculation
v1 = math.sqrt((2*(h1-h2+Q))/(1.15**2-1));
A1 = (math.pi/4)*0.2**2;
w = (A1*v1)/V1;

# Results
print "The stean flow rate is %.1f Kg/s"%w

# rounding off error
The stean flow rate is 53.6 Kg/s

Example 5.4 Page No : 104

In [6]:
import math 
import sys
from numpy import *
from sympy import Symbol

# Variables
h1 = 313.93;
h2 = 2676.;
h3 = 419.;
w1 = 4.2;

# Calculation
w = Symbol('w') 			# w = w2
P = w1*h1 + w*h2 - h3*(4.2+w)
def stress(a,b,f):
    N = 100;
    eps = 1e-5;
    if((f(a)*f(b))>0):
        print ('no root possible f(a)*f(b)>0');
        sys.exit(0)
    if(abs(f(a))<eps):
        print ('solution at a');
        sys.exit(0)
    if(abs(f(b))<eps):
        print ('solution at b');
        sys.exit(0)

    while(N>0):
        c = (a+b)/2.
        if(abs(f(c))<eps):
            x = c ;
            return x;
        if((f(a)*f(c))<0 ):
            b = c ;
        else:
            a = c ;
        N = N-1;
    print ('no convergence');
    sys.exit(0)

def p(w): 
	 return  - 441.294 + 2257*w 

w = stress(0.1,0.2,p);

# Results
print "The amount of heat that should be supplied is %.0fKg/h"%(w*3600)

# rounding off error
The amount of heat that should be supplied is 704Kg/h

Example 5.5 Page No : 104

In [8]:
# Variables
t1 = 15.
t2 = 800. 
t3 = 650.
t4 = 500.;
v1 = 30.; 
v2 = 30. 
v3 = 60.; 
w = 2.;
cp = 1005.;

# Calculation and Results
Q1_2 = w*cp*(t2-t1);
print "The rate of heat transfer to the air in the heat exchanger is %.0f KJ/s"%(round(Q1_2/1000,-1)),"KJ/s"
W_T = w*( ((v2**2-v3**2)/2) + cp*(t2-t3));
print "The power output from the turbine assuming no heat loss",W_T/1000,"KW"
v4 = math.sqrt( (v3**2) + (2*cp*(t3-t4)) );
print "The velocity at the exit of the nozzle is %.0f m/s"%v4

# rounding off error.
The rate of heat transfer to the air in the heat exchanger is 1580 KJ/s KJ/s
The power output from the turbine assuming no heat loss 298.8 KW
The velocity at the exit of the nozzle is 552 m/s

Example 5.6 Page No : 106

In [7]:
import math
# Variables
w = 5.
h1 = 900
h2 = 400
v1 = 50. 
v2 = 150.
Q = -25*5. 			# Q = dQ/dt for w = 5kg

# Calculation and Results
W = (w*( (h1-h2) + ((v1**2-v2**2)/2)*10**-3 )) + Q; 			# W = dW/dt
print "The power output of the turbine is %.0f kW"%(W)
R = 285.
T1 = 300.
P1 = 100e03;
V = (w*R*T1)/P1; 			# V = dV/dt
A1 = V/v1; 
D1 = math.sqrt((4*A1)/math.pi);
print "The diameter of the inlet pipe is %.2f m"%D1
The power output of the turbine is 2325 kW
The diameter of the inlet pipe is 0.33 m

Example 5.7 Page No : 107

In [11]:
import math 

# Variables
ha = 260.; 			    # Enthalpy of air
hg = 912.; 		    	# Enthalpy of gas
Va = 270.; 	    		# Velocity of air
f = 0.0190; 			# Fuel to air ratio wf/wa
Ef = 44500.; 			# Chemical energy of fuel in kJ/kg
Q = 21.;     			# Heat loss from the engine

# Calculation
Eg = 0.05*f*Ef/(1+f)    	# As 5% of chemical energy is not released in reaction
Vg = math.sqrt(2000*(((ha+(Va**2*0.001)/2+(f*Ef)-Q)/(1+f))-hg-Eg));

# Results
print "Velocity of exhaust gas is %.0f m/s"%Vg

# rounding off error. please check.
Velocity of exhaust gas is 541 m/s

Example 5.9 Page No : 108

In [13]:
import math 
from hornerc import horner

# Variables
u0 = 0.718*273*1e03;
#t = poly(0,'t');
#u = u0+718*t; 			# in SI unit
#hp = u + 285*(t+273); 			# ""
hp =  [273819, 1003]

# Calculation
h = horner(hp,150); 			# h = hp(150)
W = 100.; 			# W = dW/dt
m = W/h;

# Results
print "The rate at which air flows out of the tank %.3f kg/h"%(m*3600)
The rate at which air flows out of the tank 0.849 kg/h