import math
z1 = 10. #[m]
z2 = 0. #[m],Taking ground as state 2,reference
v1 = 0.
g = 9.81 #m/s
#From conservation of total energy we get
# (1/2*m*v2**2-1 / 2*m*v1**2)+(m*g*z2 - m*g*z1) = 0
# 1/2*m*v2**2 - m*g*z1 = 0
v2 = math.sqrt(2 * g * z1) ; #[m/s]
# Results
print 'Final velocity = %.f m/s'%(v2);
# Variables
V2 = 14. # [m/s]
u_cap_l1 = 104.86 ; #[kJ/kg],at 25*C internal energy of saturated water
u_cap_l_t25 = 104.86 ; #[kJ/kg], From steam table
u_cap_l_t30 = 125.77 ; #[kJ/kg], From steam table
T1 = 25. #[*C]
T2 = 30. #[*C]
# Calculations
#For unit mass change in kinetic energy
Delta_e_cap_k = 1./2 * V2**2 * 10**-3 ; #[kJ/kg]
Delta_u_cap = Delta_e_cap_k ;
#For final state of water:
u_cap_l2 = Delta_u_cap + u_cap_l1 ;
x = (u_cap_l2 - u_cap_l_t25) / (u_cap_l_t30 - u_cap_l_t25) ;
T_unknown = T1 + x*(T2 - T1) ;
# Results
print 'Final temperature of water = %.2f degreeC'%(T_unknown);
import math
import scipy.integrate
# Variables
P_ex = 1*10**5 ; #[Pa]}
# Calculations
#To calculte work done
def f(x):
return 1
I = scipy.integrate.quadrature(f,10,15.2)[0]
W = -P_ex * I * 10**-3 ; #[J]
# Results
print 'Work done = %g J'%(W);
from scipy.integrate import quad
# Variables
V = 1.0 # m**3
m = 10 # kg
p1p2 = .2
u1 = 2600.3 #kJ/kg
P1 = 20
v1 = 0.1
# Calculations
v = V/m
v2 = (p1p2*v**1.5)**(1./1.5)
def fun(v):
return P1*v1**1.5/v**1.5
w = -quad(fun,0.1,.0342)[0]
u2 = 3045.8 + (3144.5 - 3045.8) * (v2 - .03279)/(.03564 - .03279)
T2 = 500 + (550 - 500) * (v2 - .03279)/(.03564 - .03279)
# results
print "The specific volume of initial state = %.2f m**3/kg"%v
print "V2 = %.4f m**3/kg"%v2
print "Work done = %.f kJ/kg"%(w*100)
print "U2 = %.1f kJ/kg"%u2
print "T2 = %.f C"%T2
# variables
#From steam table specific enthalpy at state1 and state2 are
h_cap_1 = 3373.6 #[kJ/kg]
h_cap_2 = 2675.5 #[kJ/kg]
m_dot1 = 10. #[kg/s],As we are dealing with steady state
m_dot2 = 10. #[kg/s]
# Calculations
Ws_dot = m_dot1 * (h_cap_2 - h_cap_1) ; #[kW]
# Results
print 'Power generated = %g kW'%(Ws_dot);
# Variables
h_cap_in = 3241. #[kJ/kg] , From steam table
P_final = 10. #[MPa]
# Calculations and Results
u_cap_2 = h_cap_in ;
T2 = 600. ; # From steam table .No calculation is involved .
print 'a) The final temperature of the system = %g *C'%(T2);
u_cap_2 = h_cap_in ;
# So temperature is T2 = 600*C (From table).
#Solution(b)
print "(b) The temperature of the fluid increases in the system due to the receipent of flow work ."
import scipy.integrate.quadrature
# Variables
n = 2. #[mol]
A = 3.470 ;
B = 1.450*10**-3 ;
D = 0.121*10**5 ;
T1 = 473. ; #[K]
T2 = 773. ; #[K]
# Calculations and Results
def f(T):
return 8.314*(A + B*T + D*T**-2)
Delta_h = scipy.integrate.quadrature(f,T1,T2)[0]
Q = n * Delta_h ;
print 'a)Heat required = %d J'%(Q);
#From steam table
h_cap_1 = 2827.9 ; #[kJ/kg]
h_cap_2 = 3478.4 ; #[kJ/kg]
m = 2*0.018 ; #[kg]
Delta_h_cap = (h_cap_2 - h_cap_1) * 10**3 ; #[J/kg]
Q = m * Delta_h_cap;
print 'b)Heat required = %g J'%(Q);
# Variables
T1 = 298.;
T2_start = 300.;
A = 3.355;
B = 0.575*10**-3;
D = -0.016*10**5;
# Calculations
def f(T):
return 8.314*(A*T + B/2*T**2 - D/T)
for T2_start in range(300,1000+1,100):
del_h = f(T2_start) - f(T1);
Cp = del_h /(T2_start - 298);
print 'At temperatureK %g, Molar heat capacity J/molK, %.2f'%(T2_start,Cp);
# Variables
n_dot_air = 10. ; #[mol/min]
C_bar_P_900 = 30.71 ; #[J/molK]
C_bar_P_600 = 29.97 ; #[J/molK]
T1 = 600. ; #[K]
T2 = 900. ; #[K]
T_ref = 298. ; #[K]
# Calculations
# Q_dot = n_dot_air * (h_900 - h_600)...........Eqn E2.8A
Q_dot = n_dot_air * (C_bar_P_900 * (T2 - T_ref) - C_bar_P_600 * (T1 - T_ref));
# Results
print 'Heat rate required = %.3f J/min'%(Q_dot/1000);
# note: answer may vary because of rounding error.
import math
# Variables
P1 = 100000. ; # [N/m**2]
T1 = 298. ; #[K]
V1 = 0.1 * 0.1 ; # [m**3]
T2 = 373. ; # [N]
P_ext = 100000. ; #[N/m**2]
k = 50000. #[N/m]
A = 0.1 ; #[m**2]
# Calculations and Results
a = k / (T2 * A**2) ;
b = (P_ext / T2) - k * V1 / (A**2 * T2) ;
c = -P1 * V1 / T1 ;
V2 = (-b + math.sqrt ( b**2 - (4*a*c))) / (2 * a) ;
W = -P_ext * (V2 - V1) - ( k * (V2 - V1)**2)/(2 * A**2); #From eqn E2.9C
print 'a) Work required = %.f J '%(W);
A = 3.355 ;
B = 0.575 * 10**-3 ;
D = -0.016 * 10**5 ;
P1 = 10**5 ; #[N/m**2]
V1 = 0.01 ; #[m**3]
R = 8.314 ;
T1 = 298 ;
n = (P1 * V1) / (R * T1) ;
def f(T):
return R*((A - 1) * T + B/2 * T**2 -D/T)
del_u = f(373) - f(298) ;
del_U = n * del_u ;
Q = del_U - W;
print 'b).Heat transfered = %.f J'%(Q);
# Variables
n_dot = 10. #[mol/s]
T1 = 298.2 #[K]
T2 = 342. #[K]
T3 = 373.2 #[K]
Cp_298_342 = 216.3 #[J/molK]
A = 3.025
B = 53.722 * 10**-3
C = -16.791 * 10**-6
del_h_vap = 28.88 #[kJ/mol]
# Calculations
del_h_1 = Cp_298_342 * (T2 - T1) * 10**-3 ; #[kJ/mol]
del_h_2 = del_h_vap ;
def f(T):
return 8.314*(A*T + (B/2)*(T**2) + (C/3)*(T**3))* 10**-3 ;
del_h_3 = f(T3) - f(T2) ;
Q = n_dot * (del_h_1 + del_h_2 + del_h_3) ;
print 'Rate of heat supplied = %d kJ/s'%(Q );
# Variables
m_1_v = 4.3 #[kg]
m_1_l = 50. #[kg]
u_cap_1_v = 2437.9 #[kJ/kg],From steam table
u_cap_1_l = 191.8 #[kJ/kg],From steam table
v_cap_1_v = 14.67 #[m**3],From steam table
v_cap_1_l = 0.001 #[m**3],From steam table
# Calculations
V2 = m_1_l * v_cap_1_l + m_1_v * v_cap_1_v ;
m_2_v = m_1_l + m_1_v ;
v_cap_2_v = V2 / m_2_v ; #[m**3/kg]
P2= 0.15 #[MPa]
u_cap_2_v = 2519.6 #(kJ/kg)
Q = ((m_2_v * u_cap_2_v) -(m_1_l * u_cap_1_l + m_1_v * u_cap_1_v))*1000;
# Results
print 'Minimum amount of heat required = %.2e J'%(Q);
# Variables
del_h0_f_CO2 = -393.51 ; # [kJ/mol]
del_h0_f_H2 = 0 ; # [kJ/mol]
del_h0_f_H2O = -241.82 ; # [kJ/mol]
del_h0_f_CH3OH = -200.66 ; # [kJ/mol]
# Calculations
del_h0 = del_h0_f_CO2 + 3 * del_h0_f_H2 - del_h0_f_H2O - del_h0_f_CH3OH ;
# Results
print 'Enthalpy of reaction = %.f kJ/mol'%(del_h0);
# variables
Vp = 3*10**6 *0.7*10**6
MW = 114.2 # g/mol
#Calculations
n = Vp/MW
H = -9.3 * 10**16 # J
Ep = 200 * 0.10*24*3600 # energy density
A = -H/Ep
# Results
print "a) Area A = %.1e m**2"%A
import math
from numpy import *
from scipy.integrate import *
# Variables
del_h0_f_CO2 = -393.51 #[kJ/mol], From Appendix A.3
del_h0_f_CO = -110.53 #[kJ/mol], From Appendix A.3
del_h0_f_H2O = -241.82 #[kJ/mol], From Appendix A.3
del_h0_f_C3H8 = -103.85 #[kJ/mol], From Appendix A.3
del_h0_f_O2 = 0. #[kJ/mol], From Appendix A.3
A_CO2 = 5.457 # From table E2.13
B_CO2 = 1.05 * 10**-3
D_CO2 = -1.16 * 10**5
A_CO = 3.379
B_CO = 5.57 * 10**-4
D_CO = -3.1 * 10**3
A_H2O = 3.470
B_H2O = 1.45 * 10**-3
D_H2O = 1.21 * 10**4
A_N2 = 3.280
B_N2 = 5.93 * 10**-4
D_N2 = 4.00 * 10**3
# Calculations
n_C3H8 = 10. #[mol]
n_N2 = (0.79/0.21) * (9.7/2) * n_C3H8 ; #[mol]
n_CO2 = 2.7 * n_C3H8 ; #[mol]
n_CO = 0.3 * n_C3H8 ; #[mol]
n_H2O = 4 * n_C3H8 ; #[mol]
n_O2 = (9.7 / 2)* n_C3H8 #[mol]
T_reff = 298. #[K]
del_H_rxn_298 = n_CO2 * del_h0_f_CO2 + n_CO * del_h0_f_CO + n_H2O * del_h0_f_H2O - n_C3H8 * del_h0_f_C3H8 - n_O2 * del_h0_f_O2 ; #[kJ]
#The co-efficients of T2 in the equation of degree 3 are
a = 8.314*(n_CO2 * (B_CO2/2) + n_CO * (B_CO/2) + n_H2O * (B_H2O/2) + n_N2 * (B_N2/2));
b = 8.314*(n_CO2 * A_CO2 + n_CO * A_CO + n_H2O * A_H2O + n_N2 * A_N2) ;
d =8.314*(- n_CO2 * D_CO2 - n_CO * D_CO - n_H2O * D_H2O -n_N2 * D_N2) ;
c = (del_H_rxn_298 *1000) + 8.314 * (n_CO2 * (- T_reff * A_CO2 - B_CO2/2 * T_reff**2 + D_CO2/T_reff) + n_CO * (- T_reff * A_CO - B_CO/2 * T_reff**2 + D_CO/T_reff) + n_H2O * (- T_reff * A_H2O - B_H2O/2 * T_reff**2 + D_H2O/T_reff) + n_N2 * (-T_reff * A_N2 - B_N2/2 * T_reff**2 + D_N2/T_reff));
T2=poly1d([a,b,c,d])
M = roots(T2);
# Results
print "T2 = %.f [K]"%(round(round(M[1]),-1))
# Note: python has only 1 method to find roots so part 1-2 can be calculated same way here.
# variables
# Calculations
deltaH1rxn298 = (-393.51) - 1*(-110.53) -0 # Reaction 1
deltaH2rxn298 = 1*(-110.53) -0 - 0 # Reaction 2
E1 = 3
E2 = 1
deltaHrxn = E1*deltaH1rxn298*1000 + E2*deltaH2rxn298*1000
nCO2 = 4 - E1 + E2
nO22 = 4 - (1./2*E1) - 1./2*E2
nCO22 = 0 + E1
nC2 = 2 - E2
s = 52000.
Q = deltaHrxn + s
# Results
print "extensive enthalpy of reaction %.2e J"%deltaHrxn
print "amount of energy transferred by heat %.1e J"%Q
from numpy import *
# Variables
V1 = 350. #[m/s]
A = 3.355
B = 0.575*10**-3
D = -0.016*10**5
Tin = 283. #[K]
MW = 29.*10**-3 ; #[kg/mol]
ek = 1./2 * MW * V1**2
a = B/2.
b = A ;
c = -(Tin * A + Tin**2*B/2 - (D/Tin) + ek/8.314)
d=-D
T2=poly1d([a,b,c,d])#'T2',0);
M = roots(T2);
# Results
print "Temperature T2 = %.f [K]"%M[1]
# Variables
V_dot_2 = 0.001 ; #[m**3/kg]
v_cap_2 = 0.001 ; #[m**3/kg], Specific volume of water
z2 = 250. #[m] ; Taking ground as the reference level
e_cap_2 = 9.8 * z2 #[kg*m**2/s**2]
# Calculations
m_dot_2 = V_dot_2 / v_cap_2 #[kg/s]
W_dot_s = m_dot_2 * e_cap_2 * 10**-3 ;
# Results
print 'Minimum power required is = %.1f kW'%(W_dot_s);
# Variables
n_dot = 10. #[mol/min]
del_h_vap_CO2 = 10400. ; #[J/mol]
A_CO2 = 5.457 ; #From appendix A.3
B_CO2 = 1.045 * 10**-3 ;
D_CO2 = -1.157 * 10**5 ;
A_air = 3.355 ;
B_air = 0.575 * 10**-3 ;
D_air = -0.016 * 10**5 ;
T1 = 273. ; #[K]
T2 = 283. ; #[K]
T3 = 323. ; #[K]
T4 = 293. ; #{k}
def f1(T):
return 8.314 * (A_CO2 * T + (B_CO2/2) * T**2 - D_CO2/T)
sen_heat_CO2 = f1(T2) - f1(T1) ;
Q_dot = n_dot * (del_h_vap_CO2 + sen_heat_CO2) ; #[J/min]
def f2(T):
return 8.314 * (A_air * T + B_air/2*T**2 - D_air /T)
sen_heat_air = f2(T4) - f2(T3);
n_dot_air = - Q_dot / sen_heat_air ;
print 'Air required = %.F mol/min'%(n_dot_air);
# Variables
m_dot_1 = 10. #[kg/s]
h_cap_1 = 3238.2 ; #[kJ/kg], Super heated steam at 500*C & 200bar
h_cap_2 = 93.3 ; #[kL/kg], subcooled liquid at 20*C & 100bar
h_cap_3 = 2724.7 ; #{kJ/kg}, Super heated vapour at 100bar
# Calculations
m_dot_2 = m_dot_1 * (h_cap_1 - h_cap_3) / (h_cap_3 - h_cap_2);
# Results
print 'Flow of liquid stream = %.2f kg/s'%(m_dot_2);
# Variables
h_cap_st_1 = 2923.4 ; # [kJ/kg]
h_cap_200 = 2875.3 ; # {kJ/kg} , At 100kPa
h_cap_250 = 2974.3 ; # {kJ/kg} , At 100 kPa
del_T = 250.-200 ;
T1 = 200. #[K]
# Calculations
h_cap_st_2 = h_cap_st_1 ; #Assumimg bulk kinetic energy of the stream and heat transfered is negligible
T2 = T1 + del_T * (h_cap_st_2 - h_cap_200) / (h_cap_250 - h_cap_200) ;
# Results
print 'The exit temperature is = %d *C'%(T2) ;
import math
from numpy import zeros
# Variables
Cv = 3./2 * 8.314 ;
Cp = 5./2 * 8.314 ;
n = 1.;
R = 8.314 ;
T1 = 1000. ; #[K]
P1 = 10. ; #[bar]
T2 = 1000. ; #[K]
P2 = 0.1 ; #[bar]
T3 = 300. ; #[K]
T4 = 300. ; #[K]
# Calculations and Results
k = Cp / Cv ;
P3 = P2 * (T3 / T2)**(k/(k-1)); #[bar]
P4 = P1 * (T4 / T1)**(k/(k-1)) ; #[bar]
del_U_12 = 0 ; # As process 1-2 is isothermal
W_12 = n * R * T1 * math.log(P2 / P1);
Q_h_12 = W_12 ;
print 'a) 1) del_U = %d J'%(del_U_12) ;
print ' Work = %d J'%(W_12) ;
print ' Heat = %d J'%(Q_h_12) ;
Q_23 = 0 ; # As adiabatic process
del_U_23 = n * Cv *(T3 - T2) ;
W_23 = del_U_23 ;
print ' 2) del_U = %g J'%(round(del_U_23,-1)) ;
print ' Work J = %d J'%(round(W_23,-1)) ;
print ' Heat J = %d J'%(Q_23) ;
del_U_34 = 0 ; # As isothermal process
W_34 = n * R * T3 * math.log(P4 / P3) ; # Eqn E2.20.A
Q_c_34 = del_U_34 - W_34 ;
print ' 3) del_U = %g J'%(del_U_34) ;
print ' Work = %d J'%(W_34) ;
print ' Heat = %d J'%(Q_c_34) ;
Q_41 = 0 ; # As adiabatic process
del_U_41 = n * Cv * (T1 - T4) ;
W_41 = del_U_41 ;
print ' 4) del_U = %g J'%(round(del_U_41,-1)) ;
print ' Work = %d J'%(round(W_41,-1)) ;
print ' Heat = %d J'%(Q_41) ;
#Solution (c)
W_total = W_12 + W_23 + W_34 + W_41 ;
Q_absor = Q_h_12 ;
effi = W_total / Q_absor ;
print 'c) efficiency = %g'%(effi)
#Solution (d)
x = 1 - T3 / T1 ;
print 'd) 1 - Tc/Th = %g'%(x);
print " i.e Efficiency = 1 - Tc/Th"
#Solution (e)
print "(e) The process can be made more efficient by raimath.sing Th or by lowering Tc ."
print "Table E2.20B"
print " T(K) P(bar) v(m**3/mol)"
P = [P1 , P2 , P3 , P4 ] ;
T = [T1 , T2 , T3 , T4 ] ;
v = zeros(4)
for i in range(4):
v[i] = R * T[i] * 10**-5/ P[i] ;
print " %6d %8.4f %.4f "%(T[i],P[i],v[i]) ;