Chapter 9 : Gases and Vapour Mixtures

Example 9.1 Page no : 420

In [1]:
# Variables
V = 0.35; 			#m**3
import math 
m_CO = 0.4; 			#kg
m_air = 1; 			#kg
m_O2 = 0.233; 			#kg
m_N2 = 0.767; 			#kg
T = 293.; 			#K
R0 = 8.314; 			#kJ/kg K
M_O2 = 32.; 			#Molecular mass of O2
M_N2 = 28.; 			#Molecular mass of N2
M_CO = 28.; 			#Molecular mass of CO

# Calculations and Results

p_O2 = m_O2*R0*10**3*T/M_O2/V/10**5; 			#bar
print ("partial pressure for p_O2 %.3f")% (p_O2), ("bar")

p_N2 = m_N2*R0*10**3*T/M_N2/V/10**5; 			#bar
print ("partial pressure for p_N2 %.3f")% (p_N2), ("bar")

p_CO = m_CO*R0*10**3*T/M_CO/V/10**5; 			#bar
print ("partial pressure for p_CO %.3f")%(p_CO), ("bar")


print ("(ii) Total pressure in the vessel")
p = p_O2+p_N2+p_CO;
print ("p = %.3f")% (p), ("bar")
partial pressure for p_O2 0.507 bar
partial pressure for p_N2 1.907 bar
partial pressure for p_CO 0.994 bar
(ii) Total pressure in the vessel
p = 3.408 bar

Example 9.2 Page no : 421

In [2]:
# Variables
R0 = 8.314;
M_O2 = 32.;
M_N2 = 28.;
M_Ar = 40.;
M_CO2 = 44.;

# Calculations
R_O2 = R0/M_O2; 			#kJ/kg K
R_N2 = R0/M_N2; 			#kJ/kg K
R_Ar = R0/M_Ar; 			#kJ/kg K
R_CO2 = R0/M_CO2; 			#kJ/kg K

O2 = 0.2314;
N2 = 0.7553;
Ar = 0.0128;
CO2 = 0.0005;

# Results
print ("(i) Gas constant for air")
R = O2*R_O2 + N2*R_N2 + Ar*R_Ar + CO2*R_CO2;
print ("R = %.3f")%(R), ("kJ/kg K")

print ("(ii) Apparent molecular weight.")
M = R0/R;
print ("M = %.3f")%(M)
(i) Gas constant for air
R = 0.287 kJ/kg K
(ii) Apparent molecular weight.
M = 28.954

Example 9.3 Page no : 422

In [2]:
# Variables
p = 1.; 			#bar
#For oxygen
m_O2 = 0.2314;
M_O2 = 32;
n_O2 = m_O2/M_O2;
#For Nitrogen
m_N2 = 0.7553;
M_N2 = 28.;
n_N2 = m_N2/M_N2;
#For Argon
m_Ar = 0.0128;
M_Ar = 40;
n_Ar = m_Ar/M_Ar;

#For CO2
m_CO2 = 0.0005;
M_CO2 = 44;
n_CO2 = m_CO2/M_CO2;

# Calculations and Results
n = n_O2 + n_N2 + n_Ar + n_CO2;

#Let Vi/V be A
A_O2 = n_O2/n * 100;
print ("Vi/V of O2 = %.3f")%(A_O2),("%")

A_N2 = n_N2/n * 100;
print ("Vi/V of N2 = %.3f")%(A_N2), ("%")

A_Ar = n_Ar/n *100;
print ("Vi/V of Ar %.3f")% (A_Ar), ("%")

A_CO2 = n_CO2/n * 100;
print ("Vi/V of CO2 = %.3f")% (A_CO2), ("%")


P_O2 = n_O2/n*p;
print ("Partial pressure of O2 = %.3f")% (P_O2), ("bar")

P_N2 = n_N2/n*p;
print ("Partial pressure of N2 = %.3f")% (P_N2), ("bar")

P_Ar = n_Ar/n*p;
print ("Partial pressure of Ar = %.3f")% (P_Ar), ("bar")

P_CO2 = n_CO2/n*p;
print ("Partial pressure of CO2 = %.4f")% (P_CO2), ("bar")
Vi/V of O2 = 20.937 %
Vi/V of N2 = 78.103 %
Vi/V of Ar 0.927 %
Vi/V of CO2 = 0.033 %
Partial pressure of O2 = 0.209 bar
Partial pressure of N2 = 0.781 bar
Partial pressure of Ar = 0.009 bar
Partial pressure of CO2 = 0.0003 bar

Example 9.4 Page no : 423

