diff options
Diffstat (limited to 'Engineering_Thermodynamics_by_P._K._Nag/ch5.ipynb')
-rwxr-xr-x | Engineering_Thermodynamics_by_P._K._Nag/ch5.ipynb | 423 |
1 files changed, 423 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics_by_P._K._Nag/ch5.ipynb b/Engineering_Thermodynamics_by_P._K._Nag/ch5.ipynb new file mode 100755 index 00000000..2711babd --- /dev/null +++ b/Engineering_Thermodynamics_by_P._K._Nag/ch5.ipynb @@ -0,0 +1,423 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:98381098beaf5d6805e531ad8738dca152c4ca499326121575e7f6afde31d8cf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : First Law Applied to Flow Processes" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1 Page No : 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "V1 = 0.95;\n", + "P1 = 100e03; #initial pressure Pa\n", + "v1 = 7.; #initial velocity m/s\n", + "V2 = 0.19; #final velocity m/s\n", + "P2 = 700e03; #final pressure Pa\n", + "v2 = 5.;\n", + "w = 0.5;\n", + "u21 = 90e03; \t\t\t# u21 = u2-u1\n", + "Q = -58e03; \t\t\t# As heat is added Q = dQ/dt\n", + "\n", + "# Calculation and Results\n", + "W = - w*( u21 + (P2*V2-P1*V1) + ((v2**2-v1**2)/2) ) + Q; \t\t\t# W = dW/dt \n", + "print \"The rate of work input is\",round(W/1000),\"kW\"\n", + "\n", + "# Part (b)\n", + "A = (v2/v1)*(V1/V2); \t\t\t# A = A1./A2\n", + "d = math.sqrt(A); \t\t\t# d = d1./d2\n", + "print \"The ratio of the inlet pipe diameter and outer pipe diameter is %.2f\"%d\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of work input is -122.0 kW\n", + "The ratio of the inlet pipe diameter and outer pipe diameter is 1.89\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2 Page No : 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V1 = 0.37; #specific volume m^3/kg\n", + "P1 = 600.e03;\n", + "v1 = 16.;\n", + "V2 = 0.62; \n", + "P2 = 100.e03;\n", + "v2 = 270.;\n", + "Z1 = 32.;\n", + "Z2 = 0;\n", + "g = 9.81; \n", + "Q = -9.e03; \t\t\t# heat loss Q = dQ/dt\n", + "W = 135.e03; \t\t\t# Work done W = dW/dt\n", + "\n", + "# Calculation\n", + "U12 = (P2*V2-P1*V1) + ((v2**2-v1**2)/2.) + (Z2-Z1)*g + W - Q; \t\t\t# U12 = U1-U2\n", + "\n", + "# Results\n", + "print \"The internal energy decreases by\",round(U12/1000,3),\"Joule\"\n", + "\n", + "# note : rounding off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The internal energy decreases by 20.008 Joule\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3 Page No : 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "P1 = 4e06;\n", + "t1 = 400.;\n", + "h1 = 3213e03;\n", + "V1 = 0.073;\n", + "P2 = 3.5e06;\n", + "t2 = 392.;\n", + "h2 = 3202e03;\n", + "V2 = 0.084;\n", + "Q = -8.5e03;\n", + "\n", + "# Calculation\n", + "v1 = math.sqrt((2*(h1-h2+Q))/(1.15**2-1));\n", + "A1 = (math.pi/4)*0.2**2;\n", + "w = (A1*v1)/V1;\n", + "\n", + "# Results\n", + "print \"The stean flow rate is %.1f Kg/s\"%w\n", + "\n", + "# rounding off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The stean flow rate is 53.6 Kg/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.4 Page No : 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "import sys\n", + "from numpy import *\n", + "from sympy import Symbol\n", + "\n", + "# Variables\n", + "h1 = 313.93;\n", + "h2 = 2676.;\n", + "h3 = 419.;\n", + "w1 = 4.2;\n", + "\n", + "# Calculation\n", + "w = Symbol('w') \t\t\t# w = w2\n", + "P = w1*h1 + w*h2 - h3*(4.2+w)\n", + "def stress(a,b,f):\n", + " N = 100;\n", + " eps = 1e-5;\n", + " if((f(a)*f(b))>0):\n", + " print ('no root possible f(a)*f(b)>0');\n", + " sys.exit(0)\n", + " if(abs(f(a))<eps):\n", + " print ('solution at a');\n", + " sys.exit(0)\n", + " if(abs(f(b))<eps):\n", + " print ('solution at b');\n", + " sys.exit(0)\n", + "\n", + " while(N>0):\n", + " c = (a+b)/2.\n", + " if(abs(f(c))<eps):\n", + " x = c ;\n", + " return x;\n", + " if((f(a)*f(c))<0 ):\n", + " b = c ;\n", + " else:\n", + " a = c ;\n", + " N = N-1;\n", + " print ('no convergence');\n", + " sys.exit(0)\n", + "\n", + "def p(w): \n", + "\t return - 441.294 + 2257*w \n", + "\n", + "w = stress(0.1,0.2,p);\n", + "\n", + "# Results\n", + "print \"The amount of heat that should be supplied is %.0fKg/h\"%(w*3600)\n", + "\n", + "# rounding off error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of heat that should be supplied is 704Kg/h\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.5 Page No : 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "t1 = 15.\n", + "t2 = 800. \n", + "t3 = 650.\n", + "t4 = 500.;\n", + "v1 = 30.; \n", + "v2 = 30. \n", + "v3 = 60.; \n", + "w = 2.;\n", + "cp = 1005.;\n", + "\n", + "# Calculation and Results\n", + "Q1_2 = w*cp*(t2-t1);\n", + "print \"The rate of heat transfer to the air in the heat exchanger is %.0f KJ/s\"%(round(Q1_2/1000,-1)),\"KJ/s\"\n", + "W_T = w*( ((v2**2-v3**2)/2) + cp*(t2-t3));\n", + "print \"The power output from the turbine assuming no heat loss\",W_T/1000,\"KW\"\n", + "v4 = math.sqrt( (v3**2) + (2*cp*(t3-t4)) );\n", + "print \"The velocity at the exit of the nozzle is %.0f m/s\"%v4\n", + "\n", + "# rounding off error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat transfer to the air in the heat exchanger is 1580 KJ/s KJ/s\n", + "The power output from the turbine assuming no heat loss 298.8 KW\n", + "The velocity at the exit of the nozzle is 552 m/s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.6 Page No : 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "# Variables\n", + "w = 5.\n", + "h1 = 900\n", + "h2 = 400\n", + "v1 = 50. \n", + "v2 = 150.\n", + "Q = -25*5. \t\t\t# Q = dQ/dt for w = 5kg\n", + "\n", + "# Calculation and Results\n", + "W = (w*( (h1-h2) + ((v1**2-v2**2)/2)*10**-3 )) + Q; \t\t\t# W = dW/dt\n", + "print \"The power output of the turbine is %.0f kW\"%(W)\n", + "R = 285.\n", + "T1 = 300.\n", + "P1 = 100e03;\n", + "V = (w*R*T1)/P1; \t\t\t# V = dV/dt\n", + "A1 = V/v1; \n", + "D1 = math.sqrt((4*A1)/math.pi);\n", + "print \"The diameter of the inlet pipe is %.2f m\"%D1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power output of the turbine is 2325 kW\n", + "The diameter of the inlet pipe is 0.33 m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.7 Page No : 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "ha = 260.; \t\t\t # Enthalpy of air\n", + "hg = 912.; \t\t \t# Enthalpy of gas\n", + "Va = 270.; \t \t\t# Velocity of air\n", + "f = 0.0190; \t\t\t# Fuel to air ratio wf/wa\n", + "Ef = 44500.; \t\t\t# Chemical energy of fuel in kJ/kg\n", + "Q = 21.; \t\t\t# Heat loss from the engine\n", + "\n", + "# Calculation\n", + "Eg = 0.05*f*Ef/(1+f) \t# As 5% of chemical energy is not released in reaction\n", + "Vg = math.sqrt(2000*(((ha+(Va**2*0.001)/2+(f*Ef)-Q)/(1+f))-hg-Eg));\n", + "\n", + "# Results\n", + "print \"Velocity of exhaust gas is %.0f m/s\"%Vg\n", + "\n", + "# rounding off error. please check." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of exhaust gas is 541 m/s\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.9 Page No : 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from hornerc import horner\n", + "\n", + "# Variables\n", + "u0 = 0.718*273*1e03;\n", + "#t = poly(0,'t');\n", + "#u = u0+718*t; \t\t\t# in SI unit\n", + "#hp = u + 285*(t+273); \t\t\t# \"\"\n", + "hp = [273819, 1003]\n", + "\n", + "# Calculation\n", + "h = horner(hp,150); \t\t\t# h = hp(150)\n", + "W = 100.; \t\t\t# W = dW/dt\n", + "m = W/h;\n", + "\n", + "# Results\n", + "print \"The rate at which air flows out of the tank %.3f kg/h\"%(m*3600)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate at which air flows out of the tank 0.849 kg/h\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |