diff options
author | hardythe1 | 2015-04-07 15:58:05 +0530 |
---|---|---|
committer | hardythe1 | 2015-04-07 15:58:05 +0530 |
commit | c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131 (patch) | |
tree | 725a7d43dc1687edf95bc36d39bebc3000f1de8f /TestContribution/Chapter2.ipynb | |
parent | 62aa228e2519ac7b7f1aef53001f2f2e988a6eb1 (diff) | |
download | Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.tar.gz Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.tar.bz2 Python-Textbook-Companions-c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131.zip |
added books
Diffstat (limited to 'TestContribution/Chapter2.ipynb')
-rwxr-xr-x | TestContribution/Chapter2.ipynb | 322 |
1 files changed, 322 insertions, 0 deletions
diff --git a/TestContribution/Chapter2.ipynb b/TestContribution/Chapter2.ipynb new file mode 100755 index 00000000..f5907f3a --- /dev/null +++ b/TestContribution/Chapter2.ipynb @@ -0,0 +1,322 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d3b8a40a5268a38ad3fc311ebed2078460c9192ee65f2f5e3922c8f65a52bf49"
+ },
+ "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-22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "\n",
+ "m=1; #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,1),\" m^3/kg \\n\"\n",
+ "\n",
+ "# part (b) \n",
+ "\n",
+ "P=0.10; # Pressure in MPa\n",
+ "vf=0.001; # 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=1.694; # specific volume of saturated vapour at 0.1 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,3),\" m^3/kg \\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,5),\" m^3/kg \\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Volume change at pressure 0.001 MPa is 129.2 m^3/kg \n",
+ "\n",
+ "The Volume change at pressure 0.1 MPa is 1.693 m^3/kg \n",
+ "\n",
+ "The Volume change at pressure 10 MPa is 0.01658 m^3/kg \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.2:pg-23"
+ ]
+ },
+ {
+ "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,1),\" 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=vg*mg; # volume of vapour\n",
+ "print \" The volume of vapour is\",round(Vg,4),\" 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.9984 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.3:pg-23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=4 # 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 at 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\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Total volume of the mixture is 2.656 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Ex2.4:pg-23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# initialization of variables\n",
+ "m=2 # mass of water in lb\n",
+ "P=540 # pressure in psi\n",
+ "T=700 # temperature in degree fahrenheit\n",
+ " # Table C-3E is used for values\n",
+ "v=1.3040+(P-500)*(1.0727-1.3030)/(600-500) # specific volue by interpolatin between 500 and 600 psi\n",
+ "V=m*v # final volume\n",
+ "print \"The Final Volume is\",round(V,3),\" ft^3\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Final Volume is 2.424 ft^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.5:pg-25"
+ ]
+ },
+ {
+ "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": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.6:pg-26"
+ ]
+ },
+ {
+ "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-8\n",
+ "b=0.00169 # van der Waal's constant b value from Table B-8\n",
+ "P=(R*T/(v-b))-(a/v**2) # Pressure from van der Waals 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-8\n",
+ "b=0.00117 # van der Waal's constant b value from Table B-8\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"
+ ],
+ "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": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |