diff options
Diffstat (limited to 'sample_notebooks/SakshiGoplani/Sample.ipynb')
-rwxr-xr-x | sample_notebooks/SakshiGoplani/Sample.ipynb | 662 |
1 files changed, 662 insertions, 0 deletions
diff --git a/sample_notebooks/SakshiGoplani/Sample.ipynb b/sample_notebooks/SakshiGoplani/Sample.ipynb new file mode 100755 index 00000000..108f20cf --- /dev/null +++ b/sample_notebooks/SakshiGoplani/Sample.ipynb @@ -0,0 +1,662 @@ +{ + "metadata": { + "celltoolbar": "Raw Cell Format", + "name": "", + "signature": "sha256:b8d3bc6c59d0efdfca4aa426416ba1f24e3078d69f0411d3e3ed7b293bd81c78" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "ELEMENTS OF MECHANICAL ENGINEERING by R.K. RAJPUT" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER NUMBER 2 : FUELS AND COMBUSTION" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 2.1" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " #DATA GIVEN\n", + "c=88; #% of carbon in coal\n", + "h=4.2; #% of hydrogen in coal\n", + "Wf=0.848; #weight of coal in g\n", + "Wfw=0.027; #weight of fuse wire in calorimeter in g\n", + "W=1950; #weight of water in calorimeter in g\n", + "We=380; #water equivalent of calorimeter\n", + "Dt=3.06; #observed temperature rise (t2-t1) in deg celsius\n", + "tc=0.017; #cooling correction in deg celsius\n", + "cfw=6700; #calorific value of fuse wire in J/g\n", + "\n", + " #CALCULATIONS\n", + "ctr=(Dt)+tc; #corrected temp. rise\n", + "Hw=(W+We)*4.18*(ctr); #heat recieved by water in J\n", + "Hfw=Wfw*cfw; #heat given out by fuse wire in J\n", + "Hcf=Hw-Hfw; #heat produced due to combustion of fuel in J\n", + "HCV=Hcf/Wf; #higher calorific value of fuel in kJ/kg\n", + "Ms=9*h/100; #steam produced per kg of coal\n", + "LCV=HCV-2465*Ms; #lower calorific value of fuel in kJ/kg\n", + "\n", + "print \"The Higher calorific value of fuel, H.C.V. is: \",round(HCV,4),\" kJ/kg.\"\n", + "print \"The Lower calorific value of fuel, L.C.V. is: \",round(LCV,4),\" kJ/kg.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Higher calorific value of fuel, H.C.V. is: 35126.455 kJ/kg.\n", + "The Lower calorific value of fuel, L.C.V. is: 34194.685 kJ/kg.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 2.2" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "V1=0.08; #gas burnt in calorimeter in m^3\n", + "Pg=5.2; #pressure of gas supply in cm of water\n", + "Pb=75.5; #barometer reading in cm of Hg\n", + "Ww=28; #weight of water heated by gas in kg\n", + "Tg=13; #temperature of gas in deg celsius\n", + "Twi=10; #temperature of water at inlet in deg celsius\n", + "Two=23.5; #temperature of water at outlet in deg celsius\n", + "Ms=0.06; #steam condensed in kg\n", + "\n", + " #CALCULATIONS\n", + " #by using general gas equation, reducing the volume to S.T.P.\n", + " #p1*V1/T1=p2*V2/T2\n", + "p1=Pb+(Pg/13.6); #in cm of Hg\n", + "T1=Tg+273; #in K\n", + "p2=76; #in cm of Hg\n", + "T2=15+273; #in K\n", + "V2=p1*V1*T2/T1/p2; #in m^3\n", + "Hw=Ww*4.18*(Two-Twi); #heat recieved by water in kJ\n", + "HCV=Hw/V1; #higher calorific value of fuel in kJ/m^3\n", + "LCV=HCV-2465*Ms/V1; #lower calorific value of fuel in kJ/m^3\n", + "\n", + "print \" The Calorific values of fuel per m^3 of gas at 15 deg celsius and 76 cm of Hg pressure are:\"\n", + "print \" The Higher calorific value of fuel, H.C.V. is: \",HCV,\" kJ/m^3.\"\n", + "print \" The Lower calorific value of fuel, L.C.V. is: \",LCV,\" kJ/m^3.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Calorific values of fuel per m^3 of gas at 15 deg celsius and 76 cm of Hg pressure are:\n", + " The Higher calorific value of fuel, H.C.V. is: 19750.5 kJ/m^3.\n", + " The Lower calorific value of fuel, L.C.V. is: 17901.75 kJ/m^3.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER NUMBER 3 : PROPERTIES OF GASES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 3.1" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "Q=-50; #heat rejected to cooling water in kJ/kg\n", + "W=-100; #work input in kJ/kg\n", + "\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + "Du=Q-W; #(u2-u1) change in internal energy in kJ/kg\n", + " #since Du is +ve, there is gain in internal energy\n", + "\n", + "print \"The GAIN in internal energy is: \",Du,\" kJ/kg.\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The GAIN in internal energy is: 50 kJ/kg.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 3.2" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "u1=450; #internal energy at beginning of the expansion in kJ/kg\n", + "u2=220; #internal energy after expansion in kJ/kg\n", + "W=120; #work done by the air during expansion in kJ/kg\n", + "\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + "Q=(u2-u1)+W; #heat flow in kJ/kg\n", + " #since Q is -ve, there is rejection of heat\n", + "\n", + "print \"The heat REJECTED by air is: \",(-Q),\" kJ/kg.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat REJECTED by air is: 110 kJ/kg.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 3.3" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "m=0.3; #mass of nitrogen in kg\n", + "p1=0.1; #pressure in MPa\n", + "T1=40+273; #temperature before compression in K\n", + "p2=1; #pressure in MPa\n", + "T2=160+273; #temperature after compression in K\n", + "W=-30; #work done during the compression in kJ/kg\n", + "Cv=0.75 #in kJ/kgK\n", + "\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + " #(u2-u1)=m*Cv*(T2-T1)\n", + "Du=m*Cv*(T2-T1);\n", + "Q=Du+W; #heat flow in kJ/kg\n", + " #since Q is -ve, there is rejection of heat\n", + "\n", + "print \"The heat REJECTED by air is: \",(-Q),\" kJ. \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat REJECTED by air is: 3.0 kJ. \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER 3.4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + " #initial state\n", + "p1=0.105; #pressure of gas in MPa\n", + "V1=0.4; #volume of gas in m^3\n", + " #final state\n", + "p2=0.105; #pressure of gas in MPa\n", + "V2=0.20; #volume of gas in m^3\n", + "\n", + "Q=-42.5; #heat transferred in kJ\n", + "p=p1;\n", + "\n", + " #process used- ISOBARIC (Constant pressure)\n", + "W12=p*(V2-V1)*1000; #work in kJ\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + "Du=Q-W12; #(u2-u1) change in internal energy in kJ\n", + " #since Du is -ve, there is decrease in internal energy\n", + "\n", + "print \"The DECREASE in internal energy is: \",(-Du),\" kJ.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The DECREASE in internal energy is: 21.5 kJ.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + " #part-1\n", + " #pressure=p1,temperature=T1\n", + " #part-2\n", + " #pressure=p2,temperature=T2\n", + "\n", + " #Acc. First Law of Thermodynamics, Q=(u2-u1)+W\n", + " #when partition moved\n", + "DQ=0;\n", + "DW=0;\n", + "DU=DQ-DW;\n", + " #DU=0\n", + "\n", + "print \" CONCLUSION: \"\n", + "print \" Acc. to First Law of Thermodynamics, \"\n", + "print \" When partion moved, there is conservation of internal energy. \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " CONCLUSION: \n", + " Acc. to First Law of Thermodynamics, \n", + " When partion moved, there is conservation of internal energy. \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + " #initial state\n", + "p1=10**5; #initial pressure of air in Pa\n", + "v1=1.8; #volume of air in m^3/kg\n", + "T1=25+273; #initial temperature of air in K\n", + " #final state\n", + "p2=5*10**5; #final pressure of air in Pa\n", + "T2=25+273; #final temperature of air in K\n", + "\n", + " #process used- ISOTHERMAL (Constant temperature)\n", + "W12=(p1*v1*float(math.log(float(p1)/float(p2))/1000)); #work in kJ/kg\n", + " #since W is -ve, work is supplied to the air\n", + "\n", + " #since temperature is constant\n", + "Du=0; #(u2-u1) change in internal energy in kJ/kg\n", + "\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + "Q=Du+W12;\n", + " #since Q is -ve, there is rejection of heat from system to surroundings\n", + "\n", + "print \" (i) The Work done on the air is: \",round(-W12,4),\" kJ/kg. \"\n", + "print \" (ii) The change in internal energy is: \",(Du),\" kJ/kg. \"\n", + "print \" (iii) The Heat REJECTED is: \",round(-Q,4),\" kJ/kg. \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (i) The Work done on the air is: 289.6988 kJ/kg. \n", + " (ii) The change in internal energy is: 0 kJ/kg. \n", + " (iii) The Heat REJECTED is: 289.6988 kJ/kg. \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "p1=4*10**5; #initial pressure in N/m^2\n", + "V1=0.2; #initial volume in m^3\n", + "T1=130+273; #initial temperature in K\n", + "p2=1.02*10**5; #final pressure after adiabatic expansion in N/m^2\n", + "Q23=72.5; #increase in enthalpy during constant pressure process in kJ\n", + "Cp=1; #in kJ/kgK\n", + "Cv=0.714; #in kJ/khK\n", + "\n", + " #gamma for air, g\n", + "g=Cp/Cv;\n", + "R=(Cp-Cv)*1000;\n", + "\n", + " #for reversible adiabatic process 1-2\n", + " #p1*(V1**g)=p2*(V2**g)\n", + "V2=V1*(p1/p2)**(1/g); #final volume in m^3\n", + " #(T2/T1)=(p2/p1)**((g-1)/g);\n", + "T2=T1*(p2/p1)**((g-1)/g); #final temp. T2 in K\n", + "\n", + "m=p1*V1/R/T1; #mass in kg\n", + "\n", + " #for constant pressure process 2-3\n", + " #Q23=m*Cp*(T3-T2);\n", + "T3=Q23/m/Cp+T2;\n", + " #V2/T2=V3/T3\n", + "V3=V2/T2*T3;\n", + "\n", + " #Work done by the path 1-2-3, W123=W12+W23\n", + "W12=(p1*V1-p2*V2)/(g-1);\n", + "W23=p2*(V3-V2);\n", + "W123=W12+W23;\n", + "\n", + " #if the above processes are replaced by a single reversible polytropic process giving the same work between initial and final states,\n", + " #W13=W123=(p1V1-p3V3)/(n-1)\n", + "p3=p2;\n", + "n=1+(p1*V1-p3*V3)/W123; #index of expansion, n\n", + "\n", + "print \" (i) The Total Work done is: \",round(W123,4),\" Nm or J.\"\n", + "print \" (ii) The value of index of expansion, n is: \",round(n,4),\".\"\n", + "\n", + " #NOTE:\n", + " #there is slight variation in answers of the book due to rounding off of the values " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (i) The Total Work done is: 85343.6734 Nm or J.\n", + " (ii) The value of index of expansion, n is: 1.0603 .\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + " #initial state\n", + "p1=10**5; #initial pressure of gas in Pa\n", + "V1=0.45; #initial volume of gas in m^3\n", + "T1=80+273; #initial temperature of gas in K\n", + " #final state\n", + "p2=5*10**5; #final pressure of gas in Pa\n", + "V2=0.13; #final volume of gas in m^3\n", + "\n", + " #gamma for air, g\n", + "g=1.4;\n", + "R=294.2 #J/kgK\n", + "\n", + "m=p1*V1/R/T1; #mass in kg\n", + "\n", + " #p1*(V1^n)=p2*(V2^n)\n", + "n=math.log(p2/p1)/math.log(V2/V1); #index n\n", + "\n", + " #In a polytropic process\n", + " #(T2/T1)=(V1/V2)^(n-1);\n", + "T2=T1*(V1/V2)**(n-1); #temp. T2 in K\n", + "\n", + "Cv=R/(g-1);\n", + "Du=m*Cv*(T2-T1)/1000; #increase in internal energy in kJ\n", + "\n", + " #using First Law of Thermodynamics, Q=(u2-u1)+W\n", + " #W12=(p1*V1-p2*V2)/(n-1)=mR(T2-T1)/(n-1)\n", + "W12=m*R*(T1-T2)/(n-1)/1000;\n", + "Q=Du+W12;\n", + " #since Q is -ve, there is rejection of heat from system to surroundings\n", + "\n", + "print \" (i) The Mass of the gas is: \",round(m,4),\" kg.\"\n", + "print \" (ii) The index n is: \",round(n,4),\".\"\n", + "print \"(iii) The change in internal energy is: \",(Du),\" kJ.\"\n", + "print \" (iv) The Heat REJECTED is: \",round(-Q,4),\"kJ.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (i) The Mass of the gas is: 0.4333 kg.\n", + " (ii) The index n is: -1.2961 .\n", + "(iii) The change in internal energy is: -106.0 kJ.\n", + " (iv) The Heat REJECTED is: 124.4657 kJ.\n" + ] + } + ], + "prompt_number": 70 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + " #initial state\n", + "p1=1.02; #initial pressure of air in bar\n", + "V1=0.015; #initial volume of air in m^3\n", + "T1=22+273; #initial temperature of air in K\n", + " #final state\n", + "p2=6.8; #final pressure of air in bar\n", + " #Law of adiabatic compression, pV^g=C\n", + "\n", + " #gamma for air, g\n", + "g=1.4\n", + "R=0.287;\n", + "\n", + " #In a adiabatic process\n", + " #(T2/T1)=(p2/p1)**((g-1)/g);\n", + "T2=T1*(p2/p1)**((g-1)/g); #final temp. T2 in K\n", + "\n", + " #p1*(V1**g)=p2*(V2**g)\n", + "V2=V1*(p1/p2)**(1/g); #final volume in m^3\n", + "\n", + "m=p1*10**5*V1/10**3/R/T1; #mass in kg\n", + "\n", + " #W=(p1*V1-p2*V2)/(g-1)=mR(T2-T1)/(g-1)\n", + "W=m*R*(T1-T2)/(g-1);\n", + " #since W is -ve, the work is done on the air\n", + "\n", + "print \" (i) The Final temperature is: \",(T2-273),\" deg. celsius.\"\n", + "print \" (ii) The Final Volume is: \",V2,\" m**3. \"\n", + "print \"(iii) The Work done on the air is: \",(-W),\" kJ.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (i) The Final temperature is: 234.252870551 deg. celsius.\n", + " (ii) The Final Volume is: 0.00386887782624 m**3. \n", + "(iii) The Work done on the air is: 2.7520923046 kJ.\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE NUMBER: 3.13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + " \n", + " #DATA GIVEN\n", + "m=1; #mass of etahne gas in kg\n", + "M=30; #molecular weight of ethane\n", + "p1=1.1; #initial pressure in bar\n", + "T1=27+273; #initial temperature in K\n", + "p2=6.6; #final pressure in bar\n", + "Cp=1.75; #in kJ/kgK\n", + "\n", + " #Law of compression, pV**1.3=C\n", + "n=1.3;\n", + "\n", + " #Characteristic gas constant, R = Universal gas constant (Ro)/Molecular weight(M)\n", + "Ro=8314;\n", + "R=Ro/(M); #kJ/kgK\n", + "R1 = float(R)/1000;\n", + " #R=Cp-Cv\n", + "Cv=Cp-float(R1);\n", + "g=Cp/Cv; #gamma g\n", + "\n", + " #In a polytropic process\n", + " #(T2/T1)=(p2/p1)**((n-1)/n);\n", + "T2=T1*(p2/p1)**((n-1)/n); #final temp. T2 in K\n", + "\n", + " #W=(p1*V1-p2*V2)/(n-1)=mR(T2-T1)/(g-1)\n", + "W=m*R*(T1-T2)/(n-1);\n", + "\n", + "Q=(g-n)*W/(g-1); #heat flow in kJ/kg\n", + "\n", + "print \" The Heat SUPPLIED is: \",float(Q),\" kJ/kg.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Heat SUPPLIED is: 84441.1861346 kJ/kg.\n" + ] + } + ], + "prompt_number": 102 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |