{ "metadata": { "name": "", "signature": "sha256:eafe81375ae6bd6abb8d4dff5b78c1d88df56b904362e7f55dc57c603062c8b9" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 4 : First Law of Thermodynamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.1 Page No : 78" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "V1 = 0.3; \t\t\t# Initial volume in m3\n", "V2 = 0.15; \t\t\t# Final volume in m3\n", "P = 0.105e06; \t\t\t# Pressure in Pa\n", "Q = -37.6e03; \t\t\t# Heat tranferred in J\n", "\n", "# Calculation\n", "W = P*(V2-V1); \t\t\t# Work done\n", "U = Q-W; \t\t\t# Internal energy change\n", "\n", "# Results\n", "print \"Change in the internal energy of the system is %.2f kJ\"%(U/1000)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Change in the internal energy of the system is -21.85 kJ\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.2 Page No : 78" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "Qacb = 84e03;\n", "Wacb = 32e03;\n", "Uba = Qacb-Wacb; \t\t\t# Ub-Ua\n", "\n", "# Calculation and Results\n", "# Part (a)\n", "Wadb = 10.5e03; \n", "Qadb = Uba+Wadb; \n", "print \"The heat flow into the system along the path adb\",(Qadb/1000),\"kJ\"\n", "\n", "# Part (b)\n", "Wb_a = -21e03;\n", "Uab = - Uba;\n", "Qb_a = Uab+Wb_a;\n", "print \"The heat liberated along the path b-a is\",round(Qb_a/1000),\"kJ\"\n", "\n", "# Part (c)\n", "Wdb = 0.; \t\t\t# Constant volume\n", "Wad = 10.4e03; \n", "Wadb = Wdb-Wad; \n", "Ud = 42e03;\n", "Ua = 0.;\n", "Qad = Ud-Ua+Wad;\n", "Qdb = Qadb-Qad; \n", "print \"The heat absorbed in the path ad and db are\",round(Qdb/1000),\"kJ\",\"and\",round(Qad/1000),\"kJ\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The heat flow into the system along the path adb 62.5 kJ\n", "The heat liberated along the path b-a is -73.0 kJ\n", "The heat absorbed in the path ad and db are 10.0 kJ and 52.0 kJ\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.3 Page No : 79" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "# Process a-b\n", "Qab = 0;\n", "Wab = 2170; \t\t\t# in KJ/min\n", "Eab = Qab-Wab; \n", "\n", "# Process b-c\n", "Qbc = 21000;\n", "Wbc = 0; \n", "Ebc = Qbc-Wbc;\n", "\n", "# Process c-d\n", "Qcd = -2100;\n", "Ecd = -36600; \n", "Wcd = Qcd-Ecd;\n", "\n", "# Calculation\n", "# Process d-a\n", "Q = -17000; \t\t\t# Total heat transfer\n", "Qda = Q-Qab-Qbc-Qcd; \n", "Eda = -Eab-Ebc-Ecd;\n", "Wda = Qda-Eda;\n", "M = [[Qab, Wab, Eab],[Qbc, Wbc ,Ebc],[Qcd, Wcd, Ecd],[Qda, Wda, Eda]];\n", "process = [\"a-b\",\"b-c\",\"c-d\",\"d-a\"]\n", "# Results\n", "print \"The completed table is\"\n", "print \" process Q W deltaE\"\n", "for i in range(4):\n", " print \"%10s\"%process[i],\n", " for j in range(3):\n", " print \"%10d\"%M[i][j],\n", "\n", " print \"\"\n", "print \"\\nRate of work output : %.f kJ/min\"%(sum([M[0][0],M[1][0],M[2][0],M[3][0]]))\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The completed table is\n", " process Q W deltaE\n", " a-b 0 2170 -2170 \n", " b-c 21000 0 21000 \n", " c-d -2100 34500 -36600 \n", " d-a -35900 -53670 17770 \n", "\n", "Rate of work output : -17000 kJ/min\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.4 Page No : 80" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Part (a)\n", "import math \n", "\n", "# Variables\n", "m = 3.;\n", "V1 = 0.22; #volume m^3\n", "P1 = 500.e03; #initial pressure Pa\n", "P2 = 100.e03; #final pressure Pa\n", "\n", "# Calculation\n", "V2 = V1*(P1/P2)**(1./1.2);\n", "dU = 3.56*(P2*V2-P1*V1);\n", "gama = 1.2;\n", "W = (P2*V2-P1*V1)/(1-gama);\n", "Q = dU+W;\n", "\n", "# Results\n", "print \"Q,W and dU of the quasi static process are\",int(dU/1000),round(W/1000),round(Q/1000),\"kJ respectively\"\n", "\n", "# Part (b)\n", "Qb = 30e03;\n", "Wb = Qb-dU; \n", "print \"Work transfer for the process is\",round(Wb/1000),\"kJ\"\n", "\n", "# Part (c)\n", "print \"Wb is not equal to integral(p*dv) .since the process is not quasi static\"\n", "\n", "# rounding off error. please check" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Q,W and dU of the quasi static process are -92 129.0 37.0 kJ respectively\n", "Work transfer for the process is 122.0 kJ\n", "Wb is not equal to integral(p*dv) .since the process is not quasi static\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.5 Page No : 81" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy.linalg import inv\n", "from numpy import *\n", "from scipy.integrate import *\n", "\n", "# Variables\n", "V1 = 0.03; #initial volume m^3\n", "P1 = 170e03; #initial pressure Pa\n", "P2 = 400e03; #final pressure Pa\n", "V2 = 0.06; #final volume m^3\n", "U = 3.15*(P2*V2-P1*V1);\n", "B = array([P1, P2]);\n", "B= B.transpose()\n", "\n", "A = [[1, V1],[1, V2]];\n", "A = array(A)\n", "x = inv(A)*B;\n", "\n", "a = -60000\n", "b = 7666666.7;\n", "\n", "# Calculation\n", "def pressure(V):\n", " return a+b*V;\n", "\n", "W = quad(pressure,V1,V2)[0]\n", "Q = U+W;\n", "\n", "# Results\n", "print \"The work done by the system is\",round(W/1000,2),\"kJ\"\n", "print \"The internal energy change of the system is\",round(U/1000,1),\"J\"\n", "print \"The heat flow into the system is\",round(Q/1000,2),\"kJ\"\n", "\n", "# rounding off error. please check." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The work done by the system is 8.55 kJ\n", "The internal energy change of the system is 59.5 J\n", "The heat flow into the system is 68.09 kJ\n" ] } ], "prompt_number": 36 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.6 Page No : 82" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Process 1-2\n", "import math \n", "\n", "# Variables\n", "Q12 = 235; \t\t\t# in KJ/Kg\n", "W12 = 0 ;\n", "\n", "# Calculation\n", "U12 = Q12-W12;\n", "# Process 2-3\n", "Q23 = 0; \n", "U23 = -70 ;\n", "W23 = Q23-U23;\n", "\n", "# Process 3-1\n", "Q31 = - 200; \n", "U31 = -U12-U23;\n", "W31 = Q31-U31;\n", "W = W12 + W23 + W31;\n", "Q = Q12 + Q23 + Q31;\n", "\n", "# Results\n", "print \"Heat trasfer in the cycle is\",Q,\"KJ/Kg\"\n", "print \"Work done during the the cycle is\",W,\"KJ/Kg\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Heat trasfer in the cycle is 35 KJ/Kg\n", "Work done during the the cycle is 35 KJ/Kg\n" ] } ], "prompt_number": 39 } ], "metadata": {} } ] }