{
"metadata": {
"name": "",
"signature": "sha256:be9b81ec82ea0e8e81e59b4d7c97d91bf099bd45d69eea5f3a2ed8e0bbebe433"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 2:First Law of Thermodynamics"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.1 Page No.90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"h1=60\t\t#The heat transfer in the process in kJ\n",
"h2=-8\t\t#The heat transfer in the process in kJ\n",
"h3=-34\t\t#The heat transfer in the process in kJ\n",
"h4=6\t\t#The heat transfer in the process in kJ\n",
"\n",
"#Calculations\n",
"Q=h1+h2+h3+h4\t\t#Net work transfer in a cycle in kJ\n",
"\n",
"#Output\n",
"print'Net work transfer in a cycle is',round(Q,2),\"KJ\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Net work transfer in a cycle is 24.0 KJ\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.2 Page No. 90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"Q=-300\t\t#Heat transfer in the system consisting of the gas in kJ\n",
"u=0\t\t#Internal energy is constant\n",
"\n",
"#Calculations\n",
"W=Q-u\t\t#Work done of the system in kJ\n",
"\n",
"#Output\n",
"print'The work done of the system W = %3.0f kJ ',round(W,1),\"KJ\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The work done of the system W = %3.0f kJ -300.0 KJ\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.3 Page No. 90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"v1=1.5\t\t#Initial volume of the process in m**3\n",
"v2=4.5\t\t#Final volume of the process in m**3\n",
"Q=2000\t\t#Amount of heat added in kJ\n",
"\n",
"#Calculations\n",
"W=100*((3.5*math.log(v2/v1))+(3*(v2-v1)))\t#Amount of work done in kJ\n",
"U=Q-W\t\t\t\t\t#The change in internal energy in kJ\n",
"\n",
"#Output\n",
"print'The change in internal energy is',round(U,2),\"KJ\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The change in internal energy is 715.49 KJ\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.4 Page No.91"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"h1=35\t\t#Enthalpy of water entering the boiler in kJ/kg\n",
"h2=705\t\t#Enthalpy of steam leaving the boiler in kJ/kg\n",
"C=0\t\t#Change in kinetic energy is neglected\n",
"Z=0\t\t#Change in potential energy is neglected\n",
"\n",
"#Calculations\n",
"q=h2-h1\t\t#The heat transfer per kg of steam in kJ/kg\n",
"\n",
"#Output\n",
"print'The heat transfer per kg of steam is',round(q,1),\"kJ/kg\"\t\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The heat transfer per kg of steam is 670.0 kJ/kg\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.5 Page No. 92"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"Q=-170\t\t#Sum of all heat transfers per cycle in kJ\n",
"N=100\t\t#Total number of cycles per min in cycles/min\n",
"Q1=0\t\t#Heat developed in a-b process in kJ/min\n",
"Q2=21000\t\t#Heat developed in b-c process in kJ/min\n",
"Q3=-2100\t\t#Heat developed in c-d process in kJ/min\n",
"W1=2170\t\t#Work done in the process a-b in kJ/min\n",
"W2=0\t\t#Work done in the b-c process in kJ/min\n",
"E3=-36600\t#Change in energy in the process in kJ/min\n",
"\n",
"#Calculations\n",
"E1=Q1-W1\t\t#Change in energy in process a-b in kJ/min\n",
"E2=Q2-W2\t\t#Change in energy in b-c process in kJ/min\n",
"W3=Q3-E3\t\t#Work done in the c-d process in kJ/min\n",
"Qt=Q*N\t\t\t#Total heat transfer per min in kJ/min \n",
"Q4=Qt-Q1-Q2-Q3\t\t#Heat developed in the process d-a in kJ/min\n",
"Et=0\t\t\t#Total change in energy of the cycle\n",
"E4=Et-E1-E2-E3\t\t#Energy in the process d-a in kJ/min\n",
"W4=Q4-E4\t\t#Work done in the d-a process in kJ/min \n",
"Wn=Qt/60.0\t\t#Net rate of work output in kW\n",
"\n",
"#Output\n",
"print'(a)Change in energy in a-b process is',round(E1,2),\"kJ/min\"\n",
"print'(b)Change in energy in b-c process is',round(E2,2),\"kJ/min\"\n",
"print'(c)Work done in the c-d process is',round(W3,2),\"kJ/min\"\n",
"print'(d)Heat developed in the process d-a is',round(Q4,2),\"kJ/min\"\n",
"print'(e)Energy in the process d-a is',round(E4,2),\"kJ/min\"\n",
"print'(f)Work done in the d-a process is',round(W4,2),\"kJ/min\"\n",
"print'(g)Net rate of work output is',round(Wn,2),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Change in energy in a-b process is -2170.0 kJ/min\n",
"(b)Change in energy in b-c process is 21000.0 kJ/min\n",
"(c)Work done in the c-d process is 34500.0 kJ/min\n",
"(d)Heat developed in the process d-a is -35900.0 kJ/min\n",
"(e)Energy in the process d-a is 17770.0 kJ/min\n",
"(f)Work done in the d-a process is -53670.0 kJ/min\n",
"(g)Net rate of work output is -283.33 kW\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.6 Page No. 93"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"Q1=50\t\t#Heat developed in the 1-2 process in kJ/kg\n",
"U1=20\t\t#Change in energy in the 1-2 process in kJ/kg\n",
"Q2=-30\t\t#Heat developed in the 2-3 process in kJ/kg\n",
"W2=-40\t\t#Work done in the 2-3 process in kj/kg\n",
"U3=-30\t\t#Change in energy in the 3-1 process in kJ/kg\n",
"Wt=30\t\t#Net work done per kg of fluid in kJ/kg\n",
"m=0.1\t\t#Mass of fluid in the cycle in kg\n",
"N=10\t\t#Number of cycles per sec in cycles/sec\n",
"\n",
"#Calculations\n",
"W1=Q1-U1\t#Work done in the 1-2 process in kJ/kg\n",
"U2=Q2-W2\t#Change in energy in the 2-3 process in kJ/kg\n",
"W3=Wt-W1-W2\t#Work done in the 3-1 process in kJ/kg\n",
"Q3=W3+U3\t#Heat developed in the process in kJ/kg\n",
"m1=m*N\t\t#mass flow rate per sec in kg/sec\n",
"P=Wt*m1\t\t#Rate of power in kW\n",
"\n",
"#Output\n",
"print'(a)Work done in the 1-2 process is',round(W1,1),\"kJ/kg\"\n",
"print'(b)Change in energy in the 2-3 process is',round(U2,1),\"kJ/kg\"\n",
"print'(c)Work done in the 3-1 process is',round(W3,1),\"kJ/kg\"\n",
"print'(d)Heat developed in the processis',round(Q3,1),\"kJ/kg\"\n",
"print'(e)mass flow rate per sec ',round(m1,1), \"kg/sec \"\n",
"print'(f)Rate of power is',round(P,2),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Work done in the 1-2 process is 30.0 kJ/kg\n",
"(b)Change in energy in the 2-3 process is 10.0 kJ/kg\n",
"(c)Work done in the 3-1 process is 40.0 kJ/kg\n",
"(d)Heat developed in the processis 10.0 kJ/kg\n",
"(e)mass flow rate per sec 1.0 kg/sec \n",
"(f)Rate of power is 30.0 kW\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.7 Page No. 94"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"m=3.0\t\t#Mass of substance in the system in kg\n",
"P1=500.0\t\t#Initial pressure of the system in kPa\n",
"P2=100.0\t\t#Final pressure of the system in kPa\n",
"V1=0.22\t\t#Initial volume of the system in m**3\n",
"n=1.2\t\t#Polytropic index \n",
"Q1=30.0\t\t#Heat transfer for the another process\n",
"\n",
"#Calculations\n",
"V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
"U=3.56*(P2*V2-P1*V1)\t#Total change in internal energy in kJ\n",
"W1=(P2*V2-P1*V1)/(1-n)\t#Work done for the 1-2 process in kJ\n",
"Q=U+W1\t\t\t#Heat developed in the process in kJ\n",
"W2=Q1-U\t\t#Work done for the another process in kJ\n",
"\n",
"#Output\n",
"print'(a)Total change in internal energy is',round(U,0), \"kJ\" \n",
"print'(b)Work done for the 1-2 process is',round(W1,2), \"kJ\" \n",
"print'(c)Heat developed in the process is',round(Q,0), \"kJ\" \n",
"print'(d)Work done for the another process is',round(W2,0), \"kJ\" \n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Total change in internal energy is -92.0 kJ\n",
"(b)Work done for the 1-2 process is 129.4 kJ\n",
"(c)Heat developed in the process is 37.0 kJ\n",
"(d)Work done for the another process is 122.0 kJ\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.8 Page No. 96"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"m=5\t\t#Mass of the substance in the system in kg\n",
"P1=500\t\t#Initial pressure of the system in kPa\n",
"P2=100\t\t#Final pressure of the system in kPa\n",
"V1=0.22\t\t#Initial volume of the system in m**3\n",
"n=1.2\t\t#Polytropic index\n",
"\n",
"#Calculations \n",
"V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
"U=3.5*(P2*V2-P1*V1)\t#Change in the internal energy of the system in kJ\n",
"W=(P1*V1-P2*V2)/(n-1)\t#Work developed in the process in kJ\n",
"Q=U+W\t\t\t#Heat transfer in the process in kJ\n",
"\n",
"#Output\n",
"print'Total change in Internal Energy is',round(U,0),\"KJ\" \n",
"print'Non flow work in the process is',round(W,2),\"KJ\" \n",
"print'Heat transfer of the process is',round(Q,0),\"KJ\" \n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Total change in Internal Energy is -91.0 KJ\n",
"Non flow work in the process is 129.4 KJ\n",
"Heat transfer of the process is 39.0 KJ\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.9 Page No. 97"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"p1=170\t\t#Initial pressure of the fluid in kPa\n",
"p2=400\t\t#Final pressure of the fluid in kPa\n",
"v1=0.03\t\t#Initial volume in m**3\n",
"v2=0.06\t\t#Final volume in m**3\n",
"\n",
"#Calculations\n",
"dU=3.15*((p2*v2)-(p1*v1))\t#The change in internal energy of the fluid in kJ\n",
"#P=a+b*V #Given relation \n",
"A = array([[1,v1], \n",
" [1,v2]])\n",
"b = array([p1,p2])\n",
"X = solve(A, b)\n",
"W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0))\t#The work done during the process in kJ\n",
"Q=U+W\t\t#The heat transfer in kJ\n",
"\n",
"#Output\n",
"print'(a)The direction and magnitude of work is',round(W,2),\"KJ\"\n",
"print'(b)The direction and magnitude of heat transfer is',round(Q,2),\"KJ\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The direction and magnitude of work is 8.55 KJ\n",
"(b)The direction and magnitude of heat transfer is 68.08 KJ\n"
]
}
],
"prompt_number": 30
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.11 Page No. 99"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"E1=4000\t\t#Enthalpy at entrance in kJ/Kg\n",
"E2=4100\t\t#Enthalpy at exit in kJ/kg\n",
"V1=50\t\t#Velocity at entrance in m/s\n",
"V2=20\t\t#Velocity at exit in m/s\n",
"h1=50\t\t#Height at the entrance \n",
"h2=10\t\t#Height at the exit\n",
"m=1\t\t#mass flow rate to the system in kJ/s\n",
"Q=200\t\t#Heat transfer rate to the system in kJ/s\n",
"g=9.8\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q\n",
"print'Power capacity of the system ',round(P,0),\"KW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Power capacity of the system 101.0 KW\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.12 Page No. 101"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"W=135\t\t#Work done by the system in kJ/kg\n",
"V1=0.37\t\t#Specific volume of fluid at inlet in m**3/kg\n",
"V2=0.62\t\t#Specific volume of fluid at outlet in m**3/kg\n",
"P1=600\t\t#Pressure at the inlet in kPa\n",
"P2=100\t\t#Pressure at the outlet in kPa\n",
"C1=16\t\t#Velocity at the inlet in m/s\n",
"C2=270\t\t#Velocity at the outlet in m/s\n",
"Z1=32\t\t#Inlet height from floor level in m\n",
"Z2=0\t\t#Outlet height from floor level in m\n",
"q=-9\t\t#Heat loss between inlet and discharge in kJ/kg\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q\n",
"\n",
"#Output\n",
"print'Specific Internal Energy decreases by ',round(U,2),\"kJ/kg\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Specific Internal Energy decreases by 20.01 kJ/kg\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.13 Page No. 102"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"m=5\t\t#Rate of fluid flow in the system in kg/s\n",
"P1=620\t\t#Pressure at the entrance in kPa\n",
"P2=130\t\t#Pressure at the exit in kPa\n",
"C1=300\t\t#Velocity at the entrance in m/s\n",
"C2=150\t\t#Velocity at the exit in m/s\n",
"U1=2100\t\t#Internal energy at the entrance in kJ/kg\n",
"U2=1500\t\t#Internal energy at the exit in kJ/kg\n",
"V1=0.37\t\t#Specific volume at entrance in m**3/kg\n",
"V2=1.2\t\t#Specific volume at exit in m**3/kg\n",
"Q=-30\t\t#Heat loss in the system during flow in kJ/kg\n",
"Z=0\t\t#Change in potential energy is neglected in m\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q\n",
"P=W*m#Power capacity of the system in kW\n",
"\n",
"#Output\n",
"print'(a)Total work done in the system ',round(W,1),\"kJ/kg\"\n",
"print'(b)Power capacity of the system',round(P,1),\"KW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" (a)Total work done in the system 676.4 kJ/kg\n",
"(b)Power capacity of the system 3382.0 KW\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.14 Page No. 103"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"P1=100\t\t#Pressure at Inlet in kPa\n",
"P2=500\t\t#Pressure at Exit in kPa\n",
"V1=0.6\t\t#Specific volume at Inlet in m**3/kg\n",
"V2=0.15\t\t#Specific volume at Exit in m**3/kg\n",
"U1=50\t\t#Specific internal energy at inlet in kJ/kg\n",
"U2=125\t\t#Specific internal energy at Exit in kJ/kg\n",
"C1=8\t\t#Velocity of air at Inlet in m/s\n",
"C2=4\t\t#Velocity of air at Exit in m/s\n",
"m=5\t\t#Mass flow rate of air in kg/s\n",
"Q=-45\t\t#Heat rejected to cooling water in kW\n",
"Z=0\t\t#Change in potential energy is neglected in m\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q\n",
"P1=-P\n",
"\n",
"#Output\n",
"print'The power required to drive the compressor',round(-P1,2),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power required to drive the compressor -494.88 kW\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.15 Page No. 104"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"m1=5000\t\t#Steam flow rate in kg/hr\n",
"Q1=-250\t\t#Heat loss from the turbine insulation to surroundings in kj/min\n",
"C1=40\t \t#Velocity of steam at entrance in m/s\n",
"h1=2500\t\t#Enthalpy of the steam at entrance in kJ/kg\n",
"C2=90\t\t #Velocity of the steam at the Exit in m/s\n",
"h2=2030\t\t#Enthalpy of the steam at exit in kj/kg\n",
"Z=0\t\t #Change in potential energy is neglected in m\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"m=m1/3600.0\t #Steam flow rate in kg/s\n",
"Q=Q1/60.0\t\t#Heat loss from the turbine to the surroundings\n",
"P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q\n",
"\n",
"#Output\n",
"print'The power developed by the turbine is',round(P,1),\"KW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power developed by the turbine is 643.1 KW\n"
]
}
],
"prompt_number": 19
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.16 Page No. 105"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"c1=16\t\t#Velocity of steam at entrance in m/s\n",
"c2=37\t\t#Velocity of steam at exit in m/s\n",
"h1=2990\t\t#Specific enthalpy of steam at entrance in kJ/kg\n",
"h2=2530\t\t#Specific enthalpy of steam at exit in kJ/kg\n",
"Q=-25\t\t#Heat lost to the surroundings in kJ/kg\n",
"m1=360000\t#The steam flow rate in kg/hr\n",
"\n",
"#Calculations\n",
"m=m1/3600.0 #The steam flow rate in kg/s\n",
"W=(c1**2-c2**2)/2000.0+(h1-h2)+Q\t#Total work done in the system in kJ/kg\n",
"P=m*W\t\t\t\t\t #Power developed by the turbine in kW\n",
"\n",
"#Output\n",
"print'The work output from the turbine is',round(P,1),\"kW \"\n",
"print'NOTE: In the book there is Calculation mistake'\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The work output from the turbine is 43444.3 kW \n",
"NOTE: In the book there is Calculation mistake\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.17 Page No.106"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"p1=720\t\t#Pressure at the entrance in kPa\n",
"t1=850\t\t#Temperature at the entrance in degree centigrade \n",
"c1=160\t\t#Velocity of the gas at entrance in m/s\n",
"Q=0\t\t#Insulation (adiabatic turbine)\n",
"P2=115\t\t#Pressure at the exit in kPa\n",
"t2=450\t\t#Temperature at the exit in degree centigrade\n",
"c2=250\t\t#Velocity of the gas at exit in m/s\n",
"cp=1.04\t\t#Specific heat of gas at constant pressure in kJ/kg-K\n",
"\n",
"#Calculations\n",
"H=cp*(t1-t2)\t\t\t#Change in Enthalpy of the gas at entrance and exit in kJ/kg\n",
"W=((c1**2-c2**2)/(2*1000))+(H)\t#External work output of the turbine in kJ/kg\n",
"\n",
"#Output\n",
"print'The external work output of the turbine is',round(W,0),\"kJ/kg\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The external work output of the turbine is 397.0 kJ/kg\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.18 Page No. 107"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"p=5000\t\t#Power output of an adiabatic steam turbine in kW\n",
"p1=2000\t\t#Pressure at the inlet in kPa\n",
"p2=0.15\t\t#Pressure at the exit in bar\n",
"t1=400\t\t#temperature at the inlet in degree centigrade\n",
"x=0.9\t\t#Dryness at the exit\n",
"c1=50\t\t#Velocity at the inlet in m/s\n",
"c2=180\t\t#Velocity at the exit in m/s\n",
"z1=10\t\t#Elevation at inlet in m\n",
"z2=6\t\t#Elevation at exit in m\n",
"h1=3248.7\t\t#Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg\n",
"hf=226\t\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
"hfg=2373.2\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"h2=hf+(x*hfg) #Enthalpy at the exit in kJ/kg\n",
"W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)\n",
"m=p/W\t\t\t\t\t\t \n",
"\n",
"#Output\n",
"print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),\"kJ/kg\"\n",
"print'(b)The mass flow rate of the steam is',round(m,1),\"kg/s\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The work done per unit mass of the steam flowing through turbine is 871.9 kJ/kg\n",
"(b)The mass flow rate of the steam is 5.7 kg/s\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.19 Page No. 108"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"p1=1000.0\t\t#Pressure at the inlet in kPa\n",
"t1=750.0\t\t#Temperature at the inlet in K\n",
"c1=200.0\t\t#Velocity at the inlet in m/s\n",
"p2=125.0\t\t#Pressure at the exit in kPa\n",
"c2=40.0\t\t #Velocity at the exit in m/s\n",
"m1=1000.0\t\t#Mass flow rate of air in kg/hr\n",
"cp=1.053\t\t#Specific heat at constant pressure in kJ/kgK\n",
"k=1.375\t\t #Adiabatic index\n",
"Q=0\t\t #The turbine is adiabatic\n",
"\n",
"#Calculations\n",
"m=m1/3600.0\t#The mass flow rate of air in kg/s\n",
"P=p2/p1\t\t#Ratio of the pressure\n",
"t2=t1*((p2/p1)**((k-1)/k))\t#Temperature of air at exit in K\n",
"h=cp*(t2-t1)\t\t#Change in enthalpy of the system in kJ\n",
"p=m*(((c2**2-c1**2)/(2*1000))+h)\t#Power output of the turbine in kW\n",
"p1=-p\t\t\t#Power output of the turbine in kW\n",
"\n",
"#Output\n",
"print'(a)Temperature of air at exit is',round(t2,2),\" K \"\n",
"print'(b)The power output of the turbine is',round(p1,1),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Temperature of air at exit is 425.37 K \n",
"(b)The power output of the turbine is 100.3 kW\n"
]
}
],
"prompt_number": 24
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.20 Page No. 110"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"c1=7\t\t #Velocity of air at entrance in m/s\n",
"c2=5\t\t #Velocity of air at exit in m/s\n",
"p1=100\t\t #Pressure at the entrance in kPa\n",
"p2=700\t\t #Pressure at the exit in kPa\n",
"v1=0.95\t\t#Specific volume at entrance in m**3/kg\n",
"v2=0.19\t\t#Specific volume at exit in m**3/kg\n",
"u=90\t\t # Change in internal energy of the air entering and leaving in kJ/kg\n",
"z=0\t\t #Potential energy is neglected \n",
"Q=-58\t\t #Heat rejected to the surroundings in kW\n",
"m=0.5\t\t #The rate at which air flow in kg/s\n",
"g=9.81\t\t #Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)\n",
"A=(v1*c2)/(v2*c1)\t#From continuity equation the ratio of areas\n",
"D=A**(1/2.0)\t #The ratio of inlet pipe diameter to the outlet pipe diameter\n",
"\n",
"#Output\n",
"print'(a)The rate of work input to the air is ',round(P,2),\"kW\"\n",
"print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The rate of work input to the air is -121.99 kW\n",
"(b)The ratio of inlet pipe diameter to the outlet pipe diameter is 1.89\n"
]
}
],
"prompt_number": 20
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.21 Page No. 112"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"h1=3000\t\t#Enthalpy of the fluid passing at inlet in kJ/kg\n",
"h2=2757\t\t#Enthalpy of the fluid at the discharge in kJ/kg\n",
"c1=60\t\t#Velocity of the fluid at inlet in m/s\n",
"A1=0.1\t\t#Inlet area of the nozzle in m**2\n",
"v1=0.187\t\t#Specific volume at inlet in m**3/kg\n",
"v2=0.498\t\t#Specific volume at the outlet in m**3/kg\n",
"q=0\t\t#Heat loss during the flow is negligable\n",
"z=0\t\t#The nozzle is horizontal so change in PE is constant\n",
"w=0\t\t#The work done is also negligable\n",
"\n",
"#Calculations\n",
"c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity at the exit in m/s\n",
"m=(A1*c1)/v1\t\t\t\t#The mass flow rate in kg/s\n",
"A2=(m*v2)/c2\t\t\t\t#Area at the exit of the nozzle in m**3\n",
"\n",
"#Output\n",
"print'(a)The velocity at the exit is',round(c2,1),\"m/s\"\n",
"print'(b)The mass flow rateis',round(m,1),\"kg/s\" \n",
"print'(c)Area at the exit is',round(A2,3),\"m**2\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The velocity at the exit is 699.7 m/s\n",
"(b)The mass flow rateis 32.1 kg/s\n",
"(c)Area at the exit is 0.023 m**2\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.22 Page No. 113"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"h1=3000\t\t#Specific enthalpy of steam at inlet in kJ/kg\n",
"h2=2762\t\t#Specific enthalpy of steam at the outlet in kJ/kg\n",
"v1=0.187\t\t#Specific volume of steam at inlet in m**3/kg\n",
"v2=0.498\t\t#Specific volume of steam at the outlet in m**3/kg\n",
"A1=0.1\t\t#Area at the inlet in m**2\n",
"q=0\t\t#There is no heat loss\n",
"z=0\t\t#The nozzle is horizontal ,so no change in PE\n",
"c1=60\t\t#Velocity of the steam at the inlet in m/s\n",
"\n",
"#Calculations\n",
"c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity of the steam at the outlet in m/s\n",
"m=(A1*c1)/v1\t\t\t\t#Mass flow rate of steam in kg/s\n",
"A2=(m*v2)/c2\t\t\t\t#Area at the nozzle exit in m**2\n",
"\n",
"#Output\n",
"print'(a)Velocity of the steam at the outlet is ',round(c2,2), \"m/s \"\n",
"print'(b)Mass flow rate of steam is ',round(m,2),\"kg/s \"\n",
"print'(c)Area at the nozzle exit is',round(A2,3),\"m**2\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Velocity of the steam at the outlet is 692.53 m/s \n",
"(b)Mass flow rate of steam is 32.09 kg/s \n",
"(c)Area at the nozzle exit is 0.023 m**2\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.23 Page No. 114"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"c1=40\t\t#Velocity of air at the inlet of nozzle in m/s\n",
"h=180\t\t#The decrease in enthalpy in the nozzle in kJ/kg\n",
"w=0\t\t#Since adiabatic\n",
"q=0\t\t#Since adiabatic\n",
"z=0\t\t#Since adiabatic\n",
"\n",
"#Calculations\n",
"c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0)\t#The exit velocity of air in m/s\n",
"\n",
"#Output\n",
"print'The exit velocity of the air is',round(c2,1),\"m/s\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The exit velocity of the air is 600.0 m/s\n"
]
}
],
"prompt_number": 32
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.24 Page No. 115"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Input data\n",
"p1=100\t\t#Pressure at the inlet of the compressor in kPa\n",
"p2=500\t\t#Pressure at the outlet of the compressor in kPa\n",
"v1=3\t\t#Volume of the air at the inlet of the compressor in m**3/kg\n",
"v2=0.8\t\t#Volume of the air at the outlet of the compressor in m**3/kg\n",
"c1=25\t\t#The velocity of air at the inlet of the compressor in m/s\n",
"c2=130\t\t#The velocity of air at the outlet of the compressor in m/s\n",
"z=12\t\t#The height of delivery connection above the inlet in m\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"n=1.3\t\t#Polytropic index\n",
"\n",
"#Calculations\n",
"W=((n)*(p1*v1-p2*v2))/(n-1)\t#Workdone for open system polytropic process in kJ/kg\n",
"K=((c2**2-c1**2)/2000.0)\t#Change in kinetic energy of the system in kJ/kg\n",
"P=g*(z)/1000.0 \t\t#Change in potential energy of the system in kJ/kg\n",
"w=W-K-P\t\t\t #The shaft work of the compressor in kJ/kg\n",
"\n",
"#Output\n",
"print'The Shaft work of the compressor ',round(w,1),\"kj/kgIt is the power absorbing system\"\n",
"if w<0:\n",
" print'It is the power absorbing system'\n",
"else:\n",
" print'It is not power absorbing system'\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The Shaft work of the compressor -441.6 kj/kgIt is the power absorbing system\n",
"It is the power absorbing system\n"
]
}
],
"prompt_number": 38
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.25 Page No. 117"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#Input data\n",
"m=10\t\t#The rate of fluid compressed adiabatically in kg/s\n",
"p1=500\t\t#Initial pressure of the process in kPa\n",
"p2=5000\t\t#Final pressure of the process in kPa\n",
"v=0.001\t\t#The specific volume of the fluid in m**3/kg\n",
"\n",
"#Calculations\n",
"P=m*v*(p2-p1)\t#The power required in kW\n",
"\n",
"#Output\n",
"print'The power required is',round(P,2),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power required is 45.0 kW\n"
]
}
],
"prompt_number": 40
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.26 Page No. 117"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"#Input data\n",
"m=2.0\t\t#Mass flow rate of air in kg/s\n",
"t1=20\t\t#Initial temperature of the air in degree centigrade\n",
"P=-30\t\t#The amount of power consumed in kW\n",
"c1=100\t\t#The inlet velocity of air in m/s\n",
"c2=150\t\t#The outlet velocity of air in m/s\n",
"R=0.287\t\t#The gas constant for air in kJ/kg-K\n",
"g=1.4\t\t#It is the adiabatic index\n",
"cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
"q=0\t\t#Heat developed as it is adiabatic condition\n",
"z=0\t\t#The change in potential energy is neglected\n",
"\n",
"#Calculations\n",
"h=(P/m)+((c2**2-c1**2)/(2*1000))\t\t#The change in enthalpy of the system in kJ/kg\n",
"t=h/cp\t\t#The change in temperature of the system in degree centigrade\n",
"t2=t1-t\t\t#The exit air temperature in degree centigrade\n",
"\n",
"#Output\n",
"print'The exit air temperature is is',round(t2,2),\"C\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The exit air temperature is is 28.96 C\n"
]
}
],
"prompt_number": 26
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.27 Page No. 119"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#Input data\n",
"m=0.6\t\t#Mass flow rate of air in kg/s\n",
"W=40\t\t#Power required to run the compressor in kW\n",
"p1=100\t\t#Initial pressure at the inlet of the compressor in kPa\n",
"t1=30\t\t#Initial temperature at the inlet of the compressor in degree centigrade\n",
"z=0\t\t#Change in potential energy is neglected\n",
"c=0\t\t#Change in kinetic energy is neglected\n",
"q=0.4\t\t#Heat lost to the cooling water ,bearings and frictional effects is 40% of input\n",
"cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
"\n",
"#Calculations\n",
"Q=q*W\t\t#Net heat losses from the system in kW\n",
"H=W-Q\t\t#Change in total enthalpy of the system in kW\n",
"t2=(H/(m*cp))+t1\t#The exit air temperature in degree centigrade\n",
"\n",
"#Output\n",
"print'The exit air temperature is',round(t2,0),\"C\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The exit air temperature is 70.0 C\n"
]
}
],
"prompt_number": 46
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.28 Page No. 120"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#Input data\n",
"m1=100\t\t#Air flow rate in kg/hr\n",
"q1=600\t\t#The heat generated by each person in kJ/hr\n",
"h1=85\t\t#The enthalpy of air entering the room in kJ/kg\n",
"h2=60\t\t#The enthalpy of air leaving the room in kJ/kg\n",
"Q1=0.2\t\t#The heat added by each lamp in the room in kW\n",
"P1=0.2\t\t#The power consumed by each fan in kW\n",
"\n",
"#Calculations\n",
"q=(5*q1)/3600.0\t#The heat generated by 5 persons in the room in kW\n",
"Q=3*Q1\t\t #The heat added by three lamps in the room in kW\n",
"P=2*P1\t\t #The power consumed by two fans in the room in kW\n",
"m=m1/3600.0\t\t #Mass flow rate of air in kg/s\n",
"H=(q+Q+P)+(m*(h1-h2))\t#Heat to be removed by the cooler in kW\n",
"\n",
"#Output\n",
"print'The rate at which the heat is to be removed by cooler X is',round(H,1),\"kJ/sec\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The rate at which the heat is to be removed by cooler X is 2.5 kJ/sec\n"
]
}
],
"prompt_number": 34
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.29 Page No. 121"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"#Input data\n",
"p1=1000\t\t#Pressure at the inlet of the system in kPa\n",
"p2=15\t\t#Pressure at the outlet of the system in kPa\n",
"v1=0.206\t\t#Specific volume at the inlet of the system in m**3/kg\n",
"v2=8.93\t\t#Specific volume at the outlet of the system in m**3/kg\n",
"h1=2827\t\t#Specific enthalpy at the inlet of the system in kJ/kg\n",
"h2=2341\t\t#Specific enthalpy at the outlet of the system in kJ/kg\n",
"c1=20\t\t#Velocity at the inlet of the system in m/s\n",
"c2=120\t\t#Velocity at the outlet of the system in m/s\n",
"z1=3.2\t\t#Elevation at the inlet of the system in m\n",
"z2=0.5\t\t#Elevation at the outlet of the system in m\n",
"m=2.1\t\t#The fluid flow rate in kg/s\n",
"W=750\t\t#The work output of the device in kW\n",
"g=9.81\t\t#Gravitational constant in m/s**2\n",
"\n",
"#Calculations\n",
"Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W #The heat loss/gain by the system in kW\n",
"\n",
"#Output\n",
"print'The Heat loss by the system is',round(Q,1),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The Heat loss by the system is -256.0 kW\n"
]
}
],
"prompt_number": 50
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.30 Page No. 122"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#Input data\n",
"t1=15\t\t#The inlet temperature of the air passing through the heat exchanger in degree centigrade\n",
"c1=30\t\t#The inlet velocity of air in m/s\n",
"t2=800\t\t#The outlet temperature of the air from heat exchanger in degree centigrade \n",
"c2=30\t\t#The inlet velocity of air to the turbine in m/s\n",
"t3=650\t\t#The outlet temperature of the air from the turbine in degree centigrade\n",
"c3=60\t\t#The outlet velocity of the air from turbine in m/s\n",
"t4=500\t\t#The temperature at the outlet of the nozzle in degree centigrade\n",
"m=2\t\t #Air flow rate in kg/s\n",
"cp=1.005\t\t#Specific heat at constant pressure in kJ/kgK\n",
"\n",
"#Calculations\n",
"Qh=m*cp*(t2-t1)\t#Rate of heat transfer to the air in the heat exchanger in kJ/s\n",
"P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0))\t\t#Power output from the turbine in kW\n",
"c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0)\t\t#Velocity of air at exit from nozzle in m/s\n",
"\n",
"#Output \n",
"print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),\"kJ/s\"\n",
"print'(b)Power output from the turbine is',round(P,1),\"kW\"\n",
"print'(c)Velocity of air at exit from nozzle is',round(c4),\"m/s\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)Rate of heat transfer to the air in the heat exchanger is 1577.8 kJ/s\n",
"(b)Power output from the turbine is 298.8 kW\n",
"(c)Velocity of air at exit from nozzle is 552.0 m/s\n"
]
}
],
"prompt_number": 40
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.31 Page No. 123"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Input data\n",
"p1=400.0\t\t#Initial pressure of the gas in a turbine in kPa\n",
"t1=573.0\t\t#Initial temperature of the gas in a turbine in K\n",
"p2=100.0\t\t#Final pressure of the gas in a turbine in kPa\n",
"V=2.5\t\t #It is the ratio of final volume to the inlet volume \n",
"c2=50.0\t\t#Velocity of the gas at exit in m/s\n",
"P=1000.0\t\t#Power developed by the turbine in kW\n",
"cp=5.193\t\t#Specific heat of the helium at constant pressure in kJ/kg K\n",
"G=8.314\t\t#Gas constant in kNm/kgK\n",
"M=4.0\t\t #Molecular weight of the helium\n",
"\n",
"#Calculations\n",
"import math\n",
"R=G/M\t\t #Characteristic gas constant in kNm/kgK\n",
"v1=(R*t1)/p1\t#Specific volume at the inlet in m**3/kg\n",
"v2=V*v1\t \t#Specific volume at the outlet in m**3/kg\n",
"n=math.log(p2/p1)/math.log(v1/v2)\t#Polytropic index \n",
"t2=((t1)*((p2/p1)**((n-1)/n)))\t\t#Final temperature of the gas in a turbine in K\n",
"w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1)))\t#Specific work in kJ/kg\n",
"K=c2**2/(2*1000)\t\t\t#Change in kinetic energy in kJ/kg\n",
"Ws=w-K\t\t\t#Work done by the shaft in kJ/kg\n",
"q=Ws+(cp*(t2-t1))+K\t#The heat transfer during the process in kJ/kg\n",
"m=P/Ws\t\t\t#Mass flow rate of gas required in kg/s\n",
"A2=(m*v2)/c2\t\t#Exit area of the turbine in m**2\n",
"\n",
"#Output\n",
"print'(a)The mass flow rate of the gas required is',round(m,3),\"kg/s\" \n",
"print'(b)The heat transfer during the process is',round(q,1), \"kJ/kg\" \n",
"print'(c)Exit area of the turbine is ',round(A2,3),\"m**2\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a)The mass flow rate of the gas required is 0.76 kg/s\n",
"(b)The heat transfer during the process is 201.5 kJ/kg\n",
"(c)Exit area of the turbine is 0.113 m**2\n"
]
}
],
"prompt_number": 31
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}