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