{
"metadata": {
"name": "",
"signature": "sha256:ffa252e0f1b2a360d9cd4d249675a66968869a58480fb1a0e3c0c3fd2fa6c2ba"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 5 : Variable Specific Heat"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.2 Page no : 105"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\t\t\t\t\t\n",
"#Input data\n",
"r = 8.\t\t\t\t\t#Compression ratio\n",
"n = 1.41\t\t\t\t\t#Adiabatic index of the medium\n",
"cv = 0.17\t\t\t\t\t#Mean Specific heat at consmath.tant volume in kcal/kg/degree C\n",
"x = 2.\t\t\t\t\t#Percentage with which spcific heat at consmath.tant volume increases\n",
"R = 29.3\t\t\t\t\t#Characteristic gas consmath.tant in mkg/kg/degree C\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"e = (1-(1/r**(n-1)))\t\t\t\t\t#Air standard efficiency neglecting the variation in specific heat\n",
"debye = ((x/100)*((1-e)/e)*(R/(J*cv))*math.log(r))*100\t\t\t\t\t#Ratio of de and e in percent\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The change in air standard efficiency of the cycle is %3.3f percent'%(debye)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The change in air standard efficiency of the cycle is 1.247 percent\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.3 Page no : 106"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"from scipy.integrate import quad\n",
"\n",
"\t\t\t\t\t\n",
"#Input data\n",
"\t\t\t\t\t#Cv = 0.125+0.000005T where Cv is Specific heat at consmath.tant volume and T is the temperature in K\n",
"R = 28.9\t\t\t\t\t#Characteristic gas consmath.tant in mkg/kg/degree C\n",
"T = [100+273,50+273]\t\t\t\t\t#Temperature in K\n",
"J = 427\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"def f(x):\n",
"\treturn 0.125+(0.00005*x)\n",
"\t\n",
"I = J*quad(f,303,373)[0]\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The work done is %i m.kg/kg of gas'%(I)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The work done is 4241 m.kg/kg of gas\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.4 Page no : 109"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\t\t\t\t\t\n",
"#Input data\n",
"af = 25.\t\t\t\t\t#Air fuel ratio\n",
"cv = [0.17,0.00004]\t\t\t\t\t#Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K\n",
"r = 14.\t\t\t\t\t#Compression ratio\n",
"p1 = 1.\t\t\t\t\t#Pressure at the beginning of compression in kg/cm**2\n",
"T1 = 153.+273\t\t\t\t\t#Temperature at the beginning of compression in K\n",
"CV = 10000.\t\t\t\t\t#Heating value of fuel in kcal/kg\n",
"n = 1.35\t\t\t\t\t#Adiabatic constant\n",
"R = 29.\t\t\t\t\t#Characteristic gas constant in mkg/kg.K\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"T2 = (T1*r**(n-1))\t\t\t\t\t#Temperature at the end of compression in K\n",
"a = (cv[1]/2)\t\t\t\t\t#For solving T3\n",
"b = cv[0]+(R/J)\t\t\t\t\t#For solving T3\n",
"c = (-T2*cv[0])-((cv[1]/2)*T2**2)-((R/J)*T2)-(CV/(af+1))\t\t\t\t\t#Foe solving T3\n",
"T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a)\t\t\t\t\t#Soving for T3 in K\n",
"pc = (((T3/T2)-1)/(r-1))*100\t\t\t\t\t#Percentage cut off\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The percentage of stroke at which the constant pressure combustion stops is %i percent'%(pc)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The percentage of stroke at which the constant pressure combustion stops is 9 percent\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.5 Page no : 113"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\t\t\t\t\t\n",
"#Input data\n",
"af = 25.\t\t\t\t\t#Air fuel ratio\n",
"CV = 10000.\t\t\t\t\t#Calorific value in kcal/kg\n",
"cv = [0.17,0.00004]\t\t\t\t\t#Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K\n",
"r = 14.\t\t\t\t\t#Compression ratio\n",
"T2 = 800.+273\t\t\t\t\t#Temperature at the end of compression in K\n",
"R = 29.\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"CVm = (CV/(af+1))\t\t\t\t\t#Calorific value of mixture in kcal/kg\n",
"cpv = (R/J)\t\t\t\t\t#Difference in mean specific heats in kcal/kg mol.K\n",
"a = (cv[1]/2)\t\t\t\t\t#For solving T3\n",
"b = cpv+cv[0]\t\t\t\t\t#For solving T3\n",
"c = (-T2*(cpv+cv[0]))-((cv[1]/2)*T2**2)-CVm\t\t\t\t\t#Foe solving T3\n",
"T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a)\t\t\t\t\t#Soving for T3 in K\n",
"s = ((T3/T2)/(r-1))*100\t\t\t\t\t#Percentage of the stroke\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The percentage of the stroke at which the combustion will be complete is %3.2f percent'%(s)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The percentage of the stroke at which the combustion will be complete is 16.70 percent\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.6 Page no : 115"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"from scipy.integrate import quad\n",
"\t\t\t\t\t\n",
"#Input data\n",
"T = [500,2000]\t\t\t\t\t#Change in temperature in K\n",
"x = [11.515,-172,1530]\t\t\t\t\t#Cp = 11.515-172/math.sqrt(T)+1530/T in kcal/kg mole.K\n",
"mO2 = 32\t\t\t\t\t#Molecular weight of oxygen\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"\n",
"def f(T):\n",
"\treturn (x[0]+(x[1]/math.sqrt(T))+(x[2]/T))\n",
"\t\n",
"I = -quad(f,T[1],T[0])[0]\t\t\t\t\t#Integration\n",
"dh = (I/mO2)\t\t\t\t\t#Change in enthalpy in kcal/kg\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The change in enthalpy is %3.1f kcal/kg'%(dh)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The change in enthalpy is 365.7 kcal/kg\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.7 Page no : 117"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\t\t\t\t\t\n",
"#Input data\n",
"r = 14.\t\t\t\t\t#Compression ratio\n",
"s = 5.\t\t\t\t\t#Fuel injection stops at 5% stroke after inner head centre\n",
"pm = 50.\t\t\t\t\t#Maximum pressure in kg/cm**2\n",
"p4 = 1.\t\t\t\t\t#Pressure at the end of suction stroke in kg/cm**2\n",
"T4 = 90.+273\t\t\t\t\t#Temperature at the end of suction stroke in K\n",
"R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
"cv = [0.171,0.00003]\t\t\t\t\t#Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"a = (R/J)+cv[0]\t\t\t\t\t#a value in kcal/kg.mole.K\n",
"g = (a+cv[1]*T4)/(cv[0]+cv[1]*T4)\t\t\t\t\t#Adiabatic index of compression\n",
"z = 1.3\t\t\t\t\t#Rounding off 'z' value to one decimal.\n",
"T5 = (T4*r**(z-1))\t\t\t\t\t#Temperature in K\n",
"p5 = (p4*r**g)\t\t\t\t\t#Pressure in kg/cm**2\n",
"T1 = T5*(pm/p5)\t\t\t\t\t#Tmperature in K\n",
"T2 = (T1*(1+(s/100)*(r-1)))\t\t\t\t\t#Temperature in K\n",
"T3 = (T2*((1+(s/100)*(r-1))/r)**(g-1))\t\t\t\t\t#Temperature in K\n",
"p3 = (p4*(T3/T4))\t\t\t\t\t#Pressure in kg/cm**2\n",
"def f1(T):\n",
"\treturn cv[0]+(cv[1]*T)\n",
"I1 = quad(f1,T5,T1)[0]\n",
"\n",
"def f2(T):\n",
"\treturn (a+(cv[1]*T))\n",
"\t\n",
"I2 = quad(f2,T1,T2)[0]\t\t\t\t\t#I2 answer is given wrong in the textbook\n",
"qs = (I1+I2)\t\t\t\t\t#Heat supplied per kg of air in kcal/kg\n",
"\n",
"def f3(T):\n",
"\treturn a+(cv[1]*T)\n",
"\t\n",
"qre = quad(f3,T4,T3)[0]\t\t\t\t\t#Heat required per kg of air in kcal/kg\n",
"\n",
"nth = ((qs-qre)/qs)*100\t\t\t\t\t#Thermal efficiency in percent\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'The tempertautes and pressures at salient points of the cycle are : T1 = %3.0f K \\\n",
"\\np1 = %3.1f kg/cm**2 \\\n",
"\\nT2 = %3.0f K \\\n",
"\\np2 = %3.1f kg/cm**2 \\\n",
"\\nT3 = %3.0f K \\\n",
"\\np3 = %3.1f kg/cm**2 \\\n",
"\\nT4 = %3.0f K \\\n",
"\\np4 = %3.1f kg/cm**2 \\\n",
"\\nT5 = %3.0f K \\\n",
"\\np5 = %3.1f kg/cm**2 \\\n",
"\\nHeat supplied per kg of air is %3.1f kcal/kg \\\n",
"\\nThe thermal efficiency of the cycle is %3.1f percent'%(T1,pm,T2,pm,T3,p3,T4,p4,T5,p5,qs,nth)\n",
"\n",
"#Textbook answers are given wrong\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The tempertautes and pressures at salient points of the cycle are : T1 = 1057 K \n",
"p1 = 50.0 kg/cm**2 \n",
"T2 = 1745 K \n",
"p2 = 50.0 kg/cm**2 \n",
"T3 = 779 K \n",
"p3 = 2.1 kg/cm**2 \n",
"T4 = 363 K \n",
"p4 = 1.0 kg/cm**2 \n",
"T5 = 801 K \n",
"p5 = 37.9 kg/cm**2 \n",
"Heat supplied per kg of air is 244.5 kcal/kg \n",
"The thermal efficiency of the cycle is 56.4 percent\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.8 Page no : 119"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"from scipy.integrate import quad\n",
"\t\t\t\t\t\n",
"#Input data\n",
"r = 14.\t\t\t\t\t#Compression ratio\n",
"c = 5.\t\t\t\t\t#Cut off takes place at 5% of the stroke\n",
"p1 = 1.\t\t\t\t\t#Pressure at the beginning of compression in kg/cm**2. In texbook, it is given wrong as 10\n",
"T1 = 90.+273\t\t\t\t\t#Temperature at the beginning of compression in K\n",
"p3 = 50.\t\t\t\t\t#Maximum pressure in kg/cm**2\n",
"R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
"cv = [0.171,0.00003]\t\t\t\t\t#Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K\n",
"g1 = 1.4\t\t\t\t\t#Ratio of specific heats\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"T2x = (T1*r**(g1-1))\t\t\t\t\t#Temperature in K\n",
"def f1(T):\n",
"\treturn cv[0]+(cv[1]*T)\n",
"\n",
"I1 = quad(f1,T1,T2x)[0]\n",
"\n",
"Cv = (1/(T2x-T1))*I1\t\t\t\t\t#Mean value of Cv in kJ/kg.K\n",
"Cp = (Cv+(R/J))\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
"g = 1.35\t\t\t\t\t#(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose. Ratio of specific heats\n",
"T2 = (T1*r**(g-1))\t\t\t\t\t#Temperature in K\n",
"I2 = quad(f1,T1,T2)[0]\n",
"CV = (1/(T2-T1))*I2\t\t\t\t\t#Maen value of Cv in kJ/kg.K\n",
"CP = (Cv+(R/J))\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
"g2 = 1.36\t\t\t\t\t#(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose.Ratio of specific heats\n",
"T2a = (T1*r**(g2-1))\t\t\t\t\t#Temperature in K\n",
"p2 = (p1*r*(T2a/T1))\t\t\t\t\t#Pressure in kg/cm**2\n",
"T3 = (T2a*(p3/p2))\t\t\t\t\t#Temperature in K\n",
"T4 = (((r-1)*(c/100))+1)*T3\t\t\t\t\t#Temperature in K\n",
"g3 = 1.3\t\t\t\t\t#Assuming gamma as 1.3 for process 4-5\n",
"T5 = (T4/(r/(((r-1)*(c/100))+1))**(g3-1))\t\t\t\t\t#Temperature in K\n",
"cV = cv[0]+(cv[1]/2)*(T5+T4)\t\t\t\t\t#Mean value of Cv in kJ/kg.K\n",
"cP = cV+(R/J)\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
"g4 = (cP/cV)\t\t\t\t\t#Ratio of specific heats\n",
"T5a = (T4/(r/(((r-1)*(c/100))+1))**(g4-1))\n",
"I3 = quad(f1,T2a,T3)[0]\n",
"\n",
"def f2(T):\n",
"\treturn cv[0]+(R/J)+(cv[1]*T)\n",
"I4 = quad(f2,T3,T4)[0]\t\t\t\t\t#Textbook answer is wrong\n",
"q = I3+I4\t\t\t\t\t#Heat supplied per kg of working substance in kcal/kg\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'a) Temperatures at all the points of the cycle are: \\\n",
"\\nT1 = %i K T2 = %3.0f K T3 = %3.0f K T4 = %3.0f K T5 = %i K \\\n",
"\\nb) heat supplied per kg of the working substance is %3.1f kcal/kg'%(T1,T2a,T3,T4,T5a,q)\n",
"\t\t\t\t\t#Textbook answer is wrong\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"a) Temperatures at all the points of the cycle are: \n",
"T1 = 363 K T2 = 939 K T3 = 1296 K T4 = 2139 K T5 = 1097 K \n",
"b) heat supplied per kg of the working substance is 318.5 kcal/kg\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5.10 Page no : 119"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\t\t\t\t\t\n",
"#Input data\n",
"r = 20.\t\t\t\t\t#Compression ratio\n",
"c = 5.\t\t\t\t\t#Cut off at 5%\n",
"dc = 1.\t\t\t\t\t#Specific heat at constant volume increases by 1%\n",
"Cv = 0.171\t\t\t\t\t#pecific heat at constant volume in kJ/kg.K\n",
"R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
"k = 1.95\t\t\t\t\t#k can be obtained from relation de/e = -dcv/cv*(1-e/e)*(g-1)*((1/g)+ln(r)-(k**g*lnk)/(k**g-1))\n",
"J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
"\n",
"\t\t\t\t\t\n",
"#Calculations\n",
"g = (R/(J*Cv))+1\t\t\t\t\t#Ratio of specific heats\n",
"e = (1-((1/g)*(1/r**(g-1))*((k**g-1)/(k-1))))\t\t\t\t\t#Air standard efficiency of the cycle\n",
"dee = ((-(dc/100)*((1-e)/e)*(g-1)*((1/g)+math.log(r)-((k**g*math.log(k))/(k**g-1))))*100)\t\t\t\t\t#Change in efficiency due to 1% change in cv\n",
"\n",
"\t\t\t\t\t\n",
"#Output\n",
"print 'Percentage change in air standard efficiency is %3.3f percent This indicates that there is a decrease in efficiency'%(dee)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Percentage change in air standard efficiency is -0.564 percent This indicates that there is a decrease in efficiency\n"
]
}
],
"prompt_number": 8
}
],
"metadata": {}
}
]
}