Chapter 3 : Properties of Gases

Example 3.1 pg : 20

In [3]:
#Declaring Values
V = 3.;        #Volume in m**3
P1 = 2500.;      #Pressure in kilobar
P2 = 1500.;
T2 = 21.+273;  #Temperature in Kelvin
T1 = (T2*P1)/P2;

# Calculations
Cp = 1.005;
Cv = 0.718;
R = Cp-Cv;            #Universal Gas Consmath.tant
m = (P1*V)/(R*T1);        #Calculating mass
H = m*Cp*(T2-T1);
U = m*Cv*(T2-T1);
Q = U;        #Since Consmath.tant Volume Process: Work Done = 0

#Displaying Results
print 'Change in Enthalpy: %5.2f kJ'%(H);
print 'Change in Internal Energy: %5.f kJ'%(U);
print 'Heat Transfer: %4.f kJ'%(Q);
print 'As Answer is negative, system rejects heat'
Change in Enthalpy: -10505.23 kJ
Change in Internal Energy: -7505 kJ
Heat Transfer: -7505 kJ
As Answer is negative, system rejects heat

Example 3.2 pg : 21

In [4]:
#Inputs
m = 1.;        #Mass in kg
P1 = 7.;        #Pressure in bar
T1 = 90.+273;  #Temperature in K
P2 = 1.4;
R = 0.287;
G = 1.4;      #Gamma for air

#Calculations according to data required
x = P2/P1;
y = 0.1/1.1;
z = x**y;
T2 = T1*z;        #calculating T2
print 'Final Temperature is: %3.1f K'%(T2);

W = (m*R*(T1-T2))/(1.1-1);
print 'Work Done is: %3.1f kJ'%(W);

Cv = (R)/(G-1);
Cp = R+Cv;
CI = m*Cv*(T2-T1);
print 'Change in Internal Energy is: %3.2f kJ'%(CI);

Q = CI+W;
print 'Heat Transfer is: %3.2f kJ'%(Q);
Final Temperature is: 313.6 K
Work Done is: 141.8 kJ
Change in Internal Energy is: -35.45 kJ
Heat Transfer is: 106.35 kJ

Example 3.3 pg : 22

In [7]:
# Variables
P1 = 2.75*100;        #Pressure in kPa
V1 = 0.09         #Volume in m**3
T1 = 185.+273;     #Temperature in Kelvin
T2 = 15.+273;
R = 0.29;
Cp = 1.005;
Cv = 0.715;

# Calculations and Results
m = (P1*V1)/(R*T1);
V2 = (T2/T1)*V1;
W = P1*(V2-V1);
print 'The Work Done: %2.3f kJ'%(W);

Q = m*Cp*(T2-T1);
print 'The Heat Transfer: %2.2f kJ'%(Q);

U = Q-W;
print 'The change in Internal Energy: %2.2f kJ'%(U);
The Work Done: -9.187 kJ
The Heat Transfer: -31.84 kJ
The change in Internal Energy: -22.65 kJ

Example 3.4 pg : 23

In [10]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.67;
P1 = 14.;
T1 = 290.+273;
R = 287.;

# Calculations and Results
V1 = (m*R*T1)/(14*(10**5));
print 'The Volume: %2.3f kJ'%(V1);

V2 = 4*V1;
print 'The Final Volume: %2.3f kJ'%(V2);

x = V1/V2;
y = x**1.3;
P2 = P1*y;
print 'The Final Pressure: %2.2f bar'%(P2);

x = V1/V2;
y = x**0.3;
T2 = T1*y;
print 'The Final Temperature: %2.2f K'%(T2);
The Volume: 0.077 kJ
The Final Volume: 0.309 kJ
The Final Pressure: 2.31 bar
The Final Temperature: 371.44 K

Example 3.5 pg : 24

In [11]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 510.;
V1 = 0.142;
P2 = 170.;
V2 = 0.275;
H = -65.;
Cv = 0.718;

# Calculations and Results
X = (P2*V2)-(P1*V1);
U = H-X;
print 'The Change in Internal Energy: %2.2f kJ'%(U);

G = H/U;
Cp = G*Cv;
R = Cp-Cv;
print 'The Value of R: %2.3f kJ/kg K'%(R);
The Change in Internal Energy: -39.33 kJ
The Value of R: 0.469 kJ/kg K

Example 3.6 pg : 24

In [12]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 25.;
T1 = 27.+273;
P2 = 5.;
T2 = 20.+273;
V1 = 0.7;
Et = 1.43;
Pn = 101.325;
Tn = 273.;

#Calculations
R = (Pn)/(Et*Tn);
m1 = (Pn*V1)/(R*Tn);
V2 = (m1*R*T1)/(P1*100);
m2 = (P2*100*V2)/(R*T2);
mf = m1-m2;

# Results
print 'The mass of Oxygen used: %3.3f kg'%(mf);
The mass of Oxygen used: 0.796 kg

Example 3.7 pg : 25

In [13]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
n = 1.3;
m = 1.;
T1 = 300.;
T2 = 200.;
W = 90.;
Ro = 8.3143;

# Calculations
R = ((n-m)*W)/((T1-T2)*m);
M = Ro/R;

# Results
print 'The molecular mass of gas is: %3.1f kg/kg mole'%(M);
The molecular mass of gas is: 30.8 kg/kg mole

Example 3.8 pg : 26

In [16]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.18;
V1 = 0.15;
T1 = 15.+273;
P1 = 100.;
V2 = 0.056;
P2 = 400.;

# Calculations and Results
R = (P1*V1)/(m*T1);
print 'The Gas Consmath.tant: %3.3f kJ/kg K'%(R);

M = 8.3141/R;
print 'The Molecular Mass of Gas: %3.2f kg/kg mole'%(M);

x = math.log(P2/P1);
y = math.log(V2/V1);
G = -(x/y);
Cv = R/(G-1);
print 'The Cv: %3.2f kJ/kg K'%(Cv);

Cp = Cv+R;
print 'The Cp: %3.2f kJ/kg K'%(Cp);

x = (G-1)/G;
y = P2/P1;
z = y**x;
T2 = T1*z;
U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %3.2f kJ'%(U);
The Gas Consmath.tant: 0.289 kJ/kg K
The Molecular Mass of Gas: 28.73 kg/kg mole
The Cv: 0.71 kJ/kg K
The Cp: 1.00 kJ/kg K
The change in Internal Energy: 18.18 kJ

Example 3.9 pg : 26

In [17]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 100.;
V1 = 0.25;
T1 = 100.+273;
V2 = 0.05;
P2 = 750.;
G = 1.4;
R = 0.298;

# Calculations and Results
n = (math.log(P2/P1))/(math.log(V1/V2));
print 'The Index n: %1.2f '%(n);

T2 = T1*((P2/P1)**((n-1)/n));
Cv = R/(G-1);
Cp = R+Cv;
m = (P1*V1)/(R*T1);
W = (m*R*(T1-T2))/(n-1);
Q = ((G-n)/(G-1))*W;
print 'The Heat change: %2.2f kJ'%(Q);

U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %2.2f kJ'%(U);

 
The Index n: 1.25 
The Heat change: -18.37 kJ
The change in Internal Energy: 31.25 kJ

Example 3.13 pg : 30

In [19]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
P2 = 25.;
P1 = 1.;
pV = 260.;
T1 = 17.+273;

# Calculations and Results
T2 = T1;
V1 = (pV*T1)/(P1*100000);
print 'As process is Isothermal, Initial and Final Temperatures are same ';
print 'The Final Temperature: %3.0f K'%(T1);

V2 = (pV*T2)/(P2*100000);
print 'The Final Volume: %3.5f m**3'%(V2);

CR = P2/P1;
print 'The Compression Ratio: %3.0f '%(CR);

print 'Change in Enthalpy is zero as it is Isothermal process ';
W = P1*100*V1*(math.log(P1/P2));
print 'Work Done is: %3.1f kJ'%(W);
As process is Isothermal, Initial and Final Temperatures are same 
The Final Temperature: 290 K
The Final Volume: 0.03016 m**3
The Compression Ratio:  25 
Change in Enthalpy is zero as it is Isothermal process 
Work Done is: -242.7 kJ

Example 3.14 pg : 31

In [21]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P2 = 6.;
Cp = 1.75;
P1 = 1.;
n = 1.3;
T1 = 30.+273;
M = 30.;
m = 2.;
Ro = 8314.4;

# Calculations and Results
R = (Ro/M)/1000;
print 'The Gas Consmath.tant: %3.3f kJ/kg K'%( R);

Cv = Cp-R;
G = Cp/Cv;
print 'The value of Gamma: %1.2f '%(G);

T2 = (T1)*((P2/P1)**((n-1)/n));
print 'Final Temperature: %3.2f K'%(T2);

W = (m*R*(T1-T2))/(n-1);
print 'The work done on the gas: %3.2f kJ'%(W);

Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer is %3.2f kJ'%(Q);

U = m*Cv*(T2-T1);
print 'The change in Internal Energy is %3.2f kJ'%(U);

# note : answer may vary because of rounding off error.
The Gas Consmath.tant: 0.277 kJ/kg K
The value of Gamma: 1.19 
Final Temperature: 458.16 K
The work done on the gas: -286.68 kJ
The Heat Transfer is 170.37 kJ
The change in Internal Energy is 457.05 kJ

Example 3.15 pg : 32

In [22]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 350.;
P2 = 130.;
R = 0.287;
T1 = 450.;
G = 1.4;
m = 1.;

# Calculations and Results
T2 = T1*((P2/P1)**((G-1)/G));
W = (m*R*(T1-T2))/(G-1);
print 'Amount of External Work done: %3.2f kJ/kg'%(W);

U = -W;
print 'Change in Internal Energy: %3.2f kJ/kg'%(U);
Amount of External Work done: 79.58 kJ/kg
Change in Internal Energy: -79.58 kJ/kg

Example 3.16 pg : 33

In [24]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 1.5;
V1 = 0.1;
V2 = 0.04;
P2 = 7.5;
T1 = 30+273;

# Calculations
#Umath.sing ideal gas equation
T2 = (P2*V2*T1)/(P1*V1);

# Results
print 'The Value of Temperature of gas: %3.0f C'%(T2 - 273);
The Value of Temperature of gas: 333 C

Example 3.17 pg : 33

In [25]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 1.5;
V1 = 3.;
T1 = 27.+273;
P2 = 30.;
T2 = 60.+273;
R = 0.287;

# Calculations and Results
m1 = (P1*100*V1)/(R*T1);
m2 = (P2*100*V1)/(R*T2);

m = m2-m1;
print 'The mass pumped: %2.2f kg'%(m);

V = (m*R*(17+273))/(1*100);

print 'Volume: %2.2f m**3'%(V);


T3 = 27+273;
P3 = (T3*P2)/T2;

print 'Final air pressure in the vessel: %2.2f bar'%(P3);
The mass pumped: 88.94 kg
Volume: 74.03 m**3
Final air pressure in the vessel: 27.03 bar

Example 3.18 pg : 34

In [26]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 1.5;
m = 2.;
T1 = 27.+273;
T2 = 207.+273;
V2 = V1;
M = 28.;
Ro = 8.314;

# Calculations and Results
R = Ro/M;
P1 = (m*R*T1)/V1;
print 'The initial pressure of gas: %3.3f bar'%(P1/100);

P2 = (P1*T2)/T1;
print 'The final pressure of gas: %3.3f bar'%(P2/100);
The initial pressure of gas: 1.188 bar
The final pressure of gas: 1.900 bar

Example 3.19 pg : 35

In [27]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 27.+273;
V1 = 0.06;
P1 = 150.;
Ro = 8.314;
M = 28.;

# Calculations and Results
R = Ro/M;
m = (P1*100*V1)/(R*T1);
print 'Mass of gas at design condition: %2.1f kg'%(m);

P2 = 170.;
T2 = (T1*P2)/P1;
print 'Fusible plug should melt at: %3.0f K'%(T2);
Mass of gas at design condition: 10.1 kg
Fusible plug should melt at: 340 K

Example 3.20 pg : 35

In [29]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 7.;
m = 3.7;
V1 = 1.5;
P2 = 1.4;
V2 = 4.5;
U = 648.;
Cv = 1.05;

# Calculations and Results
RT1 = (P1*100*V1)/(m);
RT2 = (P2*100*V2)/(m);

RT = RT1-RT2;
T = (U)/(m*Cv);
R = (RT/T)
print 'The value of R: %1.3f kJ/kg K'%(R);


Cp = Cv+R;
H = m*Cp*(-T);
print 'The change in enthalpy is: %4.2f kJ'%(H);


T1 = RT1/R;
T2 = RT2/R;

print 'Initial Temperature: %3.2f K '%(T1);
print 'Final Temperature: %3.f K '%(T2);
The value of R: 0.681 kJ/kg K
The change in enthalpy is: -1068.00 kJ
Initial Temperature: 416.99 K 
Final Temperature: 250 K 

Example 3.21 pg : 36

In [30]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V = 1.6;
P = 1.;
m = 2.;
T = 17.+273;
G = 1.4;

# Calculations and Results
R = (P*100*V)/(m*T);
Cv = (R)/(G-1);
print 'The Value of Cv: %1.2f kJ/kg K'%(Cv);


Cp = Cv+R;
print 'The Value of Cp: %1.3f kJ/kg K'%(Cp);
The Value of Cv: 0.69 kJ/kg K
The Value of Cp: 0.966 kJ/kg K

Example 3.22 pg : 37

In [31]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.091;
P1 = 2.73;
T1 = 187.+273;
T2 = 27.+273;
Cp = 1.005;
Cv = 0.718;

# Calculations and Results
R = Cp-Cv;

m = (P1*100*V1)/(R*T1);
Q = m*Cp*(T2-T1);
print 'The Value of heat transferred: %1.2f kJ'%(Q);


V2 = (T2*V1)/T1;
W = P1*100*(V2-V1);
print 'The Value of Work done: %1.2f kJ'%(W);
The Value of heat transferred: -30.26 kJ
The Value of Work done: -8.64 kJ

Example 3.23 pg : 37

In [32]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 28.;
V1 = 3.;
T1 = 100.+273;
T2 = 37.+273;
G = 1.4;
Ro = 8.314;

# Calculations and Results
v = V1/m;
R = Ro/m;

P1 = (m*R*T1)/V1;

print 'The Specific Volume: %1.3f m**3/kg'%(v);


print 'The Initial Pressure: %1.2f kPa'%(P1);


P2 = (P1*T2)/T1;
print 'The Final Pressure: %1.2f kPa'%(P2);


Cv = (R)/(G-1);
Cp = Cv*G;
U = m*Cv*(T2-T1);
H = m*Cp*(T2-T1);

print 'Change in Internal Energy: %1.2f kJ'%(U);



print 'Change in Heat energy: %1.2f kJ'%(H);
The Specific Volume: 0.107 m**3/kg
The Initial Pressure: 1033.71 kPa
The Final Pressure: 859.11 kPa
Change in Internal Energy: -1309.46 kJ
Change in Heat energy: -1833.24 kJ

Example 3.24 pg : 38

In [33]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 3.;
V1 = V1*100;      #In kPa
P1 = 2.;
T1 = 73.+273;
P2 = 7.;
R = 0.287;
Cv = 0.718;
Cp = 1.005;

# Calculations
m = (P1*V1)/(R*T1);
T2 = (P2*T1)/P1;

U = m*Cv*(T2-T1);
H = m*Cp*(T2-T1);

# Results
print 'Change in Internal Energy: %1.2f kJ'%(U);
print 'Change in heat Energy: %1.2f kJ'%(H);
Change in Internal Energy: 3752.61 kJ
Change in heat Energy: 5252.61 kJ

Example 3.25 pg : 39

In [34]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
T1 = 27.+273;
T2 = 197.+273;
V1 = 2.1;
R = 0.287;
Cp = 1.005;

# Calculations and Results
W = m*R*(T2-T1);
print 'Work Done: %1.2f kJ'%(W);


Q = m*Cp*(T2-T1);
U = Q-W;

print 'Change in Heat Energy: %1.2f kJ'%(Q);
print 'Change in Internal Energy: %1.2f kJ'%(U);


P = (m*R*T1)/(V1);
V2 = (V1*T2)/(T1);
print 'Pressure: %1.2f kPa'%(P);
print 'Final Volume: %1.1f m**3'%(V2);
Work Done: 48.79 kJ
Change in Heat Energy: 170.85 kJ
Change in Internal Energy: 122.06 kJ
Pressure: 41.00 kPa
Final Volume: 3.3 m**3

Example 3.26 pg : 39

In [35]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.5;
P1 = 0.3;
V2 = 0.1;

# Calculations and Results
P2 = (P1*V1)/(V2);
print 'Final Pressure: %1.2f bar'%(P2);

W = (P1*100*V1)*(math.log(V2/V1));
print 'Work Done: %1.2f kJ'%(W);
print 'Change in Internal Energy: 0 kJ as it is Isothermal Process';
print 'Change in Heat Energy: %1.2f kJ'%(W);
Final Pressure: 1.50 bar
Work Done: -24.14 kJ
Change in Internal Energy: 0 kJ as it is Isothermal Process
Change in Heat Energy: -24.14 kJ

Example 3.27 pg : 40

In [37]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.19;
P1 = 1.;
V1 = 0.16;
T1 = 17.+273;
P2 = 4.1;
V2 = 0.046;
Ro = 8.314;

# Calculations and Results
R = (P1*100*V1)/(m*T1);
print 'Gas Constant: %1.2f kJ/kg K'%(R);

M = Ro/R;
print 'Molecular Mass: %1.2f kg/kg mole'%(M);

G = (math.log(P1/P2))/(math.log(V2/V1));
print 'Ratio of Specific Heats: %1.2f '%(G);

Cv = (R)/(G-1);
print 'Value of Cv: %1.2f kJ/kg K'%(Cv);

Cp = G*Cv;
print 'Value of Cp: %1.2f kJ/kg K'%(Cp);

T2 = (P2*100*V2)/(m*R);
U = m*Cv*(T2-T1);
print 'Change in Internal Energy: %1.2f kJ'%(U);

H = m*Cp*(T2-T1);
print 'Heat Transfer: %1.2f kJ'%(H);

W = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work Done: %1.2f kJ'%(W);

# note : rounding off error.
Gas Constant: 0.29 kJ/kg K
Molecular Mass: 28.63 kg/kg mole
Ratio of Specific Heats: 1.13 
Value of Cv: 2.20 kJ/kg K
Value of Cp: 2.49 kJ/kg K
Change in Internal Energy: 21.68 kJ
Heat Transfer: 24.54 kJ
Work Done: -21.68 kJ

Example 3.28 pg : 41

In [39]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.19;
P1 = 5.;
T1 = 190.+273;
P2 = 1.;
H = 100.;
G = 1.4;
R = 0.287;
Cp = 1.005;

# Calculations
V2 = V1*((P1/P2)**(1./G));
W = ((P1*100*V1)-(P2*100*V2))/(G-1);
m = (P1*100*V1)/(R*T1);
T2 = T1*((P2/P1)**((G-1)/G))
x = H/(m*Cp);
T3 = x+T2;

V3 = (V2*T3)/T2;
Wo = P2*100*(V3-V2);
Wf = W+Wo;

# Results
print 'Total Work Done: %1.2f kJ'%(Wf);

# note: rounding off error.
Total Work Done: 116.10 kJ

Example 3.29 pg : 42

In [41]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.1;
V3 = V1;
P1 = 10.;
T1 = 200.+273;
P2 = 3.;
R = 0.287;
G = 1.4;
Cv = 0.718;

# Calculations and Results
m = (P1*100*V1)/(R*T1);
T2 = T1*((P2/P1)**((G-1)/G));
V2 = V1*((P1/P2)**((1)/G));
T3 = T2;
P3 = (P2*V2)/V3;
print 'Pressure after Isothermal Compression: %1.2f bar'%(P3);
print 'Temperature after isothermal compression: %1.2f K'%(T2);

W1 = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work Developed during adiabatic expansion: %2.0f kJ'%(W1);

W2 = (P2*100*V2)*math.log(V3/V2);
print 'Work of Compression: %1.2f kJ'%(W2);

Q = m*Cv*(T1-T3);
print 'Heat supplied in 3rd Process: %1.2f kJ'%(Q);

U = m*Cv*(T2-T1);
print 'Change in Internal Energy: %1.2f kJ'%(U);

# note: rounding off error.
Pressure after Isothermal Compression: 7.09 bar
Temperature after isothermal compression: 335.33 K
Work Developed during adiabatic expansion: 73 kJ
Work of Compression: -60.97 kJ
Heat supplied in 3rd Process: 72.82 kJ
Change in Internal Energy: -72.82 kJ

Example 3.30 pg : 44

In [43]:
#Inputs
V1 = 0.028;
P1 = 1.;
T1 = 27.+273;
n = 1.3;
V2 = 0.0046;
T3 = T1;

# Calculations and Results
T2 = T1*((V1/V2)**(n-1));
print 'Temperature after compression: %1.2f K'%(T2);


P2 = P1*((V1/V2)**n);
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'Work Done: %1.2f kJ'%(W);


P3 = (T3*P2)/T2;
print 'Final Pressure: %1.2f bar'%(P3);
Temperature after compression: 515.75 K
Work Done: -6.71 kJ
Final Pressure: 6.09 bar

Example 3.31 pg : 45

In [45]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.15;
P1 = 900.;
T1 = 300.+273;
T3 = T1;
V2 = 3*V1;
R = 0.287;
Cp = 1.005;
G = 1.4;
n = 1.5;
Cv = 0.718;

# Calculations and Results
m = (P1*V1)/(R*T1);
T2 = (V2*T1)/V1;
Q1 = m*Cp*(T2-T1);
print 'Heat Received: %3.2f kJ'%(Q1);


Q2 = (m*Cv)*((n-G)/(n-1))*(T3-T2);
Q3 = m*R*T3*(math.log(1./27));
Qr = 0-(Q2+Q3);
print 'Heat Rejected: %3.2f kJ'%(Qr);


Eff = (1-(Qr/Q1))*100;
print 'Efficiency: %3.2f percent'%(Eff);

# rounding off error.
Heat Received: 945.47 kJ
Heat Rejected: 580.03 kJ
Efficiency: 38.65 percent

Example 3.32 pg : 47

In [47]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
M = 27.;
P1 = 1.;
T1 = 60.+273;
n = 1.3;
Cvm = 21.;
Ro = 8.314;
R = Ro/M;

# Calculations and Results
V1 = (R*T1)/(P1*100);
V2 = V1/12;
x = V1/V2;
P2 = P1*(x**n);
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'Work Done: %3.2f kJ/kg'%(W);


Cv = Cvm/M;
Cp = Cv+R;
G = Cp/Cv;

Q = ((G-n)/(G-1))*W;
print 'Heat Transfer during the process: %3.2f kJ/kg'%(Q);

# note : rounding off error.
Work Done: -378.52 kJ/kg
Heat Transfer during the process: -91.69 kJ/kg

Example 3.33 pg : 48

In [49]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
D = 0.550;
L = 0.740;
r = 12.;
P1 = 100.;
T1 = 27.+273;
n = 1.32;
R = 0.287;
G = 1.4;
V = ((22./7)/4)*D*D*L;
V2 = V/11;

# Calculations and Results
V1 = V2+V;
P2 = P1*((r)**n);
T2 = T1*((r)**(n-1));
print 'The Pressure at end of Compression: %3.3f kPa'%(P2);

print 'The Temperature at end of Compression: %3.3f K'%(T2);

m = (P1*V1)/(R*T1);
print 'The Mass in the cylinder: %3.3f kg'%(m);

W = ((P1*V1)-(P2*V2))/(n-1);
print 'The Work Done: %3.3f kJ'%(W);

Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer: %3.3f kJ'%(Q);

# note : rounding off error.
The Pressure at end of Compression: 2657.781 kPa
The Temperature at end of Compression: 664.445 K
The Mass in the cylinder: 0.223 kg
The Work Done: -72.840 kJ
The Heat Transfer: -14.568 kJ

Example 3.34 pg : 49

In [50]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
P1 = 10.;
T1 = 337.+273;
P2 = 1.;
V = 6.;
R = 0.287;
G = 1.4;

# Calculations and Results
x = math.log(P2/P1);
y = math.log(1./V);
n = x/y;
print 'The Value of n: %3.3f '%(n);

V1 = (m*R*T1)/(P1*100);
V2 = V1*6;
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'The Work Done: %3.1f kJ'%(W);

Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer: %3.2f kJ'%(Q);
The Value of n: 1.285 
The Work Done: 245.6 kJ
The Heat Transfer: 70.56 kJ

Example 3.37 pg : 54

In [51]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 430.;
T2 = 289.25;
P2 = 100.;
P1 = 400.;
G = 1.4;
V1 = 0.2;
R = 287.;
Q = 60.;
Cp = 1.005;

# Calculations and Results
T2 = T1*((P2/P1)**((G-1)/G));
V2 = V1*((P1/P2)**(1./G));
m = (P1*1000*V1)/(R*T1);
W1 = (m*(R/1000)*(T1-T2))/(G-1);
T3 = (Q/(m*Cp))+T2;
V3 = (V2*T3)/T2;
W2 = P2*(V3-V2);
W = W1+W2;
print 'The Net Work Done: %3.3f kJ'%(W);

n = ((m*(R/1000)*(T1-T3))/W)+1;
print 'The value of n: %3.2f '%(n);
The Net Work Done: 82.544 kJ
The value of n: 1.11 

Example 3.38 pg : 55

In [52]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg Km = 1;
P1 = 6.;
V1 = 0.01;
V2 = 0.05;
P2 = 2;

# Calculations and Results
W1 = (((P1+P2)/2)*100)*(V2-V1);
print 'The Work done for first cycle: %3.1f kJ'%(W1);

P3 = P2;
V3 = (P1*V1)/P3;
W2 = P2*100*(V3-V2);
print 'The Work done for second cycle: %3.1f kJ'%(W2);

W3 = (P3*100*V3)*(math.log(V1/V3));
print 'The Work done for third cycle: %3.2f kJ'%(W3);

W = W1+W2+W3;
print 'The net Work done: %3.2f kJ'%(W);

Q = W;                #As process is cyclic
print 'The Heat Transfer: %3.2f kJ'%(Q);
The Work done for first cycle: 16.0 kJ
The Work done for second cycle: -4.0 kJ
The Work done for third cycle: -6.59 kJ
The net Work done: 5.41 kJ
The Heat Transfer: 5.41 kJ

Example 3.39 pg : 57

In [53]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.6;
P1 = 1.;
T1 = 90.+273;
V2 = 0.18;
P2 = 5.;
R = 0.287;
G = 1.4;

# Calculations and Results
m = (P1*100*V1)/(R*T1);
print 'The mass of Gas: %3.4f kg'%(m);

n = (math.log(P2/P1))/(math.log(V1/V2));
print 'The value of n: %3.3f '%(n);

Cv = R/(G-1);
T2 = ((P2*V2)/(P1*V1))*T1;
U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %3.3f kJ'%(U);
The mass of Gas: 0.5759 kg
The value of n: 1.337 
The change in Internal Energy: 75.000 kJ

Example 3.40 pg : 58

In [54]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
R = 0.29;
Cp = 1.005;
P1 = 2.75;
P2 = P1;
V1 = 0.09;
T1 = 185+273;
T2 = 15+273;

# Calculations and Results
V2 = (V1*T2)/T1;
m = (P1*100*V1)/(R*T1);
Q = m*Cp*(T2-T1);
print 'The Heat Transfer: %3.3f kJ'%(Q);

W = P1*100*(V2-V1);
print 'The Work done: %3.3f kJ'%(W);
The Heat Transfer: -31.837 kJ
The Work done: -9.187 kJ

Example 3.41 pg : 59

In [55]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 25.+273;
T2 = 145.+273;
m = 2.;
R = 267.;
G = 1.4;

# Calculations and Results
Cv = R/(G-1);
print 'The value of Cv: %3.1f J/kg K'%(Cv);

Cp = G*Cv;
print 'The value of Cp: %3.1f J/kg K'%(Cp);

U = m*Cv*(T2-T1)*(1./1000);
print 'The change in Internal Energy: %3.1f kJ'%(U);

H = m*Cp*(T2-T1)*(1./1000);
print 'The Heat Transfer: %3.1f kJ'%(H);
The value of Cv: 667.5 J/kg K
The value of Cp: 934.5 J/kg K
The change in Internal Energy: 160.2 kJ
The Heat Transfer: 224.3 kJ

Example 3.42 pg : 60

In [56]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
D = 1.;
h = 4.;
P1 = 100.;
T1 = 27.+273;
P2 = 125.;
Cp = 14.307;
Cv = 10.183;

# Calculations
V1 = (22./7)*(1./4)*(D*D*h);
R = Cp-Cv;
m = (P1*V1)/(R*T1);
T2 = (P2*T1)/P1;
Q = m*Cv*(T2-T1);

# Results
print 'The Heat Transfer: %3.0f kJ'%(Q);
The Heat Transfer: 194 kJ

Example 3.43 pg : 61

In [57]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.15;
V2 = 3*V1;
P1 = 900.;
P2 = P1;
T1 = 300.+273;
T3 = T1;
n = 1.5;
G = 1.4;
R = 0.287;
Cp = 1.005;

# Calculations and Results
m = (P1*V1)/(R*T1);
T2 = (T1*V2)/V1;
Q1 = m*Cp*(T2-T1);
W1 = m*R*(T2-T3)/(n-1);
Q2 = (G-n)*W1/(G-1);
P3 = P2*((T3/T2)**(G/(G-1)));
Q3 = m*R*T1*math.log(P3/P1);
H_rec = Q1;
print 'The Heat received: %3.1f kJ'%(H_rec);

H_rej = 0-(Q2+Q3);
print 'The Heat Rejected: %3.1f kJ'%(H_rej);

eff = 100*(1-(H_rej/H_rec));
print 'Efficiency: %3.2f percent'%(eff);
The Heat received: 945.5 kJ
The Heat Rejected: 654.1 kJ
Efficiency: 30.82 percent

Example 3.44 pg : 62

In [58]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg Km = 1;
V1 = 0.15;
P1 = 1.;
V2 = 0.05;
G = 1.4;

# Calculations and Results
P2 = (V1*P1)/V2;
W_it = P1*100*V1*math.log(P1/P2);
print 'Work done in Isothermal process: %2.2f kJ'%(W_it);

P2 = P1*((V1/V2)**G);
W_ad = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work done in Adiabatic process: %2.2f kJ'%(W_ad);
Work done in Isothermal process: -16.48 kJ
Work done in Adiabatic process: -20.69 kJ

Example 3.45 pg : 63

In [59]:
import math 

#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
Cp = 1.005;
P1 = 100.;
T1 = 17.+273;
T2 = T1;
P2 = 2500.;

# Calculations and Results
print 'Final Temperature: %2.2f K'%(T2);


V1 = (260*T1)/(P1*1000);
V2 = (P1*V1)/P2;
print 'Final Volume: %2.5f m**3'%(V2);

n = P2/P1;
print 'Compression ratio: %2.0f '%(n);

H = m*Cp*(T2-T1);
print 'Change in Enthalpy: %2.2f kJ'%(H);

W = P1*V1*math.log(P1/P2);
print 'Work done: %2.2f kJ/kg'%(W);
Final Temperature: 290.00 K
Final Volume: 0.03016 m**3
Compression ratio: 25 
Change in Enthalpy: 0.00 kJ
Work done: -242.70 kJ/kg

Example 3.46 pg: 64

In [60]:
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 150.;
T1 = 17.+273;
P2 = 750.;
n = 1.3;
m = 1.;
R = 0.287;
Cp = 1.001;

# Calculations and Results
T2 = T1*((P2/P1)**((n-1)/n));
print 'The final temperature: %2.1f K'%(T2);

W = m*R*(T1-T2)/(n-1);
print 'Work done: %2.2f kJ/kg'%(W);

Cv = Cp-R;
U = m*Cv*(T2-T1);
print 'Change in internal energy: %2.2f kJ/kg'%(U);

G = Cp/Cv;
Q = ((G-n)/(G-1))*W;
print 'Amount of heat transfer: %2.2f kJ/kg'%(Q);

H = m*Cp*(T2-T1);
print 'Change in enthalpy: %2.2f kJ/kg'%(H);
The final temperature: 420.4 K
Work done: -124.78 kJ/kg
Change in internal energy: 93.13 kJ/kg
Amount of heat transfer: -31.65 kJ/kg
Change in enthalpy: 130.57 kJ/kg