{ "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": {} } ] }