In [4]:
# Variables
p = 1.*10**5; 			#Pa
T = 293.; 			#K
n_CO2 = 1.; 			#moles of CO2
n = 4.; 			#moles of air
M_CO2 = 44.;
M_N2 = 28.;
M_O2 = 32.;

#Let A be the volumeetric analysis
A_O2 = 0.21;
A_N2 = 0.79;

# Calculations and Results
n_O2 = A_O2*n;
n_N2 = A_N2*n;

print ("(i) The masses of CO2, O2 and N2, and the total mass")

m_CO2 = n_CO2*M_CO2;
print ("Mass of CO2 = %.3f")%(m_CO2),("kg")

m_O2 = n_O2*M_O2;
print ("Mass of O2 = %.3f")%(m_O2),("kg")

m_N2 = n_N2*M_N2;
print ("Mass of N2 = %.3f")%(m_N2),("kg")

m = m_CO2 + m_O2 + m_N2;
print ("Total mass  = %.3f")% (m), ("kg")


print ("(ii) The percentage carbon content by mass")
#Since the molecular weight of carbon is 12, therefore, there are 12 kg of carbon present for every mole of CO2
m_C = 12; 			#kg

C = m_C/m*100;
print ("Percentage carbon in mixture %.3f")%(C),("%")


print ("(iii) The apparent molecular weight and the gas consmath.tant for the mixture")
n = n_CO2 + n_O2 + n_N2;
M = n_CO2/n*M_CO2 + n_O2/n*M_O2 + n_N2/n*M_N2;
print ("Apparent Molecular weight %.3f")%(M)

R0 = 8.314;
R = R0/M;
print ("Gas constant for the mixture = %.3f")%(R),("kJ/kg K")


print ("(iv) The specific volume of the mixture")
v = R*10**3*T/p;
print ("specific volume = %.3f")%(v),("m**3/kg")
(i) The masses of CO2, O2 and N2, and the total mass
Mass of CO2 = 44.000 kg
Mass of O2 = 26.880 kg
Mass of N2 = 88.480 kg
Total mass  = 159.360 kg
(ii) The percentage carbon content by mass
Percentage carbon in mixture 7.530 %
(iii) The apparent molecular weight and the gas consmath.tant for the mixture
Apparent Molecular weight 31.872
Gas constant for the mixture = 0.261 kJ/kg K
(iv) The specific volume of the mixture
specific volume = 0.764 m**3/kg

Example 9.5 Page no : 424

In [5]:
# Variables
p = 1.*10**5; 			#Pa
T = 298.; 			#K
M_H2 = 2.;
M_O2 = 32.;
R0 = 8314.;
# ratio  =  V_H2/V_O2 = 2;
ratio = 2;

# Calculations and Results
print ("(i) The mass of O2 required")
			#Let the mass of O2 per kg of H2  =  x kg
m_H2 = 1; 			#kg
n_H2 = m_H2/M_H2;

# n_O2 = x/M_O2
x = M_O2*n_H2/ratio;
print ("Mass of O2 per kg of H2 = %.3f")%(x), ("kg")

print ("(ii) The volume of the container")
n_O2 = x/M_O2;
n = n_H2 + n_O2;
V = n*R0*T/p;
print ("V = %.3f")%(V), ("m**3")
(i) The mass of O2 required
Mass of O2 per kg of H2 = 8.000 kg
(ii) The volume of the container
V = 18.582 m**3

Example 9.6 Page no : 424

In [6]:
#Let composition of mixture by volume be denoted by c1
#Let Final composition desired be denoted by c2

# Variables
c1_H2 = 0.78;
c1_CO = 0.22;
c2_H2 = 0.52;
c2_CO = 0.48;
M_H2 = 2.;
M_CO = 28.;

# Calculations
M = c1_H2*M_H2 + c1_CO*M_CO;
# Let x kg of mixture be removed and y kg of CO be added.
x = (c1_H2 - c2_H2)/c1_H2*M;

# Results
print ("Mass of mixture removed  = %.3f")%(x), ("kg")

y = M_CO/M*x;
print ("Mass of CO added = %.3f")%(y),("kg")
Mass of mixture removed  = 2.573 kg
Mass of CO added = 9.333 kg

Example 9.7 Page no : 425

In [7]:
import math 

# Variables
ratio = 1./8; 			#volume ratio; v1/v2
T1 = 1223.; 			#K
cp_CO2 = 1.235; 			#kJ/kg K
cp_O2 = 1.088; 			#kJ/kg K
cp_N2 = 1.172; 			#kJ/kg K
n_CO2 = 0.13;
n_O2 = 0.125;
n_N2 = 0.745;
M_CO2 = 44.;
M_O2 = 32.;
M_N2 = 28.;


# Calculations
m_CO2 = M_CO2*n_CO2;
m_O2 = M_O2*n_O2;
m_N2 = M_N2*n_N2;
m = m_CO2 + m_O2 + m_N2;

# Let Fraction by mass be denoted by F
F_CO2 = m_CO2/m;
F_O2 = m_O2/m;
F_N2 = m_N2/m;
cp = F_CO2*cp_CO2 + F_O2*cp_O2 + F_N2*cp_N2;
R0 = 8.314;
R = F_CO2*R0/M_CO2 + F_O2*R0/M_O2 + F_N2*R0/M_N2;

cv = cp - R;
n = 1.2;

print ("(i) The workdone")
T2 = T1*(ratio)**(n-1);
W = R*(T1-T2)/(n-1);
print ("W = %.3f")%(W), ("kJ/kg")

print ("(ii) The heat flow")
du = cv*(T2-T1);
Q = du + W;
print ("Q = %.3f")%(Q), ("kJ/kg")


print ("(iii) Change of entropy per kg of mixture")
ds_1A = R*math.log(1/ratio); 			#isothermal process
ds_2A = cv*math.log(T1/T2);

ds_12 = ds_1A - ds_2A;
print ("change of entropy = %.3f")% (ds_12), ("kJ/kg K")
(i) The workdone
W = 565.669 kJ/kg
(ii) The heat flow
Q = 190.777 kJ/kg
(iii) Change of entropy per kg of mixture
change of entropy = 0.191 kJ/kg K

Example 9.8 Page no : 427

In [8]:
import math 

# Variables
M_CO2 = 44.;
M_H2 = 2.;
M_N2 = 28.;
M_CH4 = 16.;
M_CO = 28.;

# Let volumetric analysis be denoted by V
V_CO = 0.28;
V_H2 = 0.13;
V_CH4 = 0.04;
V_CO2 = 0.04;
V_N2 = 0.51;
Cp_CO = 29.27; 			#kJ/mole K
Cp_H2 = 28.89; 			#kJ/mole K
Cp_CH4 = 35.8; 			#kJ/mole K
Cp_CO2 = 37.22; 			#kJ/mole K
Cp_N2 = 29.14; 			#kJ/mole K
R0 = 8.314; 

# Calculations and Results
Cp = V_CO*Cp_CO + V_H2*Cp_H2 + V_CO2*Cp_CO2 + V_CH4*Cp_CH4 + V_N2*Cp_N2;
print ("Cp = %.3f")%(Cp), ("kJ/mole K")

Cv = Cp-R0;
print ("Cv = %.3f")% (Cv), ("kJ/mole K")

M = V_CO*M_CO + V_H2*M_H2 + V_CO2*M_CO2 + V_CH4*M_CH4 + V_N2*M_N2;

cp = Cp/M;
print ("cp = %.3f")%(cp), ("kJ/kg K")

cv = Cv/M;
print ("cv  %.3f")% (cv), ("kJ/kg K")
Cp = 29.733 kJ/mole K
Cv = 21.419 kJ/mole K
cp = 1.200 kJ/kg K
cv  0.864 kJ/kg K

Example 9.9 Page no : 427

In [10]:
import math 

# Variables
p = 1.3  			#bar
R0 = 8.314;
M_CO2 = 44.;
M_O2 = 32.;
M_N2 = 28.;
M_CO = 28.;
m_O2 = 0.1;
m_N2 = 0.7;
m_CO2 = 0.15;
m_CO = 0.05;
#Considering 1 kg of mixture
m = 1; 			#kg

# Calculations
#let moles be denoted by n
n_O2 = m_O2/M_O2;
n_N2 = m_N2/M_N2;
n_CO2 = m_CO2/M_CO2;
n_CO = m_CO/M_CO;
M = 1/(m_O2/M_O2 + m_N2/M_N2 + m_CO2/M_CO2 + m_CO/M_CO);
n = m/M;
x_O2 = n_O2/n;
x_N2 = n_N2/n;
x_CO2 = n_CO2/n;
x_CO = n_CO/n;

# Results
print ("(i) Partial pressures of the constituents")
P_O2 = x_O2*p;
print ("Partial pressure of O2 = %.3f")% (P_O2), ("bar")

P_N2 = x_N2*p;
print ("Partial pressure of N2 = %.3f")% (P_N2), ("bar")

P_CO2 = x_CO2*p;
print ("Partial pressure of CO2 = %.3f")% (P_CO2), ("bar")

P_CO = x_CO*p;
print ("Partial pressure of CO = %.3f")% (P_CO), ("bar")

R_mix = R0/M;
print ("Gas constant of mixture  = %.3f")%(R_mix), ("kJ/kg K")
(i) Partial pressures of the constituents
Partial pressure of O2 = 0.122 bar
Partial pressure of N2 = 0.975 bar
Partial pressure of CO2 = 0.133 bar
Partial pressure of CO = 0.070 bar
Gas constant of mixture  = 0.277 kJ/kg K

Example 9.10 Page no : 428

In [2]:
# Variables
p = 4.*10**5; 		    	#Pa
import math 
T = 293.;   			    #K
R0 = 8.314;

m_N2 = 4.; 	    		    #kg
m_CO2 = 6.; 			    #kg

M_N2 = 28.; 		    	    #Molecular mass
M_CO2 = 44.; 			    #Molecular mass

n_N2 = m_N2/M_N2; 			#moles of N2
n_CO2 = m_CO2/M_CO2; 			#moles of CO2

x_N2 = n_N2/(n_N2+n_CO2);
print ("x_N2 = %.3f")% (x_N2)

x_CO2 = n_CO2/(n_CO2+n_N2);
print ("x_CO2 = %.3f")% (x_CO2)


print ("(ii) The equivalent molecular weight of the mixture")
M = x_N2*M_N2 + x_CO2*M_CO2;
print ("M = %.3f")%(M), ("kg/kg-mole")

print ("(iii) The equivalent gas consmath.tant of the mixture")
m = m_N2+m_CO2;
Rmix = (m_N2*(R0/M_N2) + m_CO2*(R0/M_CO2))/m;
print ("Rmix = %.3f")% (Rmix), ("kJ/kg K")

print ("(iv) The partial pressures and partial volumes")
P_N2 = x_N2*p/10**5;
print ("P_N2 = %.3f")% (P_N2), ("bar")

P_CO2 = x_CO2*p/10**5;
print ("P_CO2 = %.3f")% (P_CO2), ("bar")

V_N2 = m_N2*R0/M_N2*T/p*10**3;
print ("V_N2  %.3f")% (V_N2), ("m**3")

V_CO2 = m_CO2*R0/M_CO2*T/p*10**3;
print ("V_CO2 %.3f")% (V_CO2), ("m**3")

print ("(v) The volume and density of the mixture")

V = m*Rmix*10**3*T/p;
print ("V = %.3f")% (V), ("m**3")

rho_mix = m/V;
print ("Density of mixture = %.3f")% (rho_mix), ("kg/m**3")


print ("(vi) cp and cv of the mixture")

y_N2 = 1.4;
cv_N2 = (R0/M_N2)/(y_N2 - 1);
cp_N2 = cv_N2*y_N2;

y_CO2 = 1.286;
cv_CO2 = (R0/M_CO2)/(y_CO2 - 1);
cp_CO2 = cv_CO2*y_CO2;

cp = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);
print ("cp = %.3f")%(cp),("kJ/kg K")

cv = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);
print ("cv = %.3f")%(cv),("kJ/kg K")

T1 = 293.; 			#K
T2 = 323.; 			#K
dU = m*cv*(T2-T1);
print ("Change in internal energy  = %.3f")% (dU), ("kJ")

dH = m*cp*(T2-T1);
print ("Change in enthalpy  = %.3f")% (dH), ("kJ")

dS = m*cv*math.log(T2/T1); 			#Consmath.tant volume process
print ("Change in entropy = %.3f")% (dS), ("kJ/kg K")


print ("When the mixture is heated at constant pressure")

print ("If the mixture is heated at constant pressure ΔU and ΔH will remain the same")

dS = m*cp*math.log(T2/T1);
print ("Change in entropy  = %.3f")% (dS), ("kJ/kg K")


# Note : Answers are slightly different because of rounding error.
x_N2 = 0.512
x_CO2 = 0.488
(ii) The equivalent molecular weight of the mixture
M = 35.814 kg/kg-mole
(iii) The equivalent gas consmath.tant of the mixture
Rmix = 0.232 kJ/kg K
(iv) The partial pressures and partial volumes
P_N2 = 2.047 bar
P_CO2 = 1.953 bar
V_N2  0.870 m**3
V_CO2 0.830 m**3
(v) The volume and density of the mixture
V = 1.700 m**3
Density of mixture = 5.881 kg/m**3
(vi) cp and cv of the mixture
cp = 0.925 kJ/kg K
cv = 0.693 kJ/kg K
Change in internal energy  = 208.001 kJ
Change in enthalpy  = 277.644 kJ
Change in entropy = 0.676 kJ/kg K
When the mixture is heated at constant pressure
If the mixture is heated at constant pressure ΔU and ΔH will remain the same
Change in entropy  = 0.902 kJ/kg K

Example 9.11 Page no : 430

In [3]:
# Variables
Cv_O2 = 21.07; 			#kJ/mole K
Cv_CO = 20.86; 			#kJ/mole K
p_O2 = 8*10**5; 			#Pa
p_CO = 1*10**5; 			#Pa
V_O2 = 1.8; 			#m**3
V_CO = 3.6; 			#m**3
T_O2 = 323.; 			#K
T_CO = 293.; 			#K
R0 = 8314.;

# Calculations and Results
n_O2 = p_O2*V_O2/R0/T_O2;
n_CO = p_CO*V_CO/R0/T_CO;
n = (n_O2+n_CO);
V = (V_O2+V_CO);

print ("(i) Final temperature (T) and pressure (p) of the mixture")

#Before mixing
U1 = n_O2*Cv_O2*T_O2 + n_CO*Cv_CO*T_CO;

T = U1/(n_O2*Cv_O2 + n_CO*Cv_CO);
t = T-273;

print ("Final temperature  = %.3f")% (t), ("°C")

p = n*R0*T/V/10**5;
print ("Final pressure  = %.3f")% (p), ("bar")


#For oxygen
dS_O1A = n_O2*R0*math.log(V/V_O2); 			#isothermal process
dS_O2A = n_O2*Cv_O2*math.log(T_O2/T); 			#consmath.tant volume process
dS_O12 = dS_O1A - dS_O2A; 			# Change of entropy of O2

#For CO
dS_CO12 = n_CO*R0*math.log(V/V_CO) + n_CO*Cv_CO*math.log(T/T_CO); 			#Change of entropy of CO
dS = (dS_O12 + dS_CO12)/10**3;
print ("(ii)Change of entropy of system  = %.3f")% (dS), ("kJ/K")
(i) Final temperature (T) and pressure (p) of the mixture
Final temperature  = 43.569 °C
Final pressure  = 3.334 bar
(ii)Change of entropy of system  = 5.396 kJ/K

Example 9.12 Page no : 432

In [13]:
import math 

# Variables
p_A = 16.*10**5; 			#Pa
p_B = 6.4*10**5; 			#Pa

T_A = 328.; 			#K
T_B = 298.; 			#K

n_A = 0.6    			#kg-mole
m_B = 3; 	    		#kg

R0 = 8314.;
M_A = 28.; 
y = 1.4;

V_A = n_A*R0*T_A/p_A;
m_A = n_A*M_A;
R = R0/M_A;
V_B = m_B*R*T_B/p_B;
V = V_A+V_B;
m = m_A+m_B;
T = 303.; 			#K

print ("(a) (i) Final equilibrium pressure, p")
p = m*R*T/V/10**5;
print ("p = %.3f")% (p), ("bar")

cv = R/10**3/(y-1);

print ("(ii) Amount of heat transferred, Q :")

U1 = cv*(m_A*T_A + m_B*T_B);
U2 = m*cv*T;
Q = U2-U1;
print ("Q = %.3f")% (Q),("kJ")

print ("(b) If the vessel were insulated :")

print ("(i) Final temperature,")

T = cv*(m_A*T_A + m_B*T_B)/(m*cv);
t = T-273;
print ("T = %.3f")% (t), ("°C")


print ("(ii) Final pressure")

p = m*R*T/V/10**5;
print ("p = %.3f")% (p), ("bar")
(a) (i) Final equilibrium pressure, p
p = 12.393 bar
(ii) Amount of heat transferred, Q :
Q = -300.640 kJ
(b) If the vessel were insulated :
(i) Final temperature,
T = 50.455 °C
(ii) Final pressure
p = 13.230 bar

Example 9.13 Page no : 434

In [14]:
import math 

# Variables
m_O2 = 3.; 			#kg
M_O2 = 32.;
m_N2 = 9.; 			#kg
M_N2 = 28.;
R0 = 8.314;

# Calculations
R_O2 = R0/M_O2;
R_N2 = R0/M_N2;
x_O2 = (m_O2/M_O2)/((m_O2/M_O2) + (m_N2/M_N2));
x_N2 = (m_N2/M_N2)/((m_O2/M_O2) + (m_N2/M_N2));
dS = -m_O2*R_O2*math.log(x_O2) -m_N2*R_N2*math.log(x_N2);

# Results
print ("Change in entropy  = %.3f")% (dS),("kJ/kg K")
Change in entropy  = 1.844 kJ/kg K

Example 9.14 Page no : 434

In [15]:
# Variables
m_N2 = 2.5; 			#kg 
M_N2 = 28.;
p_N2 = 15.; 			#bar
p_total = 20.; 			#bar

# Calculations
n_N2 = m_N2/M_N2;
p_O2 = p_total-p_N2;
n_O2 = p_O2/p_N2*n_N2;
M_O2 = 32;
m_O2 = n_O2*M_O2;

# Results
print ("Mass of O2 added  = %.3f")% (m_O2), ("kg")
Mass of O2 added  = 0.952 kg

Example 9.15 Page no : 435

In [5]:
# Variables
n_O2 = 1.;
M_N2 = 28.;
M_O2 = 32.;

# Calculations and Results
print ("(i) Moles of N2 per mole of O2 :")
n_N2 = n_O2*0.79/0.21;
print ("n_N2 = %.3f")%(n_N2),("moles")

n = n_O2+n_N2;
print ("(ii)")
p = 1; 			#atm

p_O2 = n_O2/n*p;
print ("p_O2 = %.3f")% (p_O2), ("atm")

p_N2 = n_N2/n*p;
print ("p_N2 = %.3f")% (p_N2), ("atm")


x = n_N2*M_N2/(n_N2*M_N2+n_O2*M_O2);
print ("(iii) The kg of nitrogen per kg of mixture  = %.3f")% (x), ("kg N2/kg mix")
(i) Moles of N2 per mole of O2 :
n_N2 = 3.762 moles
(ii)
p_O2 = 0.210 atm
p_N2 = 0.790 atm
(iii) The kg of nitrogen per kg of mixture  = 0.767 kg N2/kg mix

Example 9.16 Page no : 436

In [18]:
import math 

# Variables
V = 0.6; 			#m**3
p1 = 12.*10**5; 			#Pa
p2 = 18.*10**5; 			#Pa
T = 298.; 			#K
R0 = 8.314;
x_O2 = 0.23;
x_N2 = 0.77;

n = p1*V/R0/10**3/T;
#Considering 100 kg of air
m_O2 = 23.; 			#kg
m_N2 = 77.; 			#kg
M_O2 = 32.;
M_N2 = 28.;
m = 100.;    			#kg

# Calculations and Results
R = (m_O2/M_O2 + m_N2/M_N2)*R0/m; 			#for air
M = R0/R 	    		#for air

m = p1*V/R/T/10**3;

m_O2 = x_O2*m;
print ("Mass of O2 = %.3f")% (m_O2), ("kg")

m_N2 = x_N2*m;
print ("Mass of N2 = %.3f")% (m_N2), ("kg")

#After adding CO2 in the vessel
p2 = 18.*10**5; 			#Pa;

p_CO2 = 6.*10**5; 			#Pa
M_CO2 = 44.;
R_CO2 = R0/M_CO2;

m_CO2 = p_CO2*V/(R_CO2*10**3*T);
print ("Mass of CO2  =  %.3f")% (m_CO2), ("kg")
Mass of O2 = 1.927 kg
Mass of N2 = 6.451 kg
Mass of CO2  =  6.393 kg

Example 9.17 Page no : 437

In [19]:
# Variables
V = 6; 		        	#m**3
A = 0.45;   
B = 0.55;
R_A = 0.288; 			#kJ/kg K
R_B = 0.295; 			#kJ/kg K
m = 2.       			#kg
T = 303. 			    #K

# Calculations
print ("(i) The partial pressures")
m_A = A*m;
m_B = B*m;

p_A = m_A*R_A*10**3*T/V/10**5; 			#bar
print ("p_A = %.3f")% (p_A), ("bar")

p_B = m_B*R_B*10**3*T/V/10**5; 			#bar
print ("p_B = %.3f")% (p_B), ("bar")


print ("(ii) The total pressure")
p = p_A+p_B;
print ("p = %.3f")% (p), ("bar")


print ("(iii) The mean value of R for the mixture")
Rm = (m_A*R_A + m_B*R_B)/(m_A + m_B);
print ("Rm = %.3f")% (Rm), ("kJ/kg K")
(i) The partial pressures
p_A = 0.131 bar
p_B = 0.164 bar
(ii) The total pressure
p = 0.295 bar
(iii) The mean value of R for the mixture
Rm = 0.292 kJ/kg K

Example 9.18 Page no : 438

In [20]:
# Variables
m_O2 = 4.; 			#kg
m_N2 = 6.; 			#kg
p = 4.*10**5; 			#Pa
T = 300.; 			#K
M_O2 = 32.;
M_N2 = 28.;
m = 10.; 			#kg

# Calculations and Results
print ("(i) The mole fraction of each component")
n_O2 = m_O2/M_O2;
n_N2 = m_N2/M_N2;

x_O2 = n_O2/(n_O2+n_N2);
print ("x_O2 = %.3f")% (x_O2)

x_N2 = n_N2/(n_N2+n_O2);
print ("x_N2 = %.3f")% (x_N2)


print ("(ii) The average molecular weight")
M = (n_O2*M_O2 + n_N2*M_N2)/(n_O2 + n_N2);
print ("M = %.3f")%(M)

print ("(iii) The specific gas consmath.tant")
R0 = 8.314;
R = R0/M;
print ("R = %.3f")% (R), ("kJ/kg K")

print ("(iv) The volume and density")
V = m*R*T*10**3/p;
print ("V = %.3f")%(V), ("m**3")

rho = (m_O2/V) + (m_N2/V);
print ("density = %.3f")% (rho), ("kg/m**3")


print ("(v) The partial pressures and partial volumes")
p_O2 = n_O2*R0*10**3*T/V/10**5; 			#bar
print ("p_O2 = %.3f")%(p_O2), ("bar")

p_N2 = n_N2*R0*10**3*T/V/10**5; 			#bar
print ("p_N2 = %.3f")% (p_N2), ("bar")

V_O2 = x_O2*V;
print ("V_O2 = %.3f")% (V_O2), ("m**3")

V_N2 = x_N2*V;
print ("V_N2 = %.3f")% (V_N2), ("m**3")
(i) The mole fraction of each component
x_O2 = 0.368
x_N2 = 0.632
(ii) The average molecular weight
M = 29.474
(iii) The specific gas consmath.tant
R = 0.282 kJ/kg K
(iv) The volume and density
V = 2.116 m**3
density = 4.727 kg/m**3
(v) The partial pressures and partial volumes
p_O2 = 1.474 bar
p_N2 = 2.526 bar
V_O2 = 0.779 m**3
V_N2 = 1.336 m**3

Example 9.19 Page no : 439

In [21]:
import math 

# Variables
cp_CO2 = 0.85; 			#kJ/kg K
cp_N2 = 1.04; 			#kJ/kg K
m_CO2 = 4.; 			#kg
T1_CO2 = 313.; 			#K
m_N2 = 8.; 			#kg
T1_N2 = 433.; 			#K
p2 = 0.7; 			#bar
p1_CO2 = 1.4; 			#bar
p1_N2 = 1.;
R = 8.314;
M_CO2 = 44.;
M_N2 = 28.;
R_CO2 = R/M_CO2;
R_N2 = R/M_N2;

# Calculations and Results
print ("(i) Final temperature, T2")
T2 = (m_CO2*cp_CO2*T1_CO2 + m_N2*cp_N2*T1_N2)/(m_CO2*cp_CO2 + m_N2*cp_N2);
print ("T2 = %.3f")%(T2),("K")

print ("(ii) Change in entropy")
n_CO2 = 0.0909;
n_N2 = 0.2857;
n = n_CO2 + n_N2;
x_CO2 = n_CO2/n;
x_N2 = n_N2/n;
p2_CO2 = x_CO2*p2;
p2_N2 = x_N2*p2;

dS = m_CO2*cp_CO2*math.log(T2/T1_CO2) - m_CO2*R_CO2*math.log(p2_CO2/p1_CO2) + m_N2*cp_N2*math.log(T2/T1_N2) - m_N2*R_N2*math.log(p2_N2/p1_N2);
print ("dS = %.3f")%(dS), ("kJ/K")
(i) Final temperature, T2
T2 = 398.188 K
(ii) Change in entropy
dS = 3.223 kJ/K

Example 9.20 Page no : 440

In [6]:
import math 

# Variables
cv_O2 = 0.39; 			#kJ/kg K
cv_N2 = 0.446; 			#kJ/kg K
n_O2 = 1.;
n_N2 = 2.;
M_O2 = 32.;
M_N2 = 28.;
m_O2 = 32.; 			#kg
m_N2 = 2*28.; 			#kg
T_O2 = 293.; 			#K
T_N2 = 301.; 			#K
R0 = 8.314;

# Calculations
p_O2 = 2.5*10**5; 			#Pa
p_N2 = 1.5*10**5; 			#Pa
T2 = (m_O2*cv_O2*T_O2 + m_N2*cv_N2*T_N2)/(m_O2*cv_O2 + m_N2*cv_N2);
V_O2 = n_O2*R0*10**5*T_O2/p_O2;
V_N2 = n_N2*R0*10**5*T_N2/p_N2;
V = V_O2+V_N2;
dS = m_O2*(cv_O2*math.log(T2/T_O2) + R0/M_O2*math.log(V/V_O2)) + m_N2*(cv_N2*math.log(T2/T_N2) + R0/M_N2*math.log(V/V_N2));

# Results
print ("Entropy change in the mixing process = %.3f")%(dS),("kJ")
Entropy change in the mixing process = 16.627 kJ

Example 9.21 Page no : 421

In [23]:
import math 

# Variables
cv_N2 = 0.744; 			#kJ/kg K
cv_H2 = 10.352; 			#kJ/kg K
cp_N2 = 1.041; 			#kJ/kg K
cp_H2 = 14.476; 			#kJ/kg K
V = 0.45; 			#m**3
V_H2 = 0.3; 			#m**3
V_N2 = 0.15; 			#m**3
p_H2 = 3.*10**5; 			#Pa
p_N2 = 6.*10**5; 			#Pa
T_H2 = 403.; 			#K
T_N2 = 303.; 			#K

# Calculations and Results
R_H2 = 8.314/2;
R_N2 = 8.314/28;

print ("(i) Temperature of equilibrium mixture")

m_H2 = p_H2*V_H2/(R_H2*10**3)/T_H2;
m_N2 = p_N2*V_N2/(R_N2*10**3)/T_N2;
T2 = (m_H2*cv_H2*T_H2 + m_N2*cv_N2*T_N2)/(m_H2*cv_H2 + m_N2*cv_N2);
print ("T2 = %.3f")%(T2),("K")

print ("(ii) Pressure of the mixture")
p2_H2 = m_H2*R_H2*10**3*T2/V;
p2_N2 = m_N2*R_N2*10**3*T2/V;

p2 = p2_H2+p2_N2;
print ("p2 = %.3f")%(p2/10**5),("bar")

print ("(iii) Change in entropy :")

dS_H2 = m_H2*(cp_H2*math.log(T2/T_H2) - R_H2*math.log(p2_H2/p_H2));
print ("Change in entropy of H2  = %.3f")%(dS_H2),("kJ/K")

dS_N2 = m_N2*(cp_N2*math.log(T2/T_N2) - R_N2*math.log(p2_N2/p_N2));
print ("Change in entropy of N2  = %.3f")%(dS_N2),("kJ/K")

dS = dS_H2+dS_N2;

print ("Total change in entropy  = %.3f")%(dS),("kJ/K")
(i) Temperature of equilibrium mixture
T2 = 345.767 K
(ii) Pressure of the mixture
p2 = 3.998 bar
(iii) Change in entropy :
Change in entropy of H2  = 0.006 kJ/K
Change in entropy of N2  = 0.425 kJ/K
Total change in entropy  = 0.430 kJ/K

Example 9.22 Page no : 443

In [24]:
import math 

# Variables
cv_N2 = 0.745; 			#kJ/kg K
cv_CO2 = 0.653; 		#kJ/kg K
cp_N2 = 1.041; 			#kJ/kg K
cp_CO2 = 0.842; 		#kJ/kg K
m_N2 = 4.;   			#kg
m_CO2 = 6.;     		#kg
pmix = 4.; 		    	#bar
m = m_N2+m_CO2;

T1 = 298.; 			    #K
T2 = 323.; 			    #K

# Calculations and Results
cv_mix = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);
print ("cv_mix = %.3f")% (cv_mix), ("kJ/kg K")

cp_mix = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);
print ("cp_mix = %.3f")% (cp_mix), ("kJ/kg K")

dU = m*cv_mix*(T2-T1);
print ("Change in internal energy = %.3f")% (dU), ("kJ")

dH = m*cp_mix*(T2-T1);
print ("Change in enthalpy = %.3f")% (dH), ("kJ")

dS = m_N2*cv_N2*math.log(T2/T1) + m_CO2*cv_CO2*math.log(T2/T1);
print ("Change in entropy = %.3f")% (dS), ("kJ/K")
cv_mix = 0.690 kJ/kg K
cp_mix = 0.922 kJ/kg K
Change in internal energy = 172.450 kJ
Change in enthalpy = 230.400 kJ
Change in entropy = 0.556 kJ/K