Chapter 3 : PVT Behaviour And Heat Effects

Example 3.1, , Page no:45

In [13]:
# Variables
#Given:
T = 350.; 			#temperature in K
P = 10.**5; 			#pressure in N/m**2
R = 8.314; 			#ideal gas constant

# Calculations
#To find the molar volume of air
V = (R*T)/P; 			#molar volume in m**3

# Results
print 'Molar volume of air is %3.2e cubic m/mol'%V
Molar volume of air is 2.91e-02 cubic m/mol

Example 3.3, Page no:50

In [10]:
# Variables
#Given:
Cp = 29.3; 			#specific heat at constant pressure(kJ/kmol K)
R = 8.314; 			#ideal gas constant

# Calculations and Results
#To determine heat and work effects for each step
#Step 1: Gas is heated at constant volume
T1 = 300.;   		    	#temperature in K
P1 = 1.; 	    		    #initial pressure in bar
P2 = 2.; 		    	    #final pressure in bar
T2 = (P2/P1)*T1; 			#final temperature in K
Cv = Cp-R; 	    	    	#specific heat at constant volume
W1 = 0; 		    	    #work done is zero as volume remains constant
Q1 = Cv*(T2-T1); 			#heat supplied in kJ/kmol
print 'For step 1'
print 'Work done in step 1 is %i'%W1
print 'Heat supplied in step 1 is %f kJ/kmol'%Q1

#Step 2: The process is adiabatic
Q2 = 0.; 			#the process is adiabatic
P3 = 1.; 			#pressure after step 2 in bar
gama = (Cp/Cv);
T3 = ((P3/P2)**((gama-1)/gama))*T2; 			#temperature after step 2
W2 = (Cv*(T2-T3)); 			#work done by system
print 'For step 2'
print 'Heat supplied in step 2 is %i'%Q2
print 'Work done by system in step 2 is %f kJ/kmol'%W2

#Step 3: The process is isobaric
T4 = 300.; 			#temperature after step 3 (K)
Q3 = Cp*(T4-T3); 			#heat supplied during step 3(kJ/kmol)
U = (Cv*(T4-T3)); 			#change in internal energy during step 3(kJ/kmol)
W3 = Q3-U; 			#Using first law of thermodynamics
print 'For step 3'
print 'Heat given out by the system in step 3 is %f kJ/kmol'%Q3
print 'Work done on the system in step 3 is %f kJ/kmol'%W3
For step 1
Work done in step 1 is 0
Heat supplied in step 1 is 6295.800000 kJ/kmol
For step 2
Heat supplied in step 2 is 0
Work done by system in step 2 is 2248.222546 kJ/kmol
For step 3
Heat given out by the system in step 3 is -5651.101658 kJ/kmol
Work done on the system in step 3 is -1603.524204 kJ/kmol

Example 3.4, Page no:51

In [19]:
#Given:
R = 8.314; 			#ideal gas constant
Cp = 30.; 			#specific heat at constant pressure(J/mol K)

# Calculations and Results
#To calculate change in internal energy change in enthalpy work done and heat supplied
import math
#(a): Gas is expanded isothermally
T = 600.; 			#temperature in K
P1 = 5.; 			#initial pressure in bar
P2 = 4.; 			#final pressure in bar
U1 = 0; 			#since the process is isothermal
H1 = 0; 			#since the process is isothermal
W1 = (R*T*math.log(P1/P2)); 			#work done during the process
Q1 = W1; 			#heat supplied during the process
print 'When gas is expanded isothermally'
print 'Change in internal energy in isothermal process is %i'%U1
print 'Change in enthalpy in isothermal process is %i'%H1
print "Work done during the process is %f kJ/kmol"%W1
print 'Heat supplied during the process is %f kJ/kmol'%Q1

#(b): Gas is heated at constant volume
V = 0.1; 			#volume (m**3)
P1 = 1.; 			#initial pressure(bar)
T1 = 298.; 			#initial temperature(K)
T2 = 400.; 			#final temperature(K)
n = ((P1*V*10**5)/(R*T1)); 			#number of moles of gas
Cv = Cp-R; 			#specific heat at constant volume(J/mol K)
ans = round(Cv*(T2-T1))
n = round(n,2)
U2 = n*ans #Cv*round(T2-T1); 			#change in internal energy(J)
H2 = n*Cp*(T2-T1); 			#change in enthalpy(J)
W2 = 0; 			#isochoric process
Q2 = U2+W2; 			#heat supplied(J)
print '\nWhen gas is heated at constant volume'
print 'Change in internal energy is %.0f J'%U2
print 'Change in enthalpy is %f J'%H2
print 'Work done during the process is %i '% W2
print 'Heat supplied during the process is %.0f J'%Q2
When gas is expanded isothermally
Change in internal energy in isothermal process is 0
Change in enthalpy in isothermal process is 0
Work done during the process is 1113.129291 kJ/kmol
Heat supplied during the process is 1113.129291 kJ/kmol

When gas is heated at constant volume
Change in internal energy is 8936 J
Change in enthalpy is 12362.400000 J
Work done during the process is 0 
Heat supplied during the process is 8936 J

Example 3.5, Page no:52

In [16]:
from scipy.integrate import quad


def Cv(T):
    y = 27.4528+(6.1839*(10**-3)*T)-(8.9932*(10**-7)*(T**2))-R;
    return y

# Variables
m = 20.; 			#mass of air(kg)
n = 1.25; 			#polytropic constant
P1 = 1.; 			#initial pressure(bar)
P2 = 5.; 			#final pressure(bar)
T1 = 300.; 			#temperature(K)
R = 8.314; 			#ideal gas constant
M = 29.; 			#molecular wt of air

# Calculations
#To determine work done and amount of heat transferred
#(a): Work done by the compressor per cycle
n_mole = m/M; 			#moles of air(kmol)
V1 = ((n_mole*10**3*R*T1)/(P1*10**5)); 			#initial volume(m**3)
V2 = (V1*((P1/P2)**(1/n))); 			        #final volume(m**3)

#Since the process is polytropic P(V**n)=c(say constant)
c = P1*10**5*(V1**n); 
			#function[z] = f(V);
			#    z = c/(V**1.25);
			#W1 = intg(V1,V2,f); so
W = (c/(1-n))*((V2**(-n+1))-(V1**(-n+1)))/1000;
print 'Work done by compressor is %4.3e J'%(W*1000);

#(b): Amount of heat transferred to surrounding
T2 = ((T1*V2*P2)/(V1*P1)); 			#final temp in K
U1 = quad(Cv,T1,T2)[0];
U = U1*n_mole; 			            #change in internal energy(kJ)
Q = U+W; 			                #heat supplied

# Results
print 'Chnage in internal energy is %f kJ'%U
print 'Heat supplied is %f kJ'%Q
Work done by compressor is -2.613e+06 J
Chnage in internal energy is 1667.979893 kJ
Heat supplied is -944.769684 kJ

Example 3.6, Page no:55

In [17]:
# Variables
#Given:
V = 0.3821*10**-3 			#molar volume(m**3/mol)
T = 313.; 			#temperature (K)
R = 8.314; 			#ideal gas constant
a = 0.365; b = 4.28*10**-5; 			#Vander Waals constant


# Calculations and Results
#To compare the pressures
#(a): Ideal gas equation
P = ((R*T)/(V*10**5)); 			#pressure in bar
print 'Pressure obtained by ideal gas equation is %f bar'%P

#(b): Van der Waals equation
P = ((((R*T)/(V-b))-(a/(V**2)))/(10**5));
print 'Pressure obtained by Van der Waals equation is %f bar'%P
Pressure obtained by ideal gas equation is 68.104737 bar
Pressure obtained by Van der Waals equation is 51.695679 bar

Example 3.7, Page no:56

In [18]:
#To find Approx Value
def approx(V,n):
  A=round(V*10**n)/10**n;			#V-Value  n-To what place
  return A

# Variables
#Given:
T = 300.; 			#temperature(K)
P = 100.; 			#pressure(bar)
R = 8.314; 			#ideal gas constant
a = 0.1378
b = 3.18*10**-5; 			#Van der waals constant

# Calculations and Results
#(a): Ideal gas equation
V_ideal = approx(((R*T)/(P*10**5)),6);
print 'Volume calculated by ideal gas equation is %4.2e cubic m'%V_ideal

#(b): Van der Waals equation
def f(V):
    y=((P*10**5)+(a/(V**2)))*(V-b)-(R*T); 			#function to calculate difference between calculated and assumed volume
    return y
    
V_real = 0;
i = 0.20
while i<=.30:  			#Van der waals volume should be nearly equal to Ideal gas valoume
    res = approx(f(i*10**-3),0);
    for j in range(-5,6):
        if(j==res): 			#for very small difference i may be taken as exact volume
            V_real = i*10**-3;
    i += 0.01

print 'Volume calculated by Van der Waals equation is %3.2e cubic m'%V_real
Volume calculated by ideal gas equation is 2.49e-04 cubic m
Volume calculated by Van der Waals equation is 2.30e-04 cubic m

Example 3.9, Page no:59

In [22]:
#To find Approx Value
def approx(V,n):
  A=round(V*10**n)/10**n;			#V-Value  n-To what place
  return A


# Variables
#Given:
T = 500.; 			#temperature (K)
P = 10.; 			#pressure(bar)
R = 8.314; 			#ideal gas constant
B = -2.19*10**-4; C=-1.73*10**-8; 			#Virial coeffecients
Tc = 512.6; 			#critical temperature
Pc = 81.; 			#critical pressure

#To calculate compressibility factor and molar volume

# Calculations and Results
#(a): Truncated form of virial equation
V_ideal = approx(((R*T)/(P*10**5)),7); 			#ideal gas volume
def f1(V):
    z = (((R*T)/(P*10**5))*(1+(B/V)+(C/(V**2)))); 			#function for obtaining volume by virial equation
    return z

#loop for hit and trial method
flag = 1;
while(flag==1):
    V_virial = approx(f1(V_ideal),7);
    if(approx(V_ideal,5)==approx(V_virial,5)):
        flag = 0;
        break;
    else:
        V_ideal = V_virial;


Z = approx(((P*10**5*V_virial)/(T*R)),3); 			#compressibility factor
print 'Compressibilty factor for virial equation is %f '%Z

#(b): Redlich Kwong Equation
#Constants in Redlich Kwong equation
a = approx(((0.4278*(R**2)*(Tc**2.5))/(Pc*10**5)),4);
b = approx(((0.0867*R*Tc)/(Pc*10**5)),9);

V_ideal = approx(((R*T)/(P*10**5)),7); 			#ideal gas volume

#Function to find volume by Redlich Kwong equation 
def f2(V):
    x = ((R*T)/(P*10**5))+b-((a*(V-b))/((T**0.5)*(P*10**5)*V*(V+b)));
    return x

#loop for hit and trial method
flag = 1;
while(flag==1):
    V_redlich = approx(f2(V_ideal),7);
    if(approx(V_ideal,5)==approx(V_redlich,5)):
        flag = 0;
        break;
    else:
	    V_ideal = V_redlich;

print 'Volume obtained by Redlich Kwong Equation is %4.3e cubic m/mol'%V_redlich
Z = approx(((P*10**5*V_redlich)/(T*R)),3); 			#compressibility factor
print 'Compressbility factor by Redlich Kwong equation is %f'%Z
Compressibilty factor for virial equation is 0.943000 
Volume obtained by Redlich Kwong Equation is 3.963e-03 cubic m/mol
Compressbility factor by Redlich Kwong equation is 0.953000

Example 3.10, Page no:64

In [20]:
# Variables
#Given:
Ha = -890.94; 			#standard heat for reaction a (kJ)
Hb = -393.78; 			#standard heat for reaction b (kJ)
Hc = -286.03; 			#standard heat for reaction c (kJ)

# Calculations
#To calculate heat of formation of methane gas
#c*2 + b - a gives the formation of methane from elements
Hf = (2*Hc)+Hb-Ha;

# Results
print 'Heat of formation of methane is %f kJ/mol'%Hf
Heat of formation of methane is -74.900000 kJ/mol

Example 3.11, Page no:65

In [21]:
# Variables
#Given:
Ha = -509.93; 			#heat of combustion of reaction a (kJ) 
Hb = -296.03; 			#heat of combustion of reaction b (kJ)
Hc = -393.78; 			#heat of combustion of reaction c (kJ)
Hd = -167.57; 			#heat of combustion of reaction d (kJ)

# Calculations
#To calculate heat of formation of chloroform
#c + (3*d) -a -b gives chloroform from its elements
Hf = Hc+(3*Hd)-Ha-Hb;

# Results
print 'Heat of formation of chloroform is %f kJ/mol'%Hf
Heat of formation of chloroform is -90.530000 kJ/mol

Example 3.12, Page no:67

In [22]:
# Variables
#Given:
Ho = -164987.; 			#standard heat of reaction at 298 K in J
T1 = 298.;
T2 = 773.; 			#temperature(K)

# Calculations
#To calculate standard heat of reaction at 773 K
alpha = (2*29.16)+13.41-26.75-(4*26.88);
betta = ((2*14.49)+77.03-42.26-(4*4.35))*10**-3;
gama = ((2*-2.02)-18.74+14.25+(4*0.33))*10**-6;
#Using equation 3.54 (Page no. 67)
H1 = Ho-(alpha*T1)-(betta*(T1**2)/2)-(gama*(T1**3)/3);
#At 773 K
Hr = H1+(alpha*T2)+(betta*(T2**2)/2)+(gama*(T2**3)/3);

# Results
print 'Heat of reaction at 773 K is %f kJ'%(Hr/1000)
Heat of reaction at 773 K is -183.950273 kJ

Example 3.13, Page no:68

In [23]:
# Variables
#Given:
To = 298.; 			#standard temperature(K)
T1 = 400.; 			#temperature of reactants(K)
T2 = 600.; 			#temperature of products (K)
Ho = -283.028; 			#standard heat of reaction(kJ/mol)

# Calculations
#To determine heat added or removed
#Basis:
n_CO = 1.; 			#moles of CO reacted
n_O2 = 1.;			#moles of oxygen supplied
n_N2 = 1.*79./21; 			#moles of nitrogen
n1_O2 = 0.5; 			#moles of oxygen required
n_CO2 = 1.; 			#moles of carbon di oxide formed

H1 = ((n_O2*29.70)+(n_N2*29.10)+(n_CO*29.10))*(To-T1)/1000; 			#enthalpy of cooling of reactants
H2 = ((n1_O2*29.70)+(n_N2*29.10)+(n_CO2*41.45))*(T2-To)/1000; 			#enthalpy of heating the products
Hr = H1+Ho+H2;

# Results
print 'Heat supplied is %f kJ'%Hr
Heat supplied is -250.128714 kJ

Example 3.14, Page no:69

In [24]:
# Variables
#Given:
To = 298.; 			#standard temperature (K)
T1 = 373.; 			#temperature of reactants (K)
Ho = 283178.; 			#standard heat of combustion(J/mol)

# Calculations
#To calculate theoretical flame temperature
#Basis:
n_CO = 1.; 			#moles of CO
n_O2 = 1.; 			#moles of oxygen supplied
n1_O2 = 0.5; 			#moles of oxygen reacted
n_CO2 = 1.; 			#moles of carbon di oxide formed
n_N2 = 79./21; 			#moles of nitrogen

H1 = ((n_O2*34.83)+(n_N2*33.03)+(n_CO*29.23))*(To-T1); 			#enthalpy of cooling of reactants
#Using equation 3.55 (Page no. 69)
H2 = Ho-H1;
Tf = H2/((n1_O2*34.83)+(n_N2*33.03)+(n_CO2*53.59))+298; 			#flame temperature

# Results
print 'Theoretical flame temperature is %f K'%Tf
Theoretical flame temperature is 1820.588298 K