# Variables
Q = -50.; #kJ/kg
W = -100.; #kJ/kg
# Calculations
dU = Q-W;
# Results
print ("gain in internal energy = "),(dU),("kJ/kg")
# Variables
u1 = 450.; #kJ/kg
u2 = 220; #kJ/kg
W = 120; #kJ/kg
# Calculations
Q = (u2-u1) + W;
# Results
print ("Heat rejected by air = "),(-Q),("kJ/kg")
# Variables
m = 0.3; #kg
cv = 0.75; #kJ/kg.K
T1 = 313.; #K
T2 = 433.; #K
W = -30.; #kJ
# Calculations
dU = m*cv*(T2-T1);
Q = dU + W;
# Results
print ("Heat rejected during the process = "),(-Q),("kJ")
# Variables
p1 = 105.; #kPa
V1 = 0.4; #m**3
p2 = p1;
V2 = 0.20; #m**3
Q = -42.5; #kJ
# Calculations
W = p1*(V2-V1);
dU = Q-W;
# Results
print ("change in internal energy = "),(dU),("kJ")
import math
# Variables
p1 = 10.**5 # Pa
T1 = 25 + 273 # K
p2 = 5 * 10**5 # Pa
T2 = T1
# Calculations and Result
print "(i) For isothermal process :"
W12 = -p1 * (1.8)* math.log(p1/p2)
print "Work done on the air = %.3e kJ/kg."%W12
print "(ii) Since temperature is constant,"
print "u2 – u1 = 0"
print "Change in internal energy = zero."
print "(iii) Again,"
Q12 = 0 + W12
print "Heat rejected = %.3e kJ/kg."%Q12
# Variables
W_12 = -82.; #kJ
Q_12 = -45.; #kJ
dU_12 = Q_12 - W_12;
W_21 = 100.; #kJ
dU_21 = -dU_12;
# Calculations
Q_21 = dU_21 + W_21;
# Results
print ("Heat added to the system = "),(Q_21),("kJ")
# Variables
Q2 = 9000.; #kJ
Q1 = 3000.; #kJ
Q = Q1-Q2;
W = 0;
# Calculations
dU = W-Q;
# Results
print ("Work done = "),(W)
print ("Change in internal energy = "),(dU),("kJ")
# Variables
m = 20.; #kg
g = 9.81; #m/s**2
z2 = 0.;
z1 = 15.;
# Calculations and Results
print ("(i) When the stone is about to enter the water")
Q = 0
W = 0
dU = 0
PE = m*g*(z2-z1)
KE = -PE
print "∆ PE = %.3f"%KE,"J"
print ("(ii) When the stone dips into the math.tank and comes to rest")
Q = 0
W = 0
KE = 0
PE = m*g*(z2-z1)
dU = -PE
print "∆U = %.3f"%dU
print ("(iii) When the water and stone come to their initial temperature")
W = 0
KE = 0
Q = -dU
print "Q = %.3f"%Q
# Variables
Q_lqm = 168.; #kJ
W_lqm = 64.; #kJ
dU_lm = Q_lqm - W_lqm;
W_lnm = 21.; #kJ
W_ml = -42.; #kJ
# Calculations and Results
Q_lnm = dU_lm + W_lnm;
print ("(i)Q_lnm = "),(Q_lnm), ("kJ")
Q_ml = W_ml - dU_lm;
print ("(ii)Q_ml = "),(Q_ml),("kJ")
W_ln = 21.; #kJ
dU_ln = 84.; #kJ
Q_ln = dU_ln + W_ln;
Q_nm = Q_lnm-Q_ln;
print ("(iii)Q_nm = "), (Q_nm), ("kJ")
import math
from scipy.integrate import quad
# Variables
T1 = 55.; #0C
T2 = 95.; #0C
# Calculations
def f1( T):
return 200
W = quad(f1, T1, T2)[0]
def f2( T):
return 160
Q = quad(f2, T1, T2)[0]
dU = Q-W;
# Results
print ("change in internal energy = "),(dU/10**3),("kJ")
import math
# Variables
Q = -340.; #kJ
n = 200.; #cycles/min
#For Process 1-2
W_12 = 4340.; #kJ/min
Q_12 = 0.;
# Calculations and Results
dE_12 = Q_12-W_12;
print ("dE_12 = "),(dE_12),("kJ/min")
#For process 2-3
Q_23 = 42000.; #kJ/min
W_23 = 0;
dE_23 = Q_23-W_23;
print ("dE_23 = "),(dE_23),("kJ/min")
#For process 3-4
Q_34 = -4200.; #kJ/min
dE_34 = -73200.; #kJ/min
W_34 = Q_34-dE_34;
print ("W_34 = "), (W_34), ("kJ/min")
#For process 4-1
Q_41 = Q*n-Q_12-Q_23-Q_34;
print ("Q_41 = "), (Q_41), ("kJ/min")
dE_41 = 0-dE_12-dE_23-dE_34;
print ("dE_41 = "), (dE_41), ("kJ/min")
W_41 = Q_41-dE_41;
print ("W_41 = "), (W_41), ("kJ/min")
print "Since sum(Q) = sum(W), "
print "Rate of work output = -68000 KJ/min"
# Variables
P = 1200.; #kW
Qin = 3360.; #kJ/kg
Qout = 2520.; #kJ/kg
F = 6.; #kW
# Calculations
dQ = Qin - Qout;
dW = P-F; #kJ/s
m = dW/dQ;
# Results
print ("Steam flow round the cycle %.3f")%(m), ("kg/s")
# Variables
dT = 25.; #0C
Q = 30.; #kJ
cv = 1.2; #kJ/kg.0C
m = 2.5; #kg
# Calculations
dU = m*cv*dT;
# Results
print ("change in internal energy = "),(dU), ("kJ")
W = Q - dU;
print ("Work done = "),(W),("kJ")
# Variables
Q = 50.; #kJ
dV = 0.14; #m**3
p = 1.2*10**5; #N/m**2
m = 90.; #kg
d = 5.5; #m
g = 9.8; #m/s**2
W_adb = -110.; #kJ
Wnet = m*g*d/1000; #kJ
# Calculations and Results
W = p*dV/1000 + Wnet; #kJ
dE = Q-W;
print ("(i)Change in internal energy %.3f kJ")%(dE)
Q = 0;
dE = -W_adb;
print ("(ii) Adiabatic process %.3f kJ")%(dE)
Q = 50.; #kJ
dE = Q - (W_adb+W);
print ("(iii)Change in internal energy %.3f kJ")%(dE)
import math
from scipy.integrate import quad
# Variables
V1 = 0.15; #m**3
V2 = 0.05; #m**3
Q = -45.; #kJ
p1 = (5./V1+1.5)*10**5; #N/m**2
p2 = (5./V2+1.5)*10**5; #N/m**2
# Calculations
def f0( V):
return (5/V+1.5)*10**2
W = quad(f0, V1, V2)[0]
dU = Q-W;
print ("(i)Change in internal energy = %.3f kJ")%(dU)
dH = (dU*10**3+(p2*V2-p1*V1))/10**3;
print ("(ii) Change in enthalpy = %.3f kJ")%(dH)
# Variables
V1 = 0.25; #m**3
p1 = 500.; #kPa
p2 = 100.; #kPa
# Calculations and Results
V2 = V1*(p1/p2)**(1/1.25)
n = 1.25
dU = 3.64*(p2*V2 - p1*V1)
print ("(i) If the expansion is quasi-static")
W = (p1*V1-p2*V2)/(n-1);
Q = dU+W
print ("Heat transfered = %.3f")%(Q),("kJ")
print ("(ii) In another process")
Q = 32; #kJ
W = Q-dU;
print ("Work done = %.3f")%(W),("kJ")
print ("(iii)The difference")
print (" The work in (ii) is not equal to ∫ p dV math.since the process is not quasi-static.")
import math
from scipy.integrate import quad
# Variables
v1 = 0.3; #m**3/kg
T1 = 20.; #0C
v2 = 0.55; #m**3/kg
T2 = 260; #0C
p = 1.6*10**5; #Pa
print ("(i)Heat added per kg = ")
# Calculations and Results
def f5( T):
return 1.5 + 75/(T+45)
Q = quad(f5, T1,T2)[0]
print ("Q = %.3f")%(Q), ("kJ/kg")
print ("(ii)The work done per kg of fluid")
W = p*(v2-v1)/1000; #kJ/kg
print ("W = %.3f")%(W),("kJ/kg")
print ("(iii)Change in internal energy")
dU = Q-W;
print ("dU = %.3f")%(dU),("kJ/kg")
print ("(iv)Change in enthalpy")
dH = Q;
print ("dH = %.3f")%(dH),("kJ/kg")
# Variables
m = 1.; #kg
du = -42000.; #J
cp = 840.; #J/kg.0C
cv = 600.; #J/kg.0C
# Calculations
dT = du/m/cv;
Q = m*cp*dT;
W = (Q-du)/10**3;
# Results
print ("Work done = "),(W),("kJ")
from numpy import *
from scipy.integrate import quad
# Variables
p1 = 190.; #kPa
V1 = 0.035; #m**3
p2 = 420.; #kPa
V2 = 0.07; #m**3
dU = 3.6*(p2*V2-p1*V1);
p = [[1,0.035],[1,0.07]]
q = [190,420];
#X = linalg.inv(p)*q;
X = linalg.solve(p,q)
a = X[0]
b = X[1]
# Calculations
def f4( V):
return a+b*V
W = quad(f4, V1, V2)[0]
# Results
print ("Work done by the system = "),(W),("kJ")
Q = dU+W;
print ("Heat transfer into the system = "),(Q),("kJ")
# Variables
Qv = 90.; #kJ
Qp = -95; #kJ
W = -18; #kJ
U_l = 105; #kJ
W_lm = 0;
Q_lm = 90;
# Calculations
U_m = U_l+90;
dU_mn = Qp-W;
U_n = U_m+dU_mn;
dQ = Qv+Qp;
dW = dQ;
W_nl = dW-W;
# Results
print ("W_nl(in kJ) = "),(W_nl)
print ("U_l in kJ = "),(U_l)
print ("U_m in kJ = "),(U_m)
print ("U_n in kJ"), (U_n)
# Variables
V1 = 0.2; #m**3
p1 = 4.*10**5; #N/m**2
T1 = 403.; #K
p2 = 1.02*10**5; #N/m**2
dH = 72.5; #kJ
Q_23 = dH;
cp = 1.; #kJ/kg
cv = 0.714; #kJ/kg
y = 1.4;
# Calculations
V2 = round(V1*(p1/p2)**(1/y),2);
T2 = round(T1*((p2/p1)**((y-1)/y)),1);
R = (cp-cv)*1000; #J/kg.K
m = round(p1*V1/R/T1,3);
T3 = round(Q_23/(m*cp) +T2);
V3 = 0.732 # round(V2*T3/T2,2);
W_12 = (p1*V1 - p2*V2)/(y-1);
W_23 = p2*(V3-V2);
W_123 = W_12+W_23;
# Results
print ("Total work done = %.3f")%(W_123),("J")
print ("(ii) Index of expansion, n")
p3 = p2;
n = (p1*V1-p3*V3)/W_123 + 1;
print ("value of index = %.3f")%(n)
# Variables
d = 0.15; #m
T = 303.; #K
p = 3.*10**5; #N/m**2
l = 0.085; #m
Q = -4000.; #J
# Calculations and Results
print ("(i) Workdone by the system")
dv = math.pi/4*d**2*l;
W = p*dv;
print ("W = %.3f")%(W/10**3),("kJ")
print ("(ii) Decrease in internal energy of the system")
dU = (Q-W)/10**3;
print ("Decrease in internal energy = %.3f")%(-dU),("kJ")
import math
# Variables
y = 1.4
R = 294.2; #J/kg.0C
p1 = 1.*10**5; #N/m**2
T1 = 353.; #K
V1 = 0.45; #m**3
V2 = 0.13; #m**3
p2 = 5.*10**5; #N/m**2
# Calculations and Results
cv = R/(y-1);
print ("(i) The mass of gas")
m = p1*V1/R/T1;
print ("m = %.3f")%(m),("kg")
print ("(ii) The value of index ‘n’ for compression")
n = math.log(p2/p1)/math.log(V1/V2);
print ("n = %.3f")%(n)
print ("(iii) The increase in internal energy of the gas")
T2 = T1*(V1/V2)**(n-1);
dU = m*cv*(T2-T1)/10**3;
print ("dU = %.3f")%(dU),("kJ")
print ("(iv) The heat received or rejected by the gas during compression.")
W = m*R*(T1-T2)/(n-1)/10**3;
Q = dU+W;
print ("Q = %.3f")%(Q),("kJ")
# Variables
p1 = 1.02*10**5; #Pa
T1 = 295.; #K
V1 = 0.015; #m**3
p2 = 6.8*10**5; #Pa
y = 1.4;
# Calculations and Results
print ("(i) Final temperature")
T2 = T1*(p2/p1)**((y-1)/y);
t2 = T2-273;
print ("t2 = %.3f")%(t2),("°C")
print ("(ii) Final volume :")
V2 = V1*(p1/p2)**(1/y);
print ("V2 = %.3f")%(V2),("m**3")
print ("(iii)Work done")
R = 287;
m = p1*V1/R/T1;
W = m*R*(T1-T2)/(y-1)/10**3;
print ("W = %.3f")%(W),("kJ")
from numpy import *
import math
# Variables
m = 0.44; #kg
T1 = 453.; #K
ratio = 3.; #ratio = V2/V1
T2 = 288.; #K
W_12 = 52.5; #kJ
# Calculations
y = math.log(T2/T1)/ math.log(1/ratio) + 1;
R = W_12*(y-1)/m/(T1-T2);
M = [[1,-1],[1,-y]];
N = [R,0];
X = linalg.inv(M)*N;
cp = X[0][0];
cv = X[1][0];
# Results
print ("cp = %.3f")%(cp),("kJ/kg.K")
print ("cv = %.3f")%(cv),("kJ/kg.K")
# Variables
n = 1.3;
m = 1; #kg
p1 = 1.1; #bar
T1 = 300.; #K
p2 = 6.6; #bar
R0 = 8314.;
M = 30.;
cp = 1.75; #kJ/kg.K
# Calculations
R = R0/M/1000; #kJ/kg.K
cv = cp - R;
y = cp/cv;
T2 = T1 *(p2/p1)**((n-1)/n);
W = R*(T1-T2)/(n-1);
Q = ((y-n)/(y-1))*W;
# Results
print ("Heat supplied = %.3f")%(Q),("kJ/kg")
import math
# Variables
cp = 14.3; #kJ/kg.K
cv = 10.2; #kJ/kg.K
V1 = 0.1; #m**3
T1 = 300.; #K
p1 = 1.; #bar
p2 = 8.; #bar
y = cp/cv;
R = cp-cv;
V2 = V1*(p1/p2)**(1/y);
V3 = V2;
T2 = T1*(p2/p1)**((y-1)/y);
p3 = p1*V1/V3;
T3 = 300.; #K
# Calculations and Results
print ("(i) Pressure at the end of consmath.tant volume cooling = %.3f")%(p3),("bar")
print ("(ii) Change in internal energy during consmath.tant volume process")
m = p1*V1/R/T1*10**2; #kg
dU_23 = m*cv*(T3-T2);
print ("dU_23 = %.3f")%(dU_23),("kJ")
print ("(iii) Net work done and heat transferred during the cycle")
W_12 = m*R*(T1-T2)/(y-1);
W_23 = 0;
W_31 = p3*V3*math.log(V1/V3)*10**2; #kJ
Wnet = W_12+W_23+W_31;
print ("Net work done = %.3f")%(Wnet),("kJ")
Qnet = Wnet;
print ("Heat transferred during the complete cycle = %.3f")%(Qnet),("kJ")
import math
# Variables
V1 = 0.15; #m**3
p1 = 15.; #bar
T1 = 550.; #K
T2 = T1;
r = 4.; #r = V2/V1
V2 = r*V1;
T3 = 290.; #K
# Calculations
p2 = p1*V1/V2;
W_12 = p1*V1*math.log(V2/V1)*10**2; #kJ
V3 = V2;
p3 = p2*T3/T2;
W_23 = 0;
n = math.log(p1/p3)/math.log(V3/V1);
W_31 = (p3*V3-p1*V1)/(n-1)*10**2; #kJ
# Results
Wnet = W_12+W_23+W_31
print ("net work done = %.3f")%Wnet , ("kJ")
Qnet = Wnet;
print ("Heat transferred during the cycle = %.3f")%(Qnet),("kJ")
%matplotlib inline
import math
from scipy.integrate import quad
from matplotlib.pyplot import *
from numpy import *
# Variables
m = 1; #kg
p1 = 5; #bar
V1 = 0.02; #m**3
V2 = 0.08; #m**3
p2 = 1.5; #bar
# Calculations and Results
def f(V):
return a+b*V;
A = [[1,0.02],[1,0.08]]
B = [5,1.5];
#X = linalg.inv(A)*B;
X = linalg.solve(A,B)
a = X[0]
b = X[1]
print ("(i) p-V diagram")
V = linspace(0.02,0.08,80);
p = a+b*V;
plot(V,p,'b')
V = [0.0667 ,0.08];
p = [1.5 ,1.5];
plot(V,p,'g')
V = linspace(0.02,0.0667,447)
def fa(V):
return 0.1/V;
f = fa(V)
plot(V,f,'r')
suptitle("p-V diagram")
V = [0.0667, 0.0667];
p = [1.5, 0];
plot(V,p,'--')
xlabel("V(m)**3")
ylabel("P(bar)")
text(.04,4,'Reversible Expansion')
text(0.04,2.3,"pV = C")
text(0.07,1.2,"p = C")
print ("(ii) Work done and heat transfer")
def f7(V):
return (a+b*V)*10**2
W_12 = quad(f7,V1,V2)[0]
print ("Work done by the system = "),(W_12), ("kJ")
p3 = p2;
V3 = round(p1*V1/p3,4);
W_23 = p2*(V3-V2)*10**2; #kJ
W_31 = round(p3*V3*math.log(V1/V3)*10**2,2); #kJ
print ("Work done on the system = %.3f")% (W_31), ("kJ")
W_net = W_12+W_23+W_31;
print ("Net work done = %.3f")% (W_net), ("kJ")
Q_net = W_net;
print ("Heat transferred during the complete cycle = %.3f")% (Q_net),("kJ")
import math
from scipy.integrate import quad
# Variables
cv = 0.71; #kJ/kg.K
R = 0.287; #kJ/kg.K
d = 8.; #cm
l = 3.5; #cm
S = 150.; #N/cm
p1 = 30.; #N/cm
V1 = 45.; #cm**3
T1 = 293.; #K
cv = 0.71; #kJ/kg.K
R = 0.287; #kJ/kg.K
# Calculations
A = math.pi/4*d**2;
C = p1-S/A**2*V1;
dV = l*A;
V2 = V1+dV;
p2 = S/A**2*V2 + C;
def f3( p):
return A**2/S*p/100
W = quad(f3, p1, p2)[0]
T2 = p2*V2*T1/p1/V1;
m = p1*V1/R/T1/10**5; #kg
dU = m*cv*(T2-T1);
Q_12 = dU + W*10**(-3);
# Results
print ("Amount of heat added to the system = %.3f")% (Q_12), ("kJ")
# Variables
r = 10.; #kg/min
p1 = 1.5*10**5; #N/m**2
rho1 = 26.; #kg/m**3
C1 = 110.; #m/s
u1 = 910.; #kJ/kg
p2 = 5.5*10**5; #N/m**2
rho2 = 5.5; #kg/m**3
C2 = 190.; #m/s
u2 = 710.; #kJ/kg
Q = 55.; #kJ/s
h = 55.; #m
g = 9.81; #m/s**2
v2 = 1/rho2;
v1 = 1/rho1;
# Calculations and Results
dh = u2-u1+ (p2*v2-p1*v1)/10**3;
print ("(i) Change in enthalpy %.3f")%(dh), ("kJ/kg")
print ("(ii) Work done during the process (W).")
Q = 330.; #kJ/kg
KE = (C2**2-C1**2)/2/10**3; #kJ
PE = g*h/10**3; #kJ
W = -Q-KE-PE-dh;
print ("Work done = %.3f")%(W),("kJ")
P = W*10/60.;
print ("Work done per second = %.3f")%(P),("kW")
# Variables
import math
m = 15.; #kg/s
v = 0.45; #m**3/kg
P = 12000.; #kW
W = P/m; #kJ/kg
h1 = 1260.; #kJ/kg
h2 = 400.; #kJ/kg
C1 = 50.; #m/s
C2 = 110.; #m/s
# Calculations and Results
print ("(i) Heat rejected = "),
Q = h2-h1+(C2**2-C1**2)/2/10**3 +W;
Qnet = m*Q;
print ("Qnet = %.3f")%(-Qnet),("kW")
print ("(ii) Inlet area")
A = v*m/C1;
print ("A = %.3f")%(A),("m**2")
# Variables
m = 0.5; #kg/s
C1 = 6.; #m/s
C2 = 5.; #m/s
p1 = 1.; #bar
p2 = 7.; #bar
v1 = 0.85; #m**3/kg
v2 = 0.16; #m**3/kg
du = 90.; #kJ/kg
Q = -120.; #kJ/kg
# Calculations and Results
print ("(i) Power required to drive the compressor")
W = -du+(C1**2-C2**2)/2/1000 + (p1*v1 - p2*v2)*10**2 + Q;
Power = m*W;
print ("Power = %.3f")%(-Power),("kW")
print ("(ii) Inlet and outlet pipe cross-sectional areas")
A1 = m*v1/C1;
A2 = m*v2/C2;
print ("Inlet crosssectional area = %.3f")% (A1), ("m**2")
print ("Outlet crossectional area = %.3f")%(A2), ("m**2")
# Variables
h1 = 800.; #kJ/kg
C1 = 5.; #m/s
h2 = 2520.; #kJ/kg
C2 = 50.; #m/s
dZ = 4.; #m
g = 9.81; #m/s**2
Q = 2180.; #kJ/kg
# Calculations
W = h1-h2+(C1**2 - C2**2)/2/1000 +dZ*g/1000+Q;
# Results
print ("Power developed = %.3f")%(W), ("kW")
# Variables
g = 9.8; #m/s**2
m = 4500./3600; #kg/s
C1 = 2800./60; #m/s
Z1 = 5.5; #m
h1 = 2800.; #kJ/g
C2 = 5600./60; #m/s
Z2 = 1.5; #m
h2 = 2300.; #kJ/kg
Q = -16000./3600; #kJ/s
# Calculations
W = Q-m*((h1-h2) + (C2**2 - C1**2)/2/1000 + (Z2-Z1)*g/1000);
# Results
print ("Power output of the turbine = %.3f")% (-W),("kW")
# Variables
p1 = 6.87; #bar
C1 = 50.; #m/s
p2 = 1.37; #bar
C2 = 500.; #m/s
print ("From steam table corresponding to p1")
h1 = 2850.; #kJ/kg
# Calculations
h2 = h1 - (C2**2-C1**2)/2/1000;
# Results
print ("Final enthalpy of steam = "), (h2),("kJ")
# Variables
m = 220./60; #kg/s
C1 = 320.; #m/s
p1 = 6*10.**5; #N/m**2
u1 = 2000.*10**3; #J/kg
v1 = 0.36; #m**3/kg
C2 = 140.; #m/s
p2 = 1.2*10**5; #N/m**2
u2 = 1400.*10**3; #J/kg
v2 = 1.3; #m**3/kg
Q = 100*10.**3; #J/s
# Calculations
W = (m*((u1-u2)+ (p1*v1 - p2*v2) + (C1**2-C2**2)/2) -Q)/10**6;
# Results
print ("power capacity of the system = %.3f")% (W),("MW")
# Variables
p1 = 7.5*10**5; #N/m**2
C1 = 140.; #m/s
h1 = 950.*10**3; #J/kg
p2 = 2*10.**5; #N/m**2
C2 = 280.; #m/s
h2 = 650.*10**3; #J/kg
m = 5.; #kg/s
# Calculations
W = (h1-h2)+(C1**2-C2**2)/2
Power = m*W/1000;
# Results
print ("Power capacity of turbine = "), (Power), ("kW")
# Variables
C1 = 12.; #m/s
p1 = 1.*10**5; #N/m**2
v1 = 0.5; #m**3/kg
C2 = 90.; #m/s
p2 = 8.*10**5; #N/m**2
v2 = 0.14; #m**3/kg
dh = 150.; #kJ/kg
Q = -11.67; #kJ/s
m = 0.2; #kg/s
# Calculations and Results
print ("(i) Motor power required to drive the compressor")
W = m*(-dh + (C1**2-C2**2)/2/1000) +Q;
print ("Power = %.3f")% (-W), ("kW")
print ("(ii)Ratio of inlet to outlet pipi diameter")
ratio = math.sqrt(C2/C1*v1/v2);
print ("ratio = %.3f")% (ratio)
# Variables
W = -175.; #kJ/kg
dh = 70.; #kJ/kg
Q_water = -92.; #kJ/kg
# Calculations
Q = dh+W;
Q_atm = Q-Q_water;
# Results
print ("Heat transferred to the atmosphere = "),(-Q_atm), ("kJ/kg")
import math
# Variables
h1 = 2800.*10**3; #J/kg
C1 = 50.; #m/s
A1 = 900.*10**(-4); #m**2
v1 = 0.187; #m**3/kg
h2 = 2600.*10**3; #J/kg
v2 = 0.498; #m**3/kJ
# Calculations and Results
print ("(i) Velocity at exit of the nozzle")
C2 = math.sqrt(2*((h1-h2) + C1**2/2));
print ("C2 = %.3f")% (C2),("m/s")
print ("(ii) Mass flow rate")
m = A1*C1/v1;
print ("m = %.3f")% (m), ("kg/s")
print ("(iii) Area at the exit")
A2 = m*v2/C2*10**4;
print ("A2 = %.3f")%(A2), ("cm**2")
# Variables
h1 = 240.; #kJ/kg
h2 = 192.; #kJ/kg
dZ = 20.; #m
g = 9.81; #m/s**2
# Calculations
Q = (h2-h1)+dZ*g/1000;
# Results
print ("heat transfer = %.3f")% (-Q), ("kJ/kg")
import math
# Variables
p1 = 2.; #bar
C1 = 300.; #m/s
Q = 0.;
h1 = 915.*10**3; #J/kg
h2 = 800.*10**3; #J/kg
# Calculations
C2 = math.sqrt(2*(h1-h2 + C1**2/2));
# Results
print ("Relative velocity of gas leaving the pipe = %.3f")% (C2), ("m/s")
import math
# Variables
mw = 50; #kg/s
p1 = 10.**5; #N/m**2
p2 = 4.2*10**5; #N/m**2
h = 10.7; #m
d1 = 0.2; #m
d2 = 0.1; #m
v1 = 1./1000;
v2 = 1./1000;
g = 9.81; #m/s**2
# Calculations
C1 = mw*4/math.pi/d1**2*v1;
C2 = mw*4/math.pi/d2**2*v2;
W = mw*((p1*v1-p2*v2) + (g*(0-h))+(C1**2-C2**2)/2)/10**3;
# Results
print ("Capacity of electric motor %.3f")%(-W), ("kW")
import math
# Variables
Ca = 250.; #m/s
t = -14.; #0C
ha = 250.; #kJ/kg
hg = 900.; #kJ/kg
ratio = 0.0180;
Ef = 45.*10**3; #kJ/kg
Q = -21.; #kJ/kg
ma = 1.; #kg
mg = 1.018; #kg
mf = 0.018; #kg
#Calculations
Eg = 0.06*mf/mg*Ef;
Cg = math.sqrt(2000*((ma*(ha+Ca**2/2/1000) + mf*Ef + Q)/mg -hg-Eg));
# Results
print ("velocity of exhaust gas jet = %.3f")%(Cg),("m/s")
# Variables
t1 = 20.; #0C
C1 = 40.; #m/s
t2 = 820.; #0C
C2 = 40.; #m/s
t3 = 620.; #0C
C3 = 55.; #m/s
t4 = 510.; #0C
m = 2.5; #kg/s
cp = 1.005; #kJ/kg.0C
# Calculations and Results
print ("(i) Heat exchanger")
Q_12 = m*cp*(t2-t1);
print ("rate of heat transfer = "),(Q_12), ("kJ/s")
print ("(ii) Turbine")
W_23 = m*((cp*(t2-t3))+(C2**2-C3**2)/2/1000);
print ("Power output of turbine = %.3f")%(W_23), ("kW")
print ("(iii) Nozzle")
C4 = math.sqrt(2*1000*(cp*(t3-t4)+C3**2/2/1000));
print ("Velocity at exit from the nozzle = %.3f")%(C4), ("m/s")
# Variables
V = 0.028; #m**3
p1 = 80.; #bar
t = 350.; #0C
p2 = 50.; #bar
v1 = 0.02995; #m**3/kg
h1 = 2987.3; #kJ/kg
v2 = 0.02995; #m**3/kg
vg2 = 0.0394; #m**3/kg
uf2 = 1149.; #kJ/kg
ug2 = 2597.; #kJ/kg
# Calculations and Results
m = V/v1;
u1 = h1 - (p1*v1*10**2); #kJ/kg
print ("(i) State of steam after cooling")
x2 = v2/vg2;
print ("dryness fraction = %.3f")%(x2)
print ("(ii) Heat rejected by the steam")
u2 = (1-x2)*uf2 + x2*ug2;
Q = m*(u2-u1);
print ("Heat rejected = %.3f")% (-Q), ("kJ")
# Variables
m = 0.08; #kg
p = 2.*10**5; #Pa
V = 0.10528; #m**3
h1 = 2706.3; #kJ/kg
h2 = 3071.8; #kJ/kg
v1 = 0.885; #m**3/kg
# Calculations and Results
v2 = V/m; #m**3/kg
print ("(i) Heat supplied")
Q = m*(h2-h1);
print ("Q = "),(Q), ("kJ")
W = p*(v2-v1);
W_total = m*W/10**3;
print ("(ii)Total work done = "), (W_total), ("kJ")
from numpy import *
from matplotlib.pyplot import *
# Variables
m = 1.; #kg
p = 8.; #bar
s1 = 6.55; #kJ/kg.K
T = 200.; #0C
s_f1 = 2.0457; #kJ/kg.K
s_fg1 = 4.6139; #kJ/kg.K
h_f1 = 720.9; #kJ/kg
h_fg1 = 2046.5; #kJ/kg
h2 = 2839.3; #kJ/kg
# Calculations and Results
x1 = (s1-s_f1)/s_fg1;
h1 = h_f1+x1*h_fg1;
Q = h2-h1;
print ("Heat supplied = %.3f")%(Q), ("kJ/kg")
# For T-s diagram
s = linspace(0,.10,10);
T = (-(s-5)**2+298);
plot(s,T)
T = [295.44 ,295.44];
s = [6.6 ,3.45];
plot(s,T,'g')
s = [6.6 ,7];
T = [295.44, 300];
plot(s,T,'g')
s = [6.55 ,6.55];
T = [270 ,295.44];
plot(s,T,'r')
s = [6.6, 6.6];
T = [270 ,295.44];
plot(s,T,'--r')
s = [6.66, 6.66];
T = [270, 295.44];
plot(s,T,'r')
#The area in red represents the heat flow and it goes upto x-axis
# Variables
p1 = 7.*10**5; #Pa
p2 = 1.5*10**5; #Pa
Q = 420.; #kJ/kg
uf = 696.; #kJ/kg
x = 0.95;
ug = 2573.; #kJ/kg
u_f2 = 2580.; #kJ/kg
u_g2 = 2856.; #kJ/kg
x2 = 15./50;
h_f1 = 697.1; #kJ/kg
h_fg1 = 2064.9; #kJ.kg
h_f2 = 2772.6; #kJ/kg
h_g2 = 2872.9; #kJ/kg
# Calculations and Results
print ("(i) Change of internal energy")
u1 = (1-x)*uf + x*ug;
u2 = 2602.8; #kJ/kg
du = u2-u1;
print ("du = "),(du), ("kJ/kg")
print ("(ii) Change in enthalpy")
h1 = h_f1+x*h_fg1;
h2 = h_f2+x2*(h_g2-h_f2);
dh = h2-h1;
print ("dh = "), (dh), ("kJ/kg")
print ("(iii) Work done ")
W = Q-du;
print ("W = "), (W), ("kJ/kg")
import math
from scipy.integrate import quad
p1 = 5.5*10**5; #Pa
x1 = 1.;
p2 = 0.75*10**5; #Pa
v1 = 0.3427; #m**3/kg
v2 = p1*v1/p2;
# Since v2 > vg (at 0.75 bar), therefore, the steam is superheated at state 2.
u2 = 2567.25; #kJ/kg
u1 = 2565.; #kJ/kg
# Calculations and Results
du = u2-u1; #kJ/kg
C = p1*v1;
print ("Work done "),
def f6( v):
return C/v
W = quad(f6, v1,v2)[0]
print ("W ="),(W), ("N-m/kg")
Q = du+W/10**3;
print ("Heat supplied = %.3f")%(Q),("kJ/kg")
# Variables
p1 = 100.; #bar
p2 = 10.; #bar
s1 = 5.619; #kJ/kg.K
T = 584.; #K
s2 = 7.163; #kJ/kg.K
u1 = 2545.; #kJ/kg
u2 = 2811.8; #kJ/kg
# Calculations and Results
print ("(i)Heat supplied ")
Q = T*(s2-s1);
print ("Q = "),(Q),("kJ/kg")
print ("(ii) Work done")
W = Q-(u2-u1);
print ("W = "), (W), ("kJ/kg")
# Variables
m = 1.; #kg
p1 = 120.*10**5; #N/m**2
t1 = 400.; #0C
p2 = 38.; #bar
h1 = 3051.3; #kJ/kg
v1 = 0.02108; #m**3/kg
# Calculations
u1 = h1-p1*v1/10**3; #kJ/kg
u2 = 2602; #kJ/kg
# Results
W = u1-u2;
print ("Work done = %.3f")%(W),("kJ/kg")
# Variables
p1 = 7.*10**5; #N/m**2
x1 = 0.98;
p2 = 0.34*10**5; #N/m**2
vg = 0.273; #m**3/kg
n = 1.1;
v_g2 = 4.65; #m**3/kg
u_f1 = 696.; #kJ/kg
u_g1 = 2573.; #kJ/kg
u_f2 = 302.; #kJ/kg
u_g2 = 2472.; #kJ/kg
# Calculations and Results
v1 = x1*vg;
v2 = v1*(p1/p2)**(1/n);
x2 = v2/v_g2;
print ("(i) Work done by the steam during the process")
W = (p1*v1-p2*v2)/(n-1)/10**3; #kJ/kg
print ("W = %.3f")%(W), ("kJ/kg")
print ("(ii) Heat transferred")
u1 = (1-x1)*u_f1+x1*u_g1;
u2 = (1-x2)*u_f2+x2*u_g2;
Q = u2-u1 + W;
print ("Q = %.3f")%(Q), ("kJ/kg")
# Variables
p1 = 15.; #bar
t1 = 350.; #0C
C1 = 60.; #m/s
p2 = 1.2; #bar
C2 = 180.; #m/s
s1 = 7.102; #kJ/kg
s_f2 = 1.3609; #kJ/kg
s_g2 = 7.2884; #kJ/kg
h_f2 = 439.4; #kJ/kg
h_fg2 = 2241.1; #kJ/kg
h1 = 3147.5; #kJ/kg
# Calculations
x2 = (s1 - s_f2)/(s_g2-s_f2);
h2 = h_f2+x2*h_fg2;
W = (h1-h2) + (C1**2 - C2**2)/2/1000;
# Results
print ("Work done = %.3f")%(W),("kJ/kg")
# Variables
p1 = 10.; #bar
t1 = 200.; #0C
C1 = 60.; #m/s**2
c2 = 650.; #m/s
p2 = 1.5; #bar
h1 = 2827.9; #kJ/kg
h_f2 = 467.1; #kJ/kg
h2 = 2618.45; #kJ/kg
h_g2 = 2693.4; #kJ/kg
# Calculations
x2 = (h2-h_f2)/(h_g2-h_f2);
# Results
print ("quality of steam leaving the nozzle = %.3f")%(x2)
# Variables
h1 = 2776.4; #kJ/kg
h2 = h1;
h_f1 = 884.6; #kJ/kg
h_fg1 = 1910.3; #kJ/kg
# Calculations
x1 = (h1-h_f1)/h_fg1;
# Results
print ("Initial dryness fraction = %.3f")%(x1)
# Variables
p1 = 10.; #bar
x1 = 0.9; #bar
p2 = 2.; #bar
# Calculations
# Umath.sing Mollier chart, we get
x2 = 0.94;
# Results
print ("x2 = "),(x2)
import math
print ("(a)From steam tables")
# Variables
p1 = 15*10**5; #Pa
p2 = 7.5*10**5; #Pa
h_f1 = 844.7; #kJ/kg
ts1 = 198.3; #0C
s_f1 = 2.3145; #kJ/kg.K
s_g1 = 6.4406; #kJ/kg.K
v_g1 = 0.132; #m**3/kg
h_fg1 = 1945.2; #kJ/kg
x1 = 0.95;
h_f2 = 709.3; #kJ/kg
h_fg2 = 2055.55; #kJ/kg
s_f2 = 2.0195; #kJ/kg
s_g2 = 6.6816; #kJ/kg.K
v_g2 = 0.255; #m**3/kg
x2 = 0.9;
x3 = 1;
s_f3 = 0.521; #kJ/kg K
s_g3 = 8.330; #kJ/kg K
# Calculations
h2 = h_f2+x2*h_fg2;
h1 = h_f1 + x1*h_fg1;
s1 = s_f1 + x1*(s_g1-s_f1);
s2 = s1;
ds_12 = s2-s1;
s3 = s_f3+x3*(s_g3-s_f3);
ds_23 = s3-s2;
ds = 709.3 + 0.9 * 2055.55
# Results
print ("(i) Change in entropy = %.3f")% (ds), ("kJ/kg K")
h3 = h2;
dh = h2-h1;
print ("(ii) Change in enthalpy %.2f")%(dh), ("kJ/kg")
print ("(iii) Change in internal energy"),
u1 = h1-p1*x1*v_g1/10**3;
u2 = h2-p2*x2*v_g2/10**3;
du = u2-u1;
print ("du = %.3f")% (du), ("kJ/kg")
# Only the expansion of steam from point 1 to 2 (i.e., isentropic expansion) is reversible because of unresisted flow whereas the expansion from point 2 to point 3 (i.e., throttling expansion) is irreversible because of frictional resismath.tance to flow. Increase of entropy also shows that expansion from point 2 to point 3 is irreversible.
print ("(b) Using Mollier chart")
h1 = 2692; #kJ/kg
h2 = 2560; #kJ/kg
s1 = 6.23; #kJ/kg K
s2 = s1;
s3 = 8.3; #kJ/kg K
ds = s3-s1;
print ("(i) Change in entropy = %.3f")%(ds), ("kJ/kg K")
dh = h2-h1;
print ("(ii) Change in enthalpy = %.3f")%(dh),("kJ/kg")
u3=u2-u1
print ("(iii) Change in internal energy =%.3f")%(u3),("kJ/kg")
# Variables
V1 = 5.5; #m**3
p1 = 16.*10**5; #Pa
T1 = 315.; #K
V2 = V1;
p2 = 12.*10**5; #Pa
R = 0.287*10**3;
y = 1.4;
# Calculations
m1 = p1*V1/R/T1;
T2 = T1*(p2/p1)**((y-1)/y);
m2 = p2*V2/R/T2;
# Results
m = m1-m2;
print ("Mass of air which left the receiver = %.3f")% (m), ("kg")
# Note : Rounding error is there.
# Variables
cp = 1.; #kJ/kg.K
cv = 0.711; #kJ/kg.K
V1 = 1.6; #m**3
V2 = V1;
p1 = 5.*10**5; #Pa
T1 = 373.; #K
p2 = 1.*10**5; #Pa
R = 287.;
y = 1.4;
# Calculations
m1 = round(p1*V1/R/T1,2);
T2 = round(T1*(p2/p1)**((y-1)/y),2);
m2 = round(p2*V2/R/T2,3);
KE = (m1*cv*T1)-(m2*cv*T2)-(m1-m2)*cp*T2;
# Results
print "Kinetic energy of discharge air = %.3f"% (KE), ("kJ")
print ("This is the exact answer when using proper value of cv")
# Book answer is wrong.
#For oxygen
import math
# Variables
cpa = 0.88; #kJ/kg K
Ra = 0.24; #kJ/kg K
V1a = 0.035; #m**3
p1a = 4.5; #bar
T1a = 333.; #K
V2a = 0.07; #m**3
#For methane
V1b = 0.07; #m**3
V2b = 0.035; #m**3
p1b = 4.5; #bar
T1b = 261; #K
cpb = 1.92; #kJ/kg K
Rb = 0.496; #kJ/kg K
# Calculations and Results
yb = cpb/(cpb-Rb); #for methane
cva = cpa-Ra; #for oxygen
print ("(i) Final state condition")
p2b = p1b*(V1b/V2b)**yb;
print ("p2 for methane = %.3f")% (p2b), ("bar")
T2b = p2b*V2b*T1b/p1b/V1b;
print ("T2 for methane = %.3f")% (T2b), ("K")
p2a = p2b;
T2a = p2a*V2a/p1a/V1a*T1a;
print ("T2 for oxygen = %.3f")% (T2a), ("K")
Wb = (p1b*V1b - p2b*V2b)/(yb-1)*100; #kJ
print ("(ii)The piston will be in virtual equilibrium and hence zero work is effected by the piston.")
Wa = -Wb;
ma = p1a*V1a/Ra/T1a*10**2;
Q = ma*cva*(T2a-T1a) + Wa;
print "(iii) Heat transferred to oxygen = %.3f"% (Q), ("kJ")
# Rouding error is there.