import math
# Variables
eps_e = 0.27;
P = 1. ;
# Calculation
K = (4*eps_e**2*P)/(1-eps_e**2);
P1 = 100./760; # in Pa
eps_e_1 = math.sqrt((K/P1)/(4+(K/P1)));
T1 = 318.; T2 = 298.;
R = 8.3143; K1 = 0.664; K2 = 0.141;
dH = 2.30*R*((T1*T2)/(T1-T2))*(math.log(K1/K2));
# Results
print "K is",round(K,4),"atm"
print "epislon is ",round(eps_e_1,3)
print "The heat of reaction is",round(dH,0),"kJ/kg mol"
# note : book answer is wrong. please check.
# Variables
v1 = 1.
v2 = v1;
v3 = v2;
v4 = v2;
e = 0.56; # Degree of reaction
P = 1.; # Dummy
T = 1200.
R = 8.3143;
# Calculation
x1 = (1-e)/2; x2 = (1-e)/2;
x3 = e/2; x4 = e/2;
K = (((x3**v3)*(x4**v4))/((x1**v1)*(x2**v2)))*P**(v3+v4-v1-v2); # Equillibrium consmath.tant
dG = -R*T*math.log(K);
# Results
print "Equillibrium constant is",round(K,2)
print "Gibbs function change is",round(dG,1),"J/gmol"
# note : rounding off error is there.
# Variables
Veo = 1.777; # Ve/Vo
e = 1-Veo; # Degree of dissociation
P = 0.124; # in atm
# Calculation
K = (4*e**2*P)/(1-e**2);
# Results
print "The value of equillibrium constant is",round(K,3),"atm"
# Variables
v1 = 1.;
v2 = 0.;
v3 = 1.; v4 = 1./2;
dH = 250560.; e = 3.2e-03;
R = 8.3143; T = 1900.;
# Calculation
Cp = ((dH**2)*(1+e/2)*e*(1+e))/(R*T**2*(v1+v2)*(v3+v4));
# Results
print "Cp is",round(Cp,3),"j/gmol K"
# note : rounding off error.
# Variables
a = 21.89;
y = 18.5;
x = 8.9;
# Calculation
PC = 100.*(x*12.)/((8.9*12)+(18.5*1));
PH = 100-PC;
AFR = ((32*a)+(3.76*a*28))/((12*x)+y);
EAU = (8.8*32)/((21.89*32)-(8.8*32));
# Results
print "carbon = ",round(PC,2),"% and Hydrogen = ",round(PH,2),"%"
print "Air fuel ratio is",round(AFR,0)
print "Percentage of excess air used is",round((EAU*100),2),"%"
# Variables
hf_co2 = -393522;
hf_h20 = -285838;
hf_ch4 = -74874;
# Calculation
D = hf_co2 + (2*hf_h20);
QCV = D - (hf_ch4+1);
# Results
print "Heat transfer per kg mol of fuel is",D,"kJ"
print "Qcv = %.f kJ"%QCV
# note : rounding off error.
# Below values are taken fron table 16.4
# Variables
Hr = -249952.+(18.7*560)+(70*540);
Hp = 8.*(-393522.+20288)+9*(-241827+16087)+6.25*14171+70*13491;
Wcv = 150.; # Energy out put from engine in kW
Qcv = -205.; # Heat transfer from engine in kW
# Calculation
n = (Wcv-Qcv)*3600/(Hr-Hp);
# Results
print "Fuel consumption rate is",round((n*114),1),"kg/h"
# rounding error is there.
from numpy import interp
# Variables
Hr1 = -249952.; # For ocmath.tane
Hp1 = Hr1;
# Below values are calculated umath.sing value fron table 16.4
T2 = 1000.;
Hp2 = -1226577.
T3 = 1200.;
Hp3 = 46537.;
T4 = 1100.;
Hp4 = -595964.;
# Calculation
Hp = [Hp2 ,Hp3, Hp4]
T = [T2 ,T3, T4]
T1 = interp(Hp1,Hp , T); # Interpolation to find temperature at Hp1
# Results
print "the adeabatic flame temperature is",T1,"K"
# note : answer varies because the method - interp gives some different answer. please check.
# Variables
T0 = 298.;
Wrev = -23316-3*(-394374)-4*(-228583);
Wrev_ = Wrev/44.; # in kJ/kg
Hr = -103847.;
T = 980.; # Through trial and error
# Calculation
Sr = 270.019+20*205.142+75.2*191.611;
Sp = 3*268.194 + 4*231.849 + 15*242.855 + 75.2*227.485;
IE = Sp-Sr; # Increase in entropy
I = T0*3699.67/44;
Si = Wrev_ - I;
# Results
print "Reversible work is",Wrev_,"kJ/kg"
print "Increase in entropy during combustion is",round(Sp-Sr,2),"kj/kg mol K"
print "Irreversibility of the process",round(I,0),"kJ/kg"
print "Availability of products of combustion is",round(Si,1),"kJ/kg"
# note : there are rounding off errors. please check.
import math
# Variables
T0 = 298.15; P0 = 1; R = 8.3143;
xn2 = 0.7567
xo2 = 0.2035
xh2o = 0.0312
xco2 = 0.0003;
# Calculation and Results
# Part (a)
g_o2 = 0; g_c = 0; g_co2 = -394380;
A = -g_co2 + R*T0*math.log(xo2/xco2);
print "The chemical energy of carbon is",round(A,0),"kJ/k mol"
# Part (b)
g_h2 = 0; g_h2o_g = -228590;
B = g_h2 + g_o2/2 - g_h2o_g + R*T0*math.log(xo2**0.5/xh2o);
print "The chemical energy of hydrogen is",round(B,0),"kJ/k mol"
# Part (c)
g_ch4 = -50790;
C = g_ch4 + 2*g_o2 - g_co2 - 2*g_h2o_g + R*T0*math.log((xo2**2)/(xco2*xh2o));
print "The chemical energy of methane is",round(C,0),"kJ/k mol"
# Part (d)
g_co = -137150;
D = g_co + g_o2/2 - g_co2 + R*T0*math.log((xo2**0.5)/xco2);
print "The chemical energy of Carbonmonoxide is",round(D,0),"kJ/k mol"
# Part (e)
g_ch3oh = -166240;
E = g_ch3oh + 1.5*g_o2 - g_co2 - 2*g_h2o_g + R*T0*math.log((xo2**1.5)/(xco2*(xh2o**2)))
print "The chemical energy of methanol is",round(E,0),"kJ/k mol"
# Part (f)
F = R*T0*math.log(1./xn2);
print "The chemical energy of nitrogen is",round(F,1),"kJ/k mol"
# Part (g)
G = R*T0*math.log(1./xo2);
print "The chemical energy of Oxygen is",round(G,0),"kJ/k mol"
# Part (h)
H = R*T0*math.log(1./xco2);
print "The chemical energy of carbondioxide is",round(H,0),"kJ/k mol"
# Part (i)
g_h2o_l = -237180;
I = g_h2o_l - g_h2o_g + R*T0*math.log(1./xh2o);
print "The chemical energy of water is",round(I,1),"kJ/k mol"
# note : rounding off error is there. please check.
# Variables
b = 8./(0.114+0.029); # By carbon balance
C = 18./2 # By hydrogen balance
a = b*0.114 + (b/2)*0.029 + b*0.016 + C/2 ; # By oxygen balance
Wcv = 1. # Power developed by engine in kW
# Calculation and Results
n_fuel = (0.57*1)/(3600*114.22);
Qcv = Wcv-n_fuel*3845872; # 5.33
print "The rate of heat transfer from the engine is",round(Qcv,2),"kW"
# Part (b)
ach = 5407843.; # chemical energy of liquid ocmath.tane
n2 = Wcv/(n_fuel*ach);
print "The second law efficiency is",round((n2*100),1),"%"