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_by_B._l._Singhal | |
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_by_B._l._Singhal')
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch1.ipynb | 1870 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch2.ipynb | 2523 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch3.ipynb | 1047 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch4.ipynb | 863 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch5.ipynb | 685 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch6.ipynb | 1879 | ||||
-rwxr-xr-x | Thermodynamics_by_B._l._Singhal/ch7.ipynb | 543 |
7 files changed, 9410 insertions, 0 deletions
diff --git a/Thermodynamics_by_B._l._Singhal/ch1.ipynb b/Thermodynamics_by_B._l._Singhal/ch1.ipynb new file mode 100755 index 00000000..dc49e665 --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch1.ipynb @@ -0,0 +1,1870 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4cf1e7286a20ca85f0002525c71db2c8ec4a9e4ec5950a0f8b9459ae66a70214" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Thermodynamics Concepts" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4 Page No : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 500;\t\t\t#Kg\n", + "g = 7.925;\t\t\t#m/s**2\n", + "Z = 40; \t\t\t#Km\n", + "C = 2400;\t\t\t#Kmph\n", + "\n", + "# Calculations and Results\n", + "PE = m*g*Z*1000;\t \t\t#Nm\n", + "print (\"Relative to earth.\");\n", + "print \"Potential Energy in Nm : %.3e\"%PE\n", + "\n", + "KE = m*(C*1000./3600)**2/2;\t\t\t#Nm\n", + "print \"Kinetic Energy in Nm : %.3e\"%KE\n", + "print (\"Relative to moon.\");\n", + "\n", + "w = 2.94*m;\t \t\t #Nm\n", + "PE = w*Z*1000;\t \t\t#Nm\n", + "print \"Potential Energy in Nm : %.2e\"%PE\n", + "\n", + "KE = m*(C*1000./3600)**2/2;\t\t\t#Nm\n", + "print \"Kinetic Energy in Nm : %.3e\"%KE\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative to earth.\n", + "Potential Energy in Nm : 1.585e+08\n", + "Kinetic Energy in Nm : 1.111e+08\n", + "Relative to moon.\n", + "Potential Energy in Nm : 5.88e+07\n", + "Kinetic Energy in Nm : 1.111e+08\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5 Page No : 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\n", + "# Variables :\n", + "VGR = 57.;\t \t\t#KN/m**2\n", + "Patm = 765.;\t\t\t#mm of Hg\n", + "\n", + "# Calculations\n", + "#101.325KN/m**2 = 760 mm of Hg\n", + "VGR = VGR*760/101.325;\t\t\t#mm og Hg\n", + "Pabs = Patm-VGR;\t\t\t#mm of Hg\n", + "\n", + "# Results\n", + "print \"Absolute pressure in mm of Hg : %.2f\"%(Pabs)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure in mm of Hg : 337.46\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6 Page No : 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "g = 9.81; \t\t\t#m/s**2\n", + "rho_o = 0.825*10**3;\t\t\t#Kg/m**3\n", + "rho_w = 1.*10**3;\t \t\t#Kg/m**3\n", + "rho_Hg = 13.45*10**3;\t\t\t#Kg/m**3\n", + "h_o = 50./100; \t \t\t#m\n", + "h_w = 65./100;\t \t \t#m\n", + "h_Hg = 45./100;\t\t \t #m\n", + "Patm = 1.01325;\t\t\t #bar\n", + "\n", + "# Calculations and Results\n", + "P_Hg = rho_Hg*g*h_Hg;\t\t\t#N/m**2\n", + "P_w = rho_w*g*h_w;\t\t\t #N/m**2\n", + "P_o = rho_o*g*h_o;\t\t\t #N/m**2\n", + "Pbase = (Patm*10**5+P_Hg+P_o+P_w);\t\t\t#N/m**2\n", + "print \"Pressure at the base of column in N/m**2 : %.5e\"%Pbase\n", + "\n", + "P_OilWater = Patm*10**5+P_o;\t\t\t#N/m**2\n", + "print \"Pressure at the oil-water surface in N/m**2 : %.5e\"%P_OilWater\n", + "\n", + "P_WaterMercury = Patm*10**5+P_o+P_w;\t\t\t#N/m**2\n", + "print \"Pressure at the water-mercury surface in N/m**2 : %.5e\"%P_WaterMercury\n", + "\n", + "#Answer in the book is not accurate.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure at the base of column in N/m**2 : 1.71123e+05\n", + "Pressure at the oil-water surface in N/m**2 : 1.05372e+05\n", + "Pressure at the water-mercury surface in N/m**2 : 1.11748e+05\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "rho = 1000.;\t\t\t#Kg/m**3\n", + "d = 0.3;\t \t\t#m\n", + "C = 1.5;\t\t \t#m/s\n", + "h = 4.5;\t\t \t#m\n", + "FlowRate = 2000.\t\t#Kg/min\n", + "d2 = 15./100;\t\t\t#diameter of discharging line in meter\n", + "t = 15. \t\t\t#min\n", + "r = 3.\t \t\t#m\n", + "\n", + "# Calculations and Results\n", + "WaterDischarge = rho*math.pi/4*(d/2)**2*C*t*60;\t\t\t#Kg\n", + "WaterReceived = FlowRate*t; \t\t\t#Kg\n", + "NetWaterReceived = WaterReceived-WaterDischarge;\t\t\t#Kg\n", + "print \"Mass change in tank in Kg : %.1f\"%(NetWaterReceived)\n", + "\n", + "#m = rho*A*h\n", + "h = NetWaterReceived/rho/(math.pi/4*r**2);\t\t\t#m\n", + "print \"Water level in meter : %.4f\"%(h)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass change in tank in Kg : 6143.5\n", + "Water level in meter : 0.8691\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Pmercury = 10.;\t\t\t#cm of Hg\n", + "Patm = 76. \t\t\t#cm of Hg\n", + "\n", + "# Calculations\n", + "Pwater = 3.5/13.6 \t\t\t#cm of Hg\n", + "Pabs = Pmercury+Patm-Pwater;\t\t\t#cm of Hg\n", + "Pabs = Pabs/76*1.01325;\t\t \t#bar\n", + "\n", + "# Results\n", + "print \"Absolute pressure of steam in bar : %.4f\"%(Pabs)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of steam in bar : 1.1431\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Pmercury = 10.;\t\t\t#cm of Hg\n", + "Patm = 760. \t\t\t#mm of Hg\n", + "Patm = 1.01325 \t\t#bar\n", + "Pabs = 1.2 \t\t\t#bar\n", + "sg_oil = 0.8;\n", + "sg_water = 13.6;\n", + "sg_mercury = 13.6;\n", + "rho_w = 1000.\t\t\t#Kg.m**3\n", + "g = 9.81;\t \t\t#gravity constant\n", + "\n", + "# Calculations and Results\n", + "deltaP = Pabs-Patm;\t\t\t#bar\n", + "deltaP = deltaP*10**5;\t\t\t#N/m**2\n", + "#deltaP = rho_o*g*h_o\n", + "rho_o = sg_oil*rho_w;\t\t\t#kg/m**3\n", + "h_o = deltaP/rho_o/g;\t\t\t#m\n", + "print \"Height of fluid in oil manometer in meter : %.4f\"%(h_o)\n", + "\n", + "h_w = deltaP/rho_w/g;\t\t\t#m\n", + "print \"Height of fluid in water manometer in meter : %.4f\"%(h_w)\n", + "\n", + "rho_m = sg_mercury*rho_w;\t\t\t#kg/m**3\n", + "h_m = deltaP/rho_m/g;\t\t \t#m\n", + "print \"Height of fluid in mercury manometer in meter : %.4f\"%(h_m)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Height of fluid in oil manometer in meter : 2.3796\n", + "Height of fluid in water manometer in meter : 1.9037\n", + "Height of fluid in mercury manometer in meter : 0.1400\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.10 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Patm = 75. \t\t\t#mm of Hg\n", + "Patm = Patm*1.01325/76;\t\t\t#bar\n", + "rho = 800. \t\t\t#Kg.m**3\n", + "h = 30/100. \t\t\t#m\n", + "g = 9.81 \t\t#gravity constant\n", + "\n", + "# Calculations\n", + "deltaP = rho*g*h*10**-5;\t\t\t#bar\n", + "Pabs = deltaP+Patm;\t\t\t #bar\n", + "\n", + "# Results\n", + "print \"Absolute pressure of gas in bar : %.6f\"%(Pabs)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of gas in bar : 1.023462\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.11 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "h1 = 5.1/100; \t \t\t#m\n", + "h2 = 10./100;\t \t \t#m\n", + "Patm = 75.5;\t\t \t #mm of Hg\n", + "Patm = Patm*1.01325/76*10**5;\t\t\t#bar\n", + "sg_k = 0.8;\n", + "sg_Hg = 13.6;\n", + "rho_w = 1000. \t\t\t#Kg/m**3\n", + "g = 9.81;\t\t \t#gravity constant\n", + "\n", + "# Calculations\n", + "P_kerosine = sg_k*rho_w*g*h1;\t\t\t#N/m**2\n", + "P_Hg = sg_Hg*rho_w*g*h2 \t\t\t#N/m**2\n", + "Pabs = P_Hg+Patm-P_kerosine;\t\t\t#Nm**2\n", + "\n", + "# Results\n", + "print \"Absolute pressure of gas in KPa : %.2f\"%(Pabs/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of gas in KPa : 113.60\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.12 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from numpy import *\n", + "import math\n", + "\n", + "# Variables :\n", + "t_ice = 0;\t\t\t#degree centigrade\n", + "p_ice = 1.5;\n", + "t_steam = 100;\t\t\t#degree centigrade\n", + "p_steam = 7.5;\n", + "\n", + "# Calculations\n", + "#t = a*math.log(p)+b\n", + "#solving for a and b by matrix\n", + "A = array([[math.log(p_ice), 1],[math.log(p_steam) ,1]])\n", + "B = array([t_ice,t_steam])\n", + "#X = A**-1*B;\n", + "X = linalg.solve(A,B)\n", + "a = X[0]\n", + "b = X[1]\n", + "p = 3.5;\t\t\t#bar\n", + "t = a*math.log(p)+b;\t\t\t#degree C\n", + "\n", + "# Results\n", + "print \"Temperature scale in degree C : %.2f\"%t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature scale in degree C : 52.65\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.13 Page No : 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables :\n", + "theta1_p1 = 273.16;\t\t\t#K\n", + "p_gauge1 = 32.;\t\t\t#mm of Hg\n", + "p_atm = 752.;\t\t\t#mm of Hg\n", + "p_gauge2 = 76.;\t\t\t#mm of Hg\n", + "\n", + "# Calculations\n", + "P1 = p_gauge1+p_atm;\t\t \t #mm of Hg\n", + "P2 = p_gauge2+p_atm;\t \t \t#mm of Hg\n", + "theta2_p2 = theta1_p1*(P2/P1);\t\t\t#in K\n", + "theta2_p2 = theta2_p2-273;\t\t \t#degree C\n", + "\n", + "# Results\n", + "print \"Temperature in degree C : %.2f\"%theta2_p2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature in degree C : 15.49\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.14 Page No : 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "R0 = 2.8;\t\t\t#ohm\n", + "t0 = 0;\t\t\t#degree C\n", + "R1 = 3.8;\t\t\t#ohm\n", + "t1 = 100;\t\t\t#degree C\n", + "R2 = 5.8;\t\t\t#ohm\\\n", + "\n", + "# Calculations\n", + "#R = R0*(1+alfa*t)\n", + "alfa = (R1/R0-1)/t1;\n", + "t2 = (R2/R0-1)/alfa;\t\t\t#degree C\n", + "\n", + "# Results\n", + "print \"Temperature at R2 in degree C : \",t2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature at R2 in degree C : 300.0\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.16 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "#F = 2*C;\n", + "FbyC = 2;\n", + "\n", + "# Calculations\n", + "C = 32./(FbyC-9./5);\t\t\t#degree C\n", + "F = C*FbyC; \t\t\t#degree F\n", + "\n", + "# Results\n", + "print \"Temperature fluid in degree R : \",F+460\n", + "print \"Temperature fluid in degree K : \",C+273\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature fluid in degree R : 780.0\n", + "Temperature fluid in degree K : 433.0\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.17 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy import *\n", + "\t\t\t\n", + "# Variables :\n", + "T1 = 0.;\t\t\t#degree centigrade\n", + "K1 = 1.83;\n", + "T2 = 100.;\t\t\t#degree centigrade\n", + "K2 = 6.78;\n", + "\n", + "# Calculations\n", + "#T = a*math.log(K)+b\n", + "#solving for a and b by matrix\n", + "A = array([[math.log(K1),1],[math.log(K2), 1]])\n", + "B = array([T1,T2])\n", + "X = linalg.solve(A,B)\n", + "a = X[0]\n", + "b = X[1]\n", + "K = 2.42;\t\t\t#bar\n", + "T = a*math.log(K)+b;\t\t\t#degree C\n", + "\n", + "# Results\n", + "print \"Temperature in degree C : %.3f\"%T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature in degree C : 21.338\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.18 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "#t = N/30-100/3\n", + "#t = N\n", + "\n", + "# Calculations\n", + "N = (-100./3)/(1-1./30);\t\t\t#degree C\n", + "\n", + "# Results\n", + "print \"Temperatur at which degree C equals to degree N(degree C) : %.2f\"%N\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperatur at which degree C equals to degree N(degree C) : -34.48\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.19 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "#epsilon = 0.2*t-5*10**-4*t**2;\t\t\t#mV\n", + "t_ice = 0. \t\t\t#degree C\n", + "epsilon_ice = 0.2*t_ice-5*10**-4*t_ice**2;\t\t\t#mV\n", + "t_steam = 100. \t\t\t#degree C\n", + "epsilon_steam = 0.2*t_steam-5*10**-4*t_steam**2;\t\t\t#mV\n", + "\n", + "#At t = 60;\n", + "t = 60;\t\t\t#degree C\n", + "\n", + "# Calculations\n", + "epsilon = 0.2*t-5*10**-4*t**2;\t\t\t#mV\n", + "reading = (t_steam-t_ice)/(epsilon_steam-epsilon_ice)*(epsilon-epsilon_ice)\n", + "\n", + "# Results\n", + "print \"Thermometer will read(degree C) : \",reading\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermometer will read(degree C) : 68.0\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.20 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy import *\n", + "\n", + "# Variables :\n", + "tA1 = 0.;\t\t\t#degree centigrade\n", + "tB1 = 0.;\t\t\t#degree centigrade\n", + "tA2 = 100.\t\t\t#degree centigrade\n", + "tB2 = 100.\t\t\t#degree centigrade\n", + "#tA = l+m*tB+n*tb**2\n", + "l = 0;\t\t\t#by putting tA and tB equals to zero\n", + "\n", + "#tA = m*tB+n*tB**2\n", + "#Thermometer immersed in oil bath\n", + "tA1 = 51.;\t\t\t#degree centigrade\n", + "tB1 = 50.;\t\t\t#degree centigrade\n", + "#solving for m and n by matrix\n", + "A = array([[tB1 ,tB1**2],[tB2, tB2**2]])\n", + "B = array([tA1,tA2])\n", + "\n", + "# Calculations and Results\n", + "X = linalg.solve(A,B);\n", + "m = X[0]\n", + "n = X[1]\n", + "tA = 25;\t\t\t#degree centigrade\n", + "P = [n ,m ,-tA];\t\t\t#polynomial for calculation of tB\n", + "tB = roots(P);\n", + "tB = tB[1];\t\t\t#neglecting +ve sign\n", + "print \"When A reads 25 degree C, B reading in degree C : %.3f\"%tB\n", + "\n", + "#let tB = 25;\t\t\t#degree C\n", + "tB = 25;\t\t\t#degree C\n", + "tA = l+m*tB+n*tB**2;\t\t\t#degree C\n", + "print \"When B reads 25 degree C, A reading in degree C : \",tA\n", + "print (\"B is correct. A shows error greater than B.\")\n", + "#Answer is not accurate in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "When A reads 25 degree C, B reading in degree C : 24.265\n", + "When B reads 25 degree C, A reading in degree C : 25.75\n", + "B is correct. A shows error greater than B.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.21 Page No : 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p = 10.;\t \t\t#bar\n", + "T = 327.+273;\t\t\t#K\n", + "M = 42.4;\n", + "m = 1. \t\t\t#Kg\n", + "Rdegree = 8314.3;\t\t\t#Nm/KgK\n", + "\n", + "# Calculations and Results\n", + "R = Rdegree/M;\t\t\t#Nm/KgK\n", + "V = m*R*T/p/10**5;\t\t\t#m**3/Kg\n", + "print \"Specific volume in m**3/Kg ; %.4f\"%V\n", + "\n", + "rho = m/V;\t\t\t#Kg/m**3\n", + "print \"Density of gas in Kg/m**3 : %.3f\"%rho\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific volume in m**3/Kg ; 0.1177\n", + "Density of gas in Kg/m**3 : 8.499\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.22 Page No : 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Rdegree = 8314.3;\t\t\t#Universal Gas Consmath.tant\n", + "M = 32. \t\t\t#Molecular weight of gas\n", + "p1 = 3*10.**6. \t\t\t#N/m**2\n", + "V1 = 250*10.**-3\t\t\t#m**3\n", + "T1 = 20+273. \t\t\t#K\n", + "p2 = 1.8*10**6 \t\t\t#N/m**2\n", + "V2 = V1; \t\t\t#m**3\n", + "T2 = 16+273. \t\t\t#K\n", + "\n", + "# Calculations\n", + "R = Rdegree/M;\t\t\t#Nm/KgK\n", + "m1 = p1*V1/R/T1;\t\t\t#Kg\n", + "m2 = p2*V2/R/T2;\t\t\t#Kg\n", + "mass_used = m1-m2;\t\t\t#Kg\n", + "\n", + "# Results\n", + "print \"Mass of oxygen used in Kg : %.4f\"%mass_used\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of oxygen used in Kg : 3.8589\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.23 Page No : 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables :\n", + "Rdegree = 8314.3;\t\t\t#Universal Gas Consmath.tant\n", + "r = 12. \t\t\t#meter\n", + "Patm = 75.\t\t \t#cm of Hg\n", + "Patm = Patm/76*1.01325*10**5;\t\t\t#N/m**2\n", + "V = 4./3*math.pi*r**3;\t\t\t#m**3\n", + "M_air = 28.97;\n", + "M_H2 = 2.\n", + "Tair = 18.+273;\t\t\t#K\n", + "g = 9.81; \t\t\t#gravity consmath.tant\n", + "\n", + "# Calculations and Results\n", + "Rair = Rdegree/M_air;\t\t\t#Nm/KgK\n", + "RH2 = Rdegree/M_H2;\t\t\t#Nm/KgK\n", + "#p*V = m*R*T\n", + "m_air = Patm*V/Rair/Tair;\t\t\t#Kg\n", + "print \"Mass of air in kg : %.2f\"%m_air\n", + "\n", + "n_air = m_air/M_air;\t\t\t#moles\n", + "print \"No. of moles : %.2f\"%n_air\n", + "\n", + "m_H2 = n_air*M_H2;\t\t\t#Kg\n", + "print \"Mass of H2 in kg : %.2f\"%m_H2\n", + "\n", + "Load = g*(m_air-m_H2);\t\t\t#N\n", + "print \"Load balloon can lift in N ; %.1f\"%Load\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air in kg : 8666.15\n", + "No. of moles : 299.14\n", + "Mass of H2 in kg : 598.28\n", + "Load balloon can lift in N ; 79145.8\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.24 Page No : 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "p1 = 1. \t\t\t#bar\n", + "p2 = 0.45;\t\t\t#bar\n", + "R = 287.\t\t\t#KJ/KgK\n", + "V = 40. \t\t\t#m**3\n", + "V1 = 40.\t\t\t#m**3\n", + "V2 = 40.\t\t\t#m**3\n", + "T1 = 35.+273;\t\t\t#K\n", + "T2 = 5.+273;\t\t\t#K\n", + "\n", + "# Calculations\n", + "m = p1*10**5*V1/R/T1-p2*10**5*V2/R/T2\n", + "\n", + "# Results\n", + "print \"Mass of air removed in Kg : %.2f\"%m\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air removed in Kg : 22.691\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.26 Page No : 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables :\n", + "m = 1. \t \t\t#Kg\n", + "t = 80.\t \t \t#degree C\n", + "mw = 10.\t\t \t#Kg\n", + "t1 = 25.\t\t \t#degree C\n", + "delta_t = 5;\t\t\t#degree C\n", + "\n", + "# Calculations\n", + "t2 = delta_t+t1;\t\t\t#degree C\n", + "Sw = 4.187;\t\t\t#Kj/KgK\n", + "#m*S*(t-t2) = mw*Sw*(t2-t1)\n", + "S = mw*Sw*(t2-t1)/m/(t-t2);\t\t\t#Kj/KgK\n", + "\n", + "# Results\n", + "print \"Specific heat of metal in KJ/KgK : \",S\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific heat of metal in KJ/KgK : 4.187\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.27 Page No : 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables :\n", + "m = 500.;\t\t\t#Kg\n", + "t1 = 45.;\t\t\t#degree C\n", + "t0 = 5.;\t\t\t#degree C\n", + "CP = 4.18;\t\t\t#KJ/Kg-degree C\n", + "Qdot = 41.87;\t\t\t#MJ/hr\n", + "\n", + "# Calculations\n", + "Q = m*CP*(t1-t0);\t\t\t#KJ\n", + "Q = Q/1000;\t\t\t#MJ\n", + "Time = Q/Qdot;\t\t\t#hrs\n", + "\n", + "# Results\n", + "print \"Time required in hours : %.5f\"%Time\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time required in hours : 1.99666\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.28 Page No : 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "V1 = 2;\t\t\t#m**3\n", + "V2 = 4;\t\t\t#m**3\n", + "\n", + "# Calculations\n", + "def f24(V): \n", + "\t return 10**5*(V**2+6*V)\n", + "\n", + "W = quad(f24,V1,V2)[0]\n", + "\n", + "W = W/1000.;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Work done in KJ : %.1f\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in KJ : 5466.7\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.29 Page No : 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "# Variables :\n", + "p1 = 3.;\t\t\t#bar\n", + "V1 = 0.18;\t\t\t#m**3/Kg\n", + "p2 = 0.6;\t\t\t#bar\n", + "C = p1*10**5*V1**2;\t\t\t#Nm\n", + "V2 = math.sqrt((p1/p2)*V1**2);\t\t\t#m**3Kg\n", + "\n", + "# Calculations\n", + "def f27(V): \n", + " return C/V**2\n", + "\n", + "W = quad(f27,V1,V2)[0]\n", + "\n", + "W = W/1000;\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Work done in KJ/Kg : %.3f\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in KJ/Kg : 29.850\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.30 Page No : 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from numpy import *\n", + "\n", + "# Variables :\n", + "W = 160.\t \t\t#kJ\n", + "W = W*1000.\t\t \t#J\n", + "V1 = 800. \t\t\t#litres\n", + "V1 = V1/1000.\t\t\t#m**3\n", + "\n", + "# Calculations\n", + "#p = 7-3*V\n", + "#[7*(V2-V1)-1.5*(V2**2-V1**2)]-W/10**5 = 0;\t\t\t#Nm or J\n", + "#7*V2-7*V1-1.5*V2**2+1.5*V1**2-W/10**5;\t\t\t#Nm or J\n", + "#P = [-10**5*1.5 10**5*7 -10**5*7*V1+10**5*1.5*V1**2-W]\n", + "P = array([-1.5, 7, -7*V1+1.5*V1**2-W/10**5])\n", + "V2 = roots(P);\t\t\t#m**3\n", + "V2 = V2[1]\t\t\t #(V2(1) gives -ve value which is not possible)\n", + "print \"Final Volume in m**3 : %.4f\"%V2\n", + "\n", + "P2 = 7-3*V2;\t\t\t#bar\n", + "print \"Final Pressure in bar : %.3f\"%P2\n", + "#Answer is wrong in the book as calculation is wrong for V2.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final Volume in m**3 : 1.2000\n", + "Final Pressure in bar : 3.400\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.31 Page No : 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables :\n", + "p0 = 1. \t\t\t#bar\n", + "p0 = p0*10**5;\t\t\t#N/m**2\n", + "V1 = 0;\t\t \t#m**3\n", + "V2 = 0.7;\t\t\t #m**3\n", + "\n", + "# Calculations\n", + "#No p.dV work for cylinder as boundaries are \n", + "def f18(V): \n", + " return 1.\n", + "\n", + "W = p0* quad(f18,V1,V2)[0]\n", + "\n", + "W = W/1000.;\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Workdone by the system in KJ : \",W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Workdone by the system in KJ : 70.0\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.32 Page No : 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "p0 = 101.3;\t\t\t#KPa\n", + "V1 = 1.2;\t\t\t#m**3\n", + "V2 = 0;\t\t\t#m**3\n", + "\n", + "# Calculations\n", + "def f6(V): \n", + "\t return 1\n", + "\n", + "W = p0* quad(f6,V1,V2)[0]\n", + "\n", + "# Results\n", + "print \"Workdone by the air in KJ : \",W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Workdone by the air in KJ : -121.56\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.33 Page No : 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "T1 = 300;\t\t\t#K\n", + "T2 = 2300;\t\t\t#K\n", + "Gamma = 1.5;\n", + "m = 1;\t\t\t#Kg\n", + "\n", + "# Calculations and Results\n", + "def f14(T): \n", + "\t return m*(0.85+0.00004*T+5*10**-5*T**2)\n", + "\n", + "H2subH1 = quad(f14,T1,T2)[0]\n", + "\n", + "print \"Change in enthalpy in KJ/Kg : %.1f\"%H2subH1\n", + "\n", + "def f15(T): \n", + "\t return m*(0.85+0.00004*T+5*10**-5*T**2)/Gamma\n", + "\n", + "U2subU1 = quad(f15,T1,T2)[0]\n", + "\n", + "print \"Change in internal energy in KJ : %.1f\"%U2subU1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in enthalpy in KJ/Kg : 204137.3\n", + "Change in internal energy in KJ : 136091.6\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.34 Page No : 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 1.; \t\t\t #Kg\n", + "v = 1.;\t \t\t#m**3\n", + "T = 127.+273;\t\t\t#K\n", + "a = 138.;\t\t \t#KNm**4/(Kgmol)**2\n", + "a = a*10.**3;\t\t\t#Nm**4/(Kgmol)**2\n", + "M_O2 = 32.;\t\t\t #\n", + "vm = v*M_O2;\t\t\t#m**3/Kgmol\n", + "\n", + "#p*v = n*R*T\n", + "n = 1.\n", + "R = 8314.3;\t\t\t #gas constant\n", + "p = n*R*T/vm;\t\t\t#N/m**2\n", + "print \"Pressure using perfect gas equation in N/m**2 : %.1f\"%p\n", + "\n", + "#[p+a/vm**2]*[vm-b] = R*T\n", + "b = 0.0318;\n", + "p = R*T/(vm-b)-a/vm**2;\t\t\t#N/m**2\n", + "print \"Pressure using Vander Walls equation in N/m**2 : %.1f\"%p\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure using perfect gas equation in N/m**2 : 103928.7\n", + "Pressure using Vander Walls equation in N/m**2 : 103897.4\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.35 Page No : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 22.;\t\t\t#Kg\n", + "T = 300.;\t\t\t#K\n", + "V = 5.; \t\t\t#m**3\n", + "M = 44.;\t\t\t#Kg/Kgmol\n", + "a = 362.9;\t\t\t#KNm**4/Kgmol**2\n", + "b = 0.0314;\t\t\t#m**3/Kgmol\n", + "Rdash = 8314.3;\t\t\t#gas consmath.tant\n", + "\n", + "# Calculations and Results\n", + "R = Rdash/M;\t\t\t#Nm/KgK\n", + "p = m*R*T/V;\t\t\t#Pa\n", + "p = p/10**5;\t\t\t#bar\n", + "print \"Pressure, when gas behaves like a perfect gas in bar : %.4f\"%p\n", + "\n", + "Vdash = V/m*M;\t\t\t#m**3/Kgmole\n", + "#[p+a/vm**2]*[vm-b] = R*T\n", + "p = Rdash*T/(Vdash-b)-a*10**3/Vdash**2;\t\t\t#N/m**2\n", + "print \"Pressure umath.sing Vander Walls equation in bar : %.4f\"%(p/10**5)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure, when gas behaves like a perfect gas in bar : 2.4943\n", + "Pressure umath.sing Vander Walls equation in bar : 2.4659\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.36 Page No : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "pc = 37.7;\t\t\t#bar\n", + "Tc = 132.5;\t\t\t#K\n", + "vc = 0.093;\t\t\t#m**3Kgmol\n", + "R = 287.;\t\t\t#Nm/KgK\n", + "m = 10.;\t\t\t#Kg\n", + "T = 300.;\t\t\t#K\n", + "V = 0.3;\t\t\t#m**3\n", + "\n", + "# Calculations\n", + "a = 27.*R**2*Tc**2./64./pc/10**5;\n", + "b = R*Tc/8/pc/10**5;\t\t\t#\n", + "#(p+a/V**2)*(V-b) = R*T\n", + "p = R*T/(V-b)-a/V**2;\t\t\t#N/m**2\n", + "p = p/10**5;\t\t\t#bar\n", + "\n", + "# Results\n", + "print \"Pressure exerted by air in bar : %.4f\"%p\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure exerted by air in bar : 2.8641\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.37 Page No : 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "pc = 221.2;\t\t\t#bar\n", + "Tc = 374.15+273;\t\t\t#K\n", + "p = 100.;\t\t\t#bar\n", + "T = 400.+273;\t\t\t#K\n", + "R = 462.;\t\t\t#Nm/KgK\n", + "\n", + "# Calculations\n", + "#p*v = R*T\n", + "v = R*T/p/10**5;\t\t\t#m**3/Kg\n", + "print \"Specific volume, v by perfect gas equation in m**3/Kg : %.5f\"%v\n", + "\n", + "# Results\n", + "pr = p/pc;\n", + "Tr = T/Tc;\n", + "Z = 0.84;\t\t\t#From compressibility chart\n", + "v = Z*R*T/p/10**5\n", + "print \"Specific volume, v by compressibility chart in m**3/Kg : %.5f\"%v\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific volume, v by perfect gas equation in m**3/Kg : 0.03109\n", + "Specific volume, v by compressibility chart in m**3/Kg : 0.02612\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.38 Page No : 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "pr = 5;\n", + "Z = 0.8;\n", + "pc = 46.4;\t\t\t#bar\n", + "Tc = 191.1;\t\t\t#K\n", + "Tr = 1.44;\t\t\t#\n", + "\n", + "# Calculations and Results\n", + "p = pr*pc;\t\t\t#bar\n", + "print \"Pressure in bar : \",p\n", + "\n", + "T = Tr*Tc;\t\t\t#K\n", + "print \"Temperature in K : \",T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure in bar : 232.0\n", + "Temperature in K : 275.184\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.39 Page No : 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "V = 0.01653;\t\t\t#m**3\n", + "m = 5.6; \t\t\t#Kg\n", + "M = 28. \t \t\t#Kg/Kgmol\n", + "p = 200.\t\t \t#bar\n", + "Z = 0.605;\n", + "Rdash = 8314.3;\t\t\t#J/Kgk\n", + "R = Rdash/M;\t\t\t#J/Kgk\n", + "\n", + "# Calculations\n", + "#p*V = m*Z*R*T\n", + "T = p*10**5*V/m/Z/R;\t\t\t#K\n", + "\n", + "# Results\n", + "print \"Temperature in K : %.2f\"%T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature in K : 328.62\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.40 Page No : 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\t\t\t\n", + "# Variables :\n", + "mCO = 0.45;\t\t\t#Kg\n", + "mAir = 1;\t\t\t#Kg\n", + "V = 0.4;\t\t\t#m**3\n", + "T = 15.+273;\t\t\t#K\n", + "MCO = 28.;\t\t\t#Kg/Kgmo\n", + "MO2 = 32.;\t\t\t#Kg/Kgmol\n", + "MN2 = 28.;\t\t\t#Kg/Kgmol\n", + "\n", + "# Calculations\n", + "mO2 = 23.3/100*mAir;\t\t\t#Kg\n", + "mN2 = 76.7/100*mAir;\t\t\t#Kg\n", + "Rdash = 8314.3;\t\t\t#J/Kgk\n", + "#p*V = m*Z*R*T\n", + "pCO = mCO*Rdash/MCO*T/V/10**5;\t\t\t#bar\n", + "pO2 = mO2*Rdash/MO2*T/V/10**5;\t\t\t#bar\n", + "pN2 = mN2*Rdash/MN2*T/V/10**5;\t\t\t#bar\n", + "\n", + "# Results\n", + "print \"Pressure of CO in bar : %.4f\"%pCO\n", + "print \"Pressure of O2 in bar : %.4f\"%pO2\n", + "print \"Pressure of N2 in bar : %.4f\"%pN2\n", + "p = pCO+pO2+pN2;\t\t\t#bar\n", + "print \"Total pressure in vessel in bar : %.4f\"%p\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure of CO in bar : 0.9621\n", + "Pressure of O2 in bar : 0.4359\n", + "Pressure of N2 in bar : 1.6398\n", + "Total pressure in vessel in bar : 3.0378\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.41 Page No : 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "ma = 0.4;\t\t\t#Kg\n", + "mb = 0.8;\t\t\t#Kg\n", + "Ma = 44.;\n", + "Mb = 29.;\n", + "V = 0.4;\t\t\t#m**3\n", + "T = 300.;\t\t\t#K\n", + "Rdash = 8314.3;\t\t\t#J/Kgk\n", + "\n", + "# Calculations\n", + "Ra = Rdash/Ma;\t\t\t#Nm/KgK\n", + "Rb = Rdash/Mb;\t\t\t#Nm/KgK\n", + "na = ma/Ma;\t\t\t#moles\n", + "nb = mb/Mb;\t\t\t#moles\n", + "#p*V = n*R*T\n", + "pa = na*Rdash/1000*T/V;\t\t\t#bar\n", + "pb = nb*Rdash/1000*T/V;\t\t\t#bar\n", + "\n", + "# Results\n", + "print \"Pressure of container A in KPa : %.2f\"%pa\n", + "print \"Pressure of container B in KPa : %.2f\"%pb\n", + "p = pa+pb;\t\t\t#Kpa\n", + "print \"Pressure of mixture in KPa : %.2f\"%p\n", + "\n", + "#Ans of Pb is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure of container A in KPa : 56.69\n", + "Pressure of container B in KPa : 172.02\n", + "Pressure of mixture in KPa : 228.71\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.42 Page No : 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\t\t\t\n", + "# Variables :\n", + "Rdash = 8314.3;\t\t\t#J/Kgk\n", + "mO2 = 23.15/100;\n", + "mN2 = 75.52/100;\n", + "mArgon = 1.29/100;\n", + "mCO2 = 0.04/100;\n", + "MO2 = 32.;\n", + "MN2 = 28.;\n", + "MArgon = 40.;\n", + "MCO2 = 44.;\n", + "\n", + "# Calculations and Results\n", + "RO2 = Rdash/MO2;\t\t\t#J/KgK\n", + "RN2 = Rdash/MN2;\t\t\t#J/KgK\n", + "RArgon = Rdash/MArgon;\t\t\t#J/KgK\n", + "RCO2 = Rdash/MCO2;\t\t\t#J/KgK\n", + "R = (mO2*RO2+mN2*RN2+RArgon*mArgon+RCO2*mCO2)/(mO2+mN2+mArgon+mCO2);\t\t\t#J/KgK\n", + "print \"Characteristic gas constant for air in J/KgK : %.2f\"%R\n", + "\n", + "M = Rdash/R;\t\t\t#Kg/Kgmol\n", + "print \"Molecular weight of air in Kg/Kgmol : %.3f\"%M\n", + "\n", + "p = 1.013; \t\t\t#bar\n", + "nO2 = mO2/MO2;\t \t\t#moles\n", + "nCO2 = mCO2/MCO2;\t\t\t#moles\n", + "nN2 = mN2/MN2;\t\t \t#moles\n", + "nArgon = mArgon/MArgon;\t\t\t#moles\n", + "n = nO2+nN2+nArgon+nCO2;\n", + "pO2 = nO2/n*p;\t\t \t#bar\n", + "pN2 = nN2/n*p;\t\t \t #bar\n", + "pArgon = nArgon/n*p;\t\t\t#bar\n", + "pCO2 = nCO2/n*p;\t \t\t#bar\n", + "\n", + "print \"Pressure of O2 in bar : %.4f\"%pO2\n", + "print \"Pressure of N2 in bar : %.4f\"%pN2\n", + "print \"Pressure of Argon in bar : %.4f\"%pArgon\n", + "print \"Pressure of CO2 in bar : %.5f\"%pCO2\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Characteristic gas constant for air in J/KgK : 287.15\n", + "Molecular weight of air in Kg/Kgmol : 28.954\n", + "Pressure of O2 in bar : 0.2122\n", + "Pressure of N2 in bar : 0.7911\n", + "Pressure of Argon in bar : 0.0095\n", + "Pressure of CO2 in bar : 0.00027\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.43 Page No : 63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables :\n", + "yO2 = 0.3;\n", + "yN2 = 0.5;\n", + "yCO2 = 0.2;\n", + "V = 1.; \t\t\t#m**3\n", + "T = 27+273;\t\t\t#K\n", + "m = 8.;\t \t\t#Kg\n", + "MO2 = 32.;\n", + "MN2 = 28.;\n", + "MCO2 = 44.;\n", + "\n", + "# Calculations and Results\n", + "M = 1/(yO2/MO2+yN2/MN2+yCO2/MCO2);\t\t\t#Kg/Kgmol\n", + "print \"Molecular mass for mixture in Kg/Kgmol : %.3f\"%M\n", + "\n", + "Rdash = 8314.3;\t\t\t#J/Kgk\n", + "R = Rdash/M;\t\t\t#Nm/KgK\n", + "print \"Gas consmath.tant R of mixture in Nm/KgK : %.1f\"%R\n", + "\n", + "p = m*R*T/V/10**5;\t\t\t#bar\n", + "print \"Pressure exerted by gases in bar : %.3f\"%p\n", + "\n", + "nO2 = yO2/MO2*m;\t\t\t#moles\n", + "nCO2 = yCO2/MCO2*m;\t\t\t#moles\n", + "nN2 = yN2/MN2*m;\t\t\t#moles\n", + "print \"Mole fraction of O2(moles) : %.4f\"%nO2\n", + "print \"Mole fraction of N2(moles) : %.4f\"%nN2\n", + "print \"Mole fraction of CO2(moles) : %.4f\"%nCO2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Molecular mass for mixture in Kg/Kgmol : 31.469\n", + "Gas consmath.tant R of mixture in Nm/KgK : 264.2\n", + "Pressure exerted by gases in bar : 6.341\n", + "Mole fraction of O2(moles) : 0.0750\n", + "Mole fraction of N2(moles) : 0.1429\n", + "Mole fraction of CO2(moles) : 0.0364\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.44 Page No : 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "mN2 = 4.;\t\t\t#Kg\n", + "mO2 = 2.4;\t\t\t#Kg\n", + "mCO2 = 1.6;\t\t\t#Kg\n", + "MO2 = 32.;\n", + "MN2 = 28.;\n", + "MCO2 = 44.;\n", + "Gamma = 1.4;\n", + "\n", + "# Calculations\n", + "#Rdash = Cpdash*(1-1/Gamma)\n", + "Rdash = 8.3143;\t\t\t#J/KgK\n", + "Cpdash = Rdash*Gamma/(Gamma-1);\t\t\t#KJ/KgmolK\n", + "Cvdash = Cpdash/Gamma;\t\t\t#KJ/KgmolK\n", + "CpO2 = Cpdash/MO2;\t\t\t#KJ/KgmolK\n", + "CpN2 = Cpdash/MN2;\t\t\t#KJ/KgmolK\n", + "CpCO2 = Cpdash/MCO2;\t\t\t#KJ/KgmolK\n", + "CvO2 = Cvdash/MO2;\t\t\t#KJ/Kg\n", + "CvN2 = Cvdash/MN2;\t\t\t#KJ/Kg\n", + "CvCO2 = Cvdash/MCO2;\t\t\t#KJ/Kg\n", + "\n", + "\n", + "# Results\n", + "print (\"Specific heat of gases : \");\n", + "print \"For N2, Cp is %.3f\"%(CpN2),\" KJ/Kg & Cv is %.4f\"%CvN2,\" KJ/Kg.\"\n", + "print \"For O2, Cp is %.3f\"%CpO2,\" KJ/Kg & Cv is %.4f\"%CvO2,\" KJ/Kg.\"\n", + "print \"For CO2, Cp is %.3f\"%CpCO2,\" KJ/Kg & Cv is %.4f\"%CvCO2,\" KJ/Kg.\"\n", + "Cp = (mO2*CpO2+mN2*CpN2+mCO2*CpCO2)/(mO2+mN2+mCO2);\t\t\t#KJ/KgK\n", + "print \"Specific heat of mixture, Cp in KJ/KgK : %.5f\"%Cp\n", + "Cv = (mO2*CvO2+mN2*CvN2+mCO2*CvCO2)/(mO2+mN2+mCO2);\t\t\t#KJ/KgK\n", + "print \"Specific heat of mixture, Cv in KJ/KgK : %.4f\"%Cv\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific heat of gases : \n", + "For N2, Cp is 1.039 KJ/Kg & Cv is 0.7423 KJ/Kg.\n", + "For O2, Cp is 0.909 KJ/Kg & Cv is 0.6496 KJ/Kg.\n", + "For CO2, Cp is 0.661 KJ/Kg & Cv is 0.4724 KJ/Kg.\n", + "Specific heat of mixture, Cp in KJ/KgK : 0.92473\n", + "Specific heat of mixture, Cv in KJ/KgK : 0.6605\n" + ] + } + ], + "prompt_number": 44 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch2.ipynb b/Thermodynamics_by_B._l._Singhal/ch2.ipynb new file mode 100755 index 00000000..a10e370a --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch2.ipynb @@ -0,0 +1,2523 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4beb35ada58485d461354c9e6cd8c35efa87daa22f78221fc919dce02e9cad12" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : First Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "mc = 10.;\t\t\t#Kg\n", + "Cpc = 0.4;\t\t\t#KJ/KgK\n", + "Cpw = 4.187;\t\t\t#KJ/KgK(Specific heat of water)\n", + "tc = 90.;\t\t\t#degree_centigrade\n", + "Vw = 0.35;\t\t\t#m**3\n", + "tw = 30.;\t\t\t#degree_centigrade\n", + "density_water = 1000;\t\t\t#Kg/m**3\n", + "mw = Vw*density_water;\t\t\t#Kg\n", + "\n", + "# Calculations\n", + "#mc*Cpc*(tc-t) = mw*Cpw*(t-tw)\n", + "t = (mw*Cpw*tw+mc*Cpc*tc)/(mw*Cpw+mc*Cpc);\t\t\t#degree_centigrade\n", + "\n", + "# Results\n", + "print \"Equillibrium temperature in degree_centigrade : %.4f\"%t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equillibrium temperature in degree_centigrade : 30.1633\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2 Page No : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "Q1 = 2500.;\t\t\t#KJ/Kg\n", + "Q2 = 1800.;\t\t\t#KJ/Kg\n", + "Pdev = 210.;\t\t\t#MW\n", + "\n", + "# Calculations\n", + "#Power developed = Heat transfered: Pdev = m*(Q1-Q2)\n", + "m = Pdev*1000/(Q1-Q2);\t\t\t#mass flow rate of steam in Kg/s\n", + "\n", + "# Results\n", + "print \"Mass flow rate of steam in Kg/s : \",m\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flow rate of steam in Kg/s : 300.0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3 Page No : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "WA = 20;\t\t\t#KJ\n", + "QA = 15;\t\t\t#KJ\n", + "QB = 10;\t\t\t#KJ\n", + "\n", + "# Calculations\n", + "U2subU1 = QA-WA;\t\t\t#change in internal energy in KJ\n", + "WB = QB - U2subU1\n", + "QB = -10\n", + "WB = -15\n", + "QA = 15\n", + "WA = 20\n", + "\n", + "dQ = QA + QB\n", + "dW = WA + WB\n", + "\n", + "# Results\n", + "print \"Change in internal energy in KJ : \",U2subU1\n", + "print \"Workdone in process : %d KJ\"%WB\n", + "print \"d'Q = Qa + Qb = %d kJ\"%dQ\n", + "print \"d'W = Wa + Wb = %d kJ\"%dW" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy in KJ : -5\n", + "Workdone in process : -15 KJ\n", + "d'Q = Qa + Qb = 5 kJ\n", + "d'W = Wa + Wb = 5 kJ\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4 Page No : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "Q1 = 120.;\t\t\t#KJ\n", + "Q2 = -16;\t\t\t#KJ\n", + "Q3 = -48;\t\t\t#KJ\n", + "Q4 = 12;\t\t\t#KJ\n", + "W1 = 60000;\t\t\t#N-m\n", + "W2 = 68000;\t\t\t#N-m\n", + "W3 = 120000;\t\t\t#N-m\n", + "W4 = 44000;\t\t\t#N-m\n", + "\n", + "# Calculations\n", + "Net_work = Q1+Q2+Q3+Q4;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Net Work in N-m : \",Net_work*1000\n", + "print (\"Option (ii) is true.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net Work in N-m : 68000.0\n", + "Option (ii) is true.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5 Page No : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables\n", + "T1 = 100;\t\t\t#degree_centigrade\n", + "T1 = T1+273;\t\t\t#kelvin\n", + "T2 = 200;\t\t\t#degree_centigrade\n", + "T2 = T2+273;\t\t\t#kelvin\n", + "\n", + "delQbydelT = 1.005;\t\t\t#KJ/k\n", + "\n", + "# Calculations\n", + "#delWbydelT = (4-0.12*T);\t\t\t#KJ/k\n", + "def f12(T): \n", + "\t return 1.005\n", + "\n", + "Q = quad(f12,T1,T2)[0]\n", + "\n", + "def f13(T): \n", + "\t return 4-0.12*T\n", + "\n", + "W = quad(f13,T1,T2)[0]\n", + "\n", + "U2subU1 = Q-W;\t\t\t#change in internal energy in KJ\n", + "\n", + "# Results\n", + "print \"Change in internal energy in KJ : \",U2subU1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy in KJ : 4776.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6 Page No : 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "m = 20.;\t\t\t#Kg\n", + "mw = 200.;\t\t\t#Kg\n", + "Z1 = 15.;\t\t\t#m\n", + "Z2 = 0.;\t\t\t#m\n", + "g = 9.81;\t\t\t#gravity consmath.tant\n", + "\n", + "print (\"(i) Stone is about to enter the water\");\n", + "deltaPE = m*g*(Z2-Z1)/1000;\t\t\t#KJ\n", + "Q = 0;\t\t\t#Heat Transfer\n", + "W = 0;\t\t\t#Work Transfer\n", + "deltaE = Q-W;\t\t\t#Energy Transfer\n", + "#deltaE = deltaU+deltaKE+deltaPE\n", + "deltaU = 0;\t\t\t#no change in temperature\n", + "deltaKE = deltaE-deltaU-deltaPE;\t\t\t#KJ\n", + "print \"deltaU in KJ : \",deltaU\n", + "print \"deltaPE in KJ : \",deltaPE\n", + "print \"deltaKE in KJ : \",deltaKE\n", + "print \"Q in KJ : \",Q\n", + "print \"W in KJ : \",W\n", + "\n", + "print (\"(ii) Stone has come to rest near the math.tank.\");\n", + "Q = 0;\t\t\t#Heat Transfer\n", + "W = 0;\t\t\t#Work Transfer\n", + "deltaE = Q-W;\t\t\t#Energy Transfer\n", + "deltaKE = 0;\t\t\t#rest condition\n", + "\n", + "#deltaE = deltaU+deltaKE+deltaPE\n", + "deltaU = deltaE-deltaKE-deltaPE;\t\t\t#KJ\n", + "print \"deltaU in KJ : \",deltaU\n", + "print \"deltaPE in KJ : \",deltaPE\n", + "print \"deltaKE in KJ : \",deltaKE\n", + "print \"Q in KJ : \",Q\n", + "print \"W in KJ : \",W\n", + "\n", + "print (\"(iii) Heat is transfered to surroundings.\");\n", + "deltaKE = 0;\t\t\t#Energy Transfered to water\n", + "deltaPE = 0;\n", + "W = 0;\n", + "deltaE = deltaU+deltaKE+deltaPE\n", + "Q = deltaE+W;\t\t\t#KJ\n", + "print \"deltaU in KJ : \",deltaU\n", + "print \"deltaPE in KJ : \",deltaPE\n", + "print \"deltaKE in KJ : \",deltaKE\n", + "print \"Q in KJ : \",Q\n", + "print \"W in KJ : \",W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Stone is about to enter the water\n", + "deltaU in KJ : 0\n", + "deltaPE in KJ : -2.943\n", + "deltaKE in KJ : 2.943\n", + "Q in KJ : 0\n", + "W in KJ : 0\n", + "(ii) Stone has come to rest near the math.tank.\n", + "deltaU in KJ : 2.943\n", + "deltaPE in KJ : -2.943\n", + "deltaKE in KJ : 0\n", + "Q in KJ : 0\n", + "W in KJ : 0\n", + "(iii) Heat is transfered to surroundings.\n", + "deltaU in KJ : 2.943\n", + "deltaPE in KJ : 0\n", + "deltaKE in KJ : 0\n", + "Q in KJ : 2.943\n", + "W in KJ : 0\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7 Page No : 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "SigmaW = 30;\t\t\t#KJ\n", + "n = 10;\t\t\t#cycles/min\n", + "Q1_2 = 50;\t\t\t#KJ\n", + "#Q2_3 = 0;\t\t\t#KJ\n", + "#Q3_1 = 0;\t\t\t#KJ\n", + "#W1_2 = 0;\t\t\t#KJ\n", + "W2_3 = 30;\t\t\t#KJ\n", + "#W3_1 = 0;\t\t\t#KJ\n", + "deltaU1_2 = 20;\t\t\t#KJ\n", + "deltaU2_3 = -10;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "#deltaU3_1 = 0;\t\t\t#KJ\n", + "#Q-W = deltaU\n", + "#For Proess 1-2 : \n", + "W1_2 = Q1_2-deltaU1_2;\t\t\t#KJ\n", + "print \"W1-2 in KJ : \",W1_2\n", + "#For Proess 2-3\n", + "Q2_3 = W2_3+deltaU2_3;\t\t\t#KJ\n", + "print \"Q2-3 in KJ : \",Q2_3\n", + "#For Proess 3-1\n", + "W3_1 = SigmaW-W1_2-W2_3;\t\t\t#KJ\n", + "print \"-1 in KJ : \",W3_1\n", + "\n", + "SigmaQ = SigmaW;\t\t\t#KJ\n", + "Q3_1 = SigmaQ-Q1_2-Q2_3;\t\t\t#KJ\n", + "print \"Q3-1 in KJ : \",Q3_1\n", + "\n", + "deltaU3_1 = Q3_1-W3_1;\t\t\t#KJ\n", + "print \"U1-U3 or deltaU3-1 in KJ : \",deltaU3_1\n", + "\n", + "RateOfWork = SigmaW*n;\t\t\t#KJ/min\n", + "RateOfWork = RateOfWork/60;\t\t\t#KJ/sec or KW\n", + "print \"Rate of work in KW : \",RateOfWork\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W1-2 in KJ : 30\n", + "Q2-3 in KJ : 20\n", + "-1 in KJ : -30\n", + "Q3-1 in KJ : -40\n", + "U1-U3 or deltaU3-1 in KJ : -10\n", + "Rate of work in KW : 5\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8 Page No : 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 50.;\t\t\t#Kg\n", + "C1 = 10.;\t\t\t#m/s\n", + "C2 = 30.;\t\t\t#m/s\n", + "Z2subZ1 = 40.;\t\t\t#m\n", + "Q = 30000.;\t\t\t#J\n", + "W1 = -4500.;\t\t\t#J\n", + "W2 = 0.002;\t\t\t#KWh\n", + "g = 9.81;\t\t\t#gravity constant\n", + "W2 = W2*3600.*1000;\t\t\t#J\n", + "\n", + "# Calculations\n", + "#sigmaQ-sigmaW = E2-E1 = (U2-U1)+(C2**2-C1**2)/2+g*(Z2-Z1)\n", + "U2subU1 = Q-(W1+W2)-(C2**2-C1**2)/2-g*(Z2subZ1);\t\t\t#J\n", + "\n", + "# Results\n", + "print \"Change in Internal energy in J : \",U2subU1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in Internal energy in J : 26507.6\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9 Page No : 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "deltaU = -4000.;\t\t\t#KJ\n", + "W = -1.2;\t \t\t#KWh\n", + "\n", + "# Calculations\n", + "W = W*3600.;\t\t\t#KJ\n", + "Q = W+deltaU;\t\t\t#KJ/hr\n", + "\n", + "# Results\n", + "print \"Net heat transfer in KJ/hr : \",Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net heat transfer in KJ/hr : -8320.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.10 Page No : 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "mw = 100;\t\t\t#Kg\n", + "T = 30;\t\t\t#min\n", + "T = T*60;\t\t\t#sec\n", + "P = 1;\t\t\t#KW\n", + "Q = -50;\t\t\t#KJ\n", + "Sw = 4.19;\t\t\t#KJ/KgK(Specific heat of water)\n", + "W = -P*T;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "#Q = W+deltaU\n", + "deltaU = Q-W;\t\t\t#KJ\n", + "print \"Chnge in internal energy in kJ : \",deltaU\n", + "delta_t = deltaU/mw/Sw;\t\t\t#sec\n", + "print \"Rise in temperature in degree C : %.3f\"%delta_t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chnge in internal energy in kJ : 1750\n", + "Rise in temperature in degree C : 4.057\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.11 Page No : 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "V = 12.;\t\t\t#Volt\n", + "I = 6.;\t\t\t#Ampere\n", + "t = 1.5;\t\t\t#hr\n", + "t = t*3600.;\t\t\t#sec\n", + "deltaU = -750.;\t\t\t#KJ\n", + "\n", + "# Calculations\n", + "W = V*I*t/1000;\t\t\t#KJ\n", + "Q = W+deltaU;\t\t\t#KJ\n", + "\n", + "\n", + "# Results\n", + "print \"Heat transfer in KJ : \",Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transfer in KJ : -361.2\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.12 Page No : 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables\n", + "Q = 82.;\t\t\t#KJ\n", + "p1 = 4.;\t\t\t#bar\n", + "m = 1.; \t\t\t#Kg\n", + "V1 = 0.21;\t\t\t#m**3\n", + "T2 = 127.;\t\t\t#degree Centigrade\n", + "R = 300.;\t\t\t#Nm/KgK\n", + "W = 0.; \t\t\t#because V is consmath.tant.\n", + "\n", + "# Calculations and Results\n", + "print \"Work done in KJ : \",W\n", + "\n", + "#Q-W = deltaU\n", + "deltaU = Q-W;\t\t\t#KJ\n", + "print \"Change in internal energy in KJ : \",deltaU\n", + "\n", + "#p1*V1 = m*R*T1\n", + "T1 = p1*10**5*V1/m/R;\t\t\t#kelvin\n", + "T1 = T1-273;\t\t\t#degree centigrade\n", + "delta_t = T2-T1;\t\t\t#degree centigrade\n", + "Cv = deltaU/delta_t;\t\t\t#KJ/KgK\n", + "print \"Specific Heat in KJ/KgK : %.3f\"%Cv\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in KJ : 0.0\n", + "Change in internal energy in KJ : 82.0\n", + "Specific Heat in KJ/KgK : 0.683\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.13 Page No : 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "V1 = 250.;\t\t\t#litres\n", + "V2 = 250.;\t\t\t#litres\n", + "p1 = 3.;\t\t\t#Mpa\n", + "t1 = 20.;\t\t\t#degree_centigrade\n", + "p2 = 1.8;\t\t\t#Mpa\n", + "t2 = 16.;\t\t\t#degree_centigrade\n", + "Gamma = 1.4;\t\t\t#\n", + "rho = 1.43;\t\t\t#Kg/m**3\n", + "p = 0.1013;\t\t\t#Mpa\n", + "\n", + "# Calculations and Results\n", + "V1 = V1/1000;\t\t\t#m**3\n", + "V2 = V2/1000;\t\t\t#m**3\n", + "T1 = t1+273;\t\t\t#Kelvin\n", + "T2 = t2+273;\t\t\t#Kelvin\n", + "\n", + "#p = rho*R*T\n", + "T = 0+273;\t\t\t#Kelvin\n", + "R = p*10**6/rho/T;\t\t\t#Nm/KgK\n", + "\n", + "#p*V = m*R*T\n", + "m1 = p1*10**6*V1/R/T1;\t\t\t#Kg\n", + "m2 = p2*10**6*V2/R/T2;\t\t\t#Kg\n", + "Mass_oxygen = m1-m2;\t\t\t#Kg\n", + "print \"Mass of oxygen used in Kg : %.3f\"%Mass_oxygen\n", + "\n", + "#Cv*(Gamma-1) = R\n", + "Cv = R/(Gamma-1);\t\t\t#Nm/KgK\n", + "Q = m2*Cv*(t1-t2);\t\t\t#J\n", + "print \"Heat transfered in J : %.1f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of oxygen used in Kg : 3.864\n", + "Heat transfered in J : 15570.9\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.14 Page No : 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 50./1000;\t\t\t#Kg\n", + "t1 = 14.;\t\t\t#degree_centigrade\n", + "t2 = 74.;\t\t\t#degree_centigrade\n", + "t_heating = 300.;\t\t\t#sec\n", + "Pheater = 10.04;\t\t\t#Watts\n", + "Gamma = 1.4;\n", + "\n", + "Q = Pheater*t_heating;\t\t\t#J\n", + "#Q = m*Cp*(t2-t1)\n", + "Cp = Q/m/(t2-t1);\t\t\t#J/KgK\n", + "print \"Specific heat of air in J/KgK : \",Cp\n", + "\n", + "#Cp*(1-1/Gamma) = R\n", + "R = Cp*(1-1/Gamma);\t\t\t#Gas Constant in Nm/KgK\n", + "print \"Gas constant of air in Nm/KgK : %.2f\"%R\n", + "\n", + "#p = rho*R*T\n", + "p = 0.1;\t\t\t#Mpa\n", + "T = 0+273;\t\t\t#kelvin\n", + "rho = p*10**6/R/T;\t\t\t#Kg/m**3\n", + "print \"Density of air in Kg/m**3 : %.4f\"%rho\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific heat of air in J/KgK : 1004.0\n", + "Gas constant of air in Nm/KgK : 286.86\n", + "Density of air in Kg/m**3 : 1.2769\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.15 Page No : 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 1.;\t\t\t#Kg\n", + "V1 = 0.3;\t\t\t#m**3\n", + "p = 3.2*100;\t\t\t#Kpa\n", + "p1 = 3.2*100;\t\t\t#Kpa\n", + "p2 = 3.2*100;\t\t\t#Kpa\n", + "V2 = 2.*V1;\t\t\t#m**3\n", + "Cp = 1.003;\t\t\t#KJ/KgK\n", + "R = 0.2927;\t\t\t#KJ/kgK\n", + "\n", + "# Calculations and Results\n", + "#p*V = m*R*T\n", + "T1 = p1*V1/m/R;\t\t\t#kelvin\n", + "T2 = p2*V2/m/R;\t\t\t#kelvin\n", + "Q = m*Cp*(T2-T1);\t\t\t#KJ\n", + "print \"Heat Added in KJ : %.2f\"%Q\n", + "W = p*(V2-V1);\t\t\t#KJ\n", + "\n", + "print \"Work done in KJ : \",W\n", + "print \"Initial temperature of air in kelvin : \",round(T1)\n", + "print \"Final temperature of air in kelvin : \",round(T2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat Added in KJ : 328.96\n", + "Work done in KJ : 96.0\n", + "Initial temperature of air in kelvin : 328.0\n", + "Final temperature of air in kelvin : 656.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.16 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables : \n", + "p = 105;\t\t\t#Kpa\n", + "p1 = 105;\t\t\t#Kpa\n", + "p2 = 105;\t\t\t#Kpa\n", + "V1 = 0.25;\t\t\t#m**3\n", + "V2 = 0.45;\t\t\t#m**3\n", + "T1 = 10+273;\t\t\t#kelvin\n", + "T2 = 240+273;\t\t\t#kelvin\n", + "\n", + "\n", + "# Calculations and Results\n", + "def f5(T): \n", + "\t return 0.4+18/(T+40)\n", + "\n", + "Q = quad(f5,T1,T2)[0]\n", + "\n", + "print \"Heat Transfer in KJ : %.2f\"%Q\n", + "W = p*(V2-V1);\t\t\t#KJ\n", + "print \"Work Transfer in KJ : \",W\n", + "deltaU = Q-W;\t\t\t#KJ\n", + "print \"in internal energy in KJ L : %.2f\"%deltaU\n", + "deltaH = Q;\t\t\t#KJ\n", + "print \"Change in enthalpy in KJ : %.2f\"%deltaH\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat Transfer in KJ : 101.68\n", + "Work Transfer in KJ : 21.0\n", + "in internal energy in KJ L : 80.68\n", + "Change in enthalpy in KJ : 101.68\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.17 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Variables : \n", + "N = 250.;\t\t\t#rpm\n", + "tau = 10.;\t\t\t#min\n", + "Q1 = -5.;\t\t\t#KJ\n", + "deltaU = 2.;\t\t\t#KJ\n", + "p = 1.2;\t\t\t#bar\n", + "p = p*100.;\t\t\t#KJ\n", + "E = 24.;\t\t\t#volt\n", + "I = 0.45;\t\t\t#Ampere\n", + "A = 0.1;\t\t\t#m**2\n", + "T = 0.5;\t\t\t#Nm\n", + "Q2 = E*I*tau*60./1000;\t\t\t#KJ\n", + "Q = Q1+Q2;\t\t\t#KJ\n", + "\n", + "# Calculations\n", + "#Consider piston moves through a distance y\n", + "#Q-(W1+W2) = deltaU where W1 = p*A*y\n", + "W2 = -T*2*math.pi*N*tau;\t\t\t#Nm\n", + "W2 = W2/1000;\t\t\t#KJ\n", + "y = (Q-W2-deltaU)/A/p;\t\t\t#meter\n", + "\n", + "# Results\n", + "print \"Distance in cm : %.2f\"%(y*100)\n", + "\n", + "#Ans is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Distance in cm : 61.12\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.18 Page No : 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "m = 0.8;\t\t\t#Kg\n", + "p1 = 1.;\t\t\t#bar\n", + "p2 = 5.;\t\t\t#bar\n", + "T1 = 25.+273;\t\t\t#kelvin\n", + "R = 287.;\t\t\t#KJ/kgK\n", + "\n", + "# Calculations and Results\n", + "W = m*R*T1*math.log(p1/p2);\t\t\t#J\n", + "print \"Work done in KJ : %.3f\"%(W/1000)\n", + "\n", + "U2subU1 = 0;\t\t\t#change in internal energy \n", + "Q = W+U2subU1;\t\t\t#J\n", + "print \"Heat Transfer in KJ : %.3f\"%(Q/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in KJ : -110.119\n", + "Heat Transfer in KJ : -110.119\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.19 Page No : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "m = 1.;\t\t\t#Kg\n", + "p1 = 100.;\t\t\t#Kpa\n", + "T1 = 300.;\t\t\t#kelvin\n", + "V_ratio = 1./2;\t\t\t#V2/V1\n", + "T = 1.;\t\t\t#Nm\n", + "tau = 1.;\t\t\t#hr\n", + "tau = tau*60;\t\t\t#min\n", + "N = 400.;\t\t\t#rpm\n", + "R = 0.287;\t\t\t#KJ/kgK\n", + "\n", + "# Calculations\n", + "W1 = m*R*T1*math.log(V_ratio);\t\t\t#KJ\n", + "W2 = -T*2*math.pi*N*tau/1000;\t\t\t#KJ\n", + "W = W1+W2;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Net work transfer in KJ : %.2f\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work transfer in KJ : -210.48\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.20 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 2.;\t\t\t#Kg\n", + "T1 = 125.+273;\t\t\t#kelvin\n", + "T2 = 30.+273;\t\t\t#kelvin\n", + "W = 152.;\t\t\t#KJ\n", + "deltaH = -212.8;\t\t\t#KJ\n", + "Q = 0;\t\t\t#KJ(For adiabatic process)\n", + "\n", + "# Calculations and Results\n", + "#Q = W+m*Cv*(T2-T!)\n", + "Cv = (Q-W)/m/(T2-T1);\t\t\t#KJ/KgK\n", + "print \"Specific heat at constant volume in KJ/KgK : %.1f\"%Cv\n", + "\n", + "#deltaH = m*Cp*(T2-T1);\n", + "Cp = deltaH/m/(T2-T1);\t\t\t#KJ/KgK\n", + "print \"Specific heat at cinstant pressure in KJ/KgK : \",Cp\n", + "R = Cp-Cv;\t\t\t#KJ/KgK\n", + "print \"Characteristic gas constant in KJ/KgK : \",R\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific heat at constant volume in KJ/KgK : 0.8\n", + "Specific heat at cinstant pressure in KJ/KgK : 1.12\n", + "Characteristic gas constant in KJ/KgK : 0.32\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.21 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\t\t\t\n", + "# Variables : \n", + "V1 = 0.5;\t\t\t#m**3\n", + "p1 = 1.5;\t\t\t#bar\n", + "T1 = 100+273;\t\t\t#kelvin\n", + "V2 = 0.125;\t\t\t#m**3\n", + "p2 = 9;\t\t\t#bar\n", + "R = 287;\t\t\t#KJ/KgK\n", + "\n", + "\n", + "# Calculations and Results\n", + "m = p1*10**5*V1/R/T1;\t\t\t#Kg\n", + "print \"Mass of air in Kg : %.4f\"%m\n", + "\n", + "#p1*V1**n = p2*V2**n\n", + "n = math.log(p2/p1)/math.log(V1/V2);\t\t\t#\n", + "print \"Value of index : %.4f\"%n\n", + "\n", + "W = (p1*V1-p2*V2)*10**5/(n-1);\t \t\t#Nm\n", + "print \"Work done in KJ : %.4f\"%(W/1000)\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air in Kg : 0.7006\n", + "Value of index : 1.2925\n", + "Work done in KJ : -128.2133\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.22 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables : \n", + "p1 = 1.;\t\t\t#bar\n", + "V1 = 0.14;\t\t\t#m**3\n", + "V2 = 0.07;\t\t\t#m**3\n", + "R = 287.;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "#p*V = R*k1*V**(-2/5) or p*V**(7/5) = K\n", + "K = p1*10**5*V1**(7./5);\t\t\t#Nm/Kg\n", + "\n", + "def f17(V): \n", + "\t return K*V**(-7./5)\n", + "\n", + "W = quad(f17,V1,V2)[0]\n", + "\n", + "print \"Work done in Nm : %.1f\"%W\n", + "p2 = K*V2**(-7./5);\t\t\t#N/m**2\n", + "p2 = p2/10**5;\t\t\t#bar\n", + "print \"Final pressure in bar : %.2f\"%p2\n", + "\n", + "#Ans in the book is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in Nm : -11182.8\n", + "Final pressure in bar : 2.64\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.23 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 2.;\t\t\t#Kg\n", + "Q = 0.;\t\t\t#KJ(because of adiabatic process)\n", + "p1 = 1.;\t\t\t#Mpa\n", + "p1 = p1*10.**6/1000;\t\t\t#Kpa\n", + "t1 = 200.;\t\t\t#degree centigrade\n", + "T1 = t1+273;\t\t\t#kelvin\n", + "p2 = 100.;\t\t\t#Kpa\n", + "n = 1.2;\n", + "R = 0.196;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "T2 = T1*(p2/p1)**((n-1)/n);\t\t\t#kelvin\n", + "t2 = T2-273;\t\t\t#degree centigrade\n", + "u1 = 196+0.718*t1;\t\t\t#KJ\n", + "u2 = 196+0.718*t2;\t\t\t#KJ\n", + "deltau = u2-u1;\t\t\t#KJ\n", + "deltaU = m*deltau;\t\t\t#KJ\n", + "print \"Change in internal energy in KJ : %.1f\"%deltaU\n", + "W = Q-deltaU;\t\t\t#KJ\n", + "print \"Work transfer in KJ : %.1f\"%W\n", + "\n", + "W1 = m*R*(T1-T2)/(n-1);\t\t\t#KJ\n", + "print \"Displacement work in KJ : %.2f\"%W1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy in KJ : -216.5\n", + "Work transfer in KJ : 216.5\n", + "Displacement work in KJ : 295.47\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.24 Page No : 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables : \n", + "m = 1.5;\t\t\t#Kg\n", + "V1 = 0.06;\t\t\t#m**3\n", + "p1 = 5.6*10;\t\t\t#Kpa\n", + "t2 = 240.;\t\t\t#degree centigrade\n", + "T2 = t2+273;\t\t\t#kelvin\n", + "a = 0.946;\n", + "b = 0.662;\n", + "K = 10.**-4;\n", + "\n", + "# Calculations\n", + "#p*V = m*R*T = m*(a-b)*T\n", + "T1 = p1*10**5*V1/m/(a-b)/1000;\t\t\t#Kelvin\n", + "\n", + "def f28(T): \n", + "\t return m*(b+K*T)\n", + "\n", + "U2subU1 = quad(f28,T1,T2)[0]\n", + "\n", + "Q = 0;\t\t\t#isentropic process\n", + "W = Q-U2subU1;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Work done in KJ : %.1f\"%W\n", + "\n", + "#Answer in the book is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done in KJ : 300.7\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.25 Page No : 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from scipy.integrate import quad \n", + "from numpy import *\n", + "\n", + "\n", + "# Variables : \n", + "m = 1.5;\t\t\t#Kg\n", + "p1 = 1000;\t\t\t#Kpa\n", + "p2 = 200;\t\t\t#Kpa\n", + "V1 = 0.2;\t\t\t#m**3\n", + "V2 = 1.2;\t\t\t#m**3\n", + "#p = a+b*v\n", + "#solving for a and b by matrix\n", + "A = array([[1, V1],[1, V2]]);\n", + "B = array([p1,p2]);\n", + "X = linalg.solve(A,B)\n", + "a = X[0]\n", + "b = X[1]\n", + "\n", + "def f16(V): \n", + " return a+b*V\n", + "\n", + "W = quad(f16,V1,V2)[0]\n", + "print \"Work transfer in KJ/Kg : \",W\n", + "\n", + "u2SUBu1 = (1.5*p2*V2+35)-(1.5*p1*V1+35);\t\t\t#KJ/Kg\n", + "print \"Change in internal energy in KJ/Kg : \",u2SUBu1\n", + "\n", + "q = W+u2SUBu1;\t\t\t#KJ/Kg\n", + "print \"Heat transfer in KJ/Kg : \",q\n", + "\n", + "#u = 1.5*(a+b*V)*V+35;\n", + "#1.5*a+2*V*1.5*b = 0;\t\t\t#for max value putting du/dV = 0\n", + "V = -1.5*a/2/1.5/b;\t\t\t#m**3/Kg\n", + "p = a+b*V;\t\t\t #KPa\n", + "u_max = 1.5*p*V+35;\t\t\t#KJ/Kg\n", + "print \"Maximum internal energy in KJ/Kg : \",u_max\n", + "\n", + "\n", + "#Answer in the book is wrong because a is 1160 instead of 1260.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work transfer in KJ/Kg : 600.0\n", + "Change in internal energy in KJ/Kg : 60.0\n", + "Heat transfer in KJ/Kg : 660.0\n", + "Maximum internal energy in KJ/Kg : 665.75\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.26 Page No : 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "V1 = 5.;\t\t\t#m**3\n", + "p1 = 2.;\t\t\t#bar\n", + "t1 = 27.;\t\t\t#degree centigrade\n", + "T1 = t1+273;\t\t\t#kelvin\n", + "p2 = 6.;\t\t\t#bar\n", + "p3 = p1;\t\t\t#bar\n", + "R = 287.;\t\t\t#KJ/KgK\n", + "n = 1.3;\n", + "\n", + "# Calculations\n", + "#p*V**(1/3) = C\n", + "V2 = V1*(p1/p2)**(1/1.3);\t\t\t#m**3\n", + "#p*V = m*R*T1\n", + "m = p1*10**5*V1/R/T1;\t\t\t#Kg\n", + "W1_2 = 10**5*(p1*V1-p2*V2)/(n-1);\t\t\t#Nm\n", + "W1_2 = W1_2/1000;\t\t\t#KJ\n", + "Gamma = 1.4;\t\t\t#for air\n", + "#p*V**Gamma = C\n", + "V3 = (p2/p3)**(1/Gamma)*V2;\t\t\t#m**3\n", + "W2_3 = 10**5*(p2*V2-p3*V3)/(Gamma-1);\t\t\t#Nm\n", + "W2_3 = W2_3/1000;\t\t\t#KJ\n", + "W = W1_2+W2_3;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Net work done in KJ : %.2f\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work done in KJ : -94.02\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.27 Page No : 32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "Q1_2 = 85;\t\t\t#KJ\n", + "Q2_3 = -90;\t\t\t#KJ\n", + "W2_3 = -20;\t\t\t#KJ\n", + "Q3_1 = 0;\t\t\t#Adiabatic process\n", + "W1_2 = 0;\t\t\t#consmath.tant volume process\n", + "\n", + "# Calculations\n", + "W3_1 = Q1_2+Q2_3+Q3_1-W1_2-W2_3;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Direction is 3-1 and work in KJ : \",W3_1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Direction is 3-1 and work in KJ : 15\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.28 Page No : 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "V1 = 200./1000;\t\t\t#m**3\n", + "p1 = 4.;\t \t\t#bar\n", + "T1 = 400.;\t \t\t#K\n", + "p2 = 1.;\t \t\t#bar\n", + "H3subH2 = 72.;\t\t\t#KJ\n", + "Cp = 1.\t\t \t #KJ/KgK\n", + "Cv = 0.714;\t\t \t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "Gamma = Cp/Cv;\n", + "R = Cp-Cv;\t\t\t #KJ/KgK\n", + "#p*V = m*R*T\n", + "m = p1*10**5*V1/R/1000/T1 \t\t\t#Kg\n", + "T2 = T1*(p2/p1)**((Gamma-1)/Gamma);\t\t\t#K\n", + "V2 = p1*V1/T1*T2/p2;\t\t\t #m**3\n", + "W1_2 = m*R*(T1-T2)/(Gamma-1);\t\t\t #KJ\n", + "print \"Work done W1-2 in KJ : %.1f\"%W1_2\n", + "\n", + "#H3subH2 = m*Cp(T3-T2);\n", + "T3 = (H3subH2+m*Cp*T2)/m/Cp;\t\t\t#K\n", + "W2_3 = m*R*(T3-T2);\t\t \t#KJ\n", + "W = W1_2+W2_3;\t\t\t #KJ\n", + "print \"Workdone in KJ : %.0f\"%W\n", + "\n", + "#W = m*R*(T1-T3)/(n-1)\n", + "n = m*R*(T1-T3)/W+1;\t\t\t#\n", + "print \"Index of expansion : %.5f\"%n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done W1-2 in KJ : 65.4\n", + "Workdone in KJ : 86\n", + "Index of expansion : 1.06507\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.29 Page No : 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from scipy.integrate import quad \n", + "from numpy import *\n", + "\n", + "# Variables : \n", + "p1 = 10.;\t\t\t#bar\n", + "p2 = 2.;\t\t\t#bar\n", + "V1 = 0.1;\t\t\t#m**3\n", + "V2 = 0.9;\t\t\t#m**3\n", + "R = 300.;\t\t\t#Nm/Kg-K\n", + "m = 1.; \t\t\t#Kg\n", + "\n", + "# Calculations\n", + "#p = a*v+b\n", + "#solving for a and b by matrix\n", + "A = array([[V1, 1],[V2, 1]]);\n", + "B = array([p1,p2]);\n", + "X = linalg.solve(A,B);\n", + "a = X[0]\n", + "b = X[1]\n", + "\n", + "#p = a*v+b = a*R*T/p+b\n", + "#2*p-b = 0;\t\t\t #on differentiating\n", + "p = b/2;\t\t\t #bar\n", + "#p = a*v+b\n", + "v = (p-b)/a;\t\t\t #m**3/Kg\n", + "T = p*10**5*v/R;\t\t\t#K\n", + "print \"Maximum temperature in K : %.2f\"%T\n", + "\n", + "def f23(v): \n", + " return (a*v+b)*10**5\n", + "\n", + "W = quad(f23,V1,V2)[0]\n", + "\n", + "W = W/10**3;\t\t\t #KJ/KgK\n", + "print \"Work done in KJ : %.2f\"%W\n", + "\n", + "T1 = p1*10**5*V1/R;\t\t\t#K\n", + "T2 = p2*10**5*V2/R;\t\t\t#K\n", + "Gamma = 1.4;\n", + "Cv = R/(Gamma-1);\t\t\t#Nm/KgK\n", + "Cv = Cv/1000;\t\t\t #KJ/KgK\n", + "deltaU = m*Cv*(T2-T1);\t\t#KJ/Kg\n", + "Q = W+deltaU;\t\t\t #KJ\n", + "print \"Net Heat transfer in KJ : %.2f\"%-Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum temperature in K : 1008.33\n", + "Work done in KJ : 480.00\n", + "Net Heat transfer in KJ : -680.00\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.29 Page No : 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m = 5.;\t\t\t#Kg\n", + "#u = 3.62*p*v\n", + "p1 = 550.;\t\t\t#KPa\n", + "p2 = 125.;\t\t\t#KPa\n", + "V1 = 0.25;\t\t\t#m**3\n", + "\n", + "# Calculations and Results\n", + "#p*V**(1/2) = C\n", + "n = 1.2;\n", + "V2 = (p1/p2)**(1/n)*V1;\t\t\t#m**3/Kg\n", + "W = (p1*V1-p2*V2)*10**5/(n-1)/1000;\t\t\t#KJ\n", + "delta_u = (3.62*p2*V2)-(3.62*p1*V1);\t\t\t#KJ/Kg\n", + "deltaU = m*delta_u;\t\t \t#KJ\n", + "print \"Change in internal energy in KJ : %.4f\"%deltaU\n", + "\n", + "Q = W+deltaU;\t \t\t#KJ\n", + "Q = Q/1000;\t\t\t #MJ\n", + "print \"Heat transfer in MJ : %.3f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy in KJ : -544.5580\n", + "Heat transfer in MJ : 14.498\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.30 Page No : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "Vdot = 0.032;\t\t\t#m**3/s\n", + "d = 1.5;\t\t\t#m\n", + "L = 4.2;\t\t\t#m\n", + "m = 3500.;\t\t\t#Kg\n", + "\n", + "# Calculations and Results\n", + "V = math.pi/4*d**2*L;\t\t\t#m**3\n", + "rho = m/V;\t\t\t#Kg/m**3\n", + "print \"Density of liquid in Kg/m**3 : %.1f\"%rho\n", + "\n", + "m_dot = rho*Vdot;\t\t\t#Kg/s\n", + "print \"Mass flow rate in Kg/s : %.2f\"%m_dot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Density of liquid in Kg/m**3 : 471.6\n", + "Mass flow rate in Kg/s : 15.09\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.31 Page No : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "p1 = 1.; \t\t\t#bar\n", + "T1 = 20.+273;\t\t\t#K\n", + "p2 = 6.;\t\t \t#bar\n", + "m = 1.;\t\t \t #Kg\n", + "R = 287.;\t \t\t#Nm/Kg\n", + "Gamma = 1.4;\n", + "Cp = 1.005;\t\t \t#KJ/KgK\n", + "Cv = 0.7175;\t\t\t#KJ/KgK\n", + "\n", + "#T2 = T1 : Isothermal compression\n", + "T2subT1 = 0;\n", + "deltaU = m*Cv*(T2subT1); \t\t\t#KJ\n", + "print (\"Isothermal :\");\n", + "print \"Change in internal energy in KJ : \",deltaU\n", + "\n", + "Wsf = m*R/1000*T1*math.log(p1/p2);\t\t\t#KJ/Kg\n", + "print \"Work done in KJ/Kg : %.2f\"%Wsf\n", + "\n", + "p2V2subp1V1 = 0; \t\t\t#isothermal process\n", + "Q = Wsf+deltaU+p2V2subp1V1;\t\t\t#KJ/Kg\n", + "print \"Heat transfer in KJ/Kg : %.2f\"%Q\n", + "print (\"Isentropic :\");\n", + "\n", + "T2 = T1*(p2/p1)**((Gamma-1)/Gamma);\t\t\t#K\n", + "U2subU1 = m*Cv*(T2-T1);\t\t\t#KJ/Kg\n", + "print \"Change in internal energy in KJ/Kg : %.2f\"%U2subU1\n", + "\n", + "H2subH1 = m*Cp*(T2-T1);\t\t\t#KJ/Kg\n", + "print \"Change in heat in KJ/Kg : %.2f\"%H2subH1\n", + "\n", + "Q = 0;\t\t\t#adiabatic process\n", + "print \"Heat transfer in KJ/Kg : %.2f\"%Q\n", + "\n", + "Wsf = Q-H2subH1;\t\t\t#KJ/Kg\n", + "print \"Work done in KJ/Kg : %.2f\"%Wsf\n", + "print (\"Polytropic : \");\n", + "\n", + "n = 1.25;\t\t\t #index\n", + "T2 = T1*(p2/p1)**((n-1)/n);\t\t\t#K\n", + "deltaU = m*Cv*(T2-T1);\t\t \t#KJ/Kg\n", + "print \"Change in internal energy in KJ/Kg : %.2f\"%deltaU\n", + "\n", + "H2subH1 = m*Cp*(T2-T1);\t\t\t #KJ/Kg\n", + "Wsf = (n/(n-1))*m*R/1000*(T1-T2);\t\t\t#KJ/Kg\n", + "print \"Work done in KJ/Kg : %.2f\"%Wsf\n", + "\n", + "Q = Wsf+H2subH1;\t\t\t#KJ/Kg\n", + "print \"Heat transfer in KJ/Kg : %.2f\"%Q\n", + "\n", + "#Answer of chane in internal energy for last part is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Isothermal :\n", + "Change in internal energy in KJ : 0.0\n", + "Work done in KJ/Kg : -150.67\n", + "Heat transfer in KJ/Kg : -150.67\n", + "Isentropic :\n", + "Change in internal energy in KJ/Kg : 140.54\n", + "Change in heat in KJ/Kg : 196.85\n", + "Heat transfer in KJ/Kg : 0.00\n", + "Work done in KJ/Kg : -196.85\n", + "Polytropic : \n", + "Change in internal energy in KJ/Kg : 90.60\n", + "Work done in KJ/Kg : -181.20\n", + "Heat transfer in KJ/Kg : -54.30\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.32 Page No : 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables : \n", + "p1 = 5.;\t\t\t#bar\n", + "p2 = 50.;\t\t\t#bar\n", + "V = 0.001;\t\t\t#m**3/Kg\n", + "m_dot = 10.;\t\t\t#Kg/s\n", + "\n", + "# Calculations\n", + "def f20(p): \n", + "\t return -V\n", + "\n", + "wsf = quad(f20,p1*10**5,p2*10**5)[0]\n", + "\n", + "wsf = wsf/1000 \t\t\t#KJ/Kg\n", + "Wsf = abs(wsf)*m_dot;\t\t\t#KW(leaving -ve sign as it is to indiacte heat is supplied)\n", + "\n", + "# Results\n", + "print \"Power required in KW : \",Wsf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required in KW : 45.0\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.33 Page No : 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "p1 = 10.**5;\t\t\t#Pa\n", + "p2 = 5.*10**5;\t\t\t#Pa\n", + "T1 = 25.+273;\t\t\t#K\n", + "V1 = 1.8;\t\t\t#m**3/Kg\n", + "\n", + "# Calculations and Results\n", + "V2 = p1/p2*V1;\t\t\t#m**3/Kg\n", + "W = -p1*V1*math.log(p2/p1);\t\t\t#J/kg\n", + "W = W/1000.;\t\t\t#KJ/Kg\n", + "print \"Workdone in KJ : %.1f\"%W\n", + "\n", + "deltaU = 0;\t\t\t#As in a isothermal process T2-T1 = 0 \n", + "print \"Change in internal energy in KJ : \",deltaU\n", + "\n", + "Q = -W;\t\t\t#KJ/Kg(As in a isothermal process T2-T1 = 0 )\n", + "print \"Heat Transfered in KJ/Kg : %.1f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Workdone in KJ : -289.7\n", + "Change in internal energy in KJ : 0\n", + "Heat Transfered in KJ/Kg : 289.7\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.34 Page No : 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\t\t\t\n", + "# Variables : \n", + "p = 6.;\t\t\t#bar\n", + "m = 18.;\t\t\t#Kg\n", + "v = 260.;\t\t\t#m/s\n", + "rho = 4.;\t\t\t#Kg/m**3\n", + "Q = 42.;\t\t\t#KJ/Kg\n", + "W = 261.;\t\t\t#KW\n", + "Cv = 0.715;\t\t\t#KJ/KgK\n", + "pA = 1.;\t\t\t#bar\n", + "vA = 60.;\t\t\t#m/s\n", + "mdotA = 14.;\t\t\t#Kg/s\n", + "CvA = 0.835;\t\t\t#m**3/Kg\n", + "TA = 115.+273;\t\t\t#K\n", + "pB = 5.5;\t\t\t#bar\n", + "vB = 15.;\t\t\t#m/s\n", + "mdotB = 4.;\t\t\t#Kg/s\n", + "CvB = 0.46;\t\t\t#m**3/Kg\n", + "TB = 600.+273;\t\t\t#K\n", + "v1 = 1./rho;\t\t\t#m**3/Kg\n", + "\n", + "# Calculations\n", + "#m*(Cv*T+p*10**5*v1/1000+v**2/2000)+Q*rho-W = mdotA*(Cv*TA+pA*10**5*CvA/1000+vA**2/2000)+m_dotB*(Cv*TB+pB*10**5*CvB/1000+vB**2/2000);\n", + "T = (((mdotA*(Cv*TA+pA*10**5*CvA/1000+vA**2/2000)+mdotB*(Cv*TB+pB*10**5*CvB/1000+vB**2/2000))+W-Q*rho)/m-v**2/2000-p*10**5*v1/1000)/Cv;\t\t\t#K\n", + "\n", + "# Results\n", + "print \"Temperature of air at inlet in K : %.2f\"%T\n", + "\n", + "#Answer in the book is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of air at inlet in K : 417.40\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.35 Page No : 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "h1 = 3000.;\t\t\t#KJ/Kg\n", + "C1 = 60.;\t\t\t#m/s\n", + "h2 = 2762.;\t\t\t#KJ/Kg\n", + "Q = 0.;\t\t\t#KJ\n", + "m = 1.;\t\t\t#Kg\n", + "W = 0.;\t\t\t#in case of nozzle\n", + "\n", + "# Calculations and Results\n", + "#Q-W = m*[(h2-h1)+(C2**2-C1**2)/2/1000+g*(Z2-Z1)/1000]\n", + "Z2subZ1 = 0;\t\t\t#as Z1 = Z2 for horizontal nozzle\n", + "C2 = math.sqrt(-(h2-h1)*2*1000+C1**2);\t\t\t#m/s\n", + "print \"Velocity at exit of nozzle in m/s : %.2f\"%C2\n", + "\n", + "A1 = 0.1;\t\t\t#m**3\n", + "v1 = 0.187;\t\t\t#m**3/Kg\n", + "mdot = A1*C1/v1;\t\t\t#Kg/s\n", + "print \"Mass flow rate through the nozzle in Kg/s : %.4f\"%mdot\n", + "\n", + "v2 = 0.498;\t\t\t#m**3/Kg\n", + "#mdot = A2*C2/v2 = math.pi/4*d**2*C2/v2\n", + "d2 = math.sqrt(mdot/math.pi*4*v2/C2);\t\t\t#m\n", + "print \"Diameter of nozzle at exit in meter : %.4f\"%d2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity at exit of nozzle in m/s : 692.53\n", + "Mass flow rate through the nozzle in Kg/s : 32.0856\n", + "Diameter of nozzle at exit in meter : 0.1714\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.36 Page No : 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "p1 = 4.;\t\t \t#bar\n", + "p2 = 1.;\t\t\t #bar\n", + "T1 = 40.+273;\t\t\t#K\n", + "T2 = 2.5+273;\t\t\t#K\n", + "C1 = 40.;\t \t\t#m/s\n", + "C2 = 200.;\t\t \t#m/s\n", + "W = 52.;\t\t \t#KJKg\n", + "m = 1.;\t\t\t #Kg\n", + "Cp = 1.005;\t\t \t#KJ/KgK \n", + "Z2subZ1 = 0.;\t\t\t#as Z1 = Z2 \n", + "\n", + "# Calculations\n", + "Q = W+m*(Cp*(T2-T1)+(C2**2-C1**2)/2/1000)\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Heat transfered per Kg of air in KJ/Kg : %.1f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transfered per Kg of air in KJ/Kg : 33.5\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.37 Page No : 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "m1dot = 0.01;\t\t\t#Kg/s\n", + "h1 = 2950. \t\t\t#KJ/Kg\n", + "C1 = 20. \t\t\t#m/s\n", + "m2dot = 0.1;\t\t\t#Kg/s\n", + "h2 = 2565. \t\t\t#KJ/Kg\n", + "C2 = 120. \t\t\t#m/s\n", + "m3dot = 0.001;\t\t\t#Kg/s\n", + "h3 = 421. \t\t\t#KJ/Kg\n", + "C3 = 0. \t\t\t#m/s\n", + "C4 = 0. \t\t\t#m/s\n", + "Wsf_dot = 25. \t\t#KW\n", + "Qdot = 0. \t\t\t#KJ\n", + "\n", + "# Calculations\n", + "#m1dot+m2dot = m3dot+m4dot\n", + "m4dot = m1dot+m2dot-m3dot;\t\t\t#Kg/s\n", + "#m1dot*(h1+C1**2/2/1000)+m2dot*(h2+C2**2/2/1000) = m3dot*(h3+C3**2/2/1000)+m4dot*(h4+C4**2/2/1000)+Wsf_dot\n", + "h4 = (m1dot*(h1+C1**2/2/1000)+m2dot*(h2+C2**2/2/1000)-m3dot*(h3+C3**2/2/1000)-Wsf_dot)/m4dot-C4**2/2/1000;\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Enthalpy of 2nd exit stream in KJ/Kg : %.2f\"%h4\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enthalpy of 2nd exit stream in KJ/Kg : 2397.26\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.38 Page No : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables : \n", + "mdot = 0.5;\t\t\t#kg/s\n", + "p1 = 1.4;\t\t\t#bar\n", + "rho1 = 2.5;\t\t\t#kg/m**3\n", + "u1 = 920.;\t\t\t#kJ/kg\n", + "C1 = 200.;\t\t\t#m/s\n", + "p2 = 5.6;\t\t\t#bar\n", + "rho2 = 5.;\t\t\t#kg/m**3\n", + "u2 = 720.;\t\t\t#kJ/kg\n", + "C2 = 180.;\t\t\t#m/s\n", + "Qdot = -60.;\t\t\t#kW\n", + "Z21 = 60.;\t\t\t#m\n", + "g = 9.81;\t\t\t#gravity consmath.tant\n", + "\n", + "# Calculations and Results\n", + "h21 = u2-u1+(p2*10**5/(rho2*1000)-p1*10**5/(rho1*1000));\t\t\t#kJ/kg(change in enthalpy)\n", + "H21 = mdot*h21;\t\t\t#kW(total change in enthalpy)\n", + "print \"Change in enthalpy, H2-H1 in kW : \",H21\n", + "\n", + "Wsf = Qdot-mdot*(h21+(C2**2-C1**2)/2/1000+g*(Z21)/1000);\t\t\t#kW\n", + "print \"Rate of workdone, Wsf in kW : %.3f\"%Wsf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in enthalpy, H2-H1 in kW : -72.0\n", + "Rate of workdone, Wsf in kW : 13.606\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.39 Page No : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "mdot = 0.4;\t\t\t #Kg/s\n", + "C1 = 6.;\t\t\t #m/s\n", + "p1 = 1.;\t\t\t #bar\n", + "p1 = p1*100;\t\t\t#KPa\n", + "V1 = 0.16;\t\t \t#m**3/Kg\n", + "u2subu1 = 88.;\t\t\t#KJ/Kg\n", + "Qdot = -59.;\t\t\t#W\n", + "Qdot = Qdot/1000.;\t\t\t#KJ/s\n", + "W = 0.059;\t\t\t#KJ/\n", + "Gamma = 1.4;\n", + "Z2subZ1 = 0;\n", + "\n", + "# Calculations\n", + "h2subh1 = Gamma*u2subu1;\t\t\t#KJ\n", + "Wdot = Qdot-mdot*(h2subh1);\t\t\t#As C1 = C2, C2**2-C1**2 = 0 & Z2-Zi = 0\n", + "\n", + "# Results\n", + "print \"Power in KW : \",Wdot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power in KW : -49.339\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.40 Page No : 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "mdot = 1;\t\t\t#Kg/s\n", + "p1 = 40.;\t\t\t#bar\n", + "T1 = 1047.+273;\t\t\t#K\n", + "C1 = 200.;\t\t\t#m/s\n", + "C2 = 100.;\t\t\t#m/s\n", + "p2 = 1.;\t\t\t#bar\n", + "Qdot = 0.;\t\t\t#W\n", + "Cp = 1.05;\t\t\t#KJ/KgK\n", + "R = 300.;\t\t\t#Nm/KgK\n", + "Gamma = 1.4;\n", + "\n", + "# Calculations\n", + "#p*v = m*R*T\n", + "v1dot = mdot*R*T1/p1/10**5;\t\t\t#m**3/s\n", + "v2dot = (p1/p2)**(1/Gamma)*v1dot;\t\t\t#m**3/s\n", + "T2 = p2*v2dot/p1/v1dot*T1;\t\t\t#K\n", + "Wsf_dot = Qdot-mdot*(Cp*(T2-T1)+(C2**2-C1**2)/2/1000);\t\t\t#KJ/s or KW\n", + "\n", + "# Results\n", + "print \"Output of turbine in KJ/s or KW : %.0f\"%Wsf_dot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output of turbine in KJ/s or KW : 918\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.41 Page No : 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "A1C1 = 0.7;\t\t\t#m**3/s\n", + "p1 = 85.;\t\t\t#KPa\n", + "p2 = 650.;\t\t\t#KPa\n", + "v1 = 0.35;\t\t\t#m**3/Kg\n", + "v2 = 0.1;\t\t\t#m**3/Kg\n", + "d1 = 10./100;\t\t\t#m\n", + "d2 = 6.25/100;\t\t\t#m\n", + "\n", + "# Calculations and Results\n", + "mdot = A1C1/v1;\t\t\t#Kg/s\n", + "p2v2SUBp1v1 = mdot*(p2*v2-p1*v1);\t\t\t#KJ/s\n", + "print \"Change in flow work in KJ/s : %.1f\"%p2v2SUBp1v1\n", + "print \"Mass flow rate in Kg/s : %.0f\"%mdot\n", + "\n", + "C1 = A1C1/(math.pi/4*d1**2);\t\t\t#m/s\n", + "A2C2 = mdot*v2;\t \t\t#m**3/s\n", + "C2 = A2C2/(math.pi/4*d2**2);\t\t\t#m/s\n", + "C2subC1 = C2-C1;\t\t\t #m/s\n", + "print \"Velocity change in m/s : %.3f\"%C2subC1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in flow work in KJ/s : 70.5\n", + "Mass flow rate in Kg/s : 2\n", + "Velocity change in m/s : -23.937\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.42 Page No : 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "m = 12./60;\t\t\t#Kg/s\n", + "C1 = 12.;\t\t\t#m/s\n", + "p1 = 1.*100;\t\t\t#KPa\n", + "v1 = 0.5;\t\t\t#m**3/Kg\n", + "C2 = 90.;\t\t\t#m/s\n", + "p2 = 8.*100;\t\t\t#KPa\n", + "v2 = 0.14;\t\t\t#m**3/Kg\n", + "deltah = 150.;\t\t\t#KJ/Kg\n", + "Qdot = -700./60;\t\t\t#KJ/s\n", + "\n", + "# Calculations and Results\n", + "#Assuming deltaPE = 0 = g*(Z2-Z1)\n", + "#Qdot-Wdot = mdot*(deltah+(C2**2-C1**2)/2/1000+g*(Z2-Z1)/1000)\n", + "Wdot = Qdot-m*(deltah+(C2**2-C1**2)/2/1000);\t\t\t#KW\n", + "print \"Power required to drive the compressor in KW : %.3f\"%abs(Wdot)\n", + "\n", + "#A1C1/v1 = A2C2/v2\n", + "d1BYd2 = math.sqrt(C2/v2*v1/C1);\n", + "print \"Ratio of inlet to outlet pipe diameter : %.4f\"%d1BYd2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required to drive the compressor in KW : 42.462\n", + "Ratio of inlet to outlet pipe diameter : 5.1755\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.43 Page No : 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "h1 = 160.;\t\t\t#KJ/Kg\n", + "h2 = 2380.;\t\t\t#KJ/Kg\n", + "m1dot = 10.;\t\t\t#Kg/s\n", + "m2dot = 0.8;\t\t\t#Kg/s\n", + "Qdot = 10.;\t\t\t#KJ/s\n", + "Wdot = 0.;\t\t\t#KJ\n", + "deltaKE = 0.;\n", + "deltaPE = 0.;\n", + "m3dot = m1dot+m2dot;\t\t\t#Kg/s\n", + "print \"Mass flow of heated water in Kg/s : \",m3dot\n", + "#m1dot*h1+m2dot*h2 = m3dot*h3+Qdot\n", + "h3 = (m1dot*h1+m2dot*h2-Qdot)/m3dot;\t\t\t#KJ/Kg\n", + "print \"Specific enthalpy of heated water in KJ/Kg : %.3f\"%h3\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flow of heated water in Kg/s : 10.8\n", + "Specific enthalpy of heated water in KJ/Kg : 323.519\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.44 Page No : 58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "v = 0.001;\t\t\t#m**3/Kg\n", + "DisRate = 10./60;\t\t\t#m**3/s\n", + "p1 = 100.;\t\t\t#KN/m**2\n", + "p2 = 300.;\t\t\t#KN/m**2\n", + "Z1 = 3.;\t\t\t#m\n", + "Z2 = 9.;\t\t\t#m\n", + "d1 = 0.25;\t\t\t#m\n", + "d2 = 0.17;\t\t\t#m\n", + "Qdot = 0.;\t\t\t#KJ/s(Adiabatic process)\n", + "\n", + "# Calculations\n", + "#A1*C1 = A2*C2 = DisRate\n", + "C1 = DisRate/(math.pi/4*d1**2);\t\t\t#m/s\n", + "C2 = DisRate/(math.pi/4*d2**2);\t\t\t#m/s\n", + "mdot = DisRate/v;\t\t\t#Kg/s\n", + "g = 9.81;\t\t\t#gravity consmath.tant\n", + "delta_u = 0;\n", + "#Qdot-Wdot = mdot*(delta_u+p2*v2-p1*v1+C2**2-C1**2+g*(Z2-Z1))\n", + "Wdot = mdot*(delta_u+p2*10**3*v-p1*10**3*v+(C2**2-C1**2)/2+g*(Z2-Z1))-Qdot;\t\t\t#J/s\n", + "Wdot = Wdot/1000;\t\t\t#KJ/s or KW\n", + "\n", + "# Results\n", + "print \"Power required to drive the pump in KW : %.3f\"%Wdot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required to drive the pump in KW : 46.676\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.45 Page No : 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables : \n", + "mdot = 5.;\t\t\t#Kg/s\n", + "T1 = 27.+273;\t\t\t#K\n", + "\n", + "#Z1 = Z2\n", + "deltaPE = 0.;\n", + "Wdot = -100.;\t\t\t#KW\n", + "C1 = 60.;\t\t\t#m/s\n", + "C2 = 150.;\t\t\t#m/s\n", + "q = -2.;\t\t\t#KJ/Kg\n", + "Cp = 1.05;\t\t\t#KJ/Kg\n", + "Qdot = mdot*q;\t\t\t#KJ/s\n", + "delta_h = Cp;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations\n", + "#Qdot-Wdot = mdot*(delta_h*(T2-T1)+(C2**2-C1**2)/2/1000+g*(Z2-Z1))/1000)\n", + "T2 = ((Qdot-Wdot)/mdot-(C2**2-C1**2)/2/1000)/delta_h+T1;\t\t\t#K\n", + "\n", + "# Results\n", + "print \"Exit temperature in K : %.3f\"%T2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Exit temperature in K : 308.143\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.46 Page No : 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "t1 = 90.;\t\t\t#degreeC\n", + "t2 = 30.;\t\t\t#degreeC\n", + "modot = 3.;\t\t\t#Kg/s\n", + "\n", + "# Calculations\n", + "#h = 1.7*t+11*10**-4*t**2\n", + "h1 = 1.7*t1+11*10**-4*t1**2;\t\t\t#KJ/Kg\n", + "h2 = 1.7*t2+11*10**-4*t2**2;\t\t\t#KJ/Kg\n", + "tw1 = 27.;\t\t\t#degreeC\n", + "tw2 = 67.;\t\t\t#degreeC\n", + "Cp = 4.2;\t\t\t#KJ/KgK\n", + "#h = Cp*tw;\t\t\t#KJ/Kg\n", + "hw1 = Cp*tw1;\t\t\t#KJ/Kg\n", + "hw2 = Cp*tw2;\t\t\t#KJ/Kg\n", + "\n", + "#modot*(h1-h2) = mwdot*(hw2-hw1)\n", + "mwdot = modot*(h1-h2)/(hw2-hw1);\t\t\t#Kg/s\n", + "\n", + "# Results\n", + "print \"Rate of flow of water in Kg/s : %.4f\"%mwdot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of flow of water in Kg/s : 1.9629\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.47 Page No : 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables : \n", + "V1 = 6.;\t\t\t#m**3\n", + "p1 = 20.*100;\t\t\t#Kpa\n", + "T1 = 37.+273;\t\t\t#K\n", + "p2 = 10.*100;\t\t\t#Kpa\n", + "V2 = V1;\t\t\t#m**3\n", + "R = 0.287;\t\t\t#KJ/KgK\n", + "m1 = p1*V1/R/T1;\t\t\t#Kg\n", + "\n", + "# Calculations\n", + "#T2 = T1*(p2/p1)**((Gamma-1)/Gamma)\n", + "Gamma = 1.4;\n", + "T2 = T1*(p2/p1)**((Gamma-1)/Gamma);\t\t\t#K\n", + "m2 = p2*V2/R/T2;\t\t\t#Kg\n", + "m = m1-m2;\t\t\t#mass of air discharged in Kg\n", + "\n", + "# Results\n", + "print \"Mass of air discharged in Kg : %.2f\"%m\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air discharged in Kg : 52.67\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.48 Page No : 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables : \n", + "V1 = 1.5;\t\t\t#m**3\n", + "V2 = 0.;\t\t\t#m**3\n", + "p = 1.02;\t\t\t#bar\n", + "\n", + "def f21(V): \n", + "\t return 1\n", + "\n", + "W = p*10**5* quad(f21,V1,V2)[0]\n", + "\n", + "print \"Work done by the air in KJ : %.0f\"%(W/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done by the air in KJ : -153\n" + ] + } + ], + "prompt_number": 46 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch3.ipynb b/Thermodynamics_by_B._l._Singhal/ch3.ipynb new file mode 100755 index 00000000..2ad5904d --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch3.ipynb @@ -0,0 +1,1047 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:24bb4e51d6023f981d52e0e5400d7429d32a87d104b38eab26a2fc0c3b02030a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : Second Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.1 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Q2 = 1800.;\t\t\t#KJ/hr\n", + "Q2 = Q2/3600;\t\t\t#KJ/sec or KW\n", + "W = 0.35;\t\t\t#KW\n", + "\n", + "# Calculations\n", + "COP = Q2/W;\n", + "\n", + "# Results\n", + "print \"COP is : %.4f\"%COP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP is : 1.4286\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.2 Page No : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Q2 = 1;\t\t\t#KJ/sec or KW\n", + "W = 0.4;\t\t\t#KW\n", + "T2 = -30+273;\t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "COP = Q2/W;\n", + "print \"COP of refrigerator is : \",COP\n", + "\n", + "T1 = T2*(1+COP)/COP;\t\t\t#K\n", + "print \"Temperature at which heat is rejected in K : \",T1\n", + "\n", + "Q1 = Q2*(1+COP)/COP;\t\t\t#KW\n", + "print \"Heat rejected per KW of cooling(KW) : \",Q1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP of refrigerator is : 2.5\n", + "Temperature at which heat is rejected in K : 340.2\n", + "Heat rejected per KW of cooling(KW) : 1.4\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.3 Page No : 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Q2 = 100.;\t\t\t#KJ/sec or KW\n", + "T2 = -20.+273;\t\t\t#K\n", + "T1 = 35.+273;\t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "COP = T2/(T1-T2);\n", + "print \"COP is : \",COP\n", + "\n", + "W = Q2/COP;\t\t\t#KW\n", + "print \"Power input in KJ/s or KW : %.2f\"%W\n", + "\n", + "COPheatpump = T1/(T1-T2);\t\t\t#\n", + "print \"COP as heat pump : \",COPheatpump\n", + "\n", + "Eta_engine = (1-T2/T1)*100;\n", + "print \"Efficiency as an engine in : %.3f\"%(Eta_engine)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP is : 4.6\n", + "Power input in KJ/s or KW : 21.74\n", + "COP as heat pump : 5.6\n", + "Efficiency as an engine in : 17.857\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4 Page No : 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Q2dot = 12000.;\t\t\t#KJ/hr\n", + "Wdot = 0.75;\t\t\t#KW\n", + "Wdot = Wdot*3600.;\t\t\t#KJ/hr\n", + "\n", + "# Calculations and Results\n", + "COP = Q2dot/Wdot;\n", + "print \"Coefficient of Performance is : %.3f\"%COP\n", + "\n", + "Q1dot = Q2dot+Wdot;\t\t\t#KJ/hr\n", + "print \"Heat transfer rate in condenser in KJ/hr : %.0f\"%Q1dot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Coefficient of Performance is : 4.444\n", + "Heat transfer rate in condenser in KJ/hr : 14700\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.5 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from numpy import *\t\t\n", + " \t\n", + "# Variables :\n", + "Eta1 = 25./100;\t\t\t#efficiency\n", + "deltaT = 20.;\t\t\t#degree centigrade\n", + "\n", + "# Calculations\n", + "#T2dash = T2-20;\t\t\t#K\n", + "#T1dash = T1;\t\t\t#K\n", + "deltaEta1 = 30./100;\n", + "Eta_dash = 30./100;\t\t\t#efficiency\n", + "#Eta1/Eta_dash = (1-T2dash/T1dash)/(1-T2/T1)\n", + "#T1-T2 = 100;\n", + "#0.75*T1-T2 = 0;\n", + "A = array([[1, -1],[0.75, -1]])\n", + "B = array([100,0])\n", + "X = linalg.solve(A,B);\n", + "#Solution for T1 and T2 by matrix\n", + "T1 = X[0];\t\t\t#K\n", + "T2 = X[1];\t\t\t#K\n", + "\n", + "# Results\n", + "print \"Source temperature in K : %.0f\"%T1\n", + "print \"Sink temperature in K : %.0f\"%T2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Source temperature in K : 400\n", + "Sink temperature in K : 300\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.6 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 23.+273;\t\t\t#K\n", + "COP_HP = 2.5;\n", + "HeatLost = 60000.;\t\t\t#KJ/hr\n", + "HeatGenerated = 4000.;\t\t\t#KJ/hr\n", + "\n", + "# Calculations\n", + "Q1 = HeatLost-HeatGenerated;\t\t\t#KJ/hr\n", + "W = Q1/COP_HP;\t\t\t#KJ/hr\n", + "W = W/3600;\t\t\t#KJ/s or KW\n", + "\n", + "# Results\n", + "print \"Power input in KW : %.3f\"%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power input in KW : 6.222\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.7 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 400.+273;\t\t\t#K\n", + "T2 = 20.+273;\t\t\t#K\n", + "T3 = 100.+273;\t\t\t#K\n", + "T4 = T2;\t\t\t#K\n", + "Q1 = 12000.;\t\t\t#KW\n", + "Q3 = 25000.;\t\t\t#KW\n", + "\n", + "# Calculations and Results\n", + "Eta1 = 1-T2/T1;\t\t\t#Efficiency\n", + "W1 = Eta1*Q1;\t\t\t#KW\n", + "print \"Power of Engine 1, W1 in KW : %.2f\"%W1\n", + "Eta2 = 1-T4/T3;\t\t\t#Efficiency\n", + "W2 = Eta2*Q3;\t\t\t#KW\n", + "print \"Power of Engine 2, W2 in KW : %.2f\"%W2\n", + "print (\"W1>W2, The engine 1 delivers more power.\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power of Engine 1, W1 in KW : 6775.63\n", + "Power of Engine 2, W2 in KW : 5361.93\n", + "W1>W2, The engine 1 delivers more power.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.8 Page No : 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from numpy import *\n", + "\t\t\t\n", + "# Variables :\n", + "Wdot = 200.;\t\t\t#W\n", + "t1 = 40.;\t\t\t#degree centigrade\n", + "\n", + "# Calculations\n", + "#Q2dot = 20*(t1-t2);\t\t\t#W\n", + "#COP = Q2dot/W2dot = T2/(T1-T2)\n", + "#(t1-t2)/(W2dot/20) = (t1+273)/(t1-t2)\n", + "#20*t1**2+20*t2**2-20*2*t1*t2-t1*Wdot-273*Wdot\n", + "#(t2+273)/(t1-t2) = (t1-t2)/(Wdot/20)\n", + "#t2**2-(2*t1+(Wdot/20))*t2-273*(Wdot/20)+t1**2\n", + "P = array([1, -(2*t1+(Wdot/20)), -273*(Wdot/20)+t1**2])\n", + "t2 = roots(P);\n", + "t2 = t2[1];\t\t\t#degree C\n", + "\n", + "# Results\n", + "#Taken only -ve value as t2 cant be greater than t1\n", + "print \"Temperature of cold space(degree C) %.2f\"%t2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of cold space(degree C) -11.17\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.10 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 0.8;\t\t\t#Kg\n", + "hi = 335.;\t\t\t#KJ/Kg-water\n", + "T1 = 24.+273;\t\t\t#K\n", + "T2 = 0.+273;\t\t\t#K\n", + "Wdot = 400.;\t\t\t#W\n", + "Wdot = Wdot/1000.;\t\t\t#KW\n", + "\n", + "# Calculations\n", + "Q2 = m*hi;\t\t\t#KJ\n", + "ActualCOP = T2/(T1-T2)*30/100;\n", + "Q2dot = ActualCOP/Wdot;\t\t\t#KJ/s\n", + "T = Q2/Q2dot;\t\t\t#sec\n", + "\n", + "# Results\n", + "print \"Time required to freeze the water in sec : %.2f\"%T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time required to freeze the water in sec : 31.41\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.11 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 727.+273;\t\t \t#K\n", + "T2 = 27.+273;\t\t \t#K\n", + "Wdot = 76.;\t\t\t #KW\n", + "FuelBurned = 4.;\t\t \t#Kg/hr\n", + "FuelBurned = 4./3600;\t\t\t#Kg/sec\n", + "FuelHeatingValue = 75000.;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "Q1dot = FuelBurned*FuelHeatingValue;\t\t\t#KJ/s or KW\n", + "Eta = Wdot/Q1dot*100;\t\t\t#%\n", + "print \"Actual Efficiency of Engine in % : \",Eta\n", + "\n", + "Eta_c = (1-T2/T1)*100;\t\t\t#%\n", + "print \"Carnot Efficiency of Engine in % : \",Eta_c\n", + "print (\"Claim of inventor is wrong as actual efficiency is greater than carnot efficiency.\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Actual Efficiency of Engine in % : 91.2\n", + "Carnot Efficiency of Engine in % : 70.0\n", + "Claim of inventor is wrong as actual efficiency is greater than carnot efficiency.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.12 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 24.+273;\t\t\t#K\n", + "T2 = 10.+273;\t\t\t#K\n", + "Q1 = 1500.;\t\t\t#kJ/min\n", + "Q1 = Q1/60.;\t\t\t#kW\n", + "\n", + "# Calculations\n", + "COP_ideal = T1/(T1-T2);\n", + "ActualCOP = COP_ideal*30/100;\n", + "W = Q1/ActualCOP;\t\t\t#kW\n", + "\n", + "# Results\n", + "print \"Power required in kW : %.3f\"%W\n", + "\n", + "#Answer is wrong in the book as calculation for Q1 is wrong.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required in kW : 3.928\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.13 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "T1 = 450.;\t\t\t#K\n", + "T2 = 280.;\t\t\t#K\n", + "Q1 = 1200.;\t\t\t#KJ\n", + "W = 0.15;\t\t\t#KWh\n", + "W = W*3600.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "Eta_a = W/Q1*100;\t\t\t#%\n", + "print \"Actual Efficiency of Engine in % : \",Eta_a\n", + "\n", + "Eta_c = (1-T2/T1)*100;\t\t\t#%\n", + "print \"Carnot Efficiency of Engine in %% : %.1f\"%(Eta_c)\n", + "print (\"We would not issue a patent as actual efficiency is greater than carnot efficiency.\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Actual Efficiency of Engine in % : 45.0\n", + "Carnot Efficiency of Engine in % : 37.8\n", + "We would not issue a patent as actual efficiency is greater than carnot efficiency.\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.14 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 1000.;\t\t\t#K\n", + "T3 = 100.;\t\t\t#K\n", + "Q1 = 1680.;\t\t\t#KJ\n", + "\n", + "#Eta_a = Eta_b : 1-T2/T1 = 1-T3/T2\n", + "T2 = math.sqrt(T1*T3);\t\t\t#K\n", + "Eta_a = 1-T2/T1;\n", + "Eta_b = Eta_a;\n", + "W1 = Eta_a*Q1;\t\t\t#KJ\n", + "Q2 = Q1-W1;\t\t\t#KJ\n", + "Q3 = (1-Eta_b)*Q2;\t\t\t#KJ\n", + "print \"Heat rejected by engine B in KJ : \",Q3\n", + "print \"Temperature at which heat is rejected by engine A in K : %.2f\"%T2\n", + "print \"Workdone by engine A in KJ ; %.2f\"%W1\n", + "\n", + "W2 = Eta_b*Q2;\t\t\t#KJ\n", + "print \"Workdone by engine B in KJ ; %.2f\"%W2\n", + "\n", + "#If W1 = W2\n", + "#Q/T = constant\n", + "T2 = (T1+T3)/2;\t\t\t#K\n", + "Eta_a = (1-T2/T1)*100;\t\t\t#%\n", + "Eta_b = (1-T3/T2)*100;\t\t\t#%\n", + "print (\"If Engine A & B deliver equal work.\")\n", + "print \"of Engine A in %% : %.2f\"%Eta_a\n", + "print \"of Engine B in %% : %.2f\"%Eta_b\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat rejected by engine B in KJ : 168.0\n", + "Temperature at which heat is rejected by engine A in K : 316.23\n", + "Workdone by engine A in KJ ; 1148.74\n", + "Workdone by engine B in KJ ; 363.26\n", + "If Engine A & B deliver equal work.\n", + "of Engine A in % : 45.00\n", + "of Engine B in % : 81.82\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.15 Page No : 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "T1 = 800.+273;\t\t\t#K\n", + "T2 = 30.+273;\t\t\t#K\n", + "T3 = 30.+273;\t\t\t#K\n", + "T4 = -15.+273;\t\t\t#K\n", + "Q1 = 1900.;\t\t\t#KJ\n", + "W2 = 290.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "#Eta = 1-T2/T1 = W1/Q1\n", + "W1 = (1-T2/T1)*Q1;\t\t\t#KJ\n", + "Q2 = Q1-W1;\t\t\t#KJ\n", + "W3 = W1-W2;\t\t\t#KJ\n", + "\n", + "#COP = T4/(T3-T4) = Q4/W3\n", + "Q4 = T4/(T3-T4)*W3;\t\t\t#KJ\n", + "print \"Heat absorbed by refrigerant in KJ : %.2f\"%Q4\n", + "\n", + "Q3 = W3+Q4;\t\t\t#KJ\n", + "TotalHeat = Q2+Q3;\t\t\t#KJ\n", + "print \"Total Heat transferred to reservoir at 30 degree centigrade in KJ : %.2f\"%TotalHeat\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat absorbed by refrigerant in KJ : 6154.54\n", + "Total Heat transferred to reservoir at 30 degree centigrade in KJ : 7764.54\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.16 Page No : 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 840.+273;\t\t\t#K\n", + "T2 = 60.+273;\t\t\t#K\n", + "T3 = 5.+273;\t\t\t#K\n", + "W3 = 30.;\t\t\t#KW\n", + "Q3 = 17.;\t\t\t#KJ/s\n", + "\n", + "# Calculations\n", + "#Q3/T3 = Q4/T4\n", + "T4 = T2;\t\t\t#K\n", + "Q4 = Q3/T3*T4;\t\t\t#KJ/s\n", + "W2 = Q4-Q3;\t\t\t#KJ/s\n", + "W1 = W2+W3;\t\t\t#KJ/s\n", + "Q1subQ2 = W1;\t\t\t#KJ/s\n", + "#Q1/T1 = Q2/T2\n", + "Q1ByQ2 = T1/T2;\n", + "\t\t\t#Q1subQ2 = Q1subQ2*Q2-Q2\n", + "Q2 = Q1subQ2/(Q1ByQ2-1);\t\t\t#KW\n", + "Q1 = Q1ByQ2*Q2;\t\t\t#KW\n", + "\n", + "# Results\n", + "print \"Rate of heat supply from 800 degree C source in KW : %.1f\"%Q1\n", + "print \"Rate of heat rejection to sink in KW : %.3f\"%(Q2+Q4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of heat supply from 800 degree C source in KW : 47.6\n", + "Rate of heat rejection to sink in KW : 34.607\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.17 Page No : 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 27.+273;\t\t\t#K\n", + "T2 = -23.+273;\t\t\t#K\n", + "W = 1.;\t\t\t#KW\n", + "Q2 = 20000.;\t\t\t#KJ/hr\n", + "\n", + "# Calculations and Results\n", + "Q2 = Q2/3600;\t\t\t#KJ/s\n", + "ActualCOP = Q2/W;\n", + "print \"COP of machine : %.3f\"%ActualCOP\n", + "\n", + "IdealCOP = T2/(T1-T2);\n", + "print \"Ideal COP of machine : %.0f\"%IdealCOP\n", + "print (\"ActualCOP>IdealCOP, Inventor's claim is wrong.\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP of machine : 5.556\n", + "Ideal COP of machine : 5\n", + "ActualCOP>IdealCOP, Inventor's claim is wrong.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.18 Page No : 32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from numpy import *\n", + "\t\t\t\n", + "# Variables :\n", + "#Heat Pump in winter\n", + "Q1 = 2400.;\t\t\t#KJ/hr/degree temperature difference\n", + "t1 = 20.;\t\t\t#degreeC\n", + "t2 = 0.;\t\t\t#degreeC\n", + "\n", + "# Calculations and Results\n", + "Q1 = Q1*(t1-t2)/3600;\t\t\t#KJ/s\n", + "T1 = t1+273;\t\t\t#K\n", + "T2 = t2+273;\t\t\t#K\n", + "COP = T1/(T1-T2);\n", + "W = Q1/COP;\t\t\t#KW\n", + "print \"Power required to drive heat pump in KW : %.2f\"%W\n", + "\n", + "#Refrigerating unit in summer\n", + "T4 = 20+273;\t\t\t#K\n", + "#Q4 = 2400*(T3-T4)/3600;\t\t\t#KJ/s\n", + "Q3subQ4 = W;\t\t\t#KJ\n", + "#COP = Q4/(Q3subQ4) = T4/(T3-T4);\n", + "#T3**2-2*T3*T4+T4**2-T4*3600/2400*(Q3subQ4) = 0\n", + "P = array([1, -2*T4, T4**2-T4*3600./2400*(Q3subQ4)])\n", + "T3 = roots(P);\n", + "T3 = T3[0];\t\t\t#K(Maximum outside temperature)\n", + "print \"Maximum outside temperature in K : %.0f\"%T3\n", + "print \"in degree C : %.0f\"%(T3-273)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required to drive heat pump in KW : 0.91\n", + "Maximum outside temperature in K : 313\n", + "in degree C : 40\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.20 Page No : 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "VcByVa = 14.;\t\t\t#Overall expansion ratio\n", + "T1 = 257+273.;\t\t\t#K\n", + "T2 = 27+273.;\t\t\t#K\n", + "Gamma = 1.4;\n", + "Ta = T1;\t\t\t#K\n", + "Tb = T1;\t\t\t#K\n", + "Tc = T2;\t\t\t#K\n", + "Td = T2;\t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "VcByVb = (Tb/Tc)**(1/(Gamma-1));\t\t\t#Expansion ratio for Adiabatic Process : \n", + "print \"ratio for adiabatic process : %.2f\"%VcByVb\n", + "\n", + "VbByVa = VcByVa/VcByVb;\t\t\t#Expansion ratio for Isothermal Process : \n", + "print \"Expansion ratio for Isothermal process : %.3f\"%VbByVa\n", + "Eta = (1-T2/T1)*100;\t\t\t#%\n", + "print \"Thermal Efficiency of carnot cycle in %% : %.1f\"%Eta\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ratio for adiabatic process : 4.15\n", + "Expansion ratio for Isothermal process : 3.375\n", + "Thermal Efficiency of carnot cycle in % : 43.4\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.21 Page No : 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "W = 10.;\t\t\t#KW\n", + "\t\t\t#For flat plate collector\n", + "T1 = 90.+273;\t\t\t#K\n", + "T2 = 27.+273;\t\t\t#K\n", + "Tmax = T1;\t\t\t#K\n", + "IE = 1.;\t\t\t#KW/m**2 incident energy\n", + "EtaCollection = 60./100;\n", + "\n", + "# Calculations and Results\n", + "#Eta = 1-T2/T1 = W/Q1\n", + "Q1 = W/(1-T2/T1);\t\t\t#KJ/s\n", + "A1 = Q1/IE/EtaCollection;\t\t\t#m**2\n", + "print \"Solar Collector Area required in m**2 : %.3f\"%A1\n", + "\n", + "#For parabolic collector\n", + "T3 = 250.+273;\t\t\t#K\n", + "T4 = 27.+273;\t\t\t#K\n", + "Tmax = T3;\t\t\t#K\n", + "IE = 1.;\t\t\t#KW/m**2 incident energy\n", + "EtaCollection = 50./100;\n", + "\n", + "#Eta = 1-T2/T1 = W/Q1\n", + "Q3 = W/(1-T4/T3);\t\t\t#KJ/s\n", + "A2 = Q3/IE/EtaCollection;\t\t\t#m**2\n", + "print \"Parabolic Solar Collector Area required in m**2 : %.3f\"%A2\n", + "\t\t\t#Answer of 2nd part is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Solar Collector Area required in m**2 : 96.032\n", + "Parabolic Solar Collector Area required in m**2 : 46.906\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.24 Page No : 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 40.+273;\t\t\t#K\n", + "T2 = 5.+273;\t\t\t#K\n", + "T3 = 400.+273;\t\t\t#K\n", + "T4 = T1;\t\t\t#K\n", + "Q2 = 1500.;\t\t\t#KJ/min\n", + "\n", + "# Calculations and Results\n", + "COP_R = T2/(T1-T2);\n", + "print \"COP of refrigerator is : %.3f\"%COP_R\n", + "\n", + "Q2dot = Q2/60;\t\t\t#KJ/s\n", + "Wdot = Q2dot/COP_R;\t\t\t#KW\n", + "print \"Work Input to refrigerator in KW : %.4f\"%Wdot\n", + "\n", + "Eta = (1-T4/T3);\t\t\t#%\n", + "Q3dot = Wdot/Eta;\t\t\t#KW\n", + "OverallCOP = Q2dot/Q3dot;\t\t\t#\n", + "print \"Overall COP of refrigerator : %.4f\"%OverallCOP\n", + "\t\t\t\n", + "#Ans of overall COP is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP of refrigerator is : 7.943\n", + "Work Input to refrigerator in KW : 3.1475\n", + "Overall COP of refrigerator : 4.2488\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.25 Page No : 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 1500.;\t\t\t#K\n", + "T2 = 450.;\t\t\t#K\n", + "T3 = 150.;\t\t\t#K\n", + "Q3 = 250.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "COP_CR = T3/(T2-T3);\n", + "print \"COP of cold refrigerator is : %.1f\"%COP_CR\n", + "\n", + "COP_HR = T2/(T1-T2);\n", + "print \"COP of hotter refrigerator is : %.4f\"%COP_HR\n", + "COP = T3/(T1-T3);\n", + "print \"COP of composite system is : %.3f\"%COP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP of cold refrigerator is : 0.5\n", + "COP of hotter refrigerator is : 0.4286\n", + "COP of composite system is : 0.111\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.26 Page No : 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 870.;\t\t\t#K\n", + "T2 = 580.;\t\t\t#K\n", + "T3 = 290.;\t\t\t#K\n", + "Wdot = 85.;\t\t\t#KW\n", + "Q3 = 3000.;\t\t\t#KJmin\n", + "Q3 = Q3/60.;\t\t\t#KJ/s\n", + "Q1plusQ2 = Wdot+Q3;\t\t\t#KJ\n", + "\n", + "#sigma(Q/T) = 0\n", + "#Q1/T1+Q2/T2 = Q3/T3\n", + "#Q1/T1+(Q1plusQ2-Q1)/T2-Q3/T3 = 0\n", + "Q1 = (-Q3*T1*T2/T3+Q1plusQ2*T1)/(T1-T2);\t\t\t#KW\n", + "print \"Heat Supplied by source1 in KW : %.0f\"%Q1\n", + "\n", + "Q2 = Q1plusQ2-Q1;\t\t\t#KW\n", + "print \"Heat Supplied by source2 in KW : %.0f\"%Q2\n", + "\n", + "Eta = Wdot/(Q1+Q2)*100;\t\t\t#%\n", + "print \"Efficiency of engine in %% : %.2f\"%Eta\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat Supplied by source1 in KW : 105\n", + "Heat Supplied by source2 in KW : 30\n", + "Efficiency of engine in % : 62.96\n" + ] + } + ], + "prompt_number": 45 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch4.ipynb b/Thermodynamics_by_B._l._Singhal/ch4.ipynb new file mode 100755 index 00000000..6ceae71d --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch4.ipynb @@ -0,0 +1,863 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ea35efcfa8b2b76b1ca1456260b722b88d999ecbb9e7a41ed6195c31bb1ca2a1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Entropy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.1 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 400.;\t\t\t#Kelvin\n", + "T2 = 300.;\t\t\t#Kelvin\n", + "Q1 = 4800.;\t\t\t#KJ\n", + "Q2 = -4800.;\t\t\t#KJ\n", + "\n", + "# Calculations\n", + "#Q1/T1+Q2/T2< = 0\n", + "LHS = Q1/T1+Q2/T2;\t\t\t#\n", + "\n", + "# Results\n", + "print \"/T1+Q2/T2 = \",LHS\n", + "print (\"It is less than zero. Process is irreversible\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "/T1+Q2/T2 = -4.0\n", + "It is less than zero. Process is irreversible\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.2 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T1 = 290.+273;\t\t\t#Kelvin\n", + "T2 = 8.5+273;\t\t\t#Kelvin\n", + "Q1 = 300.;\t\t\t#KJ\n", + "#Case 1 :\n", + "Q2 = -215.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "sigmaQbyT = Q1/T1+Q2/T2\n", + "print \"(i) Q1/T1+Q2/T2 = %.4f\"%sigmaQbyT\n", + "print (\"It is less than zero. Cycle is irreversible\")\n", + "\n", + "#Case 2 :\n", + "Q2 = -150.;\t\t\t#KJ\n", + "sigmaQbyT = Q1/T1+Q2/T2\n", + "print \"(ii) Q1/T1+Q2/T2 = %.0f\"%sigmaQbyT\n", + "print (\"It is equal to zero. Cycle is reversible\");\n", + "#Case 3 :\n", + "Q2 = -75.;\t\t\t#KJ\n", + "sigmaQbyT = Q1/T1+Q2/T2\n", + "print \"(iii) Q1/T1+Q2/T2 = %.4f\"%sigmaQbyT\n", + "print (\"It is greater than zero. Cycle is impossible.\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Q1/T1+Q2/T2 = -0.2309\n", + "It is less than zero. Cycle is irreversible\n", + "(ii) Q1/T1+Q2/T2 = 0\n", + "It is equal to zero. Cycle is reversible\n", + "(iii) Q1/T1+Q2/T2 = 0.2664\n", + "It is greater than zero. Cycle is impossible.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.3 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "V1 = 10.;\t\t\t#m**3\n", + "T1 = 175.+273;\t\t\t#Kelvin\n", + "T2 = 36.+273;\t\t\t#Kelvin\n", + "p1 = 5.;\t\t\t#bar\n", + "p2 = 1.;\t\t\t#bar\n", + "R = 287.;\t\t\t#KJ/KgK\n", + "Cp = 1.005;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "#p*V = m*R*T\n", + "m = p1*10**5*V1/R/T1;\t\t\t#Kg\n", + "deltaS = m*Cp*math.log(T2/T1)+m*R/1000*math.log(p1/p2);\t\t\t#KJ/K\n", + "\n", + "# Results\n", + "print \"Entropy change in KJ/K : %.3f\"%deltaS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change in KJ/K : 3.445\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.4 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "deltaS = 5.;\t\t\t#KJ/KgK\n", + "W = 2000.;\t\t\t#KJ/Kg\n", + "T1 = 327.+273;\t\t\t#Kelvin\n", + "\n", + "# Calculations and Results\n", + "Q1 = deltaS*T1;\t\t\t#KJ/Kg\n", + "Q2 = Q1-W;\t\t\t#KJ/Kg\n", + "Eta = W/Q1*100;\t\t\t#%\n", + "print \"Efficiency in %% : %.1f\"%Eta\n", + "\n", + "T2 = Q2/Q1*T1;\t\t\t#K\n", + "print \"Lowest temperature in Kelvin : \",T2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Efficiency in % : 66.7\n", + "Lowest temperature in Kelvin : 200.0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.5 Page No : 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "mc = 0.5;\t\t\t#Kg\n", + "Tc = 100.+273;\t\t\t#K\n", + "Cpc = 0.393;\t\t\t#KJ/KgK\n", + "Tw = 10.+273;\t\t\t#K\n", + "Cpw = 4.2;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "def f0(T): \n", + "\t return mc*Cpc\n", + "\n", + "Q = quad(f0,Tc,Tw)[0]\n", + "\n", + "def f1(T): \n", + "\t return mc*Cpc/T\n", + "\n", + "deltaSc = quad(f1,Tc,Tw)[0]\n", + "\n", + "deltaSw = abs(Q)/Tw;\t\t\t#KJ/K\n", + "deltaSuniverse = deltaSc+deltaSw;\t\t\t#Kj/K\n", + "print \"Part (i) Chane in entropy in KJ/K : %.4f\"%deltaSuniverse\n", + "\n", + "T1 = 383.;\t\t\t#K\n", + "T2 = 283.;\t\t\t#K\n", + "T = (T1+T2)/2;\t\t\t#K\n", + "\n", + "def f2(T): \n", + "\t return 1/T\n", + "a = quad(f2,T1,T)[0]\n", + "deltaSuniverse = mc*Cpc*( a + 0.1627)\n", + "print \"Part (ii) Chane in entropy in KJ/K : %.5f\"%deltaSuniverse\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part (i) Chane in entropy in KJ/K : 0.0082\n", + "Part (ii) Chane in entropy in KJ/K : 0.00448\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.6 Page No : 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "Tc = 35.+273;\t\t\t#K\n", + "W = 500.;\t\t\t#KJ\n", + "T1 = 308.;\t\t\t#K\n", + "T2 = 308.;\t\t\t#K\n", + "T0 = 15.+273;\t\t\t#K\n", + "Q = W;\t \t\t#KJ\n", + "deltaS1 = 0;\t\t\t#as heat supplied is zero\n", + "\n", + "# Calculations\n", + "deltaS2 = Q/T0;\t\t\t#KJ/K\n", + "\n", + "# Results\n", + "print \"Change in entropy in KJ/K : %.4f\"%deltaS2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy in KJ/K : 1.7361\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.7 Page No : 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables :\n", + "mi = 0.5;\t\t\t#Kg\n", + "Ti = -10.+273;\t\t\t#K\n", + "Cpi = 2.;\t\t\t#KJ/KgK\n", + "Cpw = 4.2;\t\t\t#KJ/KgK\n", + "Li = 334.;\t\t\t#KJ/Kg\n", + "mc = 5.;\t\t\t#Kg\n", + "Tc = 80.+273;\t\t\t#K\n", + "Cpc = 0.5;\t\t\t#KJ/KgK\n", + "T0 = 0.+273;\t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "#mi*[Cpi*(T0-Ti)+Li+Cpw*(T-T0)] = mc*Cpc*(Tc-T)\n", + "T = (mc*Cpc*Tc-mi*Cpi*(T0-Ti)-mi*Li+mi*Cpw*T0)/(mi*Cpw+mc*Cpc);\t\t\t#K\n", + "deltaSi = mi*Cpi*math.log(T0/Ti)+Li/T0+mi*Cpw*math.log(T/T0);\t\t\t#KJ/K\n", + "print \"Entropy chane of Ice in KJ/K : %.4f\"%deltaSi\n", + "\n", + "deltaSc = mc*Cpc*math.log(T/Tc);\t\t\t#KJ/K\n", + "print \"Entropy chane of Copper in KJ/K : %.4f\"%deltaSc\n", + "\n", + "deltaSsurr = 0;\t\t\t#No heat transfer between system & Surrounding\n", + "deltaSuniverse = deltaSi+deltaSc+deltaSsurr;\t\t\t#KJ/K\n", + "print \"Entropy chane of universe in KJ/K : %.4f\"%deltaSuniverse\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy chane of Ice in KJ/K : 1.2989\n", + "Entropy chane of Copper in KJ/K : -0.5971\n", + "Entropy chane of universe in KJ/K : 0.7018\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.8 Page No : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "m1 = 5.;\t\t\t#Kg\n", + "T1 = 200.+273;\t\t\t#K\n", + "Cp1 = 0.4;\t\t\t#KJ/KgK\n", + "m2 = 100.;\t\t\t#Kg\n", + "T2 = 30.+273;\t\t\t#K\n", + "Cp2 = 2.1;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "#m1*Cp1*(T1-T) = m2*Cp2*(T-T2)\n", + "T = (m1*Cp1*T1+T2*m2*Cp2)/(m2*Cp2+m1*Cp1);\t\t\t#K\n", + "\n", + "def f8(T): \n", + "\t return m1*Cp1/T\n", + "\n", + "deltaS1 = quad(f8,T1,T)[0]\n", + "\n", + "def f9(T): \n", + "\t return m2*Cp2/T\n", + "\n", + "deltaS2 = quad(f9,T2,T)[0]\n", + "deltaSsurr = 0;\t\t\t#No heat transfer neglected\n", + "deltaSuniverse = deltaS1+deltaS2+deltaSsurr;\t\t\t#KJ/K\n", + "\n", + "# Results\n", + "print \"Increase in Entropy of universe in KJ/K : %.4f\"%deltaSuniverse\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in Entropy of universe in KJ/K : 0.2284\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.9 Page No : 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables :\n", + "HeatTransfer = 2;\t\t\t#KJ/degreeCentigrade(it is d'Q/dT)\n", + "T1 = 27+273;\t\t\t#K\n", + "T2 = 127+273;\t\t\t#K\n", + "\n", + "# Calculations\n", + "def f22(T): \n", + "\t return HeatTransfer/T\n", + "\n", + "deltaS = quad(f22,T1,T2)[0]\n", + "\n", + "# Results\n", + "print \"Entropy change when heat is transfered to system in KJ/K : %.4f\"%deltaS\n", + "print \"change when end states are achieved by stirring action in KJ/K : %.4f\"%deltaS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change when heat is transfered to system in KJ/K : 0.5754\n", + "change when end states are achieved by stirring action in KJ/K : 0.5754\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.11 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "m1 = 2.;\t\t\t#Kg\n", + "T1 = 80.+273;\t\t\t#K\n", + "m2 = 3.;\t\t\t#Kg\n", + "T2 = 30.+273;\t\t\t#K\n", + "Cp = 4.187;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "#m1*Cp1*(T1-T) = m2*Cp2*(T-T2)\n", + "T = (m1*Cp*T1+T2*m2*Cp)/(m2*Cp+m1*Cp);\t\t\t#K\n", + "\n", + "def f26(T): \n", + "\t return m1*Cp/T\n", + "\n", + "deltaS = quad(f26,T1,T)[0] + 0.8029\n", + "\n", + "print \"Total Entropy change due to mixing process in KJ/K : %.4f\"%deltaS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Entropy change due to mixing process in KJ/K : 0.0592\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.14 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "V1 = 4.;\t\t\t#m**3\n", + "V2 = 4.;\t\t\t#m**3\n", + "m = 20.;\t\t\t#Kg\n", + "p1 = 4.*100;\t\t\t#KPa\n", + "p2 = 8.*100;\t\t\t#KPa\n", + "Cp = 1.005;\t\t\t#KJ/KgK\n", + "Cv = 0.718;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "R = Cp-Cv;\t\t\t#KJ/KgK\n", + "T1 = p1*V1/m/R;\t\t\t#K\n", + "T2 = p2*V2/m/R;\t\t\t#K\n", + "deltaU = m*Cv*(T2-T1);\t\t\t#KJ\n", + "print \"Change in internal energy in KJ : %.2f\"%deltaU\n", + "W = 0;\t\t\t#KJ\n", + "print \"no movement, Work done in KJ : \",W\n", + "\n", + "Q = W+deltaU;\t\t\t#KJ\n", + "print \"Heat transfered in KJ : %.2f\"%Q\n", + "\n", + "def f19(T): \n", + "\t return m*Cv/T\n", + "\n", + "deltaS = quad(f19,T1,T2)[0]\n", + "\n", + "print \"Entropy change in KJ/K : %.4f\"%deltaS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy in KJ : 4002.79\n", + "no movement, Work done in KJ : 0\n", + "Heat transfered in KJ : 4002.79\n", + "Entropy change in KJ/K : 9.9536\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.15 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "V1 = 4.;\t\t\t#m**3\n", + "V2 = 4.;\t\t\t#m**3\n", + "m = 600./1000;\t\t\t#Kg\n", + "C = 150.;\t\t\t#J/K\n", + "T1 = 100.+273;\t\t\t#K\n", + "T0 = 8.+273;\t\t\t#K\n", + "Cp = C/1000;\t\t\t#KJ/K\n", + "\n", + "# Calculations and Results\n", + "def f10(T): \n", + "\t return Cp/T\n", + "\n", + "deltaSblock = quad(f10,T1,T0)[0]\n", + "\n", + "Q = Cp*(T1-T0);\t\t\t#KJ\n", + "deltaSlake = Q/T0;\t\t\t#KJ/K\n", + "deltaSuniverse = deltaSblock+deltaSlake;\t\t\t#KJ/K\n", + "print \"Part (i) Entropy change of universe in KJ/K : %.4f\"%deltaSuniverse\n", + "\n", + "T1 = 8.+273;\t\t\t#K\n", + "Z = 100.;\t\t \t#meter\n", + "g = 9.81;\t\t\t #gravity constant\n", + "PE = m*g*Z/1000.;\t\t#KJ\n", + "deltaT = PE/Cp;\t\t\t#degree centigrade\n", + "T2 = T1+deltaT;\t\t\t#K\n", + "\n", + "def f11(T): \n", + "\t return Cp/T\n", + "\n", + "deltaSblock = - quad(f11,T1,T2)[0]\n", + "\n", + "deltaSlake = PE/T0;\t\t\t#KJ/K\n", + "deltaSuniverse = deltaSblock+deltaSlake;\t\t\t#KJ/K\n", + "print \"Part (ii) Entropy change of universe in %f KJ/K : \"%deltaSuniverse\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part (i) Entropy change of universe in KJ/K : 0.0066\n", + "Part (ii) Entropy change of universe in 0.000014 KJ/K : \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.17 Page No : 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "\n", + "# Variables :\n", + "m = 1.;\t\t\t#Kg\n", + "p1 = 1.;\t\t\t#bar\n", + "T1 = 290.;\t\t\t#K\n", + "p2 = 30.;\t\t\t#bar\n", + "T2 = 290.;\t\t\t#K\n", + "n = 1.3;\t\t\t#consmath.tant\n", + "R = 300.;\t\t\t#Nm/KgK\n", + "Cv = 0.72;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "print (\"part (a) Isothermally\")\n", + "V1 = R*T1/p1/10**5;\t\t\t#m**3/Kg\n", + "V2 = p1*V1/p2;\t\t\t#m**3/Kg\n", + "w = p1*10**5*V1*math.log(V2/V1)/1000;\t\t\t#KJ/Kg\n", + "print \"Workdone in KJ/Kg : %.1f\"%w\n", + "\n", + "deltaU = m*Cv*(T2-T1);\t\t\t#KJ(as T1 = T2)\n", + "print \"Change in internal energy in KJ : \",deltaU\n", + "\n", + "q = w+deltaU;\t\t\t#KJ/Kg\n", + "print \"Heat transfer in KJ/Kg : %.1f\"%q\n", + "\n", + "S2subS1 = m*R/1000*math.log(V2/V1)+m*Cv*math.log(T2/T1);\t\t\t#KJ/KgK\n", + "print \"Change in entropy in KJ/KgK : %.4f\"%S2subS1\n", + "\n", + "print (\"\\npart (b) Polytropically\")\n", + "T2 = T1*(p2/p1)**((n-1)/n);\t\t\t#K\n", + "print \"Temperature T2 in K : %.1f\"%T2\n", + "\n", + "V1 = R*T1/p1/10**5;\t\t\t#m**3/Kg\n", + "V2 = (p1/p2)**(1/n)*V1;\t\t\t#m**3/Kg\n", + "w = m*R/1000*(T1-T2)/(n-1);\t\t\t#KJ/Kg\n", + "print \"Workdone in KJ/Kg : %.1f\"%w\n", + "\n", + "deltaU = m*Cv*(T2-T1);\t\t\t#KJ(as T1 = T2)\n", + "q = w+deltaU;\t\t\t#KJ/Kg\n", + "print \"Heat transfer in KJ/Kg : %.1f\"%q\n", + "\n", + "S2subS1 = m*R/1000*math.log(V2/V1)+m*Cv*math.log(T2/T1);\t\t\t#KJ/KgK\n", + "print \"Change in entropy in KJ/KgK : %.4f\"%S2subS1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "part (a) Isothermally\n", + "Workdone in KJ/Kg : -295.9\n", + "Change in internal energy in KJ : 0.0\n", + "Heat transfer in KJ/Kg : -295.9\n", + "Change in entropy in KJ/KgK : -1.0204\n", + "\n", + "part (b) Polytropically\n", + "Temperature T2 in K : 635.7\n", + "Workdone in KJ/Kg : -345.7\n", + "Heat transfer in KJ/Kg : -96.8\n", + "Change in entropy in KJ/KgK : -0.2198\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.18 Page No : 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "P1 = 480.;\t\t\t#kPa\n", + "T1 = 190.+273;\t\t\t#K\n", + "T3 = 190.+273;\t\t\t#K\n", + "P2 = 94.;\t\t\t#kPa\n", + "P3 = 150.;\t\t\t#kPa\n", + "T2 = T3*P2/P3;\t\t\t#K\n", + "R = 0.29;\t\t\t#KJ/KgK\n", + "m = 1.;\t\t\t#Kg\n", + "Cp = 1.011;\t\t\t#KJ/KgK\n", + "\n", + "#T2/T1 = (P2/P1)**((Gamma-1)/Gamma)\n", + "#((Gamma-1)/Gamma) = math.log(T2/T1)/math.log(P2/P1);\t\t\t#\n", + "Gamma = 1.402;\t\t\t#by trial method\n", + "print \"Index of adiabatic expansion : %.2f\"%Gamma\n", + "\n", + "Cv = R/(Gamma-1);\t\t\t#KJ/KgK\n", + "W1_2 = m*R*(T1-T2)/(Gamma-1);\t\t\t#KJ/Kg\n", + "print \"Work done, W1-2 per Kg of air in KJ/Kg : %.2f\"%W1_2\n", + "\n", + "W2_3 = 0;\t\t\t#Consmath.tant volume process\n", + "print \"Work done, W2-3 per Kg of air in KJ/Kg : %.0f\"%W2_3\n", + "\n", + "W3_1 = m*R*T2*math.log(P3/P1);\t\t\t#KJ/Kg\n", + "print \"Work done, W1-2 per Kg of air in KJ/Kg : %.2f\"%W3_1\n", + "\n", + "W = W1_2+W2_3+W3_1;\t\t\t#KJ/Kg\n", + "print \"Total Work done in KJ/Kg : %.2f\"%W\n", + "\n", + "S2subS1 = 0;\t\t\t#adiabatic process\n", + "S3subS2 = m*R*math.log(P2/P3)+m*Cp*math.log(T3/T2);\t\t\t#KJ/KgK\n", + "print \"Change in specific entropy, S1-2 in KJ/KgK ; %.3f\"%S3subS2\n", + "\n", + "S1subS3 = -S2subS1-S3subS2;\t\t\t#KJ/KgK\n", + "print \"Change in specific entropy, S3-1 in KJ/KgK ; %.3f\"%S1subS3\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index of adiabatic expansion : 1.40\n", + "Work done, W1-2 per Kg of air in KJ/Kg : 124.70\n", + "Work done, W2-3 per Kg of air in KJ/Kg : 0\n", + "Work done, W1-2 per Kg of air in KJ/Kg : -97.87\n", + "Total Work done in KJ/Kg : 26.82\n", + "Change in specific entropy, S1-2 in KJ/KgK ; 0.337\n", + "Change in specific entropy, S3-1 in KJ/KgK ; -0.337\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.21 Page No : 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "p1 = 5.;\t\t\t#bar\n", + "T1 = 30.+273;\t\t\t#K\n", + "p2 = 4.;\t\t\t#bar\n", + "m = 1.; \t\t\t#Kg\n", + "R = 0.287;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "#deltaS = m*R*math.log(p1/p2)+m*Cp*math.log(T2/T1);\t\t\t#KJ/kgK\n", + "deltaS = m*R*math.log(p1/p2);\t\t\t#KJ/kgK(T2/T1 leads to 2nd term zero)\n", + "\n", + "# Results\n", + "print \"Entropy Change in KJ/KgK : %.5f\"%deltaS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy Change in KJ/KgK : 0.06404\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.22 Page No : 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "Cpg = 1.05;\t\t\t#KJ/KgK\n", + "t1 = 400.;\t\t\t#degree centigrade\n", + "t2 = 360.;\t\t\t#degree centigrade\n", + "T = 30.+273;\t\t\t#K\n", + "\n", + "# Calculations\n", + "Q = Cpg*(t1-t2);\t\t\t#KJ/Kg\n", + "deltaSsurr = Q/T;\t\t\t#KJ/KgK\n", + "\n", + "def f25(T): \n", + "\t return Cpg/T\n", + "\n", + "deltaSsystem = quad(f25,t1+273,t2+273)[0]\n", + "deltaSuniverse = deltaSsystem+deltaSsurr;\t\t\t#KJ/KgK\n", + "\n", + "# Results\n", + "print \"Change in entropy of the universe in KJ/KgK : %.4f\"%deltaSuniverse\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy of the universe in KJ/KgK : 0.0743\n" + ] + } + ], + "prompt_number": 18 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch5.ipynb b/Thermodynamics_by_B._l._Singhal/ch5.ipynb new file mode 100755 index 00000000..a7688b21 --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch5.ipynb @@ -0,0 +1,685 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3ebf775cd37f8da59364495c7787c49c7b13cef5f433a38d770b6bcb86676939" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Properties of Steam" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables : \n", + "deltaQ = 1000.;\t\t\t#KJ\n", + "T = 1073.;\t\t\t#Kelvin\n", + "T0 = 20.+273;\t\t\t#Kelvin\n", + "\n", + "# Calculations and Results\n", + "deltaS = deltaQ/T;\t\t\t#KJ/K\n", + "A = deltaQ-T0*deltaS;\t\t\t#KJ\n", + "print \"Available energy in KJ : %.2f\"%A\n", + "\n", + "UA = T0*deltaS;\t\t\t#KJ\n", + "print \"Unavailable energy in KJ : %.2f\"%UA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Available energy in KJ : 726.93\n", + "Unavailable energy in KJ : 273.07\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 2.;\t\t\t#Kg\n", + "T1 = 300.+273;\t\t\t#Kelvin\n", + "T2 = 150.+273;\t\t\t#Kelvin\n", + "T0 = 20.+273;\t\t\t#Kelvin\n", + "Cp = 0.45;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "deltaQ = m*Cp*(T1-T2);\t\t\t#KJ\n", + "deltaS = m*Cp*math.log(T1/T2);\t\t\t#KJ/K\n", + "A = deltaQ-T0*deltaS;\t\t\t#KJ\n", + "print \"Reversible work or Available energy in KJ : %.2f\"%A\n", + "\n", + "UA = T0*deltaS;\t\t\t#KJ\n", + "print \"Irreversibility in KJ : %.2f\"%UA\n", + "#Irreversibilty is not calculated in the book and asked in the question.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reversible work or Available energy in KJ : 54.96\n", + "Irreversibility in KJ : 80.04\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3 Page No : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 5.;\t\t\t#Kg\n", + "p = 1.;\t\t\t#bar\n", + "T0 = 20.+273;\t\t\t#Kelvin\n", + "T1 = 23.+273;\t\t\t#Kelvin\n", + "T2 = 227.+273;\t\t\t#Kelvin\n", + "Cp = 1.005;\t\t\t#J/KgK\n", + "\n", + "# Calculations\n", + "deltaS = Cp*math.log(T1/T2);\t\t\t#KJ/KgK\n", + "deltaQ = Cp*(T2-T1);\t\t\t#KJ\n", + "A = m*(deltaQ+T0*deltaS);\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Increase in availability due to heating in KJ : %.2f\"%A\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in availability due to heating in KJ : 253.24\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.4 Page No : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Q1 = 400.;\t\t\t#KJ\n", + "T1 = 1227.+273;\t\t\t#Kelvin\n", + "T2 = 27.+273;\t\t\t#Kelvin\n", + "\n", + "# Calculations and Results\n", + "A = Q1-T2*Q1/T1;\t\t\t#KJ\n", + "print \"Availability of the system in KJ : \",A\n", + "\n", + "UA = Q1-A;\t\t\t#KJ\n", + "print \"Unavailable energy in KJ : \",UA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Availability of the system in KJ : 320.0\n", + "Unavailable energy in KJ : 80.0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.5 Page No : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "P = 1.;\t\t\t#KW or KJ/s\n", + "Q = 6.;\t\t\t#MJ/hr\n", + "Q = Q*1000./3600;\t\t\t#KJ/s\n", + "T1 = 26.+273;\t\t\t#Kelvin\n", + "T2 = 3.+273;\t\t\t#Kelvin\n", + "\n", + "# Calculations\n", + "COP = T1/(T1-T2);\n", + "W = Q/COP;\t\t\t#KJ/s or KW\n", + "\n", + "# Results\n", + "print \"Work required to pump heat in KJ/s or KW : %.3f\"%W\n", + "print (\"As P>W, required condition can be maintained.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work required to pump heat in KJ/s or KW : 0.128\n", + "As P>W, required condition can be maintained.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.6 Page No : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "T = 727.+273;\t\t\t#Kelvin\n", + "T0 = 17.+273;\t\t\t#Kelvin\n", + "deltaQ = 4000.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "deltaS = deltaQ/T;\t\t\t#KJ/K\n", + "A = deltaQ-T0*deltaS;\t\t\t#KJ\n", + "print \"Availability of heat energy in KJ : \",A\n", + "UA = T0*deltaS;\t\t\t#KJ\n", + "print \"Unavailable heat energy in KJ : \",UA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Availability of heat energy in KJ : 2840.0\n", + "Unavailable heat energy in KJ : 1160.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.7 Page No : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "deltaQ = 850.;\t\t\t#KJ\n", + "T = 180+273.;\t\t\t#Kelvin\n", + "T0 = 22+273.;\t\t\t#Kelvin\n", + "\n", + "# Calculations\n", + "deltaS = deltaQ/T;\t\t\t#KJ/K\n", + "A = deltaQ-T0*deltaS;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Available energy in KJ : %.2f\"%A\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Available energy in KJ : 296.47\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.8 Page No : 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "deltaQ = 850.;\t\t\t#KJ\n", + "T1 = 1400.+273.;\t\t\t#Kelvin\n", + "T2 = 250.+273.;\t\t\t#Kelvin\n", + "T0 = 20.+273.;\t\t\t#Kelvin\n", + "Q = -1000.; \t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "deltaS1 = Q/T1;\t\t\t#KJ/K(-ve as heat leaving)\n", + "deltaS2 = abs(Q)/T2;\t\t\t#KJ/K(+ve Q as steam receives heat)\n", + "deltaS = deltaS1+deltaS2;\t\t\t#KJ/K\n", + "print (\"Part (i) As energy leaves the hot gases : \");\n", + "A = (T1-T0)*deltaS1;\t\t\t#KJ\n", + "UA = T0*deltaS1;\t\t\t#KJ\n", + "print \"Available energy in KJ : %.2f\"%A\n", + "print \"Unavailable energy in KJ : %.2f\"%UA\n", + "print (\"Part (ii) As energy enters the system : \");\n", + "\n", + "A = (T2-T0)*deltaS2;\t\t\t#KJ\n", + "UA = T0*deltaS2;\t\t\t#KJ\n", + "print \"Available energy in KJ : %.2f\"%A\n", + "print \"Part (iii) Unavailable energy in KJ : %.2f\"%UA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part (i) As energy leaves the hot gases : \n", + "Available energy in KJ : -824.87\n", + "Unavailable energy in KJ : -175.13\n", + "Part (ii) As energy enters the system : \n", + "Available energy in KJ : 439.77\n", + "Part (iii) Unavailable energy in KJ : 560.23\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.9 Page No : 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import scipy\n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables :\n", + "deltaQ = 850.;\t\t\t#KJ\n", + "T1 = 523.;\t\t\t#Kelvin\n", + "T2 = 873.;\t\t\t#Kelvin\n", + "T0 = 288.;\t\t\t#Kelvin\n", + "dQ_by_dT = 100.;\t\t\t#KJ/K\n", + "\n", + "\n", + "# Calculations and Results\n", + "def f3(T): \n", + "\t return 100/T\n", + "\n", + "deltaS = quad(f3,T1,T2)[0]\n", + "\n", + "\n", + "def f4(T): \n", + "\t return 100\n", + "\n", + "deltaQ = quad(f4,T1,T2)[0]\n", + "\n", + "print \"Total heat abstracted in KJ : \",deltaQ\n", + "\n", + "A = deltaQ-T0*deltaS;\t\t\t#KJ\n", + "print \"Availability in KJ : %.1f\"%A\n", + "\n", + "Loss = deltaQ-A;\t\t\t#KJ\n", + "print \"Loss of availability in KJ : %.1f\"%Loss\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total heat abstracted in KJ : 35000.0\n", + "Availability in KJ : 20244.2\n", + "Loss of availability in KJ : 14755.8\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.10 Page No : 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables :\n", + "p0 = 1.; \t\t\t#bar\n", + "T0 = 17.+273;\t\t\t#Kelvin\n", + "T1 = 1817.+273;\t\t\t#Kelvin\n", + "Cp = 1.;\t \t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "deltaQ = Cp*(T1-T0);\t\t\t#KJ/Kg\n", + "deltaS = Cp*math.log(T0/T1);\t\t\t#KJ/KgK\n", + "deltaS_fluid = -deltaS;\t\t\t#KJ/KgK(As deltaS_surrounding = 0)\n", + "A = deltaQ-T0*deltaS_fluid;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Availability of hot products in KJ : %.2f\"%A\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Availability of hot products in KJ : 1227.24\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.11 Page No : 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "T1 = 1200.;\t\t\t#Kelvin\n", + "T2 = 400.;\t\t\t#Kelvin\n", + "T0 = 300.;\t\t\t#Kelvin\n", + "Qsource = -150.;\t\t\t#KJ/s\n", + "Qsystem = 150.;\t\t\t#KJ/s\n", + "\n", + "# Calculations and Results\n", + "deltaS_source = Qsource/T1;\t\t\t#KJ/sK\n", + "deltaS_system = Qsystem/T2;\t\t\t#KJ/sK\n", + "deltaS_net = deltaS_source+deltaS_system;\t\t\t#KJ/sK\n", + "print \"Net change in entropy in KJ/sK : \",deltaS_net\n", + "\n", + "A1 = (T1-T0)*-deltaS_source;\t\t\t#KJ/s\n", + "print \"Available energy of heat source in KJ/s : \",A1\n", + "\n", + "A2 = (T2-T0)*deltaS_system;\t\t\t#KJ/s\n", + "print \"Available energy of system in KJ/s : \",A2\n", + "\n", + "E_decrease = A1-A2;\t\t\t#KJ/s\n", + "print \"Decrease in available energy in KJ/s : \",E_decrease\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net change in entropy in KJ/sK : 0.25\n", + "Available energy of heat source in KJ/s : 112.5\n", + "Available energy of system in KJ/s : 37.5\n", + "Decrease in available energy in KJ/s : 75.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.12 Page No : 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables :\n", + "Tg1 = 1127.+273;\t\t\t#Kelvin\n", + "Tg2 = 527.+273;\t\t\t#Kelvin\n", + "T2 = 250.+273;\t\t\t#Kelvin\n", + "T0 = 27.+273;\t\t\t#Kelvin\n", + "Cpg = 1.;\t\t\t#KJ/KgK\n", + "mw = 5.;\t\t\t#Kg/s\n", + "hfg = 1716.2;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "#mg*Cpg*(Tg1-Tg2) = mw*hfg\n", + "mg = mw*hfg/Cpg/(Tg1-Tg2);\t\t\t#Kg/s\n", + "print \"Mass flow rate of gases in Kg/s : %.1f\"%mg\n", + "\n", + "deltaSg = mg*Cpg*math.log(Tg2/Tg1);\t\t\t#KJ/sK\n", + "print \"Entropy change of gases in KJ/sK : %.4f\"%deltaSg\n", + "\n", + "deltaSw = mw*hfg/T2;\t\t\t#KJ/sK\n", + "print \"Entropy change of water in KJ/sK : %.4f\"%deltaSw\n", + "\n", + "deltaSnet = deltaSg+deltaSw;\t\t\t#KJ/sK\n", + "print \"Net Entropy change in KJ/sK : %.4f\"%deltaSnet\n", + "\n", + "Q1 = mw*hfg;\t\t\t#KJ/s\n", + "Sa_sub_Sb = -deltaSg;\t\t\t#KJ/sK\n", + "A1 = Q1-T0*(Sa_sub_Sb);\t\t\t#KJ/s\n", + "print \"Availability of hot gases in KJ/s : %.2f\"%A1\n", + "\n", + "A2 = Q1-T0*deltaSw;\t\t\t#KJ/s\n", + "print \"Availability of water in KJ/s : %.2f\"%A2\n", + "\n", + "UA1 = T0*(Sa_sub_Sb);\t\t\t#KJ/s\n", + "print \"Unavailable energy of hot gases in KJ/s : %.2f\"%UA1\n", + "\n", + "UA2 = T0*deltaSw;\t\t\t#KJ/s\n", + "print \"Unavailable energy of water in KJ/s : %.2f\"%UA2\n", + "\n", + "E_increase = T0*deltaSnet;\t\t\t#KJ/s\n", + "print \"Increase in unavailable energy in KJ/s : %.2f\"%E_increase\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flow rate of gases in Kg/s : 14.3\n", + "Entropy change of gases in KJ/sK : -8.0034\n", + "Entropy change of water in KJ/sK : 16.4073\n", + "Net Entropy change in KJ/sK : 8.4038\n", + "Availability of hot gases in KJ/s : 6179.97\n", + "Availability of water in KJ/s : 3658.82\n", + "Unavailable energy of hot gases in KJ/s : 2401.03\n", + "Unavailable energy of water in KJ/s : 4922.18\n", + "Increase in unavailable energy in KJ/s : 2521.15\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.13 Page No : 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "\t\t\t\n", + "# Variables :\n", + "mg = 5.;\t\t\t#Kg\n", + "p1 = 3.;\t\t\t#bar\n", + "T1 = 500.;\t\t\t#Kelvin\n", + "Q = 500.;\t\t\t#KJ\n", + "Cv = 0.8;\t\t\t#KJ/Kg\n", + "T0 = 300.;\t\t\t#Kelvin\n", + "T = 1300.;\t\t\t#Kelvin\n", + "\n", + "# Calculations\n", + "#Q = mg*Cv*(T2-T1)\n", + "T2 = Q/mg/Cv+T1;\t\t\t#Kelvin\n", + "A1 = Q-T0*Q/T;\t\t\t#KJ\n", + "deltaSg = mg*Cv*math.log(T2/T1);\t\t\t#KJ/K\n", + "Ag = Q-T0*deltaSg;\t\t\t#KJ\n", + "Loss = A1-Ag;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Loss of Availability due to heat transfer in KJ : %.1f\"%Loss\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss of Availability due to heat transfer in KJ : 152.4\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.14 Page No : 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 3.;\t\t\t#Kg\n", + "p1 = 3.;\t\t\t#bar\n", + "T1 = 450.;\t\t\t#Kelvin\n", + "Q = 600.;\t\t\t#KJ\n", + "Cv = 0.81;\t\t\t#KJ/Kg\n", + "T0 = 300.;\t\t\t#Kelvin\n", + "T = 1500.;\t\t\t#Kelvin\n", + "\n", + "# Calculations\n", + "deltaSsource = Q/T;\t\t\t#KJ/K\n", + "#Q = m*Cv*(T2-T1)\n", + "T2 = Q/m/Cv+T1;\t\t\t#Kelvin\n", + "A1 = Q-T0*deltaSsource;\t\t\t#KJ\n", + "deltaSg = m*Cv*math.log(T2/T1);\t\t\t#KJ/K\n", + "A2 = Q-T0*deltaSg;\t\t\t#KJ\n", + "Loss = A1-A2;\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Loss in available energy due to heat transfer in KJ : %.1f\"%Loss\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss in available energy due to heat transfer in KJ : 198.9\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch6.ipynb b/Thermodynamics_by_B._l._Singhal/ch6.ipynb new file mode 100755 index 00000000..a7ed62ba --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch6.ipynb @@ -0,0 +1,1879 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5459d630b29dbbdfd93621a60c527ff0a5f89773e97a2a1d2563ab75e7bd7c03" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Properties of Steam" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.1 Page No : 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 2.; \t\t\t#Kg\n", + "p = 8.;\t \t\t#bar\n", + "H = 5535.;\t\t\t#KJ\n", + "\n", + "# Calculations and Results\n", + "h = H/m;\t\t\t#KJ/Kg\n", + "hg = 2767.5;\t\t#KJ/Kg\n", + "print \"Specific Enthalpy in KJ/Kg : %.1f\"%h\n", + "print \"Given Enthalpy in KJ/Kg : %.1f\"%hg\n", + "print (\"Given enthalpy = specific enthalpy. System is dry saturated.\");\n", + "\n", + "m = 1;\t\t\t#Kg\n", + "p = 2550*10**3/10**5;\t\t\t#bar\n", + "v = 0.2742;\t\t\t#m**3/Kg\n", + "print \"Specific volume in m**3/Kg : %.4f\"%v\n", + "vg = 0.078352;\t\t\t#m**3\n", + "print \"Given specific volume in m**3/Kg : %.4f\"%vg\n", + "\n", + "Ts = 225+273;\t\t\t#K\n", + "print (\"Since v>vg. System is super heated.\");\n", + "Tsup = v/vg*Ts;\t\t\t#K\n", + "print \"Temperature of super heated steam in degree C :%.1f\"%(Tsup-273)\n", + "\n", + "m = 1;\t\t\t#Kg\n", + "p = 60;\t\t\t#bar\n", + "h = 2470.73;\t\t\t#KJ/Kg\n", + "print \"Enthalpy in KJ/Kg : %.1f\"%h\n", + "\n", + "hg = 2475;\t\t\t#KJ/Kg\n", + "print \"Given enthalpy in KJ/Kg : %.1f\"%hg\n", + "print (\"Since h>hg. System is in vapour state.\");\n", + "\t\t\t#let x be the dryness fraction\n", + "\t\t\t#h = hf+x*hg\n", + "hf = 1213.69;\t\t\t#KJ/Kg\n", + "hfg = 1517.3;\t\t\t#KJ/Kg\n", + "x = (h-hf)/hfg;\n", + "print \"Dryness fraction : %.1f\"%x\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific Enthalpy in KJ/Kg : 2767.5\n", + "Given Enthalpy in KJ/Kg : 2767.5\n", + "Given enthalpy = specific enthalpy. System is dry saturated.\n", + "Specific volume in m**3/Kg : 0.2742\n", + "Given specific volume in m**3/Kg : 0.0784\n", + "Since v>vg. System is super heated.\n", + "Temperature of super heated steam in degree C :1469.8\n", + "Enthalpy in KJ/Kg : 2470.7\n", + "Given enthalpy in KJ/Kg : 2475.0\n", + "Since h>hg. System is in vapour state.\n", + "Dryness fraction : 0.8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2 Page No : 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p = 5;\t\t\t#bar\n", + "x = 0.98;\n", + "ts = 151.84;\t\t\t#degree C\n", + "hf = 652.8;\t\t\t#KJ/Kg\n", + "hfg = 2098;\t\t\t#KJ/Kg\n", + "vg = 0.373;\t\t\t#m**3/Kg\n", + "\n", + "# Calculations and Results\n", + "print \"Temperature of steam in degree C : %.2f\"%ts\n", + "h = hf+x*hfg;\t\t\t#KJ/Kg\n", + "print \"Enthalpy of steam in KJ/Kg : %.2f\"%h\n", + "v = x*vg;\t\t\t#m**3/Kg\n", + "print \"Specific volume in m**3/Kg ; %.4f\"%v\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of steam in degree C : 151.84\n", + "Enthalpy of steam in KJ/Kg : 2708.84\n", + "Specific volume in m**3/Kg ; 0.3655\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3 Page No : 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 1;\t\t\t#Kg\n", + "p = 12;\t\t\t#bar\n", + "x = 0.95;\n", + "ts = 187.96;\t\t\t#degree C\n", + "vg = 0.1632;\t\t\t#m**3/Kg\n", + "hf = 814.7;\t\t\t#KJ/Kg\n", + "hfg = 1970.7;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "print \"Temperature of steam in degree C : \",ts\n", + "\n", + "v = x*vg;\t\t\t#m**3/Kg\n", + "print \"Specific volume in m**3/Kg ; \",v\n", + "h = hf+x*hfg;\t\t\t#KJ/Kg\n", + "print \"Enthalpy of steam in KJ/Kg : %.1f\"%h\n", + "u = h-p*10**5*v/1000;\t\t\t#KJ/Kg\n", + "print \"Internal energy in KJ/Kg : %.1f\"%u\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of steam in degree C : 187.96\n", + "Specific volume in m**3/Kg ; 0.15504\n", + "Enthalpy of steam in KJ/Kg : 2686.9\n", + "Internal energy in KJ/Kg : 2500.8\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4 Page No : 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 1.;\t\t \t#Kg\n", + "p = 8.;\t\t\t #bar\n", + "Tsup = 280.;\t\t\t#degree C\n", + "h1 = 2950.4;\t\t\t#KJ/Kg(at 250 degree C)\n", + "h2 = 3057.3;\t\t\t#KJ/Kg(at 300 degree C)\n", + "Tsup1 = 250.;\t\t\t#degree C\n", + "Tsup2 = 300.;\t\t\t#degree C\n", + "\n", + "# Calculations and Results\n", + "hsup = h1+(h2-h1)/(Tsup2-Tsup1)*(Tsup-Tsup1);\t\t\t#KJ/Kg\n", + "print \"Specific enthalpy in KJ/Kg : %.1f\"%hsup\n", + "\n", + "v1 = 0.293;\t\t\t#m**3/Kg(at 250 degree C)\n", + "v2 = 0.324;\t\t\t#m**3/Kg(at 300 degree C)\n", + "vsup = v1+(v2-v1)/(Tsup2-Tsup1)*(Tsup-Tsup1);\t\t\t#m**3/Kg\n", + "print \"Specific volume in m**3/Kg : \",vsup\n", + "\n", + "S1 = 7.04;\t\t\t#KJ/KgK(at 250 degree C)\n", + "S2 = 7.235;\t\t\t#KJ/KgK(at 300 degree C)\n", + "Ssup = S1+(S2-S1)/(Tsup2-Tsup1)*(Tsup-Tsup1)\n", + "print \"Specific enthalpy in KJ/KgK : \",Ssup\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific enthalpy in KJ/Kg : 3014.5\n", + "Specific volume in m**3/Kg : 0.3116\n", + "Specific enthalpy in KJ/KgK : 7.157\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.5 Page No : 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 0.1;\t\t\t#bar\n", + "p2 = 0.1;\t\t\t#bar\n", + "x1 = 0.95;\n", + "t3 = 20.;\t\t\t#degree C\n", + "t2 = 35.;\t\t\t#degree C\n", + "t4 = 45.;\t\t\t#degree C\n", + "hf1 = 191.8;\t\t\t#KJ/Kg\n", + "hfg1 = 2397.9;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations\n", + "h1 = hf1+x1*hfg1;\t\t\t#KJ/kg\n", + "h2 = 188.4;\t\t\t#KJ/Kg(at 45 degree C)\n", + "h3 = 83.9;\t\t\t#KJ/Kg(at 20 degree C)\n", + "h4 = 146.6;\t\t\t#KJ/Kg(at 35 degree C)\n", + "#m1*(h1-h2) = mw*(h4-h3)\n", + "mwBYm1 = (h1-h2)/(h4-h3);\t\t\t#Kg of water/Kg of steam\n", + "\n", + "# Results\n", + "print \"Ratio of mass flow rate of cooling water to condensing steam(Kg of water/Kg of steam): %.3f\"%mwBYm1\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ratio of mass flow rate of cooling water to condensing steam(Kg of water/Kg of steam): 36.386\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "V = 3.;\t\t\t#m**3\n", + "t = 200.;\t\t\t#degree C\n", + "Pat = 1.;\t\t\t#bar\n", + "Pgauge = 7.;\t\t\t#bar\n", + "P = Pgauge+Pat;\t\t\t#bar\n", + "ts = 170.41;\t\t\t#degree C\n", + "tsup = t;\t\t\t#degree C\n", + "vsup = 0.261;\t\t\t#m**3/Kg\n", + "hsup = 2838.6;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "m = V/vsup;\t\t\t#Kg\n", + "H = m*hsup;\t\t\t#KJ\n", + "print \"Total Enthalpy in KJ : %.2f\"%H\n", + "#H = U+p*V\n", + "U = H-P*10**5*V/1000;\t\t\t#KJ\n", + "print \"Total internal energy of system in KJ : %.2f\"%U\n", + "print \"Mass of steam in Kg : %.3f\"%m\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total Enthalpy in KJ : 32627.59\n", + "Total internal energy of system in KJ : 30227.59\n", + "Mass of steam in Kg : 11.494\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.7 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "mw = 1.;\t\t\t#Kg\n", + "m_steam = 39.;\t\t\t#mass of dry steam in Kg\n", + "\n", + "# Calculations\n", + "ms = mw+m_steam;\t\t\t#Kg\n", + "x = m_steam/ms;\t\t\t#dryness fraction\n", + "\n", + "# Results\n", + "print \"Dryness fraction ; \",x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction ; 0.975\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.8 Page No : 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 10.;\t\t\t#Kg\n", + "p = 10.;\t\t\t#bar\n", + "x = 0.9;\n", + "t1 = 20.;\t\t\t#degree C\n", + "hf = 762.6;\t\t\t#KJ/Kg\n", + "hfg = 2013.6;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "H = m*(hf+x*hfg);\t\t\t#KJ;\n", + "print \"Enthalpy of wet steam in KJ : \",H\n", + "\n", + "hf1 = 83.9;\t\t\t#KJ/Kg(at 20 degree C)\n", + "Hf1 = m*hf1;\t\t\t#KJ\n", + "HeatAdded = H-Hf1;\t\t\t#KJ\n", + "print \"Heat added in KJ : \",HeatAdded\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enthalpy of wet steam in KJ : 25748.4\n", + "Heat added in KJ : 24909.4\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.9 Page No : 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "t = 50.;\t\t\t#degree C\n", + "p1 = 13.;\t\t\t#bar\n", + "Cpw = 4.187;\t\t\t#KJ/KgK\n", + "Cp = 0.0535;\t\t\t#KJ/KgK\n", + "x1 = 0.97;\n", + "hf = Cpw*(t-0);\t\t\t#KJ/Kg\n", + "hf1 = 814.7;\t\t\t#KJ/Kg(at p1 = 13 bar)\n", + "hfg1 = 1970.7;\t\t\t#KJ/Kg(at p1 = 13 bar)\n", + "hg1 = 2785.4;\t\t\t#KJ/Kg(at p1 = 13 bar)\n", + "\n", + "# Calculations and Results\n", + "Q = hf1+x1*hfg1-hf;\t\t\t#KJ/Kg\n", + "print \"Heat required to produce steam in KJ/Kg : %.2f\"%Q\n", + "Q1 = hg1-hf;\t\t\t#KJ/Kg\n", + "print \"Heat required to produce dry saturated steam in KJ/Kg : \",Q1\n", + "tsup1SUBts1 = 40;\t\t\t#degree C\n", + "Q2 = hg1+Cp*(tsup1SUBts1)-hf;\t\t\t#KJ/Kg\n", + "print \"Heat required to produce super heated steam in KJ/Kg : \",Q2\n", + "\t\t\t#Steam table is used to get some data.\n", + "\t\t\t#Ans is wrong in the book for last part.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat required to produce steam in KJ/Kg : 2516.93\n", + "Heat required to produce dry saturated steam in KJ/Kg : 2576.05\n", + "Heat required to produce super heated steam in KJ/Kg : 2578.19\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.10 Page No : 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p = 8;\t\t\t#bar\n", + "x = 0.8;\n", + "vf = 0.001115;\t\t\t#m**3/kg\n", + "vg = 0.24;\t\t\t#m**3/kg\n", + "hf = 720.9;\t\t\t#kJ/kg(at p = 8 bar)\n", + "hfg = 2046.5;\t\t\t#kJ/kg(at p = 8 bar)\n", + "m = 1;\t\t\t#kg\n", + "\n", + "# Calculations and Results\n", + "We = 100*p*(x*vg-vf);\t\t\t#kJ/kg\n", + "print \"External workdone during evaporation in kJ/kg : %.2f\"%We\n", + "\n", + "Q = x*hfg-We;\t\t\t#KJ\n", + "print \"External latent heat of steam in kJ: %.2f\"%Q\n", + "\n", + "\t\t\t#Steam table is used to get some data.\n", + "\t\t\t#Ans is wrong in the book for last part.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "External workdone during evaporation in kJ/kg : 152.71\n", + "External latent heat of steam in kJ: 1484.49\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.11 Page No : 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 20.;\t\t\t#bar\n", + "Tsup1 = 350.;\t\t\t#degree C\n", + "m1 = 1.;\t\t\t#Kg\n", + "p2 = 20.;\t\t\t#bar\n", + "m2 = 1.;\t\t\t#Kg\n", + "p3 = p1;\t\t\t#bar\n", + "Tsup3 = 250.;\t\t\t#degree C\n", + "m3 = m1+m2;\t\t\t#Kg\n", + "Cp = 2.25;\t\t\t#KJ/Kg\n", + "hg1 = 2797.2;\t\t\t#KJ/Kg(at p = 20 bar)\n", + "hg2 = hg1;\t\t\t#KJ/Kg(at p = 20 bar)\n", + "hg3 = hg1;\t\t\t#KJ/Kg(at p = 20 bar)\n", + "ts1 = 212.37;\t\t\t#degree C\n", + "ts2 = ts1;\t\t\t#degree C\n", + "ts3 = ts1;\t\t\t#degree C\n", + "\n", + "# Calculations and Results\n", + "#m1*h1+m2*h2 = m3*h3\n", + "h2 = (m3*(hg3+Cp*(Tsup3-ts3))-m1*(hg1+Cp*(Tsup1-ts1)))/m2;\t\t\t#KJ/Kg\n", + "print \"Enthalpy of boiler2 in KJ/Kg : %.2f\"%h2\n", + "print \"hg2(KJ/Kg) : \",hg2\n", + "print (\"steam is wet because h2<hg2\")\n", + "\t\t\t#h2 = hf2+x2*hfg2\t\t\t# as steam is wet because h2<hg2\n", + "hf2 = 908.6;\t\t\t#KJ/Kg\n", + "hfg2 = 1888.6;\t\t\t#KJ/Kg\n", + "x2 = (h2-hf2)/hfg2;\t\t\t#\n", + "print \"Dryness : %.5f\"%x2\n", + "\t\t\t#Steam table is used to get some data.\n", + "\t\t\t#Ans is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enthalpy of boiler2 in KJ/Kg : 2656.87\n", + "hg2(KJ/Kg) : 2797.2\n", + "steam is wet because h2<hg2\n", + "Dryness : 0.92569\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.12 Page No : 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 2.;\t\t\t#Kg\n", + "p = 8.;\t\t\t#bar\n", + "x = 0.8;\n", + "hf = 720.9;\t\t\t#KJ/Kg(at p = 8 bar)\n", + "hfg = 2046.5;\t\t\t#KJ/Kg(at p = 8 bar)\n", + "\n", + "# Calculations and Results\n", + "h = hf+x*hfg;\t\t\t #KJ/Kg\n", + "H = m*h;\t\t\t #KJ\n", + "print \"Total enthalpy of steam in KJ : \",H\n", + "\n", + "Vg = 0.227;\t\t\t #m**3/Kg\n", + "V = m*x*Vg;\t\t\t #m**3\n", + "print \"Volume in m**3 : \",V\n", + "\n", + "We = p*10**5*V/1000;\t\t\t#KJ\n", + "print \"External work of evaporation in KJ : \",We\n", + "\n", + "U = H-We;\t\t\t #KJ\n", + "print \"Total internal energy in KJ : \",U\n", + "\n", + "Sf = 2.061;\t\t \t #KJ/K\n", + "Sfg = 4.578;\t\t \t#KJ/K\n", + "S = m*(Sf+x*Sfg);\t\t\t#KJ/K\n", + "print \"Total entropy in KJ/K : \",S\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total enthalpy of steam in KJ : 4716.2\n", + "Volume in m**3 : 0.3632\n", + "External work of evaporation in KJ : 290.56\n", + "Total internal energy in KJ : 4425.64\n", + "Total entropy in KJ/K : 11.4468\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.13 Page No : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 600.;\t\t\t#KPa\n", + "p1 = p1/100.;\t\t\t#bar\n", + "T1 = 200.;\t\t\t#degree C\n", + "Vsup1 = 0.352;\t\t\t#m**3/Kg(at 6 bar)\n", + "V1 = Vsup1;\t\t\t#m**3/Kg\n", + "V2 = V1;\t\t\t#m**3(system is at consmath.tant volume)\n", + "Vg2 = V2;\t\t\t#m**3/Kg(For dry saturated)\n", + "Tsup1 = 153.3;\t\t\t#degree C\n", + "Tsup2 = 154.8;\t\t\t#degree C\n", + "vg1 = 0.34844;\t\t\t#m**3/Kg\n", + "vg2 = 0.36106;\t\t\t#m**3/Kg\n", + "\n", + "# Calculations and Results\n", + "ts2 = Tsup1+(Tsup2-Tsup1)/(vg2-vg1)*(V1-vg1);\t\t\t#degree C\n", + "print \"Temperature at which steam begins to condense in degree C : %.2f\"%ts2\n", + "\n", + "pg1 = 5.2;\t\t\t#bar\n", + "pg2 = 5.4;\t\t\t#bar\n", + "p2 = pg1+(pg2-pg1)/(Tsup2-Tsup1)*(ts2-Tsup1);\t\t\t#bar\n", + "print \"Pressure in bar is : %.3f\"%p2\n", + "\t\t\t#Some data is taken from steam table.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature at which steam begins to condense in degree C : 153.72\n", + "Pressure in bar is : 5.256\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.14 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 2.;\t\t\t#Kg\n", + "p1 = 15.;\t\t\t#bar\n", + "p2 = 15.;\t\t\t#bar\n", + "Tsup1 = 250.;\t\t\t#degree C\n", + "T1 = Tsup1;\t\t\t#degree C\n", + "V1 = 0.152;\t\t\t#m**3/Kg(at 15 bar)\n", + "hf2 = 844.7;\t\t\t#KJ/Kg(at p = 15 bar)\n", + "hg2 = 2789.9;\t\t\t#KJ/Kg(at p = 15 bar)\n", + "hfg2 = 1945.2;\t\t\t#KJ/Kg(at p = 15 bar)\n", + "h1 = 2923.;\t\t\t#KJ/Kg\n", + "Vg2 = 0.1317;\t\t\t#m**3/Kg(at 15 bar)\n", + "x2 = 0.6;\t\t\t#dry\n", + "\n", + "# Calculations and Results\n", + "h2 = hf2+x2*hfg2;\t\t\t#KJ/Kg\n", + "V2 = x2*Vg2;\t\t\t#m**3/Kg\n", + "w = (p2*V2-p1*V1)*10**5/10**3;\t\t\t#KJ/Kg\n", + "W = m*w;\t\t\t#KJ\n", + "print \"Total work done in KJ : \",W\n", + "\n", + "H2subH1 = m*(h2-h1);\t\t\t#KJ/Kg\n", + "print \"Change in enthalpy in KJ/Kg : %.1f\"%H2subH1\n", + "\n", + "Q = H2subH1;\t\t\t#KJ\n", + "print \"Heat transfered in KJ : %.1f\"%Q\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total work done in KJ : -218.94\n", + "Change in enthalpy in KJ/Kg : -1822.4\n", + "Heat transfered in KJ : -1822.4\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.15 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "p_gauge = 15.;\t\t\t#bar\n", + "p_at = 750.;\t\t\t#mm of Hg\n", + "p_at = p_at/760.*1.01325;\t\t\t#bar\n", + "p = p_gauge+p_at;\t\t\t#bar\n", + "ms = 200.;\t\t\t#Kg/hr\n", + "Cpw = 4.187;\t\t\t#KJ/KgK\n", + "t1 = 80.;\t\t\t#degree C\n", + "hf1 = Cpw*t1;\t\t\t#KJ/Kg\n", + "hf2 = 858.6;\t\t\t#KJ/Kg(at p = 16 bar)\n", + "hg2 = 2791.8;\t\t\t#KJ/Kg(at p = 16 bar)\n", + "hfg2 = 1933.2;\t\t\t#KJ/Kg(at p = 16 bar)\n", + "ts = 201.37;\t\t\t#degree C\n", + "x2 = 0.8;\t\t\t#dry\n", + "\n", + "# Calculations and Results\n", + "h2 = hf2+x2*hfg2;\t\t\t#KJ/Kg\n", + "q = ms*(h2-hf1);\t\t\t#KJ/hr\n", + "q = q/3600;\t\t\t#KJ/s\n", + "print \"Heat transfer in boiler in KJ/s : %.3f\"%q\n", + "\n", + "tsup = ts+t1;\t\t\t#degree C\n", + "Cp = 2.2;\t\t\t#KJ/KgK\n", + "hsup3 = hg2+Cp*(tsup-ts);\t\t\t#KJ/Kg\n", + "qsup = ms*(hsup3-h2)/3600;\t\t\t#KJ/s\n", + "print \"Heat transfered in superheated steam in KJ/s : %.3f\"%qsup\n", + "\n", + "Vg = 0.1237;\t\t\t#m**3/Kg(at 16 bar)\n", + "Ts = 201.37+273;\t\t\t#K\n", + "Tsup = tsup+273;\t\t\t#K\n", + "Vsup = Tsup/Ts*Vg;\t\t\t#m**3/Kg\n", + "density = 1/Vsup;\t\t\t#Kg/m**3\n", + "print \"Density of steam in Kg/m**3 : %.3f\"%density\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transfer in boiler in KJ/s : 115.011\n", + "Heat transfered in superheated steam in KJ/s : 31.258\n", + "Density of steam in Kg/m**3 : 6.917\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.16 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m = 1.5;\t\t\t#Kg\n", + "p1 = 5;\t\t\t#bar\n", + "x1 = 0.8;\t\t\t#dry\n", + "x2 = 0.4;\t\t\t#dry\n", + "Vg1 = 0.373;\t\t\t#m**3/Kg(at 5 bar)\n", + "hf1 = 640.1;\t\t\t#KJ/Kg(at p = 5 bar)\n", + "hfg1 = 2107.4;\t\t\t#KJ/Kg(at p = 5 bar)\n", + "Vg2 = x1/x2*Vg1;\t\t\t#m**3/Kg\n", + "p2 = 4.;\t\t\t#bar(at Vg2 = 0.746)\n", + "hf2 = 529.6;\t\t\t#KJ/Kg(at p = 4 bar)\n", + "hfg2 = 2184.9;\t\t\t#KJ/Kg(at p = 4 bar)\n", + "\n", + "# Calculations\n", + "V1 = x1*Vg1;\t\t \t#m**3/Kg\n", + "V2 = V1;\t\t\t #m**3/Kg\n", + "h1 = hf1+x1*hfg1;\t\t\t#KJ/Kg\n", + "h2 = hf2+x2*hfg2;\t\t\t#KJ/Kg\n", + "Q = m*((h2-h1)-100*(p2*V2-p1*V1));\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Quantity of heat in KJ : \",Q\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quantity of heat in KJ : -1338.93\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.17 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 1;\t\t\t#bar\n", + "x1 = 0.523;\t\t\t#dry\n", + "Vg1 = 1.694;\t\t\t#m**3/Kg(at 1 bar)\n", + "hf1 = 417.5;\t\t\t#KJ/Kg(at p = 1 bar)\n", + "hfg1 = 2258;\t\t\t#KJ/Kg(at p = 1 bar)\n", + "\n", + "# Calculations\n", + "h1 = hf1+x1*hfg1;\t\t\t#KJ/Kg\n", + "V1 = x1*Vg1;\t\t\t#m**3/Kg\n", + "V2 = V1;\t\t\t#m**3/Kg(Consmath.tant volume process)\n", + "Vg2 = V2;\t\t\t#m**3/Kg\n", + "p2 = 2;\t\t\t#bar;\t\t\t#at Vg2 from steam table\n", + "hg2 = 2706.3;\t\t\t#KJ/Kg(at 2 bar)\n", + "h2 = hg2;\t\t\t#KJ/Kg\n", + "W = 0;\t\t\t#KJ/Kg of steam\n", + "q = W+(h2-h1)-100*(p2*V2-p1*V1);\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Heat transfered in KJ/Kg : %.1f\"%q\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transfered in KJ/Kg : 1019.3\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.18 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "V1 = 0.9;\t\t\t#m**3\n", + "p1 = 8;\t\t\t#bar\n", + "x1 = 0.9;\t\t\t#dry\n", + "p2 = 4;\t\t\t#bar\n", + "Vg1 = 0.24;\t\t\t#m**3/Kg(at 8 bar)\n", + "hf1 = 720.9;\t\t\t#KJ/Kg(at p = 8 bar)\n", + "hfg1 = 2046.5;\t\t\t#KJ/Kg(at p = 8 bar)\n", + "Vg2 = 0.462;\t\t\t#m**3/Kg(at 4 bar)\n", + "hf2 = 604.7;\t\t\t#KJ/Kg(at p = 4 bar)\n", + "hfg2 = 2132.9;\t\t\t#KJ/Kg(at p = 4 bar)\n", + "\n", + "# Calculations and Results\n", + "#h1 = h2 : hf1+x1*hfg1 = hf2+x2*hfg2\n", + "x2 = ((hf1+x1*hfg1)-hf2)/hfg2;\t\t\t#dry\n", + "print \"Dryness fraction of steam : %.3f\"%x2\n", + "\n", + "m1 = V1/x1/Vg1;\t\t\t#Kg\n", + "V2 = V1;\t\t\t#m**3\n", + "m2 = V2/x2/Vg2;\t\t\t#Kg\n", + "m = m1-m2;\t\t\t#Kg\n", + "print \"Mass of steam blown off in Kg : %.4f\"%m\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of steam : 0.918\n", + "Mass of steam blown off in Kg : 2.0447\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.19 Page No : 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 5.;\t\t\t#Kg\n", + "p1 = 10.;\t\t\t#bar\n", + "x1 = 0.9;\t\t\t#dry\n", + "p2 = 4.;\t\t\t#bar\n", + "ts1 = 179.88;\t\t\t#degree C(at 10 bar)\n", + "print \"Final condition of steam,(Temperature in degree C) : \",ts1\n", + "\n", + "Vg1 = 0.1943;\t\t\t#m**3/Kg(at 8 bar)\n", + "hf1 = 762.6;\t\t\t#KJ/Kg(at p = 10 bar)\n", + "hfg1 = 2013.6;\t\t\t#KJ/Kg(at p = 10 bar)\n", + "h1 = hf1+x1*hfg1;\t\t\t#KJ/Kg\n", + "V1 = x1*Vg1;\t\t\t#KJ/kg\n", + "u1 = h1-p1*V1*10**5/1000;\t\t\t#KJ/Kg\n", + "U1 = m*u1;\t\t\t#KJ\n", + "Tsup2 = 179.88;\t\t\t#degree C\n", + "t11 = 150;\t\t\t#degree C\n", + "h11 = 2752;\t\t\t#KJ/Kg(at 4bar,150 degree C)\n", + "v11 = 0.471;\t\t\t#m**3/Kg(at 4bar,150 degree C)\n", + "s11 = 6.929;\t\t\t#KJ/KgK(at 4bar,150 degree C)\n", + "t22 = 200;\t\t\t#degree C\n", + "h22 = 2860.4;\t\t\t#KJ/Kg(at 4bar,200 degree C)\n", + "v22 = 0.534;\t\t\t#m**3/Kg(at 4bar,200 degree C)\n", + "s22 = 7.171;\t\t\t#KJ/KgK(at 4bar,200 degree C)\n", + "h2 = h11+(h22-h11)/(t22-t11)*(ts1-t11);\t\t\t#KJ/Kg\n", + "v2 = v11+(v22-v11)/(t22-t11)*(ts1-t11);\t\t\t#m**3/Kg\n", + "s2 = s11+(s22-s11)/(t22-t11)*(ts1-t11);\t\t\t#m**3\n", + "u2 = h2-p2*10**5*v2/1000;\t\t\t#KJ/Kg\n", + "U2 = m*u2;\t\t\t#KJ\n", + "deltaU = U2-U1;\t\t\t#KJ\n", + "print \"Change in internal energy in KJ : %.1f\"%deltaU\n", + "\n", + "sf1 = 2.138;\t\t\t#KJ/KgK\n", + "sfg1 = 4.445;\t\t\t#KJ/Kg\n", + "s1 = (sf1+x1*sfg1);\t\t\t#KJ/KgK\n", + "deltaS = m*(s2-s1);\t\t\t#KJ/K\n", + "Q = (ts1+273)*(deltaS);\t\t\t#KJ\n", + "print \"Heat transfer in KJ : %.1f\"%Q\n", + "\n", + "W = Q-deltaU;\t\t\t#KJ\n", + "print \"Workdone in KJ : %.1f\"%W\n", + "\t\t\t#Steam table is used to get some data.\n", + "\t\t\t#Answer is not accurate in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final condition of steam,(Temperature in degree C) : 179.88\n", + "Change in internal energy in KJ : 1066.8\n", + "Heat transfer in KJ : 2117.5\n", + "Workdone in KJ : 1050.7\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.20 Page No : 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m = 2.;\t\t\t#Kg\n", + "p1 = 15.;\t\t\t#bar\n", + "V1 = 0.3;\t\t\t#m**3\n", + "p2 = 1.5;\t\t\t#bar\n", + "v1 = V1/m;\t\t\t#m**3/Kg\n", + "\n", + "# Calculations and Results\n", + "#p1*v1**(1.3) = p2*v2**(1.3)\n", + "v2 = math.exp((math.log(p1)+1.3*math.log(v1)-math.log(p2))/1.3);\t\t\t#m**3/Kg\n", + "Vg2 = 1.1635;\t\t\t#m**3/Kg(at 1.5 bar)\n", + "x2 = v2/Vg2;\t\t\t#dry\n", + "print \"Dryness of steam : %.4f\"%x2\n", + "n = 1.3;\n", + "W = m*(p1*v1-p2*v2)*10**5/(n-1);\t\t\t#J\n", + "W = W/1000;\t\t\t#KJ\n", + "print \"Workdone in KJ : %.1f\"%W\n", + "\t\t\t#Steam table is used to get some data.\n", + "\t\t\t#Answer is wrong in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness of steam : 0.7578\n", + "Workdone in KJ : 618.3\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.21 Page No : 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "m1 = 5.;\t\t\t#Kg\n", + "p1 = 5.;\t\t\t#bar\n", + "Tsup1 = 200.;\t\t\t#degree C\n", + "p2 = 0.1;\t\t\t#bar\n", + "h1 = 2855;\t\t\t#KJ/Kg(from molliers diagram)\n", + "h2 = 2235;\t\t\t#KJ/Kg(from molliers diagram)\n", + "\n", + "# Calculations\n", + "W = m1*(h1-h2);\t\t\t#KJ\n", + "\n", + "# Results\n", + "print \"Workdone in KJ : \",W\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Workdone in KJ : 3100.0\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.22 Page No : 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 160.;\t\t\t#bar\n", + "Tsup1 = 550.;\t\t\t#degree C(from steam table)\n", + "q = 0.;\t\t\t#adiabatic process\n", + "deltaS = 0.1;\t\t\t#KJ/KgK\n", + "p2 = 0.2;\t\t\t#bar\n", + "t11 = 500.;\t\t\t#degree C\n", + "t22 = 600.;\t\t\t#degree C\n", + "h11 = 3297.1;\t\t\t#KJ/Kg(at 4bar,500 degree C)\n", + "h22 = 3571.;\t\t\t#KJ/Kg(at 4bar,600 degree C)\n", + "\n", + "# Calculations\n", + "h1 = h11+(h22-h11)/(t22-t11)*(Tsup1-t11);\t\t\t#KJ/Kg\n", + "s11 = 6.305;\t\t\t#KJ/KgK(at 4bar,500 degree C)\n", + "s22 = 6.639;\t\t\t#KJ/KgK(at 4bar,600 degree C)\n", + "s1 = s11+(s22-s11)/(t22-t11)*(Tsup1-t11);\t\t\t#KJ/KgK\n", + "s2 = deltaS+s1;\t\t\t#KJ/KgK\n", + "hf2 = 251.4;\t\t\t#KJ/Kg(at 0.2 bar)\n", + "hfg2 = 2358.2;\t\t\t#KJ/Kg(at 0.2 bar)\n", + "sf2 = 0.832;\t\t\t#KJ/KgK(at 0.2 bar)\n", + "sfg2 = 7.077;\t\t\t#KJ/KgK(at 0.2 bar)\n", + "\t\t\t#s2 = sf2+x2*sfg2\n", + "x2 = (s2-sf2)/sfg2;\t\t\t#dryness\n", + "h2 = hf2+x2*hfg2;\t\t\t#KJ\n", + "Wsf_a = h1-h2;\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Actual Work of expansion in KJ : %.1f\"%Wsf_a\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Actual Work of expansion in KJ : 1270.0\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.23 Page No : 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "mdot = 2.;\t\t\t#Kg/s\n", + "p1 = 10.;\t\t\t#bar\n", + "Tsup1 = 200.;\t\t\t#degree C(from steam table)\n", + "p2 = 1.;\t\t\t#bar\n", + "h1 = 2826.8;\t\t\t#KJ/Kg(at 10bar,200 degree C)\n", + "S1 = 6.692;\t\t\t#KJ/KgK(at 10bar,200 degree C)\n", + "ts2 = 99.63;\t\t\t#degree C(at 1bar)\n", + "Vg2 = 1.694;\t\t\t#m**3/Kg(at 1bar)\n", + "hf2 = 417.5;\t\t\t#KJ/Kg(at 1bar)\n", + "hfg2 = 2258.;\t\t\t#KJ/Kg(at 1bar)\n", + "sf2 = 1.303;\t\t\t#KJ/KgK(at 1bar)\n", + "sfg2 = 6.057;\t\t\t#KJ/KgK(at 1bar)\n", + "\n", + "# Calculations\n", + "#S1 = sf2+x2*sfg2\n", + "x2 = (S1-sf2)/sfg2;\t\t\t#dryness\n", + "V3 = x2*Vg2;\t\t\t#m**3/Kg\n", + "t2 = ts2;\t\t\t#degree C\n", + "S2 = S1;\t\t\t#KJ/KgK\n", + "Qdot = 0;\t\t\t#KJ\n", + "h2 = hf2+x2*hfg2;\t\t\t#KJ/Kg\n", + "Wsf_dot = Qdot-mdot*((h2-h1));\t\t\t#KJ/Kg\n", + "\n", + "# Results\n", + "print \"Final specific volume, v2 = %.4f m**3/kg\"%V3\n", + "print \"Final temperature , t2 = %.2f C\"%t2\n", + "print \"Final specific entropy, S2 = %.3f kJ/kg K\"%S2\n", + "print \"Work output of turbine in KJ/s or W : %.1f\"%Wsf_dot\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final specific volume, v2 = 1.5072 m**3/kg\n", + "Final temperature , t2 = 99.63 C\n", + "Final specific entropy, S2 = 6.692 kJ/kg K\n", + "Work output of turbine in KJ/s or W : 800.6\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.24 Page No : 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 7.;\t\t\t#bar\n", + "x1 = 0.8;\t\t\t#dryness\n", + "p2 = 1.;\t\t\t#bar\n", + "hf1 = 697.;\t\t\t#KJ/Kg(at 7bar)\n", + "hfg1 = 2064.9;\t\t\t#KJ/Kg(at 7bar)\n", + "hf2 = 417.5;\t\t\t#KJ/Kg(at 1bar)\n", + "hfg2 = 2258;\t\t\t#KJ/Kg(at 1bar)\n", + "\n", + "# Calculations and Results\n", + "#hf1+x1*hfg1 = hf2+x2*hfg2\n", + "x2 = (hf1+x1*hfg1-hf2)/hfg2;\t\t\t#dryness\n", + "print \"Final conditio of steam(dryness) : %.4f\"%x2\n", + "\n", + "sf2 = 1.303;\t\t\t#KJ/Kg(at 1bar)\n", + "sfg2 = 6.057;\t\t\t#KJ/Kg(at 1bar)\n", + "sf1 = 1.992;\t\t\t#KJ/Kg(at 7bar)\n", + "sfg1 = 4.713;\t\t\t#KJ/Kg(at 7bar)\n", + "deltaS = (sf2+x2*sfg2)-(sf1+x1*sfg1)\n", + "print \"Change in entropy in KJ/KgK : %.4f\"%deltaS\n", + "print \"Entropy change of surroundings = %.4f KJ/kg K\"%(deltaS + 0)\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final conditio of steam(dryness) : 0.8554\n", + "Change in entropy in KJ/KgK : 0.7216\n", + "Entropy change of surroundings = 0.7216 KJ/kg K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.25 Page No : 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "p1 = 10.;\t\t\t#bar\n", + "x1 = 0.9;\t\t\t#dryness\n", + "p2 = 1.;\t\t\t#bar\n", + "hf1 = 762.6;\t\t\t#KJ/Kg(at 10bar)\n", + "hfg1 = 2013.6;\t\t\t#KJ/Kg(at 10bar)\n", + "\n", + "# Calculations\n", + "h1 = hf1+x1*hfg1;\t\t\t#KJ/Kg\n", + "h2 = h1;\t\t\t#KJ/Kg\n", + "hg2 = h2;\t\t\t#KJ/Kg\n", + "p2 = 0.075;\t\t\t#bar(from steam table)\n", + "\n", + "# Results\n", + "print \"Pressure at exit in bar : \",p2\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure at exit in bar : 0.075\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.26 Page No : 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "m1dot = 3.;\t\t\t#Kg/min\n", + "p1 = 10.;\t\t\t#bar\n", + "Tsup1 = 250.;\t\t\t#degree C\n", + "m2dot = 5.;\t\t\t#Kg/min\n", + "p2 = 10.;\t\t\t#bar\n", + "x2 = 0.7;\t\t\t#dryness\n", + "p3 = 10.;\t\t\t#bar\n", + "p4 = 5.;\t\t\t#bar\n", + "p5 = 2.;\t\t\t#bar\n", + "m3dot = m1dot+m2dot;\t\t\t#Kg/min\n", + "hsup1 = 2826.8;\t\t\t#KJ/Kg(at 10bar)\n", + "hf2 = 762.6;\t\t\t#KJ/Kg(at 10bar)\n", + "hf3 = 762.6;\t\t\t#KJ/Kg(at 10bar)\n", + "hfg2 = 2013.6;\t\t\t#KJ/Kg(at 10bar)\n", + "hfg3 = 2013.6;\t\t\t#KJ/Kg(at 10bar)\n", + "\n", + "# Calculations and Results\n", + "#m1dot*hsup1+m2dot*(hf2+x2*hfg2) = m3dot*(hf3+x3*hfg3)\n", + "x3 = ((m1dot*hsup1+m2dot*(hf2+x2*hfg2))/m3dot-hf3)/hfg3;\t\t\t#dryness\n", + "print \"State of steam after mixing(dryness) : %.2f\"%x3\n", + "\n", + "x4 = 0.838;\t\t\t#dryness(from molliers diagram)\n", + "print \"State of steam after throttling(dryness) : %.3f\"%x4\n", + "\n", + "sf3 = 2.138;\t\t\t#KJ/KgK(From steam table\n", + "sfg3 = 4.445;\t\t\t#KJ/KgK(From steam table\n", + "sf4 = 1.860;\t\t\t#KJ/KgK(From steam table)\n", + "sfg4 = 4.959;\t\t\t#KJ/KgK(From steam table\n", + "s4SUBs3 = m3dot/60*((sf4+x4*sfg4)-(sf3+x3*sfg3));\t\t\t#KJ/Kg\n", + "print \"Increase in entropy due to throttling in KJ/KgK : %.5f\"%s4SUBs3\n", + "\n", + "h4 = 2405;\t\t\t#KJ/Kg(from Molliers diagram)\n", + "h5 = 2265;\t\t\t#KJ/Kg(from Molliers diagram)\n", + "x5 = 0.802;\t\t\t#dryness\n", + "C4 = 0;\t\t\t#m/s(from S.F.E.E)\n", + "\t\t\t#h4+C4**2/2/1000 = h5+C5**2/2/1000\n", + "C5 = math.sqrt((h4+C4**2/2/1000-h5)*2*1000);\t\t\t#m/s\n", + "p5 = 2;\t\t\t#bar(from steam table)\n", + "Vg5 = 0.885;\t\t\t#m**3/Kg(from steam table)\n", + "\t\t\t#mdot/60 = A5*C5/x5/Vg5\n", + "A5 = m3dot/60/C5*x5*Vg5;\t\t\t#m**2\n", + "print \"Exit area of nozzle in cm**2 : %.4f\"%(A5*10**4)\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "State of steam after mixing(dryness) : 0.82\n", + "State of steam after throttling(dryness) : 0.838\n", + "Increase in entropy due to throttling in KJ/KgK : 0.02989\n", + "Exit area of nozzle in cm**2 : 1.7885\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.27 Page No : 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "ms = 5.;\t\t\t#Kg\n", + "m2 = 140.;\t\t\t#Kg\n", + "p = 10.;\t\t\t#bar\n", + "mc = 20.;\t\t\t#KJ/K\n", + "t1 = 20.;\t\t\t#degree C\n", + "mwdot = 20.;\t\t\t#Kg\n", + "t2 = 40.;\t\t\t#degree C\n", + "Cpw = 4.19;\t\t\t#KJ/KgK\n", + "hfg = 2021.4;\t\t\t#KJ/Kg(at 10bar)\n", + "ts = 179.88;\t\t\t#degree C\n", + "\n", + "# Calculations\n", + "#ms*(x*hfg)+ms*Cpw*(ts-t2) = m2*Cpw*(t2-t1)+mc*(t2-t1)\n", + "x = (m2*Cpw*(t2-t1)+mc*(t2-t1)-ms*Cpw*(ts-t2))/ms/hfg;\t\t\t#dryness\n", + "\n", + "# Results\n", + "print \"Dryness fraction of steam : %.4f\"%x\n", + "\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of steam : 0.9104\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.28 Page No : 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 15.;\t\t\t#bar\n", + "p2 = 15.;\t\t\t#bar\n", + "p3 = 1.;\t\t\t#bar\n", + "Tsup3 = 150.;\t\t\t#degree C\n", + "mw = 0.2;\t\t\t#Kg/min\n", + "ms = 10.;\t\t\t#Kg/min\n", + "\n", + "# Calculations and Results\n", + "x1 = ms/(ms+mw);\t\t\t#dryness\n", + "print \"Dryness factor of steam : %.4f\"%x1\n", + "\n", + "hf2 = 844.7;\t\t\t#KJ/Kg(from steam table,at 15 bar)\n", + "hfg2 = 1945.2;\t\t\t#KJ/Kg(from steam table,at 15 bar)\n", + "hsup3 = 2776.3;\t\t\t#KJ/Kg(from steam table,at 15 bar)\n", + "\t\t\t#hsup3 = hf2+x2*hfg2;\t\t\t#KJ/Kg\n", + "x2 = (hsup3-hf2)/hfg2;\t\t\t#KJ/Kg\n", + "x = x1*x2;\t\t\t#dryness\n", + "print \"Dryness fraction in the mains : %.4f\"%x\n", + "\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness factor of steam : 0.9804\n", + "Dryness fraction in the mains : 0.9735\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.29 Page No : 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 1.;\t\t\t#MPa\n", + "p2 = 100.;\t\t\t#KPa\n", + "p1 = p1*10**6./10**5;\t\t\t#bar\n", + "p2 = p2*10**3./10**5;\t\t\t#bar\n", + "hf1 = 762.5;\t\t\t#KJ/Kg(from steam table)\n", + "hfg2 = 2013.6;\t\t\t#KJ/Kg(from steam table)\n", + "hg2 = 2675.5;\t\t\t#KJ/Kg(from steam table)\n", + "\n", + "# Calculations\n", + "#hg2 = hf1+x1*hfg2;\t\t\t#KJ/Kg\n", + "x1 = (hg2-hf1)/hfg2;\t\t\t#\n", + "\n", + "# Results\n", + "print \"Dryness fraction in the mains : %.2f\"%x1\n", + "\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction in the mains : 0.95\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.30 Page No : 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 900.;\t\t\t#KN/m**2\n", + "p2 = 900.;\t\t\t#KN/m**2\n", + "p3 = 0.1013;\t\t\t#MN/m**2\n", + "p1 = p1/10.**2;\t\t\t#bar\n", + "p3 = p2/10.**2;\t\t\t#bar\n", + "p3 = p3*10.**6/10**5;\t\t\t#bar\n", + "Tsup3 = 115.;\t\t\t#degree C\n", + "ms = 1.8;\t\t\t#Kg\n", + "mw = 0.16;\t\t\t#Kg\n", + "\n", + "# Calculations\n", + "x1 = ms/(ms+mw);\t\t\t#dryness\n", + "hf2 = 742.6;\t\t\t#KJ/Kg(from steam table)\n", + "hfg2 = 2029.5;\t\t\t#KJ/Kg(from steam table)\n", + "hg3 = 2676;\t\t\t#KJ/Kg(from steam table)\n", + "Ts3 = 100;\t\t\t#degree C\n", + "Cp = 2;\t\t\t#KJ/KgK\n", + "\t\t\t#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3);\t\t\t#KJ/Kg\n", + "x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;\t\t\t#KJ/Kg\n", + "x = x1*x2;\t\t\t#dryness\n", + "\n", + "# Results\n", + "print \"Dryness fraction of steam in mains : %.4f\"%x\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of steam in mains : 0.8885\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.31 Page No : 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 1.5;\t\t\t#MPa\n", + "p1 = p1*10**6/10**5;\t\t\t#bar\n", + "p2 = p1;\t\t\t#bar\n", + "p3 = 0.1;\t\t\t#MPa\n", + "p3 = p3*10**6/10**5;\t\t\t#bar\n", + "Tsup3 = 110;\t\t\t#degree C\n", + "Vw = 0.15;\t\t\t#litres\n", + "Vw = 0.15*10**-3;\t\t\t#m**3 at 70 degree C\n", + "ms = 3.24;\t\t\t#Kg\n", + "Vf = 0.001023;\t\t\t#m**3/Kg\n", + "mw = Vw/Vf;\t\t\t#Kg\n", + "x1 = ms/(ms+mw);\t\t\t#dryness\n", + "hf2 = 844.7;\t\t\t#KJ/Kg(from steam table)\n", + "hfg2 = 1945.2;\t\t\t#KJ/Kg(from steam table)\n", + "hg3 = 2675;\t\t\t#KJ/Kg(from steam table)\n", + "Ts3 = 99.63;\t\t\t#degree C\n", + "Cp = 2;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations\n", + "#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3);\t\t\t#KJ/Kg\n", + "x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;\t\t\t#KJ/Kg\n", + "x = x1*x2;\t\t\t#dryness\n", + "\n", + "# Results\n", + "print \"Quality of steam in pipe line(Dryness fraction) : %.4f\"%x\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quality of steam in pipe line(Dryness fraction) : 0.9104\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.32 Page No : 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 1.5;\t\t\t#MPa\n", + "p1 = p1*10**6/10**5;\t\t\t#bar\n", + "p_gauge = 7;\t\t\t#bar\n", + "p_at = 1;\t\t\t#bar\n", + "p2 = p_gauge+p_at;\t\t\t#bar\n", + "p3 = 1;\t\t\t#bar\n", + "Tsup3 = 110;\t\t\t#degree C\n", + "mw = 3.5;\t\t\t#Kg\n", + "ms = 48;\t\t\t#Kg\n", + "Cp = 2.1;\t\t\t#KJ/KgK\n", + "x1 = ms/(ms+mw);\t\t\t#dryness\n", + "hf2 = 720.9;\t\t\t#KJ/Kg(from steam table)\n", + "hfg2 = 2059.3;\t\t\t#KJ/Kg(from steam table)\n", + "hg3 = 2675.5;\t\t\t#KJ/Kg(from steam table)\n", + "Ts3 = 99.63;\t\t\t#degree C\n", + "\n", + "# Calculations\n", + "#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3);\t\t\t#KJ/Kg\n", + "x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2;\t\t\t#KJ/Kg\n", + "x = x1*x2;\t\t\t#dryness\n", + "\n", + "# Results\n", + "print \"Quality of steam in pipe line(Dryness fraction) : %.4f\"%x\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quality of steam in pipe line(Dryness fraction) : 0.8945\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.33 Page No : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\t\t\t\n", + "# Variables :\n", + "p1 = 20;\t\t\t#bar\n", + "Tsup3 = 360;\t\t\t#degree C\n", + "pb = 0.08;\t\t\t#bar\n", + "m = 1;\t\t\t#Kg\n", + "hf1 = 173.9;\t\t\t#KJ/Kg(from steam table)\n", + "h1 = hf1;\t\t\t#KJ/Kg\n", + "wp = (p1-pb)/10;\t\t\t#KJ/Kg\n", + "h2 = h1+wp;\t\t\t#KJ/Kg\n", + "h3 = 3160.62;\t\t\t#KJ/Kg(from steam table)\n", + "S3 = 6.994;\t\t\t#KJ/Kg\n", + "Sf4 = 0.593;\t\t\t#KJ/Kg(from steam table)\n", + "Sfg4 = 7.637;\t\t\t#KJ/Kg(from steam table)\n", + "S3 = 6.994;\t\t\t#KJ/Kg\n", + "#S3 = S4 = Sf4+x4*Sfg4\n", + "x4 = (S3-Sf4)/Sfg4;\t\t\t#dryness\n", + "hf4 = 173.9;\t\t\t#KJ/Kg(from steam table)\n", + "hfg4 = 2403.2;\t\t\t#KJ/Kg(from steam table)\n", + "\n", + "# Calculations and Results\n", + "h4 = hf4+x4*hfg4;\t\t\t#KJ/Kg\n", + "Ws = h3-h4-wp;\t\t\t#KJ/Kg\n", + "print \"Net work done in KJ/Kg : %.3f\"%Ws\n", + "\n", + "EtaR = Ws/(h3-h2)*100;\t\t\t#%\n", + "print \"Rankine efficiency in %% : %.2f\"%EtaR\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work done in KJ/Kg : 970.471\n", + "Rankine efficiency in % : 32.51\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.34 Page No : 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "p1 = 80;\t\t\t#bar\n", + "Tsup3 = 350;\t\t\t#degree C\n", + "pb = 712.5/760*1.01325;\t\t\t#bar\n", + "mdot = 2;\t\t\t#Kg/s\n", + "#mdot = 1;\t\t\t#Kg\n", + "h3 = 2964.;\t\t\t#KJ/Kg(Molliers diagram)\n", + "h4 = 2184.;\t\t\t#KJ/Kg(Molliers diagram)\n", + "\n", + "# Calculations and Results\n", + "WT = h3-h4;\t\t\t#KJ/Kg\n", + "WTdot = mdot*WT;\t\t\t#KW\n", + "print \"Total turbine work in KW : \",WTdot\n", + "\n", + "wp = (p1-pb)/10;\t\t\t#KJ/Kg\n", + "hf1 = 411.35;\t\t\t#KJ/Kg(from steam table)\n", + "h1 = hf1;\t\t\t#KJ/Kg\n", + "h2 = h1+wp;\t\t\t#KJ/Kg\n", + "qi = h3-h2;\t\t\t#KJ/Kg\n", + "EtaR = (WT-wp)/qi*100;\t\t\t#%\n", + "print \"Rankine efficiency in %% : %.2f\"%EtaR\n", + "\n", + "#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total turbine work in KW : 1560.0\n", + "Rankine efficiency in % : 30.34\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.35 Page No : 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables :\n", + "p1 = 30.\t \t\t#bar\n", + "Tsup3 = 350.\t\t\t#degree C\n", + "pb = 0.5;\t\t\t#bar\n", + "h1 = 340.5;\t\t\t#KJ/Kg(from steam table, at 0.5 bar)\n", + "Vw = 0.001;\t\t\t#m**3/Kg\n", + "wp = (p1-pb)*10**5*Vw/1000;\t\t\t#KJ/Kg\n", + "h2 = h1+wp;\t\t\t#KJ/Kg\n", + "h3 = 2854.8;\t\t\t#KJ/Kg(from steam table, at 30 bar)\n", + "S3 = 6.286;\t\t\t#KJ/KgK\n", + "S4 = S3;\t\t\t#KJ/KgK\n", + "Sf4 = 1.091;\t\t\t#KJ/KgK\n", + "Sfg4 = 6.503;\t\t\t#KJ/KgK\n", + "\n", + "# Calculations and Results\n", + "#S4 = Sf4+x4*Sfg4\n", + "x4 = (S4-Sf4)/Sfg4;\t\t\t#dryness\n", + "print \"Dryness fraction of steam entering in condenser : %.3f\"%x4\n", + "hf4 = 340.5;\t\t\t#KJ/Kg(from steam table)\n", + "hfg4 = 2305.4;\t\t\t#KJ/Kg(from steam table)\n", + "h4 = hf4+x4*hfg4;\t\t\t#KJ/Kg\n", + "q = h3-h2;\t\t\t#\n", + "print \"Heat supplied to stem in boiler in KJ : %.2f\"%q\n", + "\n", + "Ws = h3-h4-(h2-h1);\t\t\t#KJ/Kg\n", + "print \"Work done in KJ/Kg : %.2f\"%Ws\n", + "\n", + "steam_rate = 3600/Ws;\t\t\t#KJ/KWh\n", + "print \"Steam rate per in KJ/Kwh : %.3f\"%steam_rate\n", + "\n", + "EtaR = Ws/(h3-h2)*100;\t\t\t#%\n", + "print \"Rankine efficiency in %% : %.2f\"%EtaR\n", + "\t\t\t#Steam table is used to get some data.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of steam entering in condenser : 0.799\n", + "Heat supplied to stem in boiler in KJ : 2511.35\n", + "Work done in KJ/Kg : 669.65\n", + "Steam rate per in KJ/Kwh : 5.376\n", + "Rankine efficiency in % : 26.67\n" + ] + } + ], + "prompt_number": 32 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Thermodynamics_by_B._l._Singhal/ch7.ipynb b/Thermodynamics_by_B._l._Singhal/ch7.ipynb new file mode 100755 index 00000000..a8cc11e4 --- /dev/null +++ b/Thermodynamics_by_B._l._Singhal/ch7.ipynb @@ -0,0 +1,543 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b5b8074cf42c7ca646f91bd1caedd392aed8b3ed9b13fedd0aed1677334f5b33" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : IC Engines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.1 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "T = 10.;\t\t\t#N-m\n", + "N = 1500.;\t\t\t#rpm\n", + "IP = 1.85;\t\t\t#KW\n", + "\n", + "#Calculation\n", + "BP = T*2*math.pi*N/60/1000;\t\t\t#KW\n", + "FP = IP-BP;\t\t\t#KW\n", + "\n", + "# Results\n", + "print \"Friction power(KW) : %.2f\"%FP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Friction power(KW) : 0.28\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.2 Page No : 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\t\t\t\n", + "# Variables :\n", + "d = 18./100;\t\t\t#m\n", + "L = 26./100;\t\t\t#m\n", + "N = 400.;\t\t\t#rpm\n", + "positive_mep = 6;\t\t\t#bar\n", + "negative_mep = -0.3;\t\t\t#bar\n", + "n = 180.;\t\t\t#strokes/min\n", + "Etta_m = 0.75;\n", + "\n", + "#Calculation\n", + "Pm = positive_mep+negative_mep;\t\t\t#bar\n", + "A = math.pi/4*d**2;\t\t\t#m**2\n", + "IP = Pm*10**5*A*L*n/60/1000;\t\t\t#KW\n", + "BP = IP*Etta_m;\t\t\t#KW\n", + "\n", + "# Results\n", + "print \"B.P. of engine in KW : %.3f\"%BP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "B.P. of engine in KW : 8.485\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.3 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "r = 6.;\t\t\t #cm\n", + "d = 10./100;\t\t\t#m\n", + "L = 12.5/100;\t\t\t#m\n", + "Pmi = 2.6;\t\t \t#bar\n", + "W = 60.;\t\t \t#N\n", + "S = 19.;\t\t\t #N\n", + "R = 40./100;\t\t\t#m\n", + "mf = 1.;\t \t\t#Kg/hr\n", + "mf = mf/60/60;\t\t\t#Kg/sec\n", + "CV = 42000.;\t\t\t#KJ/Kg\n", + "N = 2000.; \t\t\t#rpm\n", + "\n", + "#Calculation and Results\n", + "A = math.pi/4*d**2;\t\t\t#m**2\n", + "n = N/2;\t\t\t#no. of strokes/min\n", + "IP = Pmi*10**5*A*L*n/60/1000;\t\t\t#KW\n", + "print \"Indicated Power in KW : %.3f\"%IP\n", + "\n", + "BP = (W-S)*R*2*math.pi*N/60/1000;\t\t\t#KW\n", + "print \"Brake Power in KW : %.3f\"%BP\n", + "Etta_m = BP/IP*100;\t\t\t#%\n", + "print \"Mechanical efficiency in %% : %.2f\"%Etta_m\n", + "Etta_o = BP/mf/CV*100;\t\t\t#%\n", + "print \"Overall efficiency in %% : %.2f\"%Etta_o\n", + "Gamma = 1.4;\t\t\t#consmath.tant\n", + "Etta_a = (1-1/(r**(Gamma-1)))*100 ;\t\t\t#%\n", + "print \"Air standard efficiency in %% : %.2f\"%Etta_a\n", + "Etta_r = Etta_o/Etta_a*100;\t\t\t#%\n", + "print \"Relative efficiency in %% : %.2f\"%Etta_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated Power in KW : 4.254\n", + "Brake Power in KW : 3.435\n", + "Mechanical efficiency in % : 80.74\n", + "Overall efficiency in % : 29.44\n", + "Air standard efficiency in % : 51.16\n", + "Relative efficiency in % : 57.54\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.4 Page No : 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "IP = 50.;\t\t\t #KW\n", + "Vf = 16.;\t\t\t #litre/hr\n", + "Sp_gravity_fuel = 0.755;\n", + "CV = 44500.;\t\t\t#KJ/Kg\n", + "N = 3000.;\t \t\t#rpm\n", + "Pmi = 5.2;\t\t \t#bar\n", + "\n", + "#Calculation and Results\n", + "mf = Vf*10**-3*Sp_gravity_fuel*1000;\t\t\t#Kg/hr\n", + "mf = mf/3600;\t\t\t#Kg/s\n", + "Etta_i = IP/mf/CV*100;\t\t\t#%\n", + "print \"Indicated thermal efficiency in %% : %.2f\"%Etta_i\n", + "\n", + "#IP = Pmi*10**5*math.pi/4*d**2*L*N/2/60/1000;\t\t\t#KW\n", + "d = (IP*60*1000/Pmi/10**5/(math.pi/4)/1.1/(N/2))**(1./3);\t\t\t#meter(L = 1.1*d)\n", + "print \"Bore in cm : %.2f\"%(d*100)\n", + "L = 1.1*d;\t\t\t#meter\n", + "print \"Length of stroke in cm : %.3f\"%(L*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated thermal efficiency in % : 33.48\n", + "Bore in cm : 16.45\n", + "Length of stroke in cm : 18.096\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.5 Page No : 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "Vs = 5.7;\t\t\t#litre\n", + "Vs = Vs/1000;\t\t\t#m**3\n", + "Pm = 600.;\t\t\t#KN/m**2\n", + "N = 800.;\t\t\t#rpm\n", + "\n", + "#Calculation\n", + "n = N/2;\t\t\t#No. of strokes/min\n", + "IP = Pm*Vs*n/60;\t\t\t#KW\n", + "\n", + "# Results\n", + "print \"Indicated power of Engine in KW : \",IP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated power of Engine in KW : 22.8\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.6 Page No : 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "n1 = 6.;\t\t\t#cylinders\n", + "IP = 100.;\t\t\t#KW\n", + "N = 800.;\t\t\t#rpm\n", + "Lbyd = 1.25;\t\t\t#stroke to bore ratio\n", + "Etta_m = 80./100;\n", + "bmep = 5.;\t\t\t#bar\n", + "\n", + "#Calculation\n", + "n = N/2;\t\t\t#No. of strokes/min\n", + "#IP = Pm*math.pi/4*d**2*d*Lbyd*n/60000\n", + "d = (IP/(bmep*math.pi/4*Lbyd*n/60000))**(1/3);\t\t\t#m\n", + "L = Lbyd*d;\t\t\t#m\n", + "\n", + "# Results\n", + "print \"Diameter in meter : \",d\n", + "print \"Length ofstroke in meter : \",L\n", + "\n", + "\t\t\t#Solution is not complete in the book.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Diameter in meter : 1.0\n", + "Length ofstroke in meter : 1.25\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.7 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "d = 110./1000;\t\t\t#m\n", + "L = 140./1000;\t\t\t#m\n", + "Pmi = 600.;\t\t\t#KN/m**2\n", + "N = 1000.;\t\t\t#rpm\n", + "n = N;\t\t\t#strokes/min(for 2 stroke)\n", + "\n", + "# Calculations\n", + "A = math.pi/4*d**2;\t\t\t#m**2\n", + "IP = Pmi*A*L*n/60;\t\t\t#KW\n", + "\n", + "# Results\n", + "print \"Indicated power of the engine in KW : %.3f\"%IP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated power of the engine in KW : 13.305\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.8 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\t\t\t\n", + "# Variables :\n", + "n1 = 6.;\t\t\t#cylinders\n", + "IP = 150.;\t\t\t#KW\n", + "N = 800.;\t\t\t#rpm\n", + "TwoLN = 320.;\t\t\t#m/s\n", + "Lbyd = 1.2;\t\t\t#stroke to bore ratio\n", + "Pmi = 650.;\t\t\t#Kn/m**2\n", + "\n", + "#Calculation\n", + "#IP = n1*Pmi*(math.pi/4*d**2)*L*n/60;\t\t\t#KW\n", + "d = math.sqrt(IP/n1/Pmi/(math.pi/4)*2/TwoLN*2*60);\t\t\t#meter(L*N replaced by TwoLN/2)\n", + "L = Lbyd*d;\t\t\t#in meter\n", + "N = TwoLN/2/L;\t\t\t#rpm\n", + "\n", + "# Results\n", + "print \"Engine crank shaft speed in rpm : %.2f\"%N\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Engine crank shaft speed in rpm : 695.73\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.9 Page No : 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "d = 250./1000;\t\t\t#meter\n", + "L = 400./1000;\t\t\t#meter\n", + "Pmi = 6.50;\t\t\t #bar\n", + "N = 250.;\t\t\t #rpm\n", + "NetBrakeLoad = 1080.;\t\t#N\n", + "Db = 1.5;\t \t\t#meter\n", + "mf = 10.;\t\t \t#Kg/hr\n", + "mf = mf/60./60;\t\t\t#Kg/sec\n", + "CV = 44300.;\t\t\t#KJ/Kg\n", + "\n", + "#Calculation and Results\n", + "n = N/2;\t\t\t#stroke/min\n", + "IP = Pmi*10**5*(math.pi/4*d**2)*L*n/60/1000;\t\t\t#KW\n", + "print \"Indicated Power in KW : %.2f\"%IP\n", + "\n", + "Rb = Db/2;\t\t\t#meter\n", + "BP = NetBrakeLoad*Rb*2*math.pi*N/60/1000;\t\t\t#KW\n", + "print \"Brake Power in KW : %.3f\"%BP\n", + "Etta_m = BP/IP*100;\t\t\t#%\n", + "print \"Mechanical Efficiency in %% : %.2f\"%Etta_m\n", + "Etta_i = IP/mf/CV*100;\t\t\t#%\n", + "print \"Indicated Thermal Efficiency in %% : %.2f\"%Etta_i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated Power in KW : 26.59\n", + "Brake Power in KW : 21.206\n", + "Mechanical Efficiency in % : 79.75\n", + "Indicated Thermal Efficiency in % : 21.61\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.10 Page No : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\t\n", + "# Variables :\n", + "mf = 20.;\t\t\t#Kg/hr\n", + "BP = 80.;\t\t\t#KW\n", + "Etta_m = 80./100;\n", + "CV = 45000.;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "bsfc = mf/BP;\t\t\t#break specified fuel consumption in Kg/KWh\n", + "print \"Break specified fuel consumption in Kg/KWh : \",bsfc\n", + "\n", + "IP = BP/Etta_m;\t\t\t#KW\n", + "mf = mf/60/60;\t\t\t#Kg/s\n", + "n = mf/100;\t\t\t#Kg/KWh\n", + "Etta_b = BP/mf/CV*100;\t\t\t#%\n", + "print \"Break Efficiency in % : \",Etta_b\n", + "Etta_I = Etta_b/Etta_m;\t\t\t#\n", + "print \"Indicated thermal Efficiency in % : \",Etta_I\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Break specified fuel consumption in Kg/KWh : 0.25\n", + "Break Efficiency in % : 32.0\n", + "Indicated thermal Efficiency in % : 40.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.11 Page No : 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\t\t\t\n", + "# Variables :\n", + "d = 270./1000;\t\t\t#meter\n", + "L = 380./1000;\t\t\t#meter\n", + "Pmi = 6.;\t\t\t#bar\n", + "N = 350.;\t\t\t#rpm\n", + "WsubS = 1000.;\t\t\t#N\n", + "Db = 1.5;\t\t\t#meter\n", + "mf = 10.;\t\t\t#Kg/hr\n", + "CV = 44400.;\t\t\t#KJ/Kg\n", + "\n", + "# Calculations and Results\n", + "IP = Pmi*10**5*(math.pi/4*d**2)*L*N/2/60/1000;\t\t\t#KW\n", + "print \"Indicated Power in KW : %.3f\"%IP\n", + "\n", + "BP = (WsubS)*math.pi*Db*N/60/1000;\t\t\t#KW\n", + "print \"Brake Power in KW : %.2f\"%BP\n", + "\n", + "Etta_m = BP/IP*100;\t\t\t#%\n", + "print \"Mechanical Efficiency in %% : %.1f\"%Etta_m\n", + "\n", + "mf = mf/60/60;\t\t\t#Kg/s\n", + "Etta_b = BP/mf/CV*100;\t\t\t#\n", + "print \"Indicated thermal Efficiency in %% : %.2f\"%Etta_b\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Indicated Power in KW : 38.075\n", + "Brake Power in KW : 27.49\n", + "Mechanical Efficiency in % : 72.2\n", + "Indicated thermal Efficiency in % : 22.29\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |