summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Thermodynamics/Chapter6.ipynb
diff options
context:
space:
mode:
authorhardythe12015-04-07 15:58:05 +0530
committerhardythe12015-04-07 15:58:05 +0530
commit92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch)
tree205e68d0ce598ac5caca7de839a2934d746cce86 /Fundamentals_Of_Thermodynamics/Chapter6.ipynb
parentb14c13fcc6bb6d01c468805d612acb353ec168ac (diff)
downloadPython-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip
added books
Diffstat (limited to 'Fundamentals_Of_Thermodynamics/Chapter6.ipynb')
-rwxr-xr-xFundamentals_Of_Thermodynamics/Chapter6.ipynb566
1 files changed, 566 insertions, 0 deletions
diff --git a/Fundamentals_Of_Thermodynamics/Chapter6.ipynb b/Fundamentals_Of_Thermodynamics/Chapter6.ipynb
new file mode 100755
index 00000000..2548c7ee
--- /dev/null
+++ b/Fundamentals_Of_Thermodynamics/Chapter6.ipynb
@@ -0,0 +1,566 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:084379625b3dc39247a3be2201f659a82e58d8004d66338e0ef15cb00bca073d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter6:FIRST-LAW ANALYSIS FOR A CONTROL VOLUME"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:pg-182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1\n",
+ "#calculating mass flow rate in kg/s\n",
+ "import math\n",
+ "R=0.287 #in kJ/kg-K\n",
+ "T=25 #temperature in celsius\n",
+ "P=150 #pressure in kPa\n",
+ "v=R*(T+273.15)/P #specific volume in m^3/kg\n",
+ "D=0.2 #diameter of pipe in metre\n",
+ "A=math.pi*D**2/4 #cross sectional area in m^2\n",
+ "V=0.1 #velocity of air in m/s\n",
+ "m=V*A/v #mass flow rate in kg/s\n",
+ "print\"\\n hence,the mass flow rate is\",round(m,4),\"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence,the mass flow rate is 0.0055 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:pg-184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2\n",
+ "#work done for adding the fluid\n",
+ "\n",
+ "P=600 #pressure in kPa\n",
+ "m=1 #in kg\n",
+ "v=0.001 #specific volume in m^3/kg\n",
+ "W=P*m*v #necessary work in kJ for adding the fluid \n",
+ "print\" \\n hence,the work involved in this process is\",round(W,4),\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n",
+ " hence,the work involved in this process is 0.6 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:pg-188"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3\n",
+ "#rate of flow of water\n",
+ "\n",
+ "hir=441.89 #in kJ/kg for refrigerant using steam table \n",
+ "her=249.10 #in kJ/kg for refrigerant using steam table\n",
+ "hiw=42 #in kJ/kg for water using steam table\n",
+ "hew=83.95 #in kJ/kg for water using steam table\n",
+ "mr=0.2 #the rate at which refrigerant enters the condenser in kg/s\n",
+ "mw=mr*(hir-her)/(hew-hiw) #rate of flow of water in kg/s\n",
+ "print\"\\n hence,the rate at which cooling water flows thorugh the condenser is\",round(mw,3),\"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence,the rate at which cooling water flows thorugh the condenser is 0.919 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:pg-190"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4\n",
+ "#determining quality of steam\n",
+ "\n",
+ "hi=2850.1 #initial specific heat enthalpy for steam in kJ/kg\n",
+ "Vi=50 #initial velocity of steam in m/s\n",
+ "Ve=600 #final velocity of steam in m/s\n",
+ "he=hi+Vi**2/(2*1000)-Ve**2/(2*1000) #final specific heat enthalpy for steam in kJ/kg\n",
+ "hf=467.1 #at final state in kJ/kg\n",
+ "hfg=2226.5 #at final state in kJ/kg\n",
+ "xe=(he-hf)/hfg #quality of steam in final state\n",
+ "print\" \\n hence, the quality is\",round(xe,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n",
+ " hence, the quality is 0.99\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:pg-193"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 5\n",
+ "#quality of ammonia leaving expansion valve\n",
+ "\n",
+ "hi=346.8 #specific heat enthalpy for ammonia at initial state in kJ/kg\n",
+ "he=hi #specific heat enthalpy for ammonia at final state will be equal that at initial state because it is a throttling process\n",
+ "hf=134.4 #at final state in kJ/kg\n",
+ "hfg=1296.4#at final state in kJ/kg\n",
+ "xe=(he-hf)*100/hfg #quality at final state\n",
+ "print\"\\n hence,quality of the ammonia leaving the expansion valve is\",round(xe,2),\"%\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence,quality of the ammonia leaving the expansion valve is 16.38 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:pg-194"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6\n",
+ "#power output of turbine in kW\n",
+ "\n",
+ "hi=3137 #initial specific heat of enthalpy in kJ/kg\n",
+ "he=2675.5 #final specific heat of enthalpy in kJ/kg\n",
+ "Vi=50.0 #initial velocity of steam in m/s\n",
+ "Ve=100 #final velocity of steam in m/s\n",
+ "Zi=6 #height of inlet conditions in metres\n",
+ "Ze=3 #height of exit conditions in metres\n",
+ "m=1.5 #mass flow rate of steam in kg/s\n",
+ "g=9.8066 #acc. due to gravity in m/s^2\n",
+ "Qcv=-8.5 #heat transfer rate from turbine in kW\n",
+ "Wcv=Qcv+m*(hi+Vi**2/(2*1000)+g*Zi/1000)-m*(he+Ve**2/(2*1000)+g*Ze/1000) #power output of turbine in kW\n",
+ "print\"\\n hence,the power output of the turbine is\",round(Wcv,1),\"kW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence,the power output of the turbine is 678.2 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:pg-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 7\n",
+ "#heat transfer rate in aftercooler\n",
+ "\n",
+ "V1=0 #we assume initial velocity to be zero because its given that it enters with a low velocity\n",
+ "V2=25.0 #final velocity with which carbon dioxide exits in m/s\n",
+ "h2=401.52 #final specific enthalpy of heat when carbon dioxide exits in kJ/kg\n",
+ "h1=198 #initial specific enthalpy of heat in kJ/kg\n",
+ "w=h1-h2-V2**2/(2*1000) #in kJ/kg\n",
+ "Wc=-50 #power input to the compressor in kW\n",
+ "m=Wc/w #mass flow rate of carbon dioxide in kg/s\n",
+ "h3=257.9 #final specific enthalpy of heat when carbon dioxide flows into a constant pressure aftercooler\n",
+ "Qcool=-m*(h3-h2) #heat transfer rate in the aftercooler in kW\n",
+ "print\" \\n hence,heat transfer rate in the aftercooler is\",round(Qcool,1),\"kW\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n",
+ " hence,heat transfer rate in the aftercooler is 35.2 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.8:pg-197"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8\n",
+ "#Required pump work\n",
+ "\n",
+ "m=1.5 #mass flow rate of water in kg/s\n",
+ "g=9.807 #acceleration due to gravity in m/s^2\n",
+ "Zin=-15 #depth of water pump in well in metres\n",
+ "Zex=0 #in metres\n",
+ "v=0.001001 #specific volume in m^3/kg\n",
+ "Pex=400+101.3 #exit pressure in kPa\n",
+ "Pin=90 #in kPa\n",
+ "W=m*(g*(Zin-Zex)*0.001-(Pex-Pin)*v) #power input in kW\n",
+ "print\" \\n Hence, the pump requires power of input is\",-round(W,2),\"kW\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n",
+ " Hence, the pump requires power of input is 0.84 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:pg-198"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 9\n",
+ "#heat tranfer in simple steam power plant\n",
+ "\n",
+ "h1=3023.5 #specific heat of enthalpy of steam leaving boiler in kJ/kg\n",
+ "h2=3002.5 #specific heat of enthalpy of steam entering turbine in kJ/kg\n",
+ "x=0.9 #quality of steam entering condenser\n",
+ "hf=226 #in kJ/kg\n",
+ "hfg=2373.1 #in kJ/kg\n",
+ "h3=hf+x*hfg #specific heat of enthalpy of steam entering condenser in kJ/kg\n",
+ "h4=188.5 #specific heat of enthalpy of steam entering pump in kJ/kg\n",
+ "q12=h2-h1 #heat transfer in line between boiler and turbine in kJ/kg\n",
+ "w23=h2-h3 #turbine work in kJ/kg\n",
+ "q34=h4-h3 #heat transfer in condenser\n",
+ "w45=-4 #pump work in kJ/kg\n",
+ "h5=h4-w45 #in kJ/kg\n",
+ "q51=h1-h5 #heat transfer in boiler in kJ/kg\n",
+ "print\"\\n hence, heat transfer in line between boiler and turbine is\",round(q12,1),\"kJ/kg\" \n",
+ "print\"\\n hence, turbine work is\",round(w23,1),\"kJ/kg\" \n",
+ "print\"\\n hence, heat transfer in condenser is \",round(q34,1),\"kJ/kg\" \n",
+ "print\"\\n hence, heat transfer in boiler is \",round(q51,1),\"kJ/kg\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence, heat transfer in line between boiler and turbine is -21.0 kJ/kg\n",
+ "\n",
+ " hence, turbine work is 640.7 kJ/kg\n",
+ "\n",
+ " hence, heat transfer in condenser is -2173.3 kJ/kg\n",
+ "\n",
+ " hence, heat transfer in boiler is 2831.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.10:pg-200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 10\n",
+ "#analysis of refrigerator\n",
+ "\n",
+ "hf4=167.4 #in kJ/kg\n",
+ "hfg4=215.6 #in kJ/kg\n",
+ "h3=241.8 #specific heat of enthalpy of R-134a entering expansion valve\n",
+ "h4=h3 #specific heat of enthalpy of R-134a leaving expansion valve\n",
+ "h1=387.2 #in kJ/kg\n",
+ "h2=435.1 #in kJ/kg\n",
+ "x4=(h3-hf4)/hfg4 #quality of R-134a at evaporator inlet\n",
+ "m=0.1 #mass flow rate in kg/s\n",
+ "Qevap=m*(h1-h4) #rate of heat transfer to the evaporator\n",
+ "Wcomp=-5 #power input to compressor in kW\n",
+ "Qcomp=m*(h2-h1)+Wcomp #rate of heat transfer from compressor\n",
+ "print\"\\n hence, the quality at the evaporator inlet is \",round(x4,3), \n",
+ "print\"\\n hence, the rate of heat transfer to the evaporator is \",round(Qevap,2),\n",
+ "print\"\\n hence, rate of heat transfer from the compressor is\",round(Qcomp,2), "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " hence, the quality at the evaporator inlet is 0.345 \n",
+ " hence, the rate of heat transfer to the evaporator is 14.54 \n",
+ " hence, rate of heat transfer from the compressor is -0.21\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.11:pg-204"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 11\n",
+ "#Determining the final temperature of steam\n",
+ "\n",
+ "u2=3040.4 #final internal energy in kJ/kg\n",
+ "hi=u2 #in kJ/kg\n",
+ "P2=1.4 #final Pressure in MPa\n",
+ "print\"Since, the final pressure is given as 1.4 MPa,we know two properties at the final state and hence,final state can be determined.The temperature corresponding to a pressure of 1.4 MPa and an internal energy of 3040.4 kJ/kg is found to be \"\n",
+ "T2=452 #final temperature in Celsius"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Since, the final pressure is given as 1.4 MPa,we know two properties at the final state and hence,final state can be determined.The temperature corresponding to a pressure of 1.4 MPa and an internal energy of 3040.4 kJ/kg is found to be \n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.12:pg-206"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 12\n",
+ "#Calculating mass flow of steam in tank\n",
+ "\n",
+ "V1=0.4 #initial volume fo tank in m^3\n",
+ "v1=0.5243 #initial specific volume in m^3/kg\n",
+ "h1=3040.4 #initial specific enthalpy in kJ/kg\n",
+ "u1=2548.9 #initial specific internal energy in kJ/kg\n",
+ "m1=V1/v1 #initial mass of steam in tank in kg\n",
+ "V2=0.4 #final volume in m^3\n",
+ "print\"let x=V*(h1-u2)/v2-m1*(h1-u1).If we assume T2=300C, then v2=0.1823m^3/kg ,u2=2785.2kJ/kg and x=+ve.If we assume T2=350C,then v2=0.2003 m^3/kg, u2=2869.1kJ/kg and x=-ve.Hence,actualt T2 must be between these two assumed values in order that x=0.By interplotation\" \n",
+ "T2=342 #final temperature in Celsius\n",
+ "v2=0.1974 #final specific volume in m^3/kg\n",
+ "m2=V2/v2 #final mass of the steam in the tank in kg\n",
+ "m=m2-m1 #mass of steam that flowsinto the tank\n",
+ "print\" \\n Hence,mass of the steam that flows into the tank is\",round(m,3),\"kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "let x=V*(h1-u2)/v2-m1*(h1-u1).If we assume T2=300C, then v2=0.1823m^3/kg ,u2=2785.2kJ/kg and x=+ve.If we assume T2=350C,then v2=0.2003 m^3/kg, u2=2869.1kJ/kg and x=-ve.Hence,actualt T2 must be between these two assumed values in order that x=0.By interplotation\n",
+ " \n",
+ " Hence,mass of the steam that flows into the tank is 1.263 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.13:pg-207"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 13\n",
+ "#Calculating mass flow of steam in tank\n",
+ "\n",
+ "vf1=0.001725 #in m^3/kg\n",
+ "vf2=0.0016 #in m^3/kg\n",
+ "uf1=368.7 #in kJ/kg\n",
+ "uf2=226 #in kJ/kg\n",
+ "vg1=0.08313 #in m^3/kg\n",
+ "vfg2=0.20381\n",
+ "ug1=1341 #in kJ/kg\n",
+ "ufg2=1099.7 #in kJ/kg\n",
+ "Vf=1 #initial volume of liquid in m^3\n",
+ "Vg=1 #initial volume of vapor in m^3\n",
+ "mf1=Vf/vf1 #initial mass of liquid in kg\n",
+ "mg1=Vg/vg1 #initial mass of vapor in kg\n",
+ "m1=mf1+mg1 #initial mass of liquid in kg\n",
+ "he=1461.1 #in kJ/kg\n",
+ "V=2 #volume of tank in m^3\n",
+ "print\"m1u1=mf1*uf1+mg1*ug1.If x2 is the quality,then m2=V/v2=2/(0.00160+0.20381*x2) and u2=uf2+x2*ufg2=226.0+1099.7*x2.\"\n",
+ "print\"Also,m2*(he-u2)=m1*he-m1u1.From this equation,we will get an equation for x2.\"\n",
+ "x2=((2*1461.1)-(2*226)-(0.00160*634706))/((634706*0.20381)+(2*1099.7)) #quality of ammonia\n",
+ "v2=0.00160+(0.20381*x2) #final specific volume in m^3/kg\n",
+ "m2=V/v2 #final mass of ammonia in kg\n",
+ "m=m1-m2 #mass of ammonia withdrawn\n",
+ "print\" \\n Hence,mass of ammonia withdrawn is\",round(m,1),\"kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "m1u1=mf1*uf1+mg1*ug1.If x2 is the quality,then m2=V/v2=2/(0.00160+0.20381*x2) and u2=uf2+x2*ufg2=226.0+1099.7*x2.\n",
+ "Also,m2*(he-u2)=m1*he-m1u1.From this equation,we will get an equation for x2.\n",
+ " \n",
+ " Hence,mass of ammonia withdrawn is 72.7 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file