diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Thermodynamics_Demystified_by_Merle_C._Potter | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'Thermodynamics_Demystified_by_Merle_C._Potter')
22 files changed, 4647 insertions, 0 deletions
diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter1_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter1_2.ipynb new file mode 100755 index 00000000..68c66861 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter1_2.ipynb @@ -0,0 +1,209 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2622b864e241f67942d9af83d84aabbbf519132ac138f1180d8869df35c708b4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 1 : Basic Principles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.2 : PG-9 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=10 # mass in Kg\n",
+ "V=5 # velocity in m/s\n",
+ "\n",
+ "KE=m*V**2/2 # kinetic energy in N-m \n",
+ "print \"The Kinetic Energy is \",round(KE),\" N.m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Kinetic Energy is 125.0 N.m\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.3 : PG-10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "V= 3*5*20; # Volume of air in m^3 from dimensions\n",
+ "m= 350.0; # mass in kg\n",
+ "g= 9.81; # gavitational acceleration in m/s^2\n",
+ "\n",
+ "rho=m/V;# density\n",
+ "print \" The Density is \",round(rho,3),\"kg/m^3 \\n\"\n",
+ "\n",
+ "v= 1/rho # specific volume of air\n",
+ "print \" The specific volume is\", round(v,3),\"m^3/kg \\n\"\n",
+ "\n",
+ "gama= rho*g # specific weight of air\n",
+ "print \" The specific weight is\", round(gama,2),\" N/m^3\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Density is 1.167 kg/m^3 \n",
+ "\n",
+ " The specific volume is 0.857 m^3/kg \n",
+ "\n",
+ " The specific weight is 11.45 N/m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 78
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.4 : PG-13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "h=0.020 # height of mercury in m\n",
+ "gammawater=9810 # specific weight of water in N/m^3\n",
+ "Patm=0.7846*101.3 # atmospheric pressure in kPa from table B.1\n",
+ "\n",
+ "Pgauge=13.6*gammawater*h/1000 # pressure in Pascal from condition gammaHg=13.6*gammawater\n",
+ "\n",
+ "P=(Pgauge+Patm)# absolute pressure in KPa\n",
+ "#result\n",
+ "print \"The Pressure is\",round(P,2),\" kPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Pressure is 82.15 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 79
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.5 : PG-13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "d=10.0/100 # diameter of cylinder in 'm'\n",
+ "P=600 # pressure in KPa\n",
+ "Patm=100 # atmospheric pressure in Kpa\n",
+ "K=4.8*1000 # spring constant in N/m \n",
+ "\n",
+ "deltax=(P-Patm)*(math.pi*1000*d**2)/(4*K) # by balancing forces on piston\n",
+ "#result\n",
+ "print \"The Compression in spring is\",round(deltax,3),\" m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Compression in spring is 0.818 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 80
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.6 : PG-16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "ma=2200 # mass of Automobile 'a' in kg\n",
+ "va=25 #velocity of Automobile 'a' in m/s before collision\n",
+ "va1=13.89 # velocity of Automobile 'a' after collision in m/s\n",
+ "mb=1000 # mass of Automobile 'b' in kg\n",
+ "vb=24.44 #velocity of Automobile 'b' after collision in m/s\n",
+ "\n",
+ "KE1=(ma*va**2)/2 # kinetic energy before collision\n",
+ "KE2=(ma*va1**2)/2+(mb*vb**2)/2 # kinetic energy after collision\n",
+ "U=(KE1-KE2)/1000 # internal energy from conservation of energy principle in kJ\n",
+ "#result\n",
+ "print \"The increase in kinetic energy is of\",round(U,1),\" kJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The increase in kinetic energy is of 176.6 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 81
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter2_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter2_2.ipynb new file mode 100755 index 00000000..d8357657 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter2_2.ipynb @@ -0,0 +1,322 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:63ec806cc789e6d4e52abc481b4c69dbae196d3a1063d71df1549638fb7b9752"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:Properties of Pure Substances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.1, PG-28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "m=10; #mass of saturated water in kg\n",
+ "\n",
+ " # All the necessary values are taken from table C.2\n",
+ " \n",
+ "# part (a)\n",
+ " \n",
+ "P=0.001; # Pressure in MPa\n",
+ "vf=0.001; #specific volume of saturated liquid at 0.001 Mpa in Kg/m^3\n",
+ "vg=129.2; # specific volume of saturated vapour at 0.001 Mpa in Kg/m^3\n",
+ "deltaV=m*(vg-vf) # by properties of pure substance \n",
+ "# result\n",
+ "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV),\" m^3 \\n\"\n",
+ "\n",
+ "# part (b) \n",
+ "\n",
+ "P=0.26; # Pressure in MPa\n",
+ "vf=0.0011; # specific volume of saturated liquid at 0.26 MPa( it is same from at 0.2 and 0.3 MPa upto 4 decimals)\n",
+ "vg=(P-0.2)*(0.6058-0.8857)/(0.3-0.2)+0.8857; # specific volume of saturated vapour by interpolation of Values at 0.2 MPa and 0.3 MPa\n",
+ "deltaV=m*(vg-vf) # by properties of pure substance \n",
+ "# result\n",
+ "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,2),\" m^3 \\n\"\n",
+ "\n",
+ "# part (c) \n",
+ "P=10; # Pressure in MPa\n",
+ "vf=0.00145; # specific volume of saturated liquid at 10 MPa\n",
+ "vg=0.01803; # specific volume of saturated vapour at 10 MPa\n",
+ "deltaV=m*(vg-vf) # by properties of pure substance \n",
+ "# result\n",
+ "print \"The Volume change at pressure \",(P),\" MPa is\",round(deltaV,4),\" m^3 \\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Volume change at pressure 0.001 MPa is 1292.0 m^3 \n",
+ "\n",
+ "The Volume change at pressure 0.26 MPa is 7.17 m^3 \n",
+ "\n",
+ "The Volume change at pressure 10 MPa is 0.1658 m^3 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.2, PG-29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=4.0 # mass of water in kg\n",
+ "V=1.0 # volume in m^3\n",
+ "T=150 # temperature of water in degree centigrade\n",
+ "\n",
+ "# TABLE C.1 is used for values in wet region\n",
+ "# Part (a)\n",
+ "P=475.8 # pressure in KPa in wet region at temperature of 150 *C\n",
+ "print \" The pressure is\",round(P,2),\" kPa \\n\"\n",
+ "\n",
+ "# Part (b)\n",
+ "#first we determine the dryness fraction\n",
+ "v=V/m # specific volume of water\n",
+ "vg=0.3928 # specific volume of saturated vapour @150 degree celsius\n",
+ "vf=0.00109 # specific volume of saturated liquid @150 degree celsius\n",
+ "x=(v-vf)/(vg-vf); # dryness fraction\n",
+ "mg=m*x; # mass of vapour\n",
+ "print \" The mass of vapour present is\",round(mg,3),\" kg \\n\"\n",
+ "\n",
+ "# Part(c) \n",
+ "Vg=mg*vg; # volume of vapour\n",
+ "print \" The volume of vapour is\",round(Vg,3),\" m^3\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The pressure is 475.8 kPa \n",
+ "\n",
+ " The mass of vapour present is 2.542 kg \n",
+ "\n",
+ " The volume of vapour is 0.998 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.3, PG-29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=2 # mass of water in kg\n",
+ "P=220 # pressure in KPa\n",
+ "x=0.8 # quality of steam\n",
+ "\n",
+ "# Table C.2 is used for values\n",
+ "\n",
+ "vg=(P-200)*(0.6058-0.8857)/(300-200)+0.8857 # specific volume of saturated vapour @ given pressure by interpolating\n",
+ "vf=0.0011 # specific volume of saturated liquid @ 220 KPa\n",
+ "v=vf+x*(vg-vf)# property of pure substance\n",
+ "V=m*v # total volume\n",
+ "#result\n",
+ "print \"The Total volume of the mixture is \",round(V,3),\" m^3\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Total volume of the mixture is 1.328 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.4, PG-30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=2 # mass of water in kg\n",
+ "P=2.2 # pressure in Mpa\n",
+ "T=800 # temperature in degree centigrade\n",
+ " # Table C.3 is used for values\n",
+ "v=0.2467+(P-2)*(0.1972-0.2467)/(2.5-2) # specific volue by interpolatin between 2 and 2.5 MPa\n",
+ "V=m*v # final volume\n",
+ "print \"The Final Volume is\",round(V,3),\" m^3\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Final Volume is 0.454 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.5, PG-32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "V=0.6 # volume of tyre in m^3\n",
+ "Pgauge=200 # gauge pressure in KPa\n",
+ "T=20+273 # temperature converted to kelvin\n",
+ "Patm=100 # atmospheric pressure in KPa\n",
+ "R=287 # gas constant in Nm/kg.K\n",
+ "Pabs=(Pgauge+Patm)*1000 # calculating absolute pressue in Pa \n",
+ "\n",
+ "m=Pabs*V/(R*T)# mass from ideal gas equation\n",
+ "print \"The Mass of air is\",round(m,2),\" Kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Mass of air is 2.14 Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.6, PG-33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "T=500+273 # temperature of steam in kelvin\n",
+ "rho=24.0 # density in Kg/m^3\n",
+ "R=0.462 # gas constant from Table B.2\n",
+ "v=1/rho # specific volume and density relation\n",
+ "# PART (a)\n",
+ "P=rho*R*T # from Ideal gas equation\n",
+ "print \" PART (a) The Pressure is \",int(P),\" KPa \\n\"\n",
+ "# answer is approximated in textbook\n",
+ "\n",
+ "# PART (b)\n",
+ "a=1.703 # van der Waal's constant a value from Table B.7\n",
+ "b=0.00169 # van der Waal's constant b value from Table B.7\n",
+ "P=(R*T/(v-b))-(a/v**2) # Pressure from van der Waal's equation\n",
+ "print \" PART (b) The Pressure is \",int(P),\" KPa \\n\"\n",
+ "# answer is approximated in textbook\n",
+ "\n",
+ "# PART (c)\n",
+ "a=43.9 # van der Waal's constant a value from Table B.7\n",
+ "b=0.00117 # van der Waal's constant b value from Table B.7\n",
+ "\n",
+ "P=(R*T/(v-b))-(a/(v*(v+b)*math.sqrt(T))) # Redlich-Kwong equation\n",
+ "print \" PART (c) The Pressure is \",int(P),\" KPa \\n\"\n",
+ "# answer is approximated in textbook\n",
+ "\n",
+ "# PART (d)\n",
+ "Tcr=947.4 # compressibilty temperature from table B.3\n",
+ "Pcr=22100 # compressibility pressure from table B.3\n",
+ "\n",
+ "TR=T/Tcr # reduced temperature\n",
+ "PR=P/Pcr # reduced pressure\n",
+ "Z=0.93 # from compressiblility chart\n",
+ "P=Z*R*T/v # Pressure in KPa\n",
+ "print \" PART (d) The Pressure is \",int(P),\" KPa \\n\"\n",
+ "# answer is approximated in textbook\n",
+ "\n",
+ "# PART (e)\n",
+ "P=8000 # pressure from steam table @ 500*c and v= 0.0417 m^3\n",
+ "print \" PART (e) The Pressure is \",int(P),\" KPa \\n\"\n",
+ "# answer is approximated in textbook\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " PART (a) The Pressure is 8571 KPa \n",
+ "\n",
+ " PART (b) The Pressure is 7952 KPa \n",
+ "\n",
+ " PART (c) The Pressure is 7934 KPa \n",
+ "\n",
+ " PART (d) The Pressure is 7971 KPa \n",
+ "\n",
+ " PART (e) The Pressure is 8000 KPa \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter3_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter3_2.ipynb new file mode 100755 index 00000000..f646fae2 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter3_2.ipynb @@ -0,0 +1,330 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:f6a6bb505322436c23c138c1e60d951ed65e1f5f903d0d7ef3e7664203b1c411"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3:Work and Heat"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.1:PG-45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#initialization of variables\n",
+ "m=1 # mass in kg\n",
+ "x=20.0/100.0 #quality of steam\n",
+ "P=200 #constant pressure in kPa\n",
+ "T1=100 #temperature intitial in degree centigrade\n",
+ "T2=400 #temperature final in degree centigrade\n",
+ "\n",
+ "\n",
+ "# first we find initial volume v1 and final volume v2\n",
+ "\n",
+ "# using table C.2\n",
+ "vf=0.001061 # specific volume of saturated liquid in m^3 per kg \n",
+ "vg=0.8857 # specific volume of saturated vapour in m^3 per kg \n",
+ "\n",
+ "v1=vf+x*(vg-vf);\n",
+ "\n",
+ "v2=1.549 # specific volume of steam in m^3 per kg at T2=400*C and P2=0.2MPa\n",
+ "# now calculate work\n",
+ "W=m*P*(v2-v1); # work done in constant pressure process\n",
+ "#result\n",
+ "print \"Work done is\",round(W,2),\" kJ\" # work is in kJ as pressure was in kPa"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work done is 274.2 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.2:PG-46"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialization of variables\n",
+ "D=110.0/1000.0 # diameter of cylinder in m\n",
+ "V1=100e-6 # initial volume@ state 1 in m^3\n",
+ "T1=60.0 # initial temp @ state 1 in *C\n",
+ "T2=200.0 # final temo @ state 2 in *C\n",
+ "M=50 # weight of piston in kg\n",
+ "g=9.81 # gravitational accleration in m/sec^2\n",
+ "Patm=100000 # atmospheric pressure in Pa\n",
+ "A=math.pi*(D**2)/4 # area of piston in m^2\n",
+ "\n",
+ "# BALANCING THE FORCES To GET PRESSURE P\n",
+ "# M.g=P.A-Patm\n",
+ "P=Patm+(M*g/A) # atm pressure is added to get absolute pressure\n",
+ "\n",
+ "v1=0.001017 # specific volume at 60*C and 0.15Mpa pressure\n",
+ "m=V1/v1; # mass of water in kg\n",
+ "\n",
+ "# find volume at state 2 \n",
+ "v2=1.444 # specific volume of steam at 200*C and 0.15 MPa\n",
+ "V2=m*v2 # final volume in m^3\n",
+ "\n",
+ "W=P*(V2-V1)/1000; # work done divided by 1000 to get in kJ\n",
+ "# result\n",
+ "print \"The work done is\",round(W,1),\" kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work done is 21.5 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.3:PG-47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialization of variables\n",
+ "P1=200 # initial pressure in kPa\n",
+ "V1=2 # initial volume in m^3\n",
+ "P2=100 # final pressure in kPa\n",
+ "C=P1*V1 # isothermal process i.e P.V=constant\n",
+ "# find final volume \n",
+ "V2=P1*V1/P2 # final volume by P1.V1=P2.V2\n",
+ "\n",
+ "from scipy.integrate import quad\n",
+ " \n",
+ "def integrand(v,C):\n",
+ " return C/v\n",
+ "W, err =quad(integrand, V1, V2,C ) # itegrating over volume to get work\n",
+ "# result\n",
+ "print \"The Work done by gas is\",int(W),\" kJ\" # answer is approximated in textbook"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Work done by gas is 277 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.4:PG-48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "M=100 # mass in kg\n",
+ "d=3 # depth by which mass drops in m\n",
+ "V=0.002 # increased volume in m^3\n",
+ "g=9.8 # gravitational accleration in m/sec^2\n",
+ "Pgauge=100*1000 # gauge pressure in N/m\n",
+ "Patm =100*1000 # atmospheric pressure in N/m\n",
+ "P=Pgauge+Patm # to get absolute pressure\n",
+ "\n",
+ "# calculate work done by paddle wheel\n",
+ "Wpaddlewheel=(-M*g*d) # work is negative as it is done on the system\n",
+ "\n",
+ "# calculate work done on piston it \n",
+ "Wboundary=P*V # area mulitiplied by height is volume thus W=P.V \n",
+ "\n",
+ "#net work\n",
+ "\n",
+ "Wnet=Wpaddlewheel+Wboundary; # Work in joule as SI units are used\n",
+ "print \"The Net Work done is \",round(Wnet),\" J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Net Work done is -2540.0 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.5:PG-51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "T=100 # torque of shaft in N.m\n",
+ "N=3000 # rotation speed in rpm\n",
+ "omega=(N*2*math.pi/60) # angular velocity in rad/sec\n",
+ "# calculation of power\n",
+ "Wdot=(T*omega); # power is work done per unit time\n",
+ "print \"Power transmitted is\",round(Wdot/746,1),\" hp\" # divided by 746 to convert W into hp\n",
+ "#answer is approximated in textbook"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power transmitted is 42.1 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.6:PG-51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "D=10.0/100 # diameter of cylinder in m\n",
+ "d=50.0/1000 # compression in spring in m\n",
+ "Patm=100000 # atmospheric pressure in Pa\n",
+ "K=10.0*1000 # spring constant converted in N/m\n",
+ "w=50*9.81 # weight of piston in Newton =mass*gravitational acceleration\n",
+ "\n",
+ "# find the initial pressure in cylinder by force balance\n",
+ "A=(math.pi*D**2)/4; # area of piston\n",
+ "P1=((Patm*A)+w)/A; # balancing forces on piston P1.A=Patm.A+W\n",
+ "\n",
+ "# work done by air to raise the piston for 50mm if spring not present\n",
+ "Wgas=P1*A*d; # pressure*area= force and Work = Force* displacement\n",
+ "\n",
+ "# work done on spring to compress\n",
+ "Wspring=(K*d**2)/2; # Work in j\n",
+ "\n",
+ "# now total work done by air is sum of two works\n",
+ "Wnet=Wgas+Wspring; # Work in j\n",
+ "# result\n",
+ "print \"The net work done by air is\",round(Wnet,1),\" J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The net work done by air is 76.3 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.7:PG-53"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# variable initialization\n",
+ "\n",
+ "d=2 # distance travelled by weight in m\n",
+ "m=50 # mass of weight in kg\n",
+ "g=9.8 # gravitaional acceleration in m/sec^2\n",
+ "\n",
+ "# calculation of work in non-quasiequilibrium process\n",
+ "W=m*g*d; # work in joules\n",
+ "\n",
+ "# the work done must be transferred as heat\n",
+ "Q=W;\n",
+ "\n",
+ "print \"The heat that must transfer is \",int(Q),\" Joules\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat that must transfer is 980 Joules\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter4_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter4_2.ipynb new file mode 100755 index 00000000..e17b48f1 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter4_2.ipynb @@ -0,0 +1,719 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:abd0537a9b98c6cb49f3032d9229bd28210acff6f4a7d9f1c5434293bf15ef92"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4:The First Law of Thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.1:PG-62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#initialization of variables\n",
+ "K=100 # spring constant in kN/m\n",
+ "d=0.8 # dispacement of spring in m\n",
+ " # to get total work we integrate from 0 to 0.8 displacement\n",
+ "x1=0; # lower limit of integration\n",
+ "x2=0.8; # upper limit of integration\n",
+ "from scipy.integrate import quad\n",
+ "\n",
+ "# we find work\n",
+ "def integrand(x,K):\n",
+ " return K*x\n",
+ "\n",
+ "W12, err = quad(integrand, x1, x2, K) # integrating to get work\n",
+ "Q12=W12; # by first law of thermodynamics\n",
+ "print \"The Heat transfer is \",int(Q12),\" J\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Heat transfer is 32 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.2:PG-65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "P= 5*746 # power of fan converted in watt\n",
+ "t=1*60*60 # time converted to seconds\n",
+ "\n",
+ "# by first law of thermodynamics Q=delU + W\n",
+ "# Q=0 hence -W=delU\n",
+ "# first we find work input\n",
+ "W=-P*t # work in J\n",
+ "delU=-W # from 1st law\n",
+ "print \"The internal energy increase is \",float(delU),\" J\"\n",
+ "# The answer is approximated in textbook\n",
+ "# our answer is precise\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The internal energy increase is 13428000.0 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.3:PG-65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "P=400 # pressure in kPa\n",
+ "T1=200 # initial temperature in degree celsius\n",
+ "V1= 2 # initial volume in m^3\n",
+ "Q=3500 # heat added in kJ\n",
+ "v1=0.5342 # specific volume of steam at 200 degree celcius and 0.4 Mpa pressure from table C.3\n",
+ "u1=2647 # specific internal energy in kJ/kg @ pressure = 0.4 MPa\n",
+ "m=V1/v1 # mass in kg\n",
+ "# we have a relation Between u2 and v2 from 1st law of thermodynamics\n",
+ "v2=1.06 # specific volume at state 2 by trial and error and interpolation\n",
+ "V2=m*v2 \n",
+ "u2=((3500-400*(V2-V1))/m)+2647 # specific internal energy for v2=1.06 by trial and error\n",
+ "\n",
+ "# on interpolation from steam table at 0.4 MPa we get temperature \n",
+ "T2=644 # temperature in degree celsius\n",
+ "print \"The temperature for u2=\",round(u2),\" kJ and v2 =\",round(v2,3),\" kg/m^3 is \\n \",int(T2),\" degree celsius\"\n",
+ "# this numerical is solved by trial and error thus refer to Appendix C"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature for u2= 3372.0 kJ and v2 = 1.06 kg/m^3 is \n",
+ " 644 degree celsius\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.4:PG-67"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# initialization of variables\n",
+ "P=400 # pressure in kPa\n",
+ "T1=200 # initial tmperature in degree celsius\n",
+ "V=2 # initial volume in m^3\n",
+ "Q=3500 # heat added in kJ\n",
+ "\n",
+ "#solution\n",
+ "h1=2860 # initial enthalpy @ 200*C and 400 kPa from steam table\n",
+ "v=0.5342 # specific volume from steam table C.3 \n",
+ "m=V/v;\n",
+ "h2=(Q/m)+h1; # final enthalpy in kJ/kg from energy equation\n",
+ "\n",
+ "# NOW USING THIS ENTHLAPY AND INTERPOlATING FROM STEAM TABLE\n",
+ "\n",
+ "T2=600+(92.6/224)*100\n",
+ "\n",
+ "print \"The Final temperature is \",int(T2),\" degree Celsius\"\n",
+ "# result is obtained from interpolation on steam table\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Final temperature is 641 degree Celsius\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.5:PG-71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=300 # initial temperature in degree celsius\n",
+ "T2=700 # final temperature in degree celsius\n",
+ "P=150 # pressure in kPa\n",
+ "m=3 # mass of steam in kg\n",
+ "\n",
+ "# solution\n",
+ "# part (a)\n",
+ "from scipy.integrate import quad\n",
+ "\n",
+ "# now we make function to integrate\n",
+ "def integrand(T):\n",
+ " return 2.07+(T-400)/1480\n",
+ "\n",
+ "I, err = quad(integrand, T1, T2) # integrating specific heat over temperature range\n",
+ "delH=m*I #integrate('2.07+(T-400)/1480','T',T1,T2) # expressing as function of temperature and integrating\n",
+ "\n",
+ "print\" The change in Enthalpy is \",int(delH),\" kJ \\n\"\n",
+ " \n",
+ "# part(b)\n",
+ "CPavg=delH/(m*(T2-T1)) # avg value of specific heat at constant pressure\n",
+ "print \" The average value of Cp is \",round(CPavg,2),\" kJ/kg.*C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The change in Enthalpy is 2565 kJ \n",
+ "\n",
+ " The average value of Cp is 2.14 kJ/kg.*C\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.6,PG-72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "m=1 # mass of nitrogen in kg\n",
+ "T1=300 # initial temperature in Kelvin\n",
+ "T2=1200 # final temperature in Kelvin\n",
+ "M=28.0 # in kg/kmol\n",
+ "# part(a)\n",
+ "# the enthalpy change is found from gas table in App.E\n",
+ "delh=36777-8723 # from gas table\n",
+ "delH=delh/M \n",
+ "print \" The entalpy change from gas table is \",round(delH),\" kJ/kg \\n\"\n",
+ "\n",
+ "# part (b) \n",
+ "Cp=1.042 # from table B.2\n",
+ "delH=Cp*(T2-T1)\n",
+ "print \" The entalpy change by assuming constant specific heat is \",round(delH),\" kJ/kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The entalpy change from gas table is 1002.0 kJ/kg \n",
+ "\n",
+ " The entalpy change by assuming constant specific heat is 938.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.7:PG-76"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "x=0.7 # quality of steam\n",
+ "P1=200 # initial pressure in kPa\n",
+ "P2=800 # final pressure in kPa\n",
+ "V=2 # volume in m^3\n",
+ "# The values are taken from TABLE C.2\n",
+ "vf1=0.0010 # specific volume of saturated liquid at 200 kPa\n",
+ "vg1=0.8857 # specific volume of saturated gas at 200 kPa\n",
+ "uf1=504.5 # specific internal energy of saturated liquid @ state 1\n",
+ "ug1=2529.5 # speciific internal energy of saturated gas @ state 1\n",
+ "\n",
+ "v1=vf1+x*(vg1-vf1); # specific volume of vapour\n",
+ "m=V/v1\n",
+ "\n",
+ "u1=uf1+x*(ug1-uf1) # specific internal energy of vapour @ state 1\n",
+ "v2=v1 # constant volume process\n",
+ "u2=((0.6761-0.6203)*(3661-3853)/(0.6761-0.6181))+3853 # from steam table @ 800kPa by interpolating\n",
+ "Q=m*(u2-u1) # heat transfer\n",
+ "print \"The heat transfer is \",round(Q,3),\" kJ\"\n",
+ "# The answer in the textbook is approximated"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat transfer is 5630.537 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.8:PG-76"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "V=0.02 # volume in m^3\n",
+ "P=400 # pressure in kPa\n",
+ "T1=50+273 # initial temperature in kelvin\n",
+ "T2=700+273 # final temperature in kelvin\n",
+ "Q=50 # heat added in kJ\n",
+ "R=287 # constant for air\n",
+ "Cp=1 # constant for specific heat of air\n",
+ "\n",
+ "# using the ideal gas equation\n",
+ "\n",
+ "m=P*1000*V/(R*T1) # mass of air in kg\n",
+ "W=Q-(m*Cp*(T2-T1)) # work done from first law\n",
+ "# result\n",
+ "print \"The Paddle work is \",round(W,2),\" kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Paddle work is -6.09 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.9,PG-77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "V1=2 # initial volume in m^3\n",
+ "V2=0.2 # final volume in m^3\n",
+ "T1=20+273 # temperature in kelvin\n",
+ "P=200 # pressure in kPa\n",
+ "R=0.287 # constant for air\n",
+ "gama=1.4 # polytropic index for air\n",
+ "Cv=0.717 # specific heat at constant volume for air\n",
+ "\n",
+ "#solution\n",
+ "\n",
+ "#using the ideal gas equation\n",
+ "m=(P*V1)/(R*T1) # mass in kg\n",
+ "# process is adiabatic thus\n",
+ "T2=T1*((V1/V2)**(gama-1)) # final temperature\n",
+ "\n",
+ "W=-m*Cv*(T2-T1) # work from first law\n",
+ "print \"The Work is \",int(W),\" kJ\"\n",
+ "# solution is approximated in textbook"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Work is -1510 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.10:PG-79"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "P1=2000.0 # initial pressure in kPa\n",
+ "T1=600.0 # initial temperature in degree celsius\n",
+ "p2=600.0 # final pressure in kPa\n",
+ "T2=200.0 # final temperature in degree celsius\n",
+ "d1=0.06 # diameter of inlet pipe in metre\n",
+ "d2=0.120 # diameter of outlet pipe in metre\n",
+ "V1=20.0 # velocity at inlet in m/s\n",
+ "\n",
+ "# solution\n",
+ "# from superheat table C.3 values are noted\n",
+ "v1=0.1996 # specific volume of superheated steam @ 600*C and 2000 kPa\n",
+ "v2=0.3520 # specific volume of superheated steam @ 200*C and 2000 kPa\n",
+ "rho1=1/v1 # initial density\n",
+ "rho2=1/v2 # final density\n",
+ "A1=(math.pi*d1**2)/4 # inlet area\n",
+ "A2=(math.pi*d2**2)/4 # exit area\n",
+ "\n",
+ "V2=(rho1*A1*V1)/(rho2*A2) # from continuity equation\n",
+ "print \" The Exit velocity is \",round(V2,2),\" m/s \\n\"\n",
+ "\n",
+ "mdot=rho1*A1*V1 # mass flow rate\n",
+ "print\" The mass flow rate is \",round(mdot,3),\" kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Exit velocity is 8.82 m/s \n",
+ "\n",
+ " The mass flow rate is 0.283 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.11:PG-82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "P1=8000 # initial pressure in kPa\n",
+ "T1=300 # temperature in degree celsius\n",
+ "P2=2000 # final pressure in kPa\n",
+ "\n",
+ "# solution\n",
+ "h1=2785 # specific enthalpy of steam in kJ/kg @ 8000 kPa and 300 degree celsius from steam table\n",
+ "h2=h1 # throttling process thus enthalpy is constant\n",
+ "T2=212.4 # from steam table as we know enthalpy and pressure\n",
+ "hf2=909 # specific enthalpy of saturated liquid @ 2000 kPa and 300 degree celsius\n",
+ "hg2=2799.5 # specific enthalpy of saturated gas @ 2000 kPa and 300 degree celsius\n",
+ "x2=(h2-hf2)/(hg2-hf2) # quality of steam\n",
+ "\n",
+ "vg2=0.0992 # specific volume of saturated gas @ 2000 kPa and 212.4*c\n",
+ "vf2=0.0012 # specific volume of saturated liquid @ 2000 kPa and 212.4*c\n",
+ "v2=vf2+x2*(vg2-vf2) # from properties of pure substance\n",
+ "\n",
+ "print \"The Final Temperature and Specific volume is \",round(T2,1),\"*C and \",round(v2,3),\" m^3/kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Final Temperature and Specific volume is 212.4 *C and 0.098 m^3/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.12:PG-84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "P1=4000 # inlet pressure in kPa\n",
+ "T1=500 # inlet temperature in degree celsius\n",
+ "V1=200 # inlet steam velocity in m/s\n",
+ "d1=0.05 # inlet diameter in 'm'\n",
+ "P2=80 # exit pressure in kPa\n",
+ "d2=0.250 # exit diameter in 'm'\n",
+ "\n",
+ "# solution\n",
+ "v1=0.08643 # specific volume from steam table @ 4000 kPa and 500*C\n",
+ "v2=2.087 # specific volume from steam table @ 80 kPa and 500*C\n",
+ "rho1=1/v1 # density at inlet\n",
+ "rho2=1/v2 # density at outlet\n",
+ "A1=(math.pi*d1**2)/4 # inlet area\n",
+ "A2=(math.pi*d2**2)/4\n",
+ "mdot=rho1*A1*V1 # mass flow rate\n",
+ "mdot=round(mdot,3) # rounding to 3 significant digits\n",
+ "\n",
+ "#now using table C.3\n",
+ "h1=3445 # initial specific enthalpy @ 4000 kPa and 500 *C \n",
+ "h2=2666 # final specific enthalpy @ 80 kPa and 500 *C\n",
+ "WT=-mdot*(h2-h1) # maximum power from first law\n",
+ "print \" The power output is \",round(WT),\" kJ/s \\n \"\n",
+ "\n",
+ "V2=(A1*V1*rho1)/(A2*rho2) \n",
+ "V2=round(V2) # rounding of digits\n",
+ "delKE=mdot*((V2**2)-(V1**2))/2 # the change in kinetic energy\n",
+ "print \" The change in K.E is \",round(delKE),\" J/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The power output is 3540.0 kJ/s \n",
+ " \n",
+ " The change in K.E is -6250.0 J/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 78
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.13:PG-85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "Wdot=10 # pump power in hp\n",
+ "g=9.81 # acceleration due to gravity\n",
+ "rho=1000 # density of water in kg/m^3\n",
+ "d1=0.06 # inlet dimeter in 'm'\n",
+ "d2=0.10 # oulet diamter in 'm'\n",
+ "V1=10 # velocity of water at inlet in m/s\n",
+ "\n",
+ "#solution\n",
+ "A1=math.pi*(d1**2)/4 # area of inlet\n",
+ "A2=math.pi*(d2**2)/4 # area of outlet\n",
+ "V2=A1*V1/A2 # oulet velocity from continuity equation\n",
+ "\n",
+ "mdot=rho*A1*V1 # mass flow rate\n",
+ "delP=((((Wdot*746)/mdot)-((V2**2)-V1**2)/(2*g))*rho)/1000 # change in pressure in kPa\n",
+ "print \"The rise in pressure is \",round(delP),\" kPa\"\n",
+ "# The answer is approximated in textbook , our answer is precise \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rise in pressure is 268.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 80
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.14:PG-85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "# initialization of variables\n",
+ "P1=7000.0 # inlet pressure in Pa\n",
+ "T1=420.0 # inlet temperature in degree celsius\n",
+ "V1=400.0 # inlet velocity in m/s\n",
+ "d1=0.200 # inlet diameter in 'm'\n",
+ "V2=700.0 # exit velocity in m/s\n",
+ "k=1.4 # polytopic index for air\n",
+ "Cp=1000 # specific heat at constant pressure for air in j/kg.K\n",
+ "R=287 # specific gas constant for air\n",
+ "\n",
+ "#solution\n",
+ "\n",
+ "#part (a)\n",
+ "T2=(((V1**2)-V2**2)/(2*Cp))+T1 # outlet temperature in degree celsius\n",
+ "print \" The exit temperature is \",round(T2),\" *C \\n\"\n",
+ "\n",
+ "#part (b)\n",
+ "\n",
+ "rho1=P1/(R*(T1+273)) # density at entrance\n",
+ "A1=(math.pi*d1**2)/4\n",
+ "mdot=rho1*A1*V1 # \n",
+ "print \" The mass flow rate is \",round(mdot,3),\" kg/s \\n\"\n",
+ "\n",
+ "# part (c)\n",
+ "\n",
+ "rho2=rho1*(((T2+273)/(T1+273))**(1/(k-1))) # density at exit\n",
+ "# now we find the exit diameter\n",
+ "d2=math.sqrt((rho1*V1*(d1)**2)/(rho2*V2))\n",
+ "print \" The outlet diameter is \",round(d2,3),\" m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The exit temperature is 255.0 *C \n",
+ "\n",
+ " The mass flow rate is 0.442 kg/s \n",
+ "\n",
+ " The outlet diameter is 0.212 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 87
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.15:PG-89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "mdots=100 # mass flow rate of sodium in kg/s\n",
+ "Ts1=450 # inlet temperature of sodium in degree celsius\n",
+ "Ts2=350 # exit temperature of sodium in degree celsius\n",
+ "Cp=1.25 # specific heat of sodium in KJ/kg.*C\n",
+ "Tw1=20 # inlet temperature of water in degree celsius\n",
+ "Pw=5000 # inlet pressure of water in kPa \n",
+ "\n",
+ "# solution\n",
+ "hw1=88.65 # enthalpy from table C.4\n",
+ "hw2=2794 # enthalpy from table C.3\n",
+ "mdotw=(mdots*Cp*(Ts1-Ts2))/(hw2-hw1) # mass flow rate of water\n",
+ "print \" The mass flow rate of water is \",round(mdotw,2),\" kg/s \\n\"\n",
+ "Qdot=mdotw*(hw2-hw1) # heat transfer in kW using energy equation\n",
+ "# result\n",
+ "print \" The rate of heat transfer is \",round(Qdot),\" kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The mass flow rate of water is 4.62 kg/s \n",
+ "\n",
+ " The rate of heat transfer is 12500.0 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 90
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter5_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter5_2.ipynb new file mode 100755 index 00000000..ac5d7227 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter5_2.ipynb @@ -0,0 +1,586 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:4df6ac0705dbecae7b5d61911e7c199aa54ae833c2fc9f2d87f583d3d1c651ef"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5:The Second Law of Thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.4:PG-112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "Th=200+273.0 # higher temperture in kelvin \n",
+ "Tl=20+273.0 # lower temperture in kelvin\n",
+ "Wdot=15 # output of engine in kW\n",
+ "\n",
+ "ef=1-(Tl/Th) # carnot efficiency\n",
+ "\n",
+ "Qhdot=Wdot/ef # heat supplied by reservoir\n",
+ "print \" The heat suppled by higher temperature reservoir is\",round(Qhdot,2),\"kW \\n \"\n",
+ "# using forst law\n",
+ "Qldot=Qhdot-Wdot # heat rejected to reservoir\n",
+ "print \" The heat suppled by lower temperature reservoir is\",round(Qldot,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The heat suppled by higher temperature reservoir is 39.42 kW \n",
+ " \n",
+ " The heat suppled by lower temperature reservoir is 24.42 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.5:PG-113"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "TL1=-5+273.0 # lower temperature in kelvin for first situation\n",
+ "TH=20+273.0 # higher temperature in kelvin\n",
+ "TL2=-25+273.0 #lower temperature in kelvin for second situation\n",
+ "\n",
+ "#solution\n",
+ "\n",
+ "COP1=TL1/(TH-TL1) # carnot refrigerator COP for first situation\n",
+ "# Let Heat be 100 kJ\n",
+ "QL=100.0 # assumption\n",
+ "W1=QL/COP1 # work done for situation 1\n",
+ "\n",
+ "# for situation 2\n",
+ "COP2=TL2/(TH-TL2) # COP carnot for second situation\n",
+ "W2=QL/COP2 # work done\n",
+ "\n",
+ "Per=(W2-W1)*100/W1 # percentage increase in work done \n",
+ "#result\n",
+ "print\" The perccentage increase in work is \",round(Per,1),\"%\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The perccentage increase in work is 94.5 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.6:PG-117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "T1=20+273 # initial temperature in kelvin\n",
+ "P=200 # pressure in kPa\n",
+ "V=2 # volume in m^3\n",
+ "R=0.287 # gas constant for air\n",
+ "W=720 # work done on air in kJ\n",
+ "Cv=0.717 # specific heat at constant volume for air\n",
+ "\n",
+ "#solution\n",
+ "m=(P*V)/(R*T1) # mass of air\n",
+ "\n",
+ "T2=T1+(W/(m*Cv))# final temperature in kelvin\n",
+ "\n",
+ "delS=m*Cv*math.log(T2/T1) # ENROPY CHANGE FOR CONSTANT VOLUME PROCESS\n",
+ "print \" The Entropy increase is\",round(delS,3),\"kJ/K \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Entropy increase is 1.851 kJ/K \n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.7:PG-118"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=350+273 # initial temperature in kelvin\n",
+ "P1=1200.0 # initial pressure in kPa\n",
+ "P2=140 # final pressure in kPa\n",
+ "k=1.4 # polytopic index for air\n",
+ "Cv=0.717 # specific heat at constant volume for air\n",
+ "#solution\n",
+ "T2=T1*((P2/P1)**((k-1)/k)) # reversible adiabatic process relation\n",
+ "\n",
+ "w=-Cv*(T2-T1) # work done by gases in reversible adiabatic process\n",
+ "print\" The work done by gases is\",round(w),\"kJ/kg\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The work done by gases is 205.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.8:PG-120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "T1=20+273.0 # initial temperature in kelvin\n",
+ "P1=200.0 # pressure in kPa\n",
+ "V=2 #volume in m^3\n",
+ "R=0.287 # gas constant for air\n",
+ "W=-720 # negative as work is done on air in kJ\n",
+ "\n",
+ "#solution\n",
+ "\n",
+ "m=(P1*V)/(R*T1)# mass of air\n",
+ "\n",
+ "u1=209.1 #specific internal energy of air at 293K and 200 kPa from table E.1\n",
+ "s1=1.678 # by interpolation from table E.1\n",
+ "# change in internal energy= work done\n",
+ "u2=-(W/m)+u1 # final internal energy\n",
+ "T2=501.2# final temperature interpolated from table E.1 corresponding to value of u2\n",
+ "s2=2.222 # value of s from table E.3 by interpolating from corresponding to value of u2\n",
+ "\n",
+ "P2=P1*(T2/T1) # final pressure in kPa\n",
+ "\n",
+ "delS=m*(s2-s1-R*math.log(P2/P1))# entropy change\n",
+ "# result\n",
+ "print \" The Entropy increase is\",round(delS,3),\"kJ/K \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Entropy increase is 1.855 kJ/K \n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.9:PG-120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=350+273.0 # initial temperature in kelvin\n",
+ "P1=1200.0 # initial pressure in kPa\n",
+ "P2=140.0 # final pressure in kPa\n",
+ "k=1.4 # polytopic index for air\n",
+ "\n",
+ "#solution\n",
+ "# The values are taken from table E.1\n",
+ "Pr660=23.13# relative pressure @ 660K\n",
+ "Pr620=18.36# relative pressure @ 620K\n",
+ "Pr1=((Pr660-Pr620)*3/40)+Pr620 # relative pressure by interpolation\n",
+ "\n",
+ "Pr2=Pr1*(P2/P1) # relative pressure at state 2\n",
+ "\n",
+ "Pr340=2.149 # relative pressure @ 340K\n",
+ "Pr380=3.176 # relative pressure @ 380K\n",
+ "T2=((Pr2-Pr340)/(Pr380-Pr340))*40+340 # interpolating final temperature from table E.1\n",
+ "\n",
+ "# now interpolating u1 AND u2 from table E.1\n",
+ "u620=451.0# specific internal energy @ 620k\n",
+ "u660=481.0# specific internal energy @ 660k\n",
+ "u1=(u660-u620)*(3/40.0)+u620 # initial internal energy\n",
+ "\n",
+ "u380=271.7 #specific internal energy @ 380k\n",
+ "u340=242.8 #specific internal energy @ 340k\n",
+ "u2=((Pr2-Pr340)/(Pr380-Pr340))*(u380-u340)+u340 # final internal energy\n",
+ "\n",
+ "w=u2-u1 # work= change in internal energy\n",
+ "print \" The work done by gas is\",int(w),\"kJ/kg\"\n",
+ "# The answer is slightly different as values are approximated in textbook\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The work done by gas is -209 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.10:PG-123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=300+273.0 # initial temperature in kelvin\n",
+ "P1=600 # initial pressure in kPa\n",
+ "P2=40 # final pressure in kPa\n",
+ "\n",
+ "#solution\n",
+ "#please refer to steam table for values\n",
+ "v1=0.4344 # specific volume from steam table @ 573k and 600 kPa\n",
+ "v2=v1 # rigid container\n",
+ "u1=2801.0 # specific internal energy from steam table @ 573k and 600 kPa\n",
+ "s1=7.372 # specific entropy @ 600 kPa and 573 K\n",
+ "\n",
+ "vg2=0.4625 # specific volume of saturated vapour @ 40 kPa and 573 K\n",
+ "vf2=0.0011 # specific volume of saturated liquid @ 40 kPa and 573 K\n",
+ "sf2=1.777 # specific entropy of saturated liquid @ 40 kPa and 573 K\n",
+ "sg2=5.1197 # specific entropy of saturated vapour @ 40 kPa and 573 K\n",
+ "x=(v2-vf2)/(vg2-vf2)# quality of steam using pure substance relation\n",
+ "\n",
+ "s2=sf2+x*sg2 # overall specific enthalpy at quality 'x' \n",
+ "delS=s2-s1 # entropy change\n",
+ "print\" The entropy change is\",round(delS,3),\"kJ/kg.K \\n \"\n",
+ "\n",
+ "#heat transfer\n",
+ "uf2=604.3 #specific internal energy of saturated liquid @ 40 kPa and 573 K\n",
+ "ug2=1949.3 #specific internal energy of saturated vapour @ 40 kPa and 573 K\n",
+ "u2=uf2+x*ug2 #specific internal energy @ quality x\n",
+ "q=u2-u1 # heat transfer in kJ/kg from first law as W=0\n",
+ "print \" The heat transfer is\",int(q),\"kJ/kg\"\n",
+ "# result\n",
+ "# the answers are approximated in textbook but here they are precise thus minute difference is there"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The entropy change is -0.787 kJ/kg.K \n",
+ " \n",
+ " The heat transfer is -366 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.11:PG-126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "v1=0.5 # assumed as air is filled in half of the tank\n",
+ "v2=1.0 # final volume when partition is removed\n",
+ "R=0.287 # gas contant for air\n",
+ "#solution\n",
+ "q=0 # heat transfer is zero\n",
+ "w=0 # work done is zero\n",
+ "# temperatue is constant as no change in internal energy by first law\n",
+ "dels=R*math.log(v2/v1)# change in entropy when temperature is constant\n",
+ "print \"The change in specific entropy is\",round(dels,3),\"kJ/kg.K\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in specific entropy is 0.199 kJ/kg.K\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.12:PG-127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=400+273.0 # initial temperature in kelvin\n",
+ "P=600 # pressure in kPa\n",
+ "Tsurr=25+273.0 # surrounding temperature in K\n",
+ "m=2 # mass of steam in kg\n",
+ "\n",
+ "#solution\n",
+ "#please refer to steam table for values\n",
+ "s1=7.708 # specific entropy of steam @ 400 degree celsius and 0.6 MPa\n",
+ "s2=1.9316# specific enropy of condensed water @ 25 degree celsius and 0.6 MPa\n",
+ "delSsys=m*(s2-s1) # entropy change in system i.e of steam\n",
+ "\n",
+ "h1=3270 # specific enthalpy of steam @ 400 degree celsius and 0.6 MPa\n",
+ "h2=670.6#specific enropy of condensed water @ 25 degree celsius and 0.6 MPa\n",
+ "\n",
+ "Q=m*(h1-h2)# heat transfer at constant pressure\n",
+ "delSsurr=Q/Tsurr # entropy change in surroundings\n",
+ "\n",
+ "sigma=delSsys+delSsurr # net entropy change\n",
+ "\n",
+ "print \"The net entropy production is\",round(sigma,1),\"kJ/K\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The net entropy production is 5.9 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.13:PG-130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=600+273 # initial temperature in kelvin\n",
+ "P1=2 # initial pressure in MPa\n",
+ "P2=10 # final pressure in kPa\n",
+ "mdot=2 # mass flow rate in kg/s\n",
+ "\n",
+ "#solution\n",
+ "#please refer to steam table for values\n",
+ "h1=3690 # specific enthalpy in kJ/kg @ 2MPa and 600 degree celsius\n",
+ "s1=7.702 #specific entropy in kJ/kg.K @ 2MPa and 600 degree celsius\n",
+ "s2=s1 # Reversible adiabatic process thus entropy is constant\n",
+ "sf2=0.6491 #specific entropy of saturated liquid from steam table @ 10 kPa\n",
+ "sg2=8.151 #specific entropy of saturated vapour from steam table @ 10 kPa\n",
+ "\n",
+ "x2=(s2-sf2)/(sg2-sf2) # quality of steam at turbine exit\n",
+ "\n",
+ "h2f=191.8 #specific enthalpy of saturated liquid from steam table @ 10 kPa\n",
+ "h2g=2584.8 #specific enthalpy of saturated vapour from steam table @ 10 kPa\n",
+ "h2=h2f+x2*(h2g-h2f) # specific enthalpy @ quality 'x' \n",
+ "\n",
+ "WdotT=mdot*(h1-h2)# from work done in adiabatic process\n",
+ "# result\n",
+ "print \" The maximum power output is\",int(WdotT),\"kJ/s\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The maximum power output is 2496 kJ/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.14:PG-130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "T1=600+273 # initial temperature in kelvin\n",
+ "P1=2 # initial pressure in MPa\n",
+ "P2=10 # final pressure in kPa\n",
+ "mdot=2 # mass flow rate in kg/s\n",
+ "EffT=0.8 # efficiency of turbine \n",
+ "WdotT=2496 # theoritical power of turbine in kW\n",
+ "\n",
+ "#solution\n",
+ "Wdota=EffT*WdotT # actual power output of turbine\n",
+ "h1=3690 # specific enthalpy @ 2MPa and 600 degree celsius\n",
+ "h2=h1-(Wdota/mdot) # final enthalpy from first law of thermodynamics\n",
+ "\n",
+ "T2=((h2-2688)/(2783-2688))*(150-100)+100 # by interpolating from steam table @ P2= 10 kPa, h2=2770 \n",
+ "s2=8.46 # final specific entropy by interpolation from steam table\n",
+ "\n",
+ "print \"The temperature by interpolation is\",round(T2),\" degree celsius \\n\"\n",
+ "print \"The final entropy by interpolation is\",round(s2,2),\"kJ/kg.K\"\n",
+ "# The temperature and entropy are found by interpolation from steam table and cannot be shown here.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature by interpolation is 102.0 degree celsius \n",
+ "\n",
+ "The final entropy by interpolation is 8.46 kJ/kg.K\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.15:PG-131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "T2=250.0 # temperature of steam in degree celsius\n",
+ "mdot2=0.5 # mass flow rate of steam in kg/s\n",
+ "T1=45 # temperature of water in degree celsius\n",
+ "mdot1=4 # mass flow rate of water in kg/s\n",
+ "P=600.0 # pressure in kPa\n",
+ "\n",
+ "\n",
+ "mdot3=mdot1+mdot2 # by mass balance\n",
+ "\n",
+ "h2=2957 # specific enthalpy in kJ/kg of steam @ 600 Kpa from steam table\n",
+ "h1=188.4 # specific enthalpy in kJ/kg of water @ 600 Kpa from steam table\n",
+ "\n",
+ "h3=(mdot1*h1+mdot2*h2)/mdot3 # specific enthalpy in kJ/kg at exit\n",
+ "\n",
+ "# by interpolation from saturated steam table\n",
+ "T3=(h3-461.3)*10/(503.7-461.3)+110 # temperature of mixture\n",
+ "\n",
+ "sf3=1.508 # entropy of saturated liquid in kJ/kg.K at 600Kpa and T3 temperature from steam table\n",
+ "s3=sf3 # by interpolating sf\n",
+ "s2=7.182 # entropy of superheated steam in kJ/kg.K @ 600Kpa from steam table\n",
+ "s1=0.639 # entropy of entering water in kJ/kg.K at T= 45 degree celsius\n",
+ "\n",
+ "sigmaprod=mdot3*s3-mdot2*s2-mdot1*s1\n",
+ "# result\n",
+ "print \"The rate of entropy production is\",round(sigmaprod,3),\"kW/K \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of entropy production is 0.639 kW/K \n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter6_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter6_2.ipynb new file mode 100755 index 00000000..49cfc54d --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter6_2.ipynb @@ -0,0 +1,695 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:353d9311290d1e9a150d4f5b7334fda96148ffc036b68321a43e559706361c16"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6:Power Vapor Cycles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:PG-146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "# Please refer to the given figure in question for quantities\n",
+ "P2=2*1000 #higher pressure converted in in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "rho=1000 # density of water in Kg/m^3\n",
+ "h1=192 # enthalpy at state 1 in kJ/kg\n",
+ "h3=3248 # enthalpy at state 3 in kJ/kg\n",
+ "s3=7.1279# entropy at state 3 in kJ/kg.K\n",
+ "\n",
+ "#calculation of pump work\n",
+ "wp=(P2-P1)/rho # pump work given by equation 4.56 in textbook\n",
+ "h2=h1+wp # by enrgy balance b/w state 1 and 2\n",
+ "q=h3-h2 # Heat input from 2 to 3\n",
+ "\n",
+ "s4=s3 # isentropic process\n",
+ "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "x=(s4-sf)/(sg-sf)# from property of pure substance\n",
+ "hf=191.8 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",
+ "\n",
+ "wt=h3-h4 # turbine work\n",
+ "\n",
+ "efficiency=(wt-wp)/q # efficiency of power cycle\n",
+ "print \" The Efficiency is\",round(efficiency,4),\" or\",round(efficiency*100,1),\"%\"\n",
+ "# the answer is correct within limits\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.3238 or 32.4 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:PG-149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "# Please refer to the given figure of question 6.1 for quantities\n",
+ "effi1=0.323 #old efficiency\n",
+ "P2=4*1000 #higher pressure converted in in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "rho=1000 # density of water in Kg/m^3\n",
+ "h1=192 # enthalpy at state 1 in kJ/kg\n",
+ "h3=3214 # enthalpy at state 3 i.e @400 degree celsius and 4MPa in kJ/kg\n",
+ "s3=6.769# entropy at state 3 i.e @400 degree celsius and 4MPa in kJ/kg.K\n",
+ "\n",
+ "s4=s3 # insentropic process\n",
+ "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "x=(s4-sf)/(sg-sf)# quality of steam\n",
+ "\n",
+ "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",
+ "h2=h1 # isenthalpic process\n",
+ "qb=h3-h2 # heat addition\n",
+ "\n",
+ "wt=h3-h4 # turbine work\n",
+ "\n",
+ "effi2=(wt)/qb # efficiency of power cycle\n",
+ "\n",
+ "print \" The Efficiency is\",round(effi2,3),\" or\",round(effi2*100),\"% \\n\"\n",
+ "\n",
+ "perincrease=((effi2-effi1)/effi1)*100 \n",
+ "\n",
+ "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.354 or 35.0 % \n",
+ "\n",
+ " The % increase in Efficiency is 9.69 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:PG-149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "# Please refer to fig of question 6.1 for quantities\n",
+ "effi1=0.323 #old efficiency\n",
+ "P2=2*1000 #higher pressure converted in in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "rho=1000 # density of water in Kg/m^3\n",
+ "T2=600# max temperature of cycle in degree celsius\n",
+ "h1=192 # enthalpy at state 1 in kJ/kg\n",
+ "h3=3690 # enthalpy at state 3 in kJ/kg, 600*C and 2MPa pressure\n",
+ "s3=7.702# entropy at state 3 in kJ/kg.K, 600*C and 2MPa pressure\n",
+ " \n",
+ "s4=s3# isentropic process\n",
+ "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "x=(s4-sf)/(sg-sf)# quality of steam\n",
+ "\n",
+ "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",
+ "\n",
+ "h2=h1 # isenthalpic process\n",
+ "qb=h3-h2 # heat addition\n",
+ "\n",
+ "wt=h3-h4 # turbine work\n",
+ "\n",
+ "effi2=(wt)/qb # efficiency of power cycle\n",
+ "print \" The Efficiency is\",round(effi2,3),\" or\",round(effi2*100),\"% \\n\"\n",
+ "perincrease=((effi2-effi1)/effi1)*100 \n",
+ "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.357 or 36.0 % \n",
+ "\n",
+ " The % increase in Efficiency is 10.56 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:PG-150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "# Please refer to fig of question 6.1 for quantities\n",
+ "effi1=0.323 #old efficiency\n",
+ "P2=2*1000 #higher pressure converted in in kPa\n",
+ "P1=4 # condenser pressure in kPa\n",
+ "rho=1000 # density of water in Kg/m^3\n",
+ "h1=192 # enthalpy at state 1 in kJ/kg\n",
+ "h3=3248 # enthalpy at state 3 in kJ/kg\n",
+ "s3=7.1279# entropy at state 3 in kJ/kg.K\n",
+ "\n",
+ "s4=s3 # isentropic process \n",
+ "\n",
+ "sf=0.4225 # entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.4754 # entropy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "x=(s4-sf)/(sg-sf)# from property of pure substance\n",
+ "\n",
+ "hf=121 #enthalpy of saturated liquid @4 kPa from steam table\n",
+ "hg=2554 # enthalpy of saturated vapour @4 kPa from steam table\n",
+ "h4=hf+x*(hg-hf)# enthalpy @ state 4h1=h2 # isenthalpic process\n",
+ "h2=h1 # isenthalpic process\n",
+ "qb=h3-h2 # heat addition\n",
+ "\n",
+ "wt=h3-h4 # turbine work\n",
+ "\n",
+ "effi2=(wt)/qb # efficiency of power cycle\n",
+ "print \" The Efficiency is\",round(effi2,4),\" or\",round(effi2*100),\"% \\n\"\n",
+ "perincrease=((effi2-effi1)/effi1)*100 \n",
+ "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.3603 or 36.0 % \n",
+ "\n",
+ " The % increase in Efficiency is 11.55 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:PG-152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "P2=2*1000 #higher pressure converted in in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "h1=192.0 # enthalpy at 10 kPa in kJ/kg\n",
+ "h3=3248.0 # enthalpy @ state 3 in kJ/kg from table C.3\n",
+ "s3=7.128 # entropy @ state 3 in kJ/kg.K from table C.3\n",
+ "s4=s3 # isentropic process\n",
+ "\n",
+ "h2=h1 #isenthalpic process\n",
+ "h4=((s4-7.038)/(7.233-7.038))*(3056-2950)+2950 #using adjacent values for \n",
+ "#interpolation from table C.3 \n",
+ "h5=3267.0 # enthalpy at 800 kPa and $00 degree celsius\n",
+ "s5=7.572 # entropy at 800 kPa and $00 degree celsius\n",
+ "\n",
+ "s6=s5 # isentropic process\n",
+ "sf=0.6491# entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "x=(s6-sf)/(sg-sf)# quality of steam\n",
+ "\n",
+ "hf=192.0 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2585.0 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "h6=hf+x*(hg-hf)# enthalpy @ state 6\n",
+ "\n",
+ "# we now calculate energy input\n",
+ "qb=(h5-h4)+(h3-h2)# heat interaction\n",
+ "\n",
+ "# we now calculate work output\n",
+ "wt=(h5-h6)+(h3-h4)# turbine work\n",
+ "\n",
+ "eff=(wt)/qb # efficiency of power cycle\n",
+ "print\" The Efficiency is\",round(eff,3),\" or\",round(eff*100,2),\"%\"\n",
+ "\n",
+ "# // The anwer is different in textbook as there the intermediate values are approximated while in python the calculations are precise \n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.336 or 33.57 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:PG-155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# initialization of variables\n",
+ "\n",
+ "# Please refer to fig of question 6.1 for quantities\n",
+ "\n",
+ "effi1=0.357 #efficiency from example 6.3\n",
+ "P2=2*1000.0 #higher pressure converted in in kPa\n",
+ "P1=10.0 # lower pressure in kPa\n",
+ "rho=1000.0 # density of water in Kg/m^3\n",
+ "T2=600.0 # max temperature of cycle in degree celsius\n",
+ "h1=192.0 # enthalpy at state 1 in kJ/kg\n",
+ "h3=3690.0 # enthalpy at state 3 in kJ/kg, 600*C and 2MPa pressure\n",
+ "h4=2442.0 # enthalpy from example 6.3\n",
+ "h6=505.0 # specific enthalpy @ 200 kPa from steam table\n",
+ "h7=h6 # isenthalpic process\n",
+ "s3=7.702# entropy at state 3 in kJ/kg.K, 600*C and 2MPa pressure\n",
+ "\n",
+ "h2=h1 # isenthalpic process\n",
+ "s5=s3 # isentropic process\n",
+ "h5=(s3-7.509)*(2971-2870)/(7.709-7.509)+2870 # interpolationg from steam table 2 200 kPa using s5=s3= 7.702 kJ/kg.\n",
+ "\n",
+ "m6=1.0 # let mass of steam =1 Kg\n",
+ "m5=(h6-h2)*(m6)/(h5-h2) \n",
+ "m2=m6-m5 # conservation of mass\n",
+ "\n",
+ "wt=h3-h5+(h5-h4)*m2 # work done by turbine\n",
+ "qb=h3-h7 # heat given to bolier\n",
+ "effi2=(wt)/qb # efficiency of power cycle\n",
+ "print \" The Efficiency is\",round(effi2,4),\" or\",round(effi2*100),\"% \\n\"\n",
+ "perincrease=((effi2-effi1)/effi1)*100 \n",
+ "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n",
+ "\n",
+ "# The anwer is different in textbook as there the intermediate values are approximated while in python the calculations are precise \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.3732 or 37.0 % \n",
+ "\n",
+ " The % increase in Efficiency is 4.55 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:PG-156"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "P2=2*1000 #higher pressure converted in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "h1=192 # enthalpy at 10 kPa in kJ/kg\n",
+ "h3=3248 # enthalpy @ state 3 in kJ/kg from table C.3\n",
+ "s3=7.128 # entropy @ state 3 in kJ/kg.K from table C.3\n",
+ "\n",
+ "s4=s3 # isentropic process\n",
+ "\n",
+ "h4=((s4-7.038)/(7.233-7.038))*(3056-2950)+2950 #using adjacent values for \n",
+ "#interpolation from table C.3 \n",
+ "h5=3267 # enthalpy at 800 kPa and $00 degree celsius\n",
+ "s5=7.572 # entropy at 800 kPa and $00 degree celsius\n",
+ "\n",
+ "s6=s5 # isentropic process\n",
+ "sf=0.6491# entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "x=(s6-sf)/(sg-sf)# quality of steam\n",
+ "\n",
+ "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2585 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "\n",
+ "h6=hf+x*(hg-hf)# enthalpy @ state 6\n",
+ "h7=721 # enthalpy of saturated liquid @800 kPa from steam table\n",
+ "h8=h7 # isenthalpic process\n",
+ "h2=h1 # isenthalpic process\n",
+ "\n",
+ "m8=1 # let mass of steam =1 Kg\n",
+ "m4=(h8-h2)*(m8)/(h4-h2)\n",
+ "m2=m8-m4 # conservation of mass\n",
+ "\n",
+ "wt=h3-h4+(h5-h6)*m2 # work done by turbine\n",
+ "qb=h3-h8+(h5-h4)*m2 # heat given to bolier\n",
+ "\n",
+ "effi=(wt)/qb # efficiency of power cycle\n",
+ "# result\n",
+ "print \" The Efficiency is\",round(effi,3),\" or\",round(effi*100,2),\"%\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.347 or 34.7 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.8:PG-159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "\n",
+ "# for rankine cycle refer to fig 6.9\n",
+ "\n",
+ "effiT=0.8 # turbine efficiency\n",
+ "P2=2*1000 # higher pressure converted in kPa\n",
+ "P1=10 # lower pressure in kPa\n",
+ "h1=192 # enthalpy at 10 kPa in kJ/kg\n",
+ "h3=3690 # enthalpy of superheated steam @ 2 MPa from steam table in kJ/kg\n",
+ "s3=7.702 #entropy of superheated steam @ 2 MPa from steam table in kJ/kg.K\n",
+ "# state 4' is repsresented by '41'\n",
+ "h2=h1 #isenthalpic process\n",
+ "s41=s3 # entropy is constant\n",
+ "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",
+ "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",
+ "x=(s41-sf)/(sg-sf)# from property of pure substance\n",
+ "\n",
+ "hf=191.8 #enthalpy of saturated liquid @10 kPa from steam table\n",
+ "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",
+ "h41=hf+x*(hg-hf)# enthalpy @ state 41\n",
+ "\n",
+ "wa=effiT*(h3-h41)# turbine efficiency =(actual work)/(isentropic work)\n",
+ "\n",
+ "qb=h3-h2 # heat supplied\n",
+ "\n",
+ "effi=(wa)/qb # efficiency of power cycle\n",
+ "print\" The Efficiency is\",round(effi,3),\" or\",round(effi*100,1),\"%\"\n",
+ "\n",
+ "h4=h3-wa # adiabatic process\n",
+ "\n",
+ "# now using interpolation for superheated steam @ 10 kPa\n",
+ "T4=(h4-2688)*(150-100)/(2783-2688)+100\n",
+ "\n",
+ "print \"\\n The Temperature from interpolation comes out to be\",int(T4),\" degree celsius\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Efficiency is 0.286 or 28.6 %\n",
+ "\n",
+ " The Temperature from interpolation comes out to be 101 degree celsius\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:PG-162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialization of variables\n",
+ "\n",
+ "# refer to fig 6.10c\n",
+ "\n",
+ "mdot=0.6 # mass flow rate of refrigerant in kg/sec\n",
+ "T1=-24 # evaporator temperature in degree celsius\n",
+ "T2=39.39 # condenser temperature in degree celsius\n",
+ "h1=232.8 # enthalpy of saturated R134a vapour @ -24 degree celsius from table D.1\n",
+ "s1=0.9370 # entropy of saturated R134a vapour @ -24 degree celsius from table D.1\n",
+ "h3=105.3 # enthalpy of saturated R134a liquid @ -24 degree celsius from table D.2\n",
+ "h4=h3 # isenthalpic process\n",
+ "\n",
+ "# interpolating enthalpy from table D.3 @ 39.39 degree celsius\n",
+ "h2=(s1-0.9066)*(280.19-268.68)/(0.9428-0.9066)+268.68\n",
+ "QdotE=mdot*(h1-h4) # heat transfer rate\n",
+ "WdotC=mdot*(h2-h1)# power given to compressor\n",
+ "\n",
+ "COP=QdotE/WdotC # coefficient of performance\n",
+ "\n",
+ "Hp=(WdotC/0.746)/(QdotE/3.52) #calculating Horsepower required per Ton\n",
+ "\n",
+ "print \"The rate of refrigeration is\",round(QdotE,2),\"kJ/s \\n \"\n",
+ "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",
+ "print \"The rating in horsepower per ton is\",round(Hp,3),\" hp\\n \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of refrigeration is 76.5 kJ/s \n",
+ " \n",
+ "The coefficient of performance is 2.8 \n",
+ " \n",
+ "The rating in horsepower per ton is 1.686 hp\n",
+ " \n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.10:PG-163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialization of variables\n",
+ "# refer to fig 6.10c\n",
+ "effi=0.8 # compressor efficiency\n",
+ "mdot=0.6 # mass flow rate of refrigerant in Kg/sec\n",
+ "T4=-24 # temperature of evaporator\n",
+ "T2=39.39 # temperature of condensor\n",
+ "T1=-20.0 # supeheating temperature\n",
+ "T3=40 # subcooling temperature\n",
+ "h3=106.2 # enthalpy of liquid R-134a @ 40 degree celsius from table D.1\n",
+ "h4=h3 # isenthalpic process\n",
+ "h1=236.5 # enthalpy of superheated R-134a @ 0.10 MPa and -20 degree celsius from table D.3\n",
+ "s1=0.960 #entropy of superheated R-134a @ 0.10 MPa and -20 degree celsius from table D.3 \n",
+ "\n",
+ "s2dash=s1 # isentropic process\n",
+ "\n",
+ "# using interpolation from table D.3 @ 1.0 MPa for s2dash=0.960 \n",
+ "h2dash=(s2dash-0.9428)*(291.36-280.19)/(0.9768-0.9428)+280.19\n",
+ "\n",
+ "h2=(h2dash-h1)/(effi)+h1 # by definition of compressor efficiency\n",
+ "\n",
+ "QdotE=mdot*(h1-h4)#heat transfer rate power given to compressor\n",
+ " \n",
+ "wdotc=mdot*(h2-h1)# power given to compressor\n",
+ "\n",
+ "COP=QdotE/wdotc # coefficient of performance\n",
+ "\n",
+ "print \"The rate of refrigeration is\",round(QdotE,1),\"kJ/s \\n \"\n",
+ "\n",
+ "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",
+ "# The value of Wdotc is shown wrong in the textbook. It should be multiplied by mass flow rate\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of refrigeration is 78.2 kJ/s \n",
+ " \n",
+ "The coefficient of performance is 2.11 \n",
+ " \n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.11:PG-165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# solution\n",
+ "#initialization of variables\n",
+ "# refer to fig 6.10c\n",
+ "\n",
+ "QdotC=300 #heating Load in KWh or heat rejected by condensor\n",
+ "T1=-12 # evaporator temperature in degree celsius\n",
+ "P2=800 # condensor pressure in kPa \n",
+ "h1=240 # specific enthalpy of saturated R-134a vapour @ -12 degree celsius from table D.1\n",
+ "s1=0.927 # specific entropy of saturated R-134a vapour @ -12 degree celsius from table D.1\n",
+ "s2=s1 # isentropic process\n",
+ "h3=93.4 #specific enthalpy of saturated R-134a liquid @ 800 kPa from tableD.2\n",
+ "\n",
+ "# extrapolating enthalpy from table D.2 @ 0.8 MPa for s=0.927\n",
+ "h2=273.7-(0.9374-s2)*(284.4-273.7)/(0.9711-0.9374)\n",
+ "\n",
+ "# QdotE=mdot*(h1-h4) is heat transfer rate\n",
+ "mdot=QdotC/(h2-h3)# mass flow rate\n",
+ "\n",
+ "WdotC=mdot*(h2-h1)# power given to compressor\n",
+ "\n",
+ "#part(a)\n",
+ "COP=QdotC/WdotC # coefficient of performance\n",
+ "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",
+ "\n",
+ "#part(b)\n",
+ "Cost=WdotC*0.07 # cost of electricity\n",
+ "print \"The cost of electricity is $\",round(Cost,3),\"/hr \\n\"\n",
+ "\n",
+ "#part(c)\n",
+ "costgas=(300*3600*0.50)/100000 # cost of gas\n",
+ "print \"The cost of gas is $\",round(costgas,2),\"/hr \\nThus heat pump is better \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The coefficient of performance is 5.82 \n",
+ " \n",
+ "The cost of electricity is $ 3.607 /hr \n",
+ "\n",
+ "The cost of gas is $ 5.4 /hr \n",
+ "Thus heat pump is better \n"
+ ]
+ }
+ ],
+ "prompt_number": 66
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter7_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter7_2.ipynb new file mode 100755 index 00000000..1c4b1c97 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter7_2.ipynb @@ -0,0 +1,616 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c5a74c16b8ffa890dee9e16252d9e0c3674909f92103f0b1c670f62652469cd7"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7:Power and Refrigeration Gas Cycles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.1:PG-175"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=12 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "p1=200.0 # pressure at state 1 in kPa\n",
+ "p3=10000.0 # pressure at state 3 in kPa\n",
+ "\n",
+ "c=100/(r-1) # clearance in percentage\n",
+ "print \"The percent clearance is\",round(c,2),\"% \\n\"\n",
+ "v3=100.0 # let us assume v3=100 m^3 for calculations\n",
+ "p2=p1*(r**k) # polytopic process pressure relation\n",
+ "p4=p3*(1/(r**k))# polytropic process pressure relation\n",
+ "w34=v3*(r*p4-p3)/(1-k) # polytropic work done in process 3 to 4\n",
+ "v2=v3 # constant volume process\n",
+ "w12=v2*(p2-r*p1)/(1-k)\n",
+ "wcycle=w12+w34 # total work in cycle\n",
+ " # now equating the polytropic work calculated to work by MEP\n",
+ "MEP=wcycle/(r*v2-v2) # as work = pressure*change in volume\n",
+ "print \"The MEP is\",round(MEP),\" kPa\" \n",
+ "# The solution is wrong in textbook as calculation for P2 is wrong \n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The percent clearance is 9.0 % \n",
+ "\n",
+ "The MEP is 503.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.2:PG-179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=10.0 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "Cv=0.717 # specific heat at constant volume\n",
+ "Wnet=1000 # net work output in kJ/kg\n",
+ "T1=227+273.0 # low air temperaure in kelvin\n",
+ "p1=200.0 # low pressure in kPa\n",
+ "\n",
+ "effi=1-(1/r**(k-1)) # thermal efficeiency \n",
+ "print \"The maximum possible thermal efficiency is\",round(effi*100,1),\"% \\n\"\n",
+ "\n",
+ "T2=T1*(r)**(k-1) # isentropic process temperature relation\n",
+ "\n",
+ "T4=((Wnet/Cv)+T2-T1)/((r**(k-1))-1) # using expression for work\n",
+ "\n",
+ "T3=T4*(r)**(k-1)\n",
+ "\n",
+ "efficarnot=1-T1/T3\n",
+ "print \"The carnot efficiency is\",round(efficarnot*100),\"%\"\n",
+ "\n",
+ "v1=R*T1/p1 # initial volume \n",
+ "v2=v1/r # from compression ratio\n",
+ "\n",
+ "MEP=Wnet/(v1-v2) # mean effective pressure equation\n",
+ "\n",
+ "print \"The MEP is\",round(MEP),\" kPa\"\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum possible thermal efficiency is 60.2 % \n",
+ "\n",
+ "The carnot efficiency is 86.0 %\n",
+ "The MEP is 1549.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.3:PG-182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "\n",
+ "r=18 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "Cv=0.717 # specific heat at constant volume\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "T1=200+273 # lower temperaure in kelvin\n",
+ "P1=200.0 # low pressure in kPa\n",
+ "T3=2000 # higher temperature of cycle in kelvin\n",
+ "\n",
+ "v1=R*T1/P1 # specific volume at state 1 in m^3\n",
+ "v2=v1/r # specific volume after compression in m^3\n",
+ "\n",
+ "T2=T1*(v1/v2)**(k-1) # temperature after compression\n",
+ "P2=P1*(v1/v2)**k # pressure after compression\n",
+ "P3=P2 # diesel cycle\n",
+ "v3=R*T3/P3 # volume at state 3\n",
+ "\n",
+ "rc=v3/v2 # cutoff ratio\n",
+ "\n",
+ "effi=1-((rc**k)-1)/(r**(k-1)*k*(rc-1))\n",
+ "\n",
+ "\n",
+ "print \"The thermal efficiency is\",round(effi*100,1),\"%\"\n",
+ "\n",
+ "v4=v1 # diesel cycle\n",
+ "T4=T3*(v3/v4)**(k-1) # adiabatic process\n",
+ "\n",
+ "qin=Cp*(T3-T2) # using first law \n",
+ "qout=Cv*(T4-T1) # heat rejected \n",
+ "\n",
+ "Wnet=qin-qout # net work\n",
+ "MEP=Wnet/(v1-v2) # expression of mean effective pressure in terms of work\n",
+ "\n",
+ "print \"The MEP is\",round(MEP),\" kPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The thermal efficiency is 66.6 %\n",
+ "The MEP is 515.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.4:PG-183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "r=18 # compression ratio\n",
+ "k=1.4 # polytropic index for air\n",
+ "R=0.287 # specific gas constant for air\n",
+ "T1=200+273 # lower temperaure in kelvin\n",
+ "P1=200.0 # low pressure in kPa\n",
+ "T3=2000.0 # higher temperature of cycle in kelvin \n",
+ "\n",
+ "v1=R*T1/P1 # specific volume at state 1 in m^3\n",
+ "#using table E.1\n",
+ "u1=340.0 # specific internal energy in kJ/kg\n",
+ "vr1=198.1 # in m^3/kg\n",
+ "\n",
+ "vr2=vr1*(1/r) # as r=v1/v2\n",
+ "\n",
+ "# now finding corresponding values from table E.1\n",
+ "T2=1310.0 # temperature in kelvin\n",
+ "Pr2=34.0 # pressure in kPa\n",
+ "h2=1408.0 # specific entropy in kJ/kg\n",
+ "v2=v1/18 # volume at state 2\n",
+ "P2=R*T2/v2 # pressure at state 2\n",
+ "\n",
+ "h3=2252.1 # specific enthalpy in kJ/kg from table E.1\n",
+ "vr3=2.776 \n",
+ "P3=P2 # diesel cycle\n",
+ "v3=R*T3/P3 # after compression volume\n",
+ "v4=v1 # isochoric process\n",
+ "vr4=vr3*v4/v3 # isentropic process\n",
+ "# now using Vr4 we read corresponding value from table E.1\n",
+ "T4=915 # final temperature in kelvin\n",
+ "u4=687.5 # specific internal energy at state 4\n",
+ "\n",
+ "qin=h3-h2 # using first law \n",
+ "qout=u4-u1 # heat rejected \n",
+ "\n",
+ "Wnet=qin-qout # net work\n",
+ "effi=100*Wnet/qin # thermal efficiency\n",
+ "print\" The thermal efficiency is\",round(effi,1),\"%\"\n",
+ "\n",
+ "MEP=Wnet/(v1-v2) # expression of mean effective pressure in terms of work\n",
+ "\n",
+ "print \" The MEP is\",round(MEP),\" kPa\"\n",
+ "\n",
+ "erroreffi=(66.6-effi)*100/effi # error in efficiency\n",
+ "errorMEP=(515-MEP)*100/MEP # error in MEP\n",
+ "\n",
+ "print \" The % error in efficiency is\",round(erroreffi,1),\"%\"\n",
+ "print \" The % error MEP is\",round(errorMEP,1),\"% \\n\"\n",
+ "\n",
+ "# the answers are slight different due to approximation in textbook ... here answers are precise\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The thermal efficiency is 58.8 %\n",
+ " The MEP is 775.0 kPa\n",
+ " The % error in efficiency is 13.2 %\n",
+ " The % error MEP is -33.5 % \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.5:PG-186"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "T2=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "\n",
+ "T4=T3*(1/r)**((k-1.0)/k) # final temperature\n",
+ "\n",
+ "Wcomp=Cp*(T2-T1) # compressor work\n",
+ "Wturb=Cp*(T3-T4) # turbine work\n",
+ "\n",
+ "BWR=Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR*100,1),\"%\\n\" \n",
+ "\n",
+ "Effi=1-r**((1-k)/k) # thermal efficiency\n",
+ "\n",
+ "print\" The thermal efficiency is\",round(Effi*100,1),\"%\"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 42.0 %\n",
+ " The thermal efficiency is 36.9 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.6:PG-186"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "efficomp=0.75 # efficiency of compressor\n",
+ "effiturb=0.75 # efficiency of turbine\n",
+ "\n",
+ "T2dash=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "Wcomp=Cp*(T2dash-T1)/efficomp # compressor work\n",
+ "\n",
+ "T4dash=T3*(1/r)**((k-1)/k) # final temperature\n",
+ "Wturb=Cp*(T3-T4dash)*effiturb # turbine work\n",
+ "\n",
+ "BWR=100*Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR,1),\"%\\n\"\n",
+ "\n",
+ "T2=(Wcomp/Cp)+T1 # actual temperature of state 2\n",
+ "\n",
+ "qin=Cp*(T3-T2) # using first law \n",
+ "\n",
+ "Wnet=(Wturb-Wcomp) # net work\n",
+ "\n",
+ "effi=100*Wnet/qin # thermal efficiency\n",
+ "print\" The thermal efficiency is\",round(effi,1),\"%\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 74.7 %\n",
+ " The thermal efficiency is 13.2 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.7:PG-191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific heat at constant pressure\n",
+ "k=1.4 # polytropic index for air\n",
+ "T1=25+273.0 # temperature at compressor inlet\n",
+ "T3=850+273.0 # maximum temperature in kelvin\n",
+ "\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "T2=T1*(r)**((k-1)/k) # temperature after compression\n",
+ "\n",
+ "T4=T3*(1/r)**((k-1)/k) # final temperature\n",
+ "\n",
+ "Wcomp=Cp*(T2-T1) # compressor work\n",
+ "Wturb=Cp*(T3-T4) # turbine work\n",
+ "\n",
+ "BWR=Wcomp/Wturb # back work ratio\n",
+ "\n",
+ "print \" The BWR is\",round(BWR,2),\"\\n\"\n",
+ "\n",
+ "effi=(1-((T1/T4)*(r**((k-1)/k))))# efficiency\n",
+ "print\" The thermal efficiency is\",round(effi*100,1),\"%\"\n",
+ "# The solution in textbook is incorrect due to wrong value of T4 (temperature at state 4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The BWR is 0.42 \n",
+ "\n",
+ " The thermal efficiency is 33.4 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.8:PG-193"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "#REFER TO FIG.:7.8\n",
+ "\n",
+ "Cp=1 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "T5=25+273.0 # temperature at state 5 in kelvin\n",
+ "T7=850+273.0 # temperature at state 4 in kelvin\n",
+ "T9=350 # exit temperature of water from bolier in kelvin\n",
+ "WdotST=100000.0 # power from steam turbine in Watt\n",
+ "r=5.0 # pressure ratio=P2/P1 & P4/P3\n",
+ "\n",
+ "h1=192.0 # specific enthalpy at 10 Kpa from steam table\n",
+ "h2=h1 # isenthalpic process\n",
+ "h3=3214.0 # specific enthalpy at 4 Mpa and 400 degree celsius from steam table\n",
+ "s3=6.769 # specific entropy at 4 Mpa and 400 degree celsius from steam table\n",
+ "\n",
+ "s4=s3 # isentropic process\n",
+ "sf=0.6491 # specific entropy of saturated liquid at 10 kPa and 45 degree celsiusfrom table C.2\n",
+ "sg=8.1510 # specific entropy of saturated liquid at 10 kPa and 45 degree celsiusfrom table C.2\n",
+ "x4=(s4-sf)/(sg-sf) # quality of steam\n",
+ "\n",
+ "hf=h1 # specific enthalpy of saturated liquid @ 10 Kpa \n",
+ "hg=2584.6\n",
+ "h4=hf+x4*(hg-hf) # specific entropy at state 4\n",
+ "\n",
+ "mdots=WdotST/(h3-h4) # steam mass flow rate from turbine output\n",
+ "\n",
+ "T6=T5*(r**((k-1)/k)) # adiabatic process relation\n",
+ "T8=T7*(1/r**((k-1)/k)) # adiabatic process relation\n",
+ "\n",
+ "# Now using energy balance in boiler\n",
+ "mdota=mdots*(h3-h2)/(Cp*(T8-T9)) # mass flow rate of water\n",
+ "\n",
+ "Wdotturb=mdota*Cp*(T7-T8) # power produced by turbine\n",
+ "\n",
+ "Wdotcomp=mdota*Cp*(T6-T5) # energy needed by compressor\n",
+ "\n",
+ "WdotGT=Wdotturb-Wdotcomp # net turbine work\n",
+ "\n",
+ "Qdotin=mdota*Cp*(T7-T6) # energy input by combustor\n",
+ "\n",
+ "effi=100*(WdotST+WdotGT)/Qdotin # combined efficiency\n",
+ "\n",
+ "print \"The thermal efficiency of the combined cycle is\",round(effi,1),\"%\"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The thermal efficiency of the combined cycle is 56.4 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.9:PG-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "r=10.0\n",
+ "T2=-10+273 # temperature at entry of compressor\n",
+ "T4=30+273 # temperature at entry of turbine\n",
+ "\n",
+ "T3=T2*(r**((k-1)/k)) # temperature at state 3 in kelvin\n",
+ "T1=T4*(1/r**((k-1)/k)) # temperature at state 1 in degree celsius\n",
+ "print \"The minimum temperature is\",round(T1-273),\"degree celsius \\n\"\n",
+ "\n",
+ "qin=Cp*(T2-T1) # heat input\n",
+ "Wcomp=Cp*(T3-T2)# compressor work\n",
+ "Wturb=Cp*(T4-T1) # turbine work\n",
+ "\n",
+ "COP=qin/(Wcomp-Wturb) # COP of refrigeration\n",
+ "print\" The COP is\",round(COP,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum temperature is -116.0 degree celsius \n",
+ "\n",
+ " The COP is 1.07\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.10:PG-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#solution\n",
+ "# initialization of variables\n",
+ "\n",
+ "Cp=1.0 # specific constant at constant pressure\n",
+ "k=1.4 # polytropic constant for air\n",
+ "r=10.0\n",
+ "T3=-10+273 # temperature at entry of compressor\n",
+ "T6=-40+273 # temperature at entry of turbine\n",
+ "\n",
+ "T5=T3 # heat exchanger\n",
+ "T2=T6 # heat exchanger\n",
+ "\n",
+ "T4=T3*(r**((k-1)/k)) # temperature after compression\n",
+ "T1=T6*(1/r**((k-1)/k)) # temperature after exit from turbine\n",
+ "\n",
+ "print \"The minimum temperature is\",round(T1-273),\"degree celsius \\n\"\n",
+ "\n",
+ "qin=Cp*(T2-T1) # heat input\n",
+ "Wcomp=Cp*(T4-T3)# compressor work\n",
+ "Wturb=Cp*(T6-T1) # turbine work\n",
+ "\n",
+ "COP=qin/(Wcomp-Wturb) # COP of refrigeration\n",
+ "\n",
+ "print\" The COP is\",round(COP,3)\n",
+ "\n",
+ "# the answer is correct within given limits\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum temperature is -152.0 degree celsius \n",
+ "\n",
+ " The COP is 0.848\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter8_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter8_2.ipynb new file mode 100755 index 00000000..2ab04749 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter8_2.ipynb @@ -0,0 +1,530 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:cd14818c82eb9353b8e2f9e12079fb0ba7b2a061c9a528ea53dea9dfa9a116ce"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8:Psychrometrics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.1:PG-208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#initialization of variables\n",
+ "Ra=0.287 # specific gas constant for air\n",
+ "P=100.0 # pressure of room in kPa\n",
+ "V=150.0 # volume of room in m^3\n",
+ "T=25+273 # temperature of air in kelvin\n",
+ "phi=0.6 # relative humidity\n",
+ "Pg=3.29 # saturation vapour pressure in kPa at 25 *C from table C.1\n",
+ "Mv= 18 # molecular mass of water vapor\n",
+ "Ma=28.97 # molecular mass of air\n",
+ "\n",
+ "Pv=Pg*phi # partial pressure of water vapour\n",
+ "\n",
+ "Pa=P-Pv # partial pressure of air\n",
+ "\n",
+ "w=0.622*(Pv/Pa) # humidity ratio in Kg of water/ Kg of dry air\n",
+ "Tdp=17.4 # dew point temperature from interpolation in table C.2 corresponding to partial pressure Pv=1.98 kPa\n",
+ "\n",
+ "ma=Pa*V/(Ra*T) # mass of air\n",
+ "mv=w*ma # mass of water vapour in kg\n",
+ "\n",
+ "# now we find volume percentage\n",
+ "Nv=mv/Mv # moles of vapour\n",
+ "Na=ma/Ma # moles of air\n",
+ "\n",
+ "Vw= Nv/(Na+Nv) # fraction of volume occupied by water vapour\n",
+ "\n",
+ "print \"The humidity ratio is\",round(w,4),\"kg water/ kg of dry air \\n\"\n",
+ "print \"The dew point is\",round(Tdp,1),\"degree celsius \\n \"\n",
+ "print \"The mass of water vapour in the air is\",round(mv,3),\"kg \\n\"\n",
+ "print \"The volume percentage of the room that is water vapor is\",round(Vw*100,2),\"%\"\n",
+ "# The answers are correct within given limits \n",
+ "# The variation in answers is due to approximations made by\n",
+ "# textbook while python is precise\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The humidity ratio is 0.0125 kg water/ kg of dry air \n",
+ "\n",
+ "The dew point is 17.4 degree celsius \n",
+ " \n",
+ "The mass of water vapour in the air is 2.153 kg \n",
+ "\n",
+ "The volume percentage of the room that is water vapor is 1.98 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.2:PG-209"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#initialization of variables\n",
+ "Ra=0.287 # specific gas constant for air\n",
+ "P=100.0 # pressure of room in kPa\n",
+ "w1=0.0126 # old humidity ratio of example 8.1-\n",
+ "Pg=3.29 # saturation vapour pressure in kPa at 25 *C from table C.1\n",
+ "mv=2.17 # initial mass of water vapour in example 8.1\n",
+ "T=25+273 # temperature after reheat\n",
+ "V=150.0 # volume of room in m^3 \n",
+ "Pv=1.228 # saturation vapour pressure in kPa @ 10 degree celsius from table C.1\n",
+ "Pa=P-Pv # partial pressure of air\n",
+ "w2=0.622*(Pv/Pa) # new humidity ratio in Kg of water/ Kg of dry air\n",
+ "deltaw=w1-w2 # difference in humidity ratio\n",
+ "ma=Pa*V/(Ra*T) # mass of air\n",
+ "deltamv=deltaw*ma # mass of water vapour condensed\n",
+ "X=deltamv*100/mv # percentage of water vapour condensed\n",
+ "print \"The percentage that condenses is\",round(X,2),\"% \\n\"\n",
+ "# AFTER REHEATING\n",
+ "phi=1.608*w2*Pa/Pg\n",
+ "print \"The relative humidity is\",round(phi*100,3),\"%\"\n",
+ "\n",
+ "# The answers are correct within given limits \n",
+ "# The variation in answers is due to approximations made by\n",
+ "# textbook while python is precise\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The percentage that condenses is 38.85 % \n",
+ "\n",
+ "The relative humidity is 37.332 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.3:PG-212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#initialization of variables\n",
+ "T1=40 # dry bulb temperature in degree celsius\n",
+ "T2=20 # wet bulb temperature in degree celsius\n",
+ "Cp=1.0 # specific heat\n",
+ "P=100 # pressure of air stream in kPa\n",
+ "pg1=7.383 #saturation pressure @ 40 degree celsius\n",
+ "hfg2=2454 # latent heat for 20 degree celsius\n",
+ "Pg2=2.338 # saturation pressure @ 20 degree celsius\n",
+ "w2=0.622*Pg2/(P-Pg2) # specific humidity for wet bulb condition\n",
+ "hg1=2574 # specific enthalpy of saturated vapour @ 40 degree celsius\n",
+ "hf2=83.9 #spedific enthalpy of saturated liquid @ 20 degree celsius\n",
+ "w1=((w2*hfg2)+Cp*(T2-T1))/(hg1-hf2)# specific humidity for 40 degree celsius\n",
+ "print \"The humidity ratio is\",round(w1,4),\"kg water/ Kg dry air \\n\"\n",
+ "pv1=100*w1/(0.622+w1) # partial pressure of vapour\n",
+ "phi=pv1/pg1 # relative humidity\n",
+ "print \"The relative humidity is\",round(phi*100,1),\"% \\n\"\n",
+ "\n",
+ "hv=hg1 # temperature is at DBT=40 degree celsius\n",
+ "h=Cp*T1+w1*hv # specific enthalpy of air\n",
+ "print \"The specific enthalpy is\",round(h,1),\"kJ/kg dry air\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The humidity ratio is 0.0066 kg water/ Kg dry air \n",
+ "\n",
+ "The relative humidity is 14.3 % \n",
+ "\n",
+ "The specific enthalpy is 57.1 kJ/kg dry air\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.5:PG-215"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "T1=40 # inlet temperature in degree celsius\n",
+ "T2=27 # outlet temperature in degree celsius\n",
+ "phi1= 10 # relative humidity at inlet\n",
+ "# as no heat transfer takes place thus isenthalpic process\n",
+ "\n",
+ "#Thus following the enthalpy line at DBT=40 and Relative humidity=10\n",
+ "\n",
+ "phi2=45 # by interpolation of constant enthalpy line\n",
+ "w1=0.0046# specific humidity @ T=40 and phi1=10\n",
+ "w2=0.010 # specific humidity at outlet\n",
+ "W=w2-w1 # amount of water added\n",
+ "Tmin=18.5 # minimum temperature at 100% relative humidity\n",
+ "\n",
+ "print \"The relative humidity is\",round(phi2,1),\"% \\n \"\n",
+ "print \"The added water is\",round(W,4),\"kg water/kg dry air \\n\"\n",
+ "print \"The lowest possible temperature is\",round(Tmin,1),\"*C \"\n",
+ "\n",
+ "\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The relative humidity is 45.0 % \n",
+ " \n",
+ "The added water is 0.0054 kg water/kg dry air \n",
+ "\n",
+ "The lowest possible temperature is 18.5 *C \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.6:PG-215"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "T1=5+273.0 # outside air temperature in kelvin\n",
+ "P=100.0 # pressure in kPa\n",
+ "Ra=0.287 # specific gas constant for air\n",
+ "phi=0.7 # relative humidity outside\n",
+ "Qf=50.0/60.0 # volume flow rate in m**3/sec\n",
+ "Pg1=0.872 # saturation pressure at 278 K\n",
+ "Pv1=phi*Pg1 # partial pressure of water vapour\n",
+ "Pa1=P-Pv1 # partial pressure of air\n",
+ "\n",
+ "rhoa=Pa1/(Ra*T1) # density of dry air\n",
+ "\n",
+ "mdota=Qf*rhoa # mass flow rate of dry air\n",
+ "\n",
+ "# using psychrometric chart at T1=5*C and phi1=70% \n",
+ "h1=14 # inlet enthalpy in kJ/kg\n",
+ "h2=35 # enthalpy after heating in kJ/kg\n",
+ "\n",
+ "Qdot=mdota*(h2-h1) # heat transfer rate\n",
+ "# from psychrometric chart for T=25 *C and 35 kJ/kg enthalpy\n",
+ "phi2=19 # realtive humidity\n",
+ "\n",
+ "print \"The heat transfer rate is\",round(Qdot,1),\"kJ/s \\n\"\n",
+ "print \"The final relative humidity is\",round(phi2,4),\"% \"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat transfer rate is 21.8 kJ/s \n",
+ "\n",
+ "The final relative humidity is 19.0 % \n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.7:PG-216"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "#DATA TAKEN FROM PSYCHROMETRIC CHART\n",
+ "T1=5+273.0 # outside temperature in kelvin\n",
+ "h1=10# enthalpy in kJ/kg @ T=5 *C and 40 % relative humidity\n",
+ "Pg1=0.872 # saturaion pressure in kPa for 5 degree celsius DBT\n",
+ "phi1=0.4\n",
+ "h2=33 # specific enthalpy at 25 *C and 40 % relatuve humidity\n",
+ "h3=45.0 # specific enthalpy at state 3\n",
+ "P=100.0 # atmospheric pressure in kPa\n",
+ "Ra=0.287 # specific gas constant for air\n",
+ "Qf=60.0/60.0 # volume flow rate in m**3/s\n",
+ "Pv1=phi1*Pg1 # partial presure of water vapour \n",
+ "Pa1=P-Pv1 # partial pressure of air\n",
+ "w2=0.0021 # specific humidity @ 40 % relative humidity and 25*C temperature\n",
+ "w3=0.008 # final specific humidity\n",
+ "rhoa1=Pa1/(Ra*T1) # air density\n",
+ "mdota=Qf*rhoa1 # mass flow rate of dry air\n",
+ "\n",
+ "Qdot=mdota*(h2-h1) # heat transfer rate\n",
+ "\n",
+ "# as the process is isothermal thus\n",
+ "mdots=mdota*(w3-w2)# mass flow rate of steam by conservation of mass\n",
+ "print \"the rate of steam supplied is\",round(mdots,4),\"kg/s \\n\"\n",
+ "# also using energy balance\n",
+ "hs=(mdota*(h3-h2))/mdots # enthalpy of steam\n",
+ "hf=604.7 # enthalpy of saturated liquid @ 400 kPa\n",
+ "hg=2738.5 # enthalpy of saturated vapour @ 400 kPa\n",
+ "xs=(hs-hf)/(hg-hf)\n",
+ "print \"The quality of steam is\",round(xs,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the rate of steam supplied is 0.0074 kg/s \n",
+ "\n",
+ "The quality of steam is 0.67\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.8:PG-217"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "# REFER TO FIG. 8.4\n",
+ "T1=30 # outside temperature in degree celsius\n",
+ "phi1=0.9 # outside relative humidity\n",
+ "T2=23 # room temperature in degree celsius\n",
+ "phi2=0.4 # relative humidity in room\n",
+ "\n",
+ "# using psychrometric chart\n",
+ "w1=0.0245 # specific humidity @ 30 *C and relative humidity 0.9\n",
+ "h1=93 # specific enthalpy @ 30 *C and relative humidity 0.9\n",
+ "w2=w1 # during cooling humidity remains constant \n",
+ "w3=0.007 # specific humidity @ 23 *C and relative humidity 0.4\n",
+ "h4=41 # final specific enthalpy\n",
+ "h3=26 # specific enthalpy @ 23 *C and relative humidity 0.4\n",
+ "deltaw=w3-w2 # moisture removed\n",
+ "print \" the amount of moisture removed is\",round(deltaw,4),\"kg \\n\"\n",
+ "\n",
+ "qout=h3-h1 # heat removed F-G-H process\n",
+ "\n",
+ "print \" the heat removed is\",round(qout,4),\"kJ/kg \\n \"\n",
+ "\n",
+ "qin=h4-h3 # heat added to bring to desired state\n",
+ "\n",
+ "print \" the heat added is\",round(qin,4),\"kJ/kg \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the amount of moisture removed is -0.0175 kg \n",
+ "\n",
+ " the heat removed is -67.0 kJ/kg \n",
+ " \n",
+ " the heat added is 15.0 kJ/kg \n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.9:PG-218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "P=100 # atospheric pressure in kPa\n",
+ "R=0.287 # specific gas constant for air\n",
+ "T1=15+273 # outside temperature in kelvin\n",
+ "phi1=0.4# outside air relative humidity\n",
+ "Qf1=40 # outside air flow rate in m^3/min\n",
+ "T2=32+273 # inside temperature in kelvin\n",
+ "phi2=0.7 # inside air relative humidity\n",
+ "Qf2=20 # outside air flow rate in m^3/min\n",
+ "Ps1=1.7 # saturation pressure @ 15 degree celsius and 40% humidity\n",
+ "Ps2=4.9 # saturation pressure @ 32 degree celsius and 70% humidity\n",
+ "\n",
+ "Pv1=Ps1*phi1 # partial pressure of water vapour outside\n",
+ "\n",
+ "Pv2=Ps2*phi2 # partial pressure of water vapour inside\n",
+ "\n",
+ "Pa1=P-Pv1 #partial pressure of dry air outside\n",
+ "Pa2=P-Pv2 #partial pressure of dry air inside\n",
+ "\n",
+ "rhoa1=Pa1/(R*T1) # density of outside air\n",
+ "mdota1=Qf1*rhoa1 # mass flow rate of air outside\n",
+ "\n",
+ "rhoa2=Pa2/(R*T2) # density of inside air\n",
+ "mdota2=Qf2*rhoa2 # mass flow rate of inside air\n",
+ " # using psychrometric chart locating state 1 and 2\n",
+ "h1=37 # specific enthalpy @ DBT 15*C and 40 % humidity\n",
+ "w1=0.0073 # specific humidity @ DBT 15*C and 40 % humidity\n",
+ "h2=110 # specific enthalpy @ DBT 32*C and 70 % humidity\n",
+ "w2=0.0302 # specific humidity @ DBT 32*C and 70 % humidity\n",
+ "ratio=mdota1/mdota2 # ratio of distance between states \n",
+ "# using this ratio state 3 is located on psychrometric chart\n",
+ "T3=(mdota1*T1+mdota2*T2)/(mdota1+mdota2)-273 # final temparature in celsius\n",
+ "\n",
+ "phi3=65# final relative humidity at T3 from psychrometric chart\n",
+ "\n",
+ "print \" The relative humidity is\",round(phi3,4),\"% \\n\"\n",
+ "print \" The resultant temperature is\",round(T3),\"degree celsius\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The relative humidity is 65.0 % \n",
+ "\n",
+ " The resultant temperature is 20.0 degree celsius\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.10:PG-219"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "mdotw3=10000.0 # mass flow rate of water entering in cooling tower in kg/min\n",
+ "Tw1=40+273.0 # temperature of water entering cooling tower in kelvin\n",
+ "Ta1=20+273.0 # temperature of air entering cooling tower in kelvin\n",
+ "phi1=0.5# relative humidity of entering air\n",
+ "Tw2=25+273.0 # temperature of water leaving cooling tower in kelvin\n",
+ "Ta2=32+273 # temperature of air leaving cooling tower in kelvin\n",
+ "phi2=0.98 # relative humidity of leaving air\n",
+ "# from psychrometric chart\n",
+ "h1=37.0# specific enthalpy of air @ 20*C DBT and 50% humidity\n",
+ "w1=0.0073 # specific humidity of air @ 20*C DBT and 50% humidity\n",
+ "h2=110.0 # specific enthalpy of air @ 32*C DBT and 98% humidity\n",
+ "w2=0.030 # specific humidity of air @ 32*C DBT and 98% humidity\n",
+ "\n",
+ "h3=167.5 # specific enthalpy of water from steam table at 40 degree celsius\n",
+ "h4=104.9 # specific enthalpy of water from steam table at 25 degree celsius\n",
+ "\n",
+ "mdota=(mdotw3*(h4-h3))/(h1-h2+(w2-w1)*h4) # by energy balance\n",
+ "\n",
+ "\n",
+ "v1=0.84 # specific volume of air entering tower from psychrometric chart\n",
+ "\n",
+ "Qf=mdota*v1 # volume flow rate in m^3/min\n",
+ "print \"The volume flow rate of air into the cooling tower is\",round(Qf),\" m^3/min \\n\"\n",
+ "\n",
+ "mdot4=mdotw3-(w2-w1)*mdota # by mass balance\n",
+ "print \"The mass flow rate of water that leaves the cooling tower \",round(mdot4),\"kg/min\"\n",
+ "# The answers is slightly different in textbook due to approximations in calculations while in python solution is precise\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The volume flow rate of air into the cooling tower is 7446.0 m^3/min \n",
+ "\n",
+ "The mass flow rate of water that leaves the cooling tower 9799.0 kg/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter9_2.ipynb b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter9_2.ipynb new file mode 100755 index 00000000..9448e892 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter9_2.ipynb @@ -0,0 +1,630 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:7e02442740cf50f0beae7f1fd9dfdf2fb7a16b9c0848a48a17d80c7a19de3f3d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9:Combustion"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.1:PG-229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "AFactual=20 # air fuel ratio actual\n",
+ "# The energy balance is done from equation\n",
+ "\n",
+ "# C4H10 + 6.5(O2+3.76N2)-----> 4CO2 + 5H2O + 24.44N2\n",
+ "\n",
+ "P=100 # atmospheic preesure in kPa\n",
+ "mair=6.5*(1+3.76)*29 # mass of air\n",
+ "mfuel=1*58 # mass of fuel\n",
+ "AFth=mair/mfuel # theoritical air-fuel ratio\n",
+ "Pexcessair=(AFactual-AFth)*100/AFth\n",
+ "\n",
+ "print \"The % excess air is\",round(Pexcessair,2),\"% \\n\"\n",
+ "\n",
+ "# NOW THE REACTION IS\n",
+ "# C4H10+ (1+%excessair/100)*6.5*(O2+3.76N2) -----> 4CO2 + 5H2O + 1.903O2 + 31.6N2\n",
+ "\n",
+ "PCO2=4/42.5*100 # VOLUME % OF CO2\n",
+ "\n",
+ "print \"The volume % of CO2 is\",round(PCO2,2),\"% \\n\"\n",
+ "\n",
+ "# NOW WE FIND DEW POINT\n",
+ "Nv=5 # moles of water\n",
+ "N=42.5 # moles of air\n",
+ "Pv=P*(Nv/N) # partial pressure of vapour\n",
+ "Tdp=49# dew point temperature in degree celsius from table C.2\n",
+ "\n",
+ "print \"The Dew point temperature is\",round(Tdp,2),\"degree celsius\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The % excess air is 29.28 % \n",
+ "\n",
+ "The volume % of CO2 is 9.41 % \n",
+ "\n",
+ "The Dew point temperature is 49.0 degree celsius\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.2:PG-231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "Pair=0.9 # 90% air is used for combustion\n",
+ "\n",
+ "# THE REACTION IS\n",
+ "# C4H10 + 0.9*6.5*(O2+3.76N2)----> aCO2 + 5H20 + bCO\n",
+ "# a and b are calculated by atomic balance\n",
+ "a=2.7\n",
+ "b=1.3\n",
+ "PCO=b*100/31 # volume % of CO\n",
+ "\n",
+ "print \"The volume % of CO is\",round(PCO,2),\"% \\n\"\n",
+ "\n",
+ "mair=6.5*Pair*4.76*29 # mass of air in kg\n",
+ "mfuel=1*58 # mass of fuel butane in kg\n",
+ "AF=mair/mfuel # air-fuel ratio\n",
+ "\n",
+ "print \"The air to fuel ratio is\",round(AF,2),\"kg air/ kg fuel \"\n",
+ "# THE SOLUTION IS CORRECT BUT THERE ARE SOME PRINTING MISTAKES IN TEXTBOOK\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The volume % of CO is 4.19 % \n",
+ "\n",
+ "The air to fuel ratio is 13.92 kg air/ kg fuel \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.3:PG-231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "# THE REACTION IS\n",
+ "# aC4H10 + b(O2+3.76N2)----> CO2 + 1CO + 3.5H20 + 84.6N2 + cH2O\n",
+ "# a, b and c are calculated by atomic balance\n",
+ "# on balancing the equations we get a=3 b=22.5 c=15\n",
+ "# Now equation becomes\n",
+ "#C4H10 + 7.5(O2+3.76N2)----> 3.67CO2 + 0.33CO + 1.17H20 + 28.17N2 + 5H2O\n",
+ "#MOLES OF AIR in this equation is 7.5 moles\n",
+ "mairactual=7.5 # in moles\n",
+ "#MOLES OF AIR in standard equation of Ex.9 is 6.5\n",
+ "mairtheoritical=6.5\n",
+ "Ptheoriticalair=100*(mairactual/mairtheoritical) \n",
+ "print \"The % theoritical air is\",round(Ptheoriticalair,1),\"% \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The % theoritical air is 115.4 % \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.4:PG-232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "# The reaction equation is \n",
+ "#CaHb + c(O2+3.76N2)---> 10.4CO2 + 1.2CO + 2.8O2 + 85.6N2 + dH2O\n",
+ "\n",
+ "# using atomic balancing the equations become\n",
+ "\n",
+ "# C11.6H37.9 + 21.08(O2+3.76N2)---> 11.6CO2 + 18.95H2O + 79.26N2\n",
+ "Ptheoriticalair=22.8*100/21.08 # theoritical air\n",
+ "excessair=Ptheoriticalair-100\n",
+ "\n",
+ "print\"The excess air is\",round(excessair),\"%\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The excess air is 8.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.5:PG-235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "# The reaction equation is \n",
+ "#C3H8 + 5(O2+3.76N2)---> 3CO2 + 18.8N2 + 4H2O\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "hfCO2=-393520 # enthalpy associated with CO2\n",
+ "hfH2O=-285830 # enthalpy associated with H2O(l)\n",
+ "hfC3H8=-103850# ehthalpy associated with C3H8\n",
+ "\n",
+ "# by first law Q= Hproducts - Hreactants\n",
+ "\n",
+ "Qg=3*(hfCO2)+4*(hfH2O)-(hfC3H8) # enthalpy of combustion for gaseous propane\n",
+ "\n",
+ "print \" The enthalpy of combustion for gaseous propane is\",round(Qg),\"kJ\\n\"\n",
+ "\n",
+ "hv=15060 # enthalpy of vaporization for propane\n",
+ "\n",
+ "Ql=3*(hfCO2)+4*(hfH2O)-(hfC3H8-hv) # enthalpy of combustion for liquid propane\n",
+ "\n",
+ "print \" The enthalpy of combustion for liquid propane is\",round(Ql),\"kJ\\n\"\n",
+ "\n",
+ "#The answers are slightly different in textbook as they have approximated the result while in Python results are precise\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The enthalpy of combustion for gaseous propane is -2220030.0 kJ\n",
+ "\n",
+ " The enthalpy of combustion for liquid propane is -2204970.0 kJ\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.6:PG-235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "# The reaction equation is \n",
+ "#C3H8 + 5(O2+3.76N2)---> 3CO2 + 18.8N2 + 4H2O\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
+ "hbarCO2=22280 #enthalpy associated with CO2 at 600K from table E.4\n",
+ "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
+ "\n",
+ "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
+ "hbarH2O=20402 #enthalpy associated with H20 at 600K from table E.6\n",
+ "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
+ "\n",
+ "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
+ "\n",
+ "hbarN2=17563 #enthalpy associated with N2 at 600K from table E.2\n",
+ "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
+ "# by first law Q= Hproducts - Hreactants\n",
+ "\n",
+ "Qg=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+18.8*(hbarN2-hdotbarN2)-(hfC3H8) # enthalpy of combustion\n",
+ "\n",
+ "print\"The heat transfer required is\",round(Qg),\"kJ\\n\"\n",
+ "\n",
+ "#The answer is WRONG textbook as they have made an error in calculating Qg \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat transfer required is -1796043.0 kJ\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.7:PG-236"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# initialization of variables\n",
+ "# The reaction equation is \n",
+ "\n",
+ "#C8H18 + 12.5(O2+3.76N2)---> 8CO2 + 47N2 + 9H2O\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
+ "hbarCO2=42769 #enthalpy associated with CO2 at 1000K from table E.4\n",
+ "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
+ "\n",
+ "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
+ "hbarH2O=35882 #enthalpy associated with H20 at 1000K from table E.6\n",
+ "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
+ "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
+ "\n",
+ "hbarN2p=(30784+29476)/2 #enthalpy associated with N2 at 1000K from table E.2 by averaging enthalpy at 1020K and 980K for product\n",
+ "hbarN2r=17563 #enthalpy associated with N2 at 600K from table E.2 for reactant\n",
+ "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
+ "\n",
+ "hfC8H18=-249910 # enthalpy of formation associated with octane taken from internet as not provided in textbook\n",
+ "\n",
+ "hbarO2=17929 # enthalpy associated with O2 at 600K table E.3\n",
+ "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
+ "\n",
+ "# using first law and including kinetic energy change\n",
+ "# 0=Hp-Hr+Mp*(V^2)/2\n",
+ "\n",
+ "Hp=8*(hfCO2+hbarCO2-hdotbarCO2)+9*(hfH2O+hbarH2O-hdotbarH2O)+47*(hbarN2p-hdotbarN2)\n",
+ "# enthalpy of products\n",
+ "\n",
+ "Hr=(hfC8H18)+12.5*(hbarO2-hdotbarO2)+47*(hbarN2r-hdotbarN2)\n",
+ "# enthalpy of reactants\n",
+ "\n",
+ "Mp=8*44+9*18+47*28 #(mass of products by multiplying molecular mass to number of moles)\n",
+ "\n",
+ "V=math.sqrt(2*1000*(Hr-Hp)/Mp)# exit velocity using energy balance\n",
+ "\n",
+ "print \"The exit velocity is\",round(V),\"m/s\"\n",
+ "\n",
+ "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The exit velocity is 2116.0 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.8:PG-237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "# The reaction equation with theoritical air is \n",
+ "# C8H18 + 12.5(O2+3.76N2)---> 8CO2 + 47N2 + 9H2O\n",
+ "\n",
+ "# for 400% theoritical air reaction is\n",
+ "\n",
+ "# C8H18 + 50(O2+3.76N2)---> 8CO2 + 188N2 + 9H2O + 37.5O2\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
+ "hbarCO2=42769 #enthalpy associated with CO2 at 1000K from table E.4\n",
+ "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
+ "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
+ "hbarH2O=35882 #enthalpy associated with H20 at 1000K from table E.6\n",
+ "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
+ "hbarN2p=(30784+29476)/2 #enthalpy associated with N2 at 1000K from table E.2 by averaging enthalpy at 1020K and 980K \n",
+ "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
+ "\n",
+ "hfC8H18=-249910 # enthalpy associated with octane taken from internet as not provided in textbook\n",
+ "hbarO2=31389 # enthalpy associated with O2 at 1000K table E.3\n",
+ "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
+ "\n",
+ "Hp=8*(hfCO2+hbarCO2-hdotbarCO2)+9*(hfH2O+hbarH2O-hdotbarH2O)+37.5*(hbarO2-hdotbarO2)+188*(hbarN2p-hdotbarN2)# enthalpy of products\n",
+ "\n",
+ "Hr=(hfC8H18)\n",
+ "# enthalpy of reactants\n",
+ "\n",
+ "Q=Hp-Hr # using first law2\n",
+ "\n",
+ "print \" The heat transfer is\",round(Q),\"kJ\"\n",
+ "\n",
+ "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The heat transfer is 312593.0 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.9:PG-237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "# The reaction equation is \n",
+ "#C3H8 + 5O2---> 8CO2 + 4H2O\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "hfCO2=-393520 # enthalpy associated with CO2\n",
+ "hfH2O=-241820 # enthalpy associated with gaseous H2O\n",
+ "hfC3H8=103850# enthalpy of formation associated with C3H8\n",
+ "hfgC3H8=15060# enthalpy of vapourization associated with C3H8\n",
+ "T=20+273 # temperature in kelvin\n",
+ "Rbar=8.314 # universal gas constant\n",
+ "Nr=6 # number of moles of reactants\n",
+ "Np=7 # number of moles of products\n",
+ "Hp=3*(hfCO2)+4*(hfH2O) # enthalpy of products\n",
+ "\n",
+ "Hr=hfC3H8+hfgC3H8 # enthalpy of reactants\n",
+ "\n",
+ "Q=(Hp-Hr-(Nr-Np)*Rbar*T)*10**(-3) # heat transfer from first law\n",
+ "\n",
+ "print \" The heat transfer is\",round(Q),\"MJ\"\n",
+ "\n",
+ "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The heat transfer is -2264.0 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.10:PG-239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "# The reaction equation for theoritical air is \n",
+ "#C3H8 + 5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 18.8N2\n",
+ "\n",
+ "# for 250% theoritical air reaction becomes\n",
+ "#C3H8 + 12.5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 47N2 + 7.5O2\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "\n",
+ "Np=47+7.5+4+3 # number of moles of product\n",
+ "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
+ "hbarCO2=(62963+65271)/2 #enthalpy associated with CO2 at 1380 K from table E.4\n",
+ "hbarCO2dash=(58381+60666)/2 #enthalpy associated with CO2 at 1300 K by average from table E.4\n",
+ "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
+ "\n",
+ "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
+ "\n",
+ "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
+ "hbarH2O=(51521+53351)/2 #enthalpy associated with H20 at 1380 K by taking average from table E.6\n",
+ "hbarH2Odash=48807 #enthalpy associated with H20 at 1300 K from table E.6\n",
+ "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
+ "\n",
+ "hbarN2=42920 #enthalpy associated with N2 at 1380K from table E.2 by interpolating enthalpy between 1020K and 980K \n",
+ "hbarN2dash=40170 #enthalpy associated with N2 at 1300 K from table E.2 \n",
+ "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
+ "\n",
+ "hfO2=(44198+45648)/2 # enthalpy associated with O2 at 1380 Kby taking average from table E.3\n",
+ "hfO2dash=48807 # enthalpy associated with O2 at 1380 Kby taking average from table E.3\n",
+ "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
+ "\n",
+ "# for adiabatic flame temperature first assume products composed only of nitrogen and Q=0 as adiabatic\n",
+ "hp=(hfC3H8-3*(hfCO2)-4*(hfH2O))/Np +hdotbarN2\n",
+ "# using hp we assume temp=1380 K\n",
+ "# then energy for 1380 k is\n",
+ "H1=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+7.5*(hfO2-hdotbarO2)+47*(hbarN2-hdotbarN2) # energy assuming temperature to be 1380 K\n",
+ "\n",
+ "#this is very large \n",
+ "\n",
+ "# now at 1300 K adiabatic temperature\n",
+ "H2=3*(hfCO2+hbarCO2dash-hdotbarCO2)+4*(hfH2O+hbarH2Odash-hdotbarH2O)+7.5*(hfO2dash-hdotbarO2)+47*(hbarN2dash-hdotbarN2) # energy assuming temperature to be 1300 K\n",
+ " \n",
+ " # now interpolation between these two temperatures\n",
+ "Tp=1300-((hp+H2)/(H1-H2))*(1380-1300) # adiabatic temperature by interpolation\n",
+ "print \"The adiabatic flame temperature is\",round(Tp),\"K\"\n",
+ "\n",
+ "#The answers is different in textbook as they have printed the value of hfCO2 with positive sign while calculating H2\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The adiabatic flame temperature is 1311.0 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.11:PG-240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "# The reaction equation for theoritical air is \n",
+ "#C3H8 + 5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 18.8N2\n",
+ "\n",
+ "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
+ "\n",
+ "Np=18.8+4+3 # number of moles of product\n",
+ "hfCO2=-393520 # enthalpy associated with CO2\n",
+ "hbarCO2=137400 #enthalpy associated with CO2 at 2600 K from table E.4 by interpolation\n",
+ "hbarCO2dash=125152 #enthalpy associated with CO2 at 2400 K from table E.4\n",
+ "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
+ "\n",
+ "hfC3H8=-103850# ehthalpy associated with C3H8\n",
+ "\n",
+ "hfH2O=-241820 # enthalpy associated with gaseous H2O\n",
+ "hbarH2O=114273 #enthalpy associated with H20 at 2600 K from table E.6\n",
+ "hbarH2Odash=103508 #enthalpy associated with H20 at 2400 K from table E.6\n",
+ "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
+ "\n",
+ "hbarN2=86600 #enthalpy associated with N2 at 2600 K from table E.2 by interpolation\n",
+ "hbarN2dash=79320 #enthalpy associated with N2 at 2400 K from table E.2 \n",
+ "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
+ "\n",
+ "# for adiabatic flame temperature first assume products composed only of nitrogen and Q=0 as adiabatic\n",
+ "hp=(hfC3H8-3*(hfCO2)-4*(hfH2O))/Np +hdotbarN2 \n",
+ "\n",
+ "# using hp we assume temp=2600 K\n",
+ "# then energy for 2600 k is\n",
+ "H1=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+18.8*(hbarN2-hdotbarN2) # energy assuming temperature to be 2600 K\n",
+ "\n",
+ "# now at 2400 K adiabatic temperature\n",
+ "H2=3*(hfCO2+hbarCO2dash-hdotbarCO2)+4*(hfH2O+hbarH2Odash-hdotbarH2O)+18.8*(hbarN2dash-hdotbarN2) # energy assuming temperature to be 2400 K\n",
+ " \n",
+ " # now interpolation between these two temperatures\n",
+ "Tp=2400-((hp+H2)/(H1-H2))*(2600-2400) # adiabatic temperature by interpolation\n",
+ "print \"The adiabatic flame temperature is\",round(Tp),\"K\"\n",
+ "\n",
+ "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The adiabatic flame temperature is 2409.0 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/README.txt b/Thermodynamics_Demystified_by_Merle_C._Potter/README.txt new file mode 100755 index 00000000..2aa18a7d --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/README.txt @@ -0,0 +1,10 @@ +Contributed By: Aviral Yadav +Course: btech +College/Institute/Organization: ABES Engineering College +Department/Designation: Mechanical Engineering +Book Title: Thermodynamics Demystified +Author: Merle C. Potter +Publisher: Mcgraw-hill, Usa +Year of publication: 2009 +Isbn: 0071605991 +Edition: 1
\ No newline at end of file diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/Carnotrefrigerator.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/Carnotrefrigerator.png Binary files differnew file mode 100755 index 00000000..464e99d0 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/Carnotrefrigerator.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator.png Binary files differnew file mode 100755 index 00000000..cf918bd5 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_1.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_1.png Binary files differnew file mode 100755 index 00000000..cf918bd5 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_1.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_2.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_2.png Binary files differnew file mode 100755 index 00000000..cf918bd5 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/carnotrefrigerator_2.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy.png Binary files differnew file mode 100755 index 00000000..04bc8fe4 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_1.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_1.png Binary files differnew file mode 100755 index 00000000..04bc8fe4 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_1.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_2.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_2.png Binary files differnew file mode 100755 index 00000000..04bc8fe4 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_2.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_3.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_3.png Binary files differnew file mode 100755 index 00000000..04bc8fe4 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/internalenergy_3.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium.png Binary files differnew file mode 100755 index 00000000..464e99d0 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_1.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_1.png Binary files differnew file mode 100755 index 00000000..464e99d0 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_1.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_2.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_2.png Binary files differnew file mode 100755 index 00000000..464e99d0 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_2.png diff --git a/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_3.png b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_3.png Binary files differnew file mode 100755 index 00000000..41ef1110 --- /dev/null +++ b/Thermodynamics_Demystified_by_Merle_C._Potter/screenshots/quasiequilibrium_3.png |