Chapter 10 : Properties of Gases and Gas Mixtures

Example 10.1 Page No : 352

In [3]:
# Variables
# Part (a)
P1 = 100.
P2 = 50.;
T1 = 273.+300;

# Calculation and Results
T2 = (P2/P1)*T1;
R = 0.287
cv = 0.718;
V1 = 0.8;
m = (P1*V1)/(R*T1);
Q = m*cv*(T2-T1);
print "If the fluid is in the air"
print "The final temperature is ",T2,"K"
print "The heat transferred is %.2f kJ/Kg"%Q

# Part (b)
t2 = 273+81.33
vf = 0.00103
vg = 3.24;
v1 = 2.6388
u1 = 2810.4; 
x2 = (v1-vf)/(vg-vf);
u2 = 340.42+(x2*2143.4);
m_ = V1/v1;
Q_ = m_*(u2-u1);

print ("\nIf the fluid is in the steam")
print "The final temperature is ",t2,"K"
print "The heat transferred is %.2f kJ/Kg"%Q_

# rounding off error. please check . value of m is wrong in book please check.
If the fluid is in the air
The final temperature is  286.5 K
The heat transferred is -100.07 kJ/Kg

If the fluid is in the steam
The final temperature is  354.33 K
The heat transferred is -219.62 kJ/Kg

Example 10.2 Page No : 353

In [3]:
# Variables
# Part (a)
R = 0.287
T1 = 273.+150
v1 = 0.96
v2 = 1.55
Cp = 1.005;

# Calculation and Results
P = (R*T1)/v1;
W = P*(v2-v1);
T2 = (v2/v1)*T1;
Q = Cp*(T2-T1);
print ("If the fluid is in the air")
print "The final temperature is %.2f K"%T2
print "The heat transferred is %.2f kJ"%Q
print "Work done is %.2f kJ"%W

# Part (b)
vg = 0.3928;
P1 = 200e03;
P2 = P1;
h1 = 2768.8;
t2 = 273+400; h2 = 3276.5;
Q_ = h2-h1;
W_ = P1*(v2-v1);
print ("\nIf the fluid is in the steam")
print "The final temperature is ",t2,"K"
print "The heat transferred is",Q_,"kJ"
print "Work done is",W_/1000,"kJ"
If the fluid is in the air
The final temperature is 682.97 K
The heat transferred is 261.27 kJ
Work done is 74.61 kJ

If the fluid is in the steam
The final temperature is  673 K
The heat transferred is 507.7 kJ
Work done is 118.0 kJ

Example 10.3 Page No : 355

In [8]:
import math 

# Variables
v = 16. ; 			# v = v1./v2
P1 = 300e03;
P2 = P1*v;
R = 0.287
T1 = 300+223;

# Calculation and Results
W12 = R*T1*math.log(1./v);

print ("If the fluid is in the air")
print "The final pressure is ",P2/1000,"kPa"
print "The change in internal energy is",0,"kJ"
print "Work done is %.2f kJ"%W12

# Part (b)
v1 = 0.7664; u1 = 2728.7;
v2 = v1/16;
x2 = (v2-0.00125)/(0.05013);
s2 = 2.7927+(x2*3.2802);
s1 = 7.5165
u2 = 1080.37+(x2*1522.0);
du = u2-u1;
T = 250+273;
Q12 = T*(s2-s1)

print ("\nIf the fluid is in the steam")
print "The final temperature is ",T,"K"
print "The heat transferred is",Q12,"kJ/kg"
print "The change in internal energy is",du,"kJ/kg  "

# rounding off error. please check. value of x2 is wrong in book .
If the fluid is in the air
The final pressure is  4800.0 kPa
The change in internal energy is 0 kJ
Work done is -416.17 kJ

If the fluid is in the steam
The final temperature is  523 K
The heat transferred is -874.095064273 kJ/kg
The change in internal energy is -231.986493118 kJ/kg  

Example 10.4 Page No : 356

In [6]:
# Variables
# Part (a)
P1 = 10.
P2 = 1.;
T1 = 273.+300;
g = 1.4;

# Calculation and Results
T2 = T1*((P2/P1)**((g-1)/g));
R = 0.287;
W12 = ((R*T1)/(1-g))*(T2/T1-1);
v2 = (R*T2)/(100*P2);

print ("If the fluid is in the air")
print "The specific volume is %.3f m3/Kg"%v2
print "The work done per kg of the fluid is %.2f kJ"%W12

# Part (b)
u1 = 2793.2
v1 = 0.2579
s1 = 7.1228;
x2 = (7.1228-1.3025)/6.0568;
u2 = 417.33+(x2*2088.7);
v2 = 0.001043+(0.96*1.693);
W12 = u1-u2;
print ("\nIf the fluid is in the steam")
print "The specific volume is %.3f m3/Kg"%v2
print "The work done per kg of the fluid is %.1f kJ"%round(W12,-1)

# note : rounding off error. please check.
If the fluid is in the air
The specific volume is 0.852 m3/Kg
The work done per kg of the fluid is 198.19 kJ

If the fluid is in the steam
The specific volume is 1.626 m3/Kg
The work done per kg of the fluid is 370.0 kJ

Example 10.5 Page No : 357

In [7]:
# Variables
# Part (a)
P1 = 10.
P2 = 1.;
T1 = 273.+200
n = 1.15
R = 0.287;

# Calculation and Results
v2 = ((R*T1)/(P1*100))*((P1/P2)**(1./1.15));
v1 = ((R*T1)/(P1*100));
T2 = T1*(P2/P1)*(v2/v1);
cv = 0.716;
Q = (cv+(R/(1-n)))*(T2-T1);

print ("If the fluid is in the air")
print "The specific volume is %.4f m3/Kg"%v2
print "The final temperature is %.1f K"%T2
print "Heat transferred per kg is %.f kJ"%Q

# Part (b)
v1 = 0.20596
u1 = 2621.9;
v2 = v1*(P1/P2)**(1./n);
x2 = (v2-0.001043)/(1.694-0.001043);
t2 = 99.62;
W = ((P1*100*0.13575)-(P2*100*1.525))/(n-1);
Q = 2366.1-u1+W;

print ("\nIf the fluid is in the steam")
print "The specific volume is %.3f m3/Kg"%v2
print "The final temperature is ",t2,"C"
print "Heat transferred per kg is %.2f kJ"%Q
If the fluid is in the air
The specific volume is 1.0053 m3/Kg
The final temperature is 350.3 K
Heat transferred per kg is 147 kJ

If the fluid is in the steam
The specific volume is 1.525 m3/Kg
The final temperature is  99.62 C
Heat transferred per kg is -367.47 kJ

Example 10.6 Page No : 359

In [14]:
import math 

# Variables
P0 = 1000.;
T0 = 3.; 
V0 = 0.001;
R = 287.;

# Calculation
n = (P0*V0)/(R*T0); 			# Number of moles

# Process ab
Wab = 0;
cv = (3/2.)*R;
Ta = T0; Tb = 300;
Qab = n*cv*(Tb-Ta);
Ua = 0; 			# Given internal energy
Ub = Qab+Ua;
Uab = Ub-Ua;
print Qab
# Process bc
Qbc = 0
Uc = 0
Ubc = Uc-Ub;
Wbc = -Ubc;
# Process ca
Tc = Ta;
g = 5./3; 			# gamma
Vcb = (Tb/Tc)**(3./2); 			# Vc/Vb
Wca = -n*R*Tc*math.log(Vcb);
Qca = Wca ;
Uca = 0;

# Results
print "Work done in the cycle is %.1f J"%(Wbc)
print "Internal energy change in the cycle is",Ub,"J"
print "Heat transfer in the cycle is %.2f"%(Wca)

# Part (b)
e = (Qab+Qca)/Qab;
print "Thermal efficiency of the system is %.3f %%"%(e)
148.5
Work done in the cycle is 148.5 J
Internal energy change in the cycle is 148.5 J
Heat transfer in the cycle is -6.91
Thermal efficiency of the system is 0.953 %

Example 10.7 Page No : 360

In [8]:
import math 

Pa = 1.5; 
Ta = 273.+50; 
ca = 0.5;
Pb = 0.6; 
Tb = 20.+273; 
mb = 2.5;
R = 8.3143;

# Calculation
Va = (ca*R*Ta)/(Pa*1e03);
ma = ca*28;
Rn = R/28.;
Vb = (mb*Rn*Tb)/(Pb*1e03);
V = Va + Vb ;
m = ma + mb ;
Tf = 27+273.;
P = (m*Rn*Tf)/V;
g = 1.4;
cv  = Rn/(g-1);
U1 = cv*(ma*Ta+mb*Tb);
U2 = m*cv*Tf;
Q = U2-U1;

# Results
print "The final equillibrium pressure is %.3f MPa"%(P/1000)
print "The amount of heat transferred to the surrounding is %.1f kJ"%Q
T_ = (ma*Ta+mb*Tb)/m ;
P_ = (m*Rn*T_)/V;
print "If the vessel is perfectly inslulated"
print "The final temperature is %.1f k"%T_
print "The final pressure is %.2f MPa"%(P_/1000)
The final equillibrium pressure is 1.169 MPa
The amount of heat transferred to the surrounding is -226.0 kJ
If the vessel is perfectly inslulated
The final temperature is 318.5 k
The final pressure is 1.24 MPa

Example 10.8 Page No : 361

In [9]:
import math 

# Variables
cp = 1.968; 
cv = 1.507;
R_ = 8.314;
V = 0.3; 
m = 2.; 
T1 = 5.+273; 
T2 = 100.+273;

# Calculation
R = cp-cv;
mu = R_/R;
Q12 = m*cv*(T2-T1);
W12 = 0 ;
U21 = Q12;
H21= m*cp*(T2-T1);
S21 = m*cv*math.log(T2/T1);

# Results
print "Molecular weight and the gas constant of the gas are %.2f kJ/Kg mol and %.3f kJ/Kg K"%(mu,R)
print "Work done",0,"kJ"
print "The heat transferred %.2f kJ"%Q12
print "The change in internal energy ",U21,"kJ"
print "Change in entropy %.1f kJ/K"%S21
print "Change in enthalpy",H21,"kJ"

# rounding off error would be there.
Molecular weight and the gas constant of the gas are 18.03 kJ/Kg mol and 0.461 kJ/Kg K
Work done 0 kJ
The heat transferred 286.33 kJ
The change in internal energy  286.33 kJ
Change in entropy 0.9 kJ/K
Change in enthalpy 373.92 kJ

Example 10.9 Page No : 362

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

# Variables
m = 1.5;
P1 = 5.6; 
V1 = 0.06;
T2 = 273.+240;
a = 0.946; b = 0.662;
k = 0.0001;

# Calculation
# Part (b)
R = a-b;
T1 = (P1*1e03*V1)/(m*R);
def f8(T): 
	 return m*(b+k*T)

W12 = - quad(f8,T1,T2)[0]

# Results
print "The work done in the expansion is %.0f kJ"%W12

# note : answer is different becaues of quad function.
The work done in the expansion is 301 kJ

Example 10.11 Page No : 363

In [34]:
import math 

# Variables
m = 0.5;
P1 = 80e03; 
T1 = 273.+60;
P2 = 0.4e06;
R = 0.287;
V1 = (m*R*T1)/P1 ;
g = 1.4; 			# Gamma

# Calculation
T2 = T1*(P2/P1)**((g-1)/g);
W12 = (m*R*(T1-T2))/(g-1);
V2 = V1*((P1/P2)**(1./g));
W23 = P2*(V1-V2);
W = W12+W23;
V3 = V1;
T3 = T2*(V3/V2);
cp = 1.005;
Q = m*cp*(T3-T2);

# Results
print "The work transfer for the whole path is %.1f kJ"%W
print "The heat transfer for the whole path %.2f kJ"%Q

# note : incorrect answer in the textbook
The work transfer for the whole path is 93.5 kJ
The heat transfer for the whole path 571.64 kJ

Example 10.12 Page No : 365

In [38]:
import math 

# Variables
P1 = 700e03
T1 = 273.+260; 
T3 = T1;
V1 = 0.028; 
V2 = 0.084;
R = 0.287;

# Calculation
m = (P1*V1)/(R*T1);
P2 = P1;
T2 = T1*((P2*V2)/(P1*V1));
n  = 1.5;
P3 = P2*((T3/T2)**(n/(n-1)));
cp = 1.005; cv = 0.718;
Q12 = m*cp*(T2-T1);
Q23 = m*cv*(T3-T2) + (m*R*(T2-T3))/(n-1);
Q31 = m*R*T1*math.log(P3/P1);
Q1 = Q12;
Q2 = -(Q23+Q31);
e = 1-(Q2/Q1);

# Results
print "The heat received in the cycle is",round(Q1/1000,2),"kJ"
print "The heat rejected in the cycle",round(Q2/1000,2),"J"
print "The efficiency of the cycle is %.2f"%e

# note : rounding error is there.
The heat received in the cycle is 137.27 kJ
The heat rejected in the cycle 84.27 J
The efficiency of the cycle is 0.39

Example 10.13 Page No : 366

In [19]:
import math 

# Variables
P1 = 300e03; 
V1 = 0.07;
m = 0.25; 
T1 = 80+273;

# Calculation
R = (P1*V1)/(1000*m*T1);
P2 = P1;
V2 = 0.1;
T2 = (P2*V2)/(1000*m*R);
W = -25;
cv = -W/(m*(T2-T1));
cp = R+cv;
S21 = m*cp*math.log(V2/V1); 			# S21 = S2-S1

# Results
print "cv of the gas is %.3f kJ/Kg K"%cv
print "cp of the gas is %.3f kJ/Kg K"%cp
print "Increase in the entropy of the gas is %.2f kJ/Kg K"%S21
cv of the gas is 0.661 kJ/Kg K
cp of the gas is 0.899 kJ/Kg K
Increase in the entropy of the gas is 0.08 kJ/Kg K

Example 10.14 Page No : 367

In [15]:
import math 

# Variables
P1 = 1.;
P2 = 15.;
V1 = 800e-06;
V2 = V1/8;
cv = 0.718; 
g = 1.4;

# Calculation
n = (math.log(P2/P1))/(math.log(V1/V2))
T1 = 348; R = 0.287;
m = (P1*100*V1)/(R*T1);
T2 = T1*((P2*V2)/(P1*V1));
P3 = 50;
T3 = T2*(P3/P2);
S21 = m*(cv*math.log(T2/T1)+R*math.log(V2/V1));
S32 = m*cv*math.log(T3/T2);
Q = (m*cv*(g-n)*(T2-T1))/(1-n);

# Results
print "The index of compression process is %.1f"%n
print "T2 = %.1f K"%T2
print "S2-S1 is %.6f kJ/K"%S21
print "S3-S2 is %.6f kJ/k"%S32
print "The heat exchange is %.3f kJ"%Q
The index of compression process is 1.3
T2 = 652.5 K
S2-S1 is -0.000117 kJ/K
S3-S2 is 0.000692 kJ/k
The heat exchange is -0.057 kJ

Example 10.15 Page No : 368

In [10]:
import math 

# Variables
mn = 3.; 			# Mass of nitrogen in kg
mc = 5.; 			# mass of CO2 in kg
an = 28.; 			# Atomic weight of nitrogen
ac = 44.; 			# Atomic weight of CO2

# Calculation and Results
# Part (a)
xn = (mn/an)/((mn/an)+(mc/ac)); 
xc = (mc/ac)/((mn/an)+(mc/ac)); 
print "Mole fraction of N2 is %.3f"%xn
print "Mole fraction of CO2 is %.3f"%xc

# Part (b)
M = xn*an+xc*ac;
print "Equivalant molecular weight of mixture is %.2f Kg"%M

# Part (c)
R = 8.314;
Req = ((mn*R/an)+(mc*R/ac))/(mn+mc);
print "The equivalent gas consmath.tant of the mixture is %.3f kJ/Kg K"%Req

# Part (d)
P = 300.; 			# Pressure in kPa
T = 20.+273;
Pn = xn*P; 			# Partial pressure of Nitrogen
Pc = xc*P; 			# Partial pressure of CO2 
Vn = (mn*R*T)/(P*an); 			# Volume of nitrogen
Vc = (mc*R*T)/(P*ac); 			# Volume of CO2
print "Partial pressures of nitrogen and CO2 are %.1f and %.1f kPa respectively"%(Pn,Pc)
print "Partial volume of nitrogen and CO2 are %.2f and %.2f m3 respectively"%(Vn,Vc)

# Part (e)
V = (mn+mc)*Req*T/P; 			# Total volume
rho = (mn+mc)/V;
print "Volume of mixture is %.2f m3"%V
print "Density of mixture is %.2f Kg/m3"%rho

# Part (f)
gn = 1.4; 			# Gamma
gc = 1.286;
cvn = R/((gn-1)*an); 			# cp and cv of N2
cpn = gn*cvn; 
cvc = R/((gc-1)*ac); 			# cp and cv of CO2
cpc = gc*cvc;
cp = (mn*cpn+mc*cpc)/(mn+mc) ; 			# of mixture
cv = (mn*cvn+mc*cvc)/(mn+mc) ;
print "cp and cv of mixture are %.2f and %.2f kJ/Kg K respectively"%(cp,cv)

T1 = T; 
T2 = 40.+273;
U21 = (mn+mc)*cv*(T2-T1);
H21 = (mn+mc)*cp*(T2-T1);
S21v = (mn+mc)*cv*math.log(T2/T1); 			# If heated at constant volume

print "Change in internal energy of the system heated at constant volume is %.1f kJ"%U21
print "Change in enthalpy of the system heated at constant volume is %.1f kJ"%H21
print "Change in entropy of the system heated at constant volume is %.3f kJ/Kg K"%S21v
S21p = (mn+mc)*cp*math.log(T2/T1); 			# If heated at constant Pressure
print "Change in entropy of the system heated at constant Pressure is %.2f kJ"%S21p
Mole fraction of N2 is 0.485
Mole fraction of CO2 is 0.515
Equivalant molecular weight of mixture is 36.24 Kg
The equivalent gas consmath.tant of the mixture is 0.229 kJ/Kg K
Partial pressures of nitrogen and CO2 are 145.6 and 154.4 kPa respectively
Partial volume of nitrogen and CO2 are 0.87 and 0.92 m3 respectively
Volume of mixture is 1.79 m3
Density of mixture is 4.46 Kg/m3
cp and cv of mixture are 0.92 and 0.69 kJ/Kg K respectively
Change in internal energy of the system heated at constant volume is 110.6 kJ
Change in enthalpy of the system heated at constant volume is 147.3 kJ
Change in entropy of the system heated at constant volume is 0.365 kJ/Kg K
Change in entropy of the system heated at constant Pressure is 0.49 kJ

Example 10.16 Page No : 370

In [30]:
import math 

# Variables
mo = 2.;
mn = 6.;
muo = 32.; 
mun = 28.;

# Calculation
o = mo/muo;
n = mn/mun;
xo = o/(n+o);
xn = n/(n+o);
R = 8.314;
Ro = R/muo; Rn = R/mun;
dS = -mo*Ro*math.log(xo)-mn*Rn*math.log(xn);

# Results
print "Increase in entropy is %.4f kJ/Kg K"%dS
Increase in entropy is 1.2292 kJ/Kg K

Example 10.17 Page No : 371

In [31]:
import math 

# Variables
an = 20.183; 			# molecular weight of neon
Pc = 2.73; 			# Critical pressure
Tc = 44.5;
Vc = 0.0416;
Pr = 2; 			# Reduced Pressure
Tr = 1.3; 
Z = 0.7;

# Calculation
P = Pr*Pc; 
T = Tr*Tc;
R = 8.314;
v = (Z*R*T)/(P*1000*an);
vr = (v*an)/Vc ;

# Results
print "Specific volume is %.3e m3/Kg"%v
print "Specific temperature is",T,"K"
print "Specific pressure is",P,"MPa"
print "Reduced volume is %.2f"%vr
Specific volume is 3.055e-03 m3/Kg
Specific temperature is 57.85 K
Specific pressure is 5.46 MPa
Reduced volume is 1.48