diff options
author | hardythe1 | 2015-04-07 15:58:05 +0530 |
---|---|---|
committer | hardythe1 | 2015-04-07 15:58:05 +0530 |
commit | 92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch) | |
tree | 205e68d0ce598ac5caca7de839a2934d746cce86 /Engineering_Thermodynamics/ch10.ipynb | |
parent | b14c13fcc6bb6d01c468805d612acb353ec168ac (diff) | |
download | Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2 Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip |
added books
Diffstat (limited to 'Engineering_Thermodynamics/ch10.ipynb')
-rwxr-xr-x | Engineering_Thermodynamics/ch10.ipynb | 1017 |
1 files changed, 1017 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics/ch10.ipynb b/Engineering_Thermodynamics/ch10.ipynb new file mode 100755 index 00000000..40b22144 --- /dev/null +++ b/Engineering_Thermodynamics/ch10.ipynb @@ -0,0 +1,1017 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:417bf1adea0580223c4d3786d62ed073e6155f8ed43cae453792997d33751fc8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : Properties of Gases and Gas Mixtures" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.1 Page No : 352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Part (a)\n", + "P1 = 100.\n", + "P2 = 50.;\n", + "T1 = 273.+300;\n", + "\n", + "# Calculation and Results\n", + "T2 = (P2/P1)*T1;\n", + "R = 0.287\n", + "cv = 0.718;\n", + "V1 = 0.8;\n", + "m = (P1*V1)/(R*T1);\n", + "Q = m*cv*(T2-T1);\n", + "print \"If the fluid is in the air\"\n", + "print \"The final temperature is \",T2,\"K\"\n", + "print \"The heat transferred is %.2f kJ/Kg\"%Q\n", + "\n", + "# Part (b)\n", + "t2 = 273+81.33\n", + "vf = 0.00103\n", + "vg = 3.24;\n", + "v1 = 2.6388\n", + "u1 = 2810.4; \n", + "x2 = (v1-vf)/(vg-vf);\n", + "u2 = 340.42+(x2*2143.4);\n", + "m_ = V1/v1;\n", + "Q_ = m_*(u2-u1);\n", + "\n", + "print (\"\\nIf the fluid is in the steam\")\n", + "print \"The final temperature is \",t2,\"K\"\n", + "print \"The heat transferred is %.2f kJ/Kg\"%Q_\n", + "\n", + "# rounding off error. please check . value of m is wrong in book please check." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "If the fluid is in the air\n", + "The final temperature is 286.5 K\n", + "The heat transferred is -100.07 kJ/Kg\n", + "\n", + "If the fluid is in the steam\n", + "The final temperature is 354.33 K\n", + "The heat transferred is -219.62 kJ/Kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.2 Page No : 353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Part (a)\n", + "R = 0.287\n", + "T1 = 273.+150\n", + "v1 = 0.96\n", + "v2 = 1.55\n", + "Cp = 1.005;\n", + "\n", + "# Calculation and Results\n", + "P = (R*T1)/v1;\n", + "W = P*(v2-v1);\n", + "T2 = (v2/v1)*T1;\n", + "Q = Cp*(T2-T1);\n", + "print (\"If the fluid is in the air\")\n", + "print \"The final temperature is %.2f K\"%T2\n", + "print \"The heat transferred is %.2f kJ\"%Q\n", + "print \"Work done is %.2f kJ\"%W\n", + "\n", + "# Part (b)\n", + "vg = 0.3928;\n", + "P1 = 200e03;\n", + "P2 = P1;\n", + "h1 = 2768.8;\n", + "t2 = 273+400; h2 = 3276.5;\n", + "Q_ = h2-h1;\n", + "W_ = P1*(v2-v1);\n", + "print (\"\\nIf the fluid is in the steam\")\n", + "print \"The final temperature is \",t2,\"K\"\n", + "print \"The heat transferred is\",Q_,\"kJ\"\n", + "print \"Work done is\",W_/1000,\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "If the fluid is in the air\n", + "The final temperature is 682.97 K\n", + "The heat transferred is 261.27 kJ\n", + "Work done is 74.61 kJ\n", + "\n", + "If the fluid is in the steam\n", + "The final temperature is 673 K\n", + "The heat transferred is 507.7 kJ\n", + "Work done is 118.0 kJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.3 Page No : 355" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "v = 16. ; \t\t\t# v = v1./v2\n", + "P1 = 300e03;\n", + "P2 = P1*v;\n", + "R = 0.287\n", + "T1 = 300+223;\n", + "\n", + "# Calculation and Results\n", + "W12 = R*T1*math.log(1./v);\n", + "\n", + "print (\"If the fluid is in the air\")\n", + "print \"The final pressure is \",P2/1000,\"kPa\"\n", + "print \"The change in internal energy is\",0,\"kJ\"\n", + "print \"Work done is %.2f kJ\"%W12\n", + "\n", + "# Part (b)\n", + "v1 = 0.7664; u1 = 2728.7;\n", + "v2 = v1/16;\n", + "x2 = (v2-0.00125)/(0.05013);\n", + "s2 = 2.7927+(x2*3.2802);\n", + "s1 = 7.5165\n", + "u2 = 1080.37+(x2*1522.0);\n", + "du = u2-u1;\n", + "T = 250+273;\n", + "Q12 = T*(s2-s1)\n", + "\n", + "print (\"\\nIf the fluid is in the steam\")\n", + "print \"The final temperature is \",T,\"K\"\n", + "print \"The heat transferred is\",Q12,\"kJ/kg\"\n", + "print \"The change in internal energy is\",du,\"kJ/kg \"\n", + "\n", + "# rounding off error. please check. value of x2 is wrong in book ." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "If the fluid is in the air\n", + "The final pressure is 4800.0 kPa\n", + "The change in internal energy is 0 kJ\n", + "Work done is -416.17 kJ\n", + "\n", + "If the fluid is in the steam\n", + "The final temperature is 523 K\n", + "The heat transferred is -874.095064273 kJ/kg\n", + "The change in internal energy is -231.986493118 kJ/kg \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.4 Page No : 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Part (a)\n", + "P1 = 10.\n", + "P2 = 1.;\n", + "T1 = 273.+300;\n", + "g = 1.4;\n", + "\n", + "# Calculation and Results\n", + "T2 = T1*((P2/P1)**((g-1)/g));\n", + "R = 0.287;\n", + "W12 = ((R*T1)/(1-g))*(T2/T1-1);\n", + "v2 = (R*T2)/(100*P2);\n", + "\n", + "print (\"If the fluid is in the air\")\n", + "print \"The specific volume is %.3f m3/Kg\"%v2\n", + "print \"The work done per kg of the fluid is %.2f kJ\"%W12\n", + "\n", + "# Part (b)\n", + "u1 = 2793.2\n", + "v1 = 0.2579\n", + "s1 = 7.1228;\n", + "x2 = (7.1228-1.3025)/6.0568;\n", + "u2 = 417.33+(x2*2088.7);\n", + "v2 = 0.001043+(0.96*1.693);\n", + "W12 = u1-u2;\n", + "print (\"\\nIf the fluid is in the steam\")\n", + "print \"The specific volume is %.3f m3/Kg\"%v2\n", + "print \"The work done per kg of the fluid is %.1f kJ\"%round(W12,-1)\n", + "\n", + "# note : rounding off error. please check." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "If the fluid is in the air\n", + "The specific volume is 0.852 m3/Kg\n", + "The work done per kg of the fluid is 198.19 kJ\n", + "\n", + "If the fluid is in the steam\n", + "The specific volume is 1.626 m3/Kg\n", + "The work done per kg of the fluid is 370.0 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.5 Page No : 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Part (a)\n", + "P1 = 10.\n", + "P2 = 1.;\n", + "T1 = 273.+200\n", + "n = 1.15\n", + "R = 0.287;\n", + "\n", + "# Calculation and Results\n", + "v2 = ((R*T1)/(P1*100))*((P1/P2)**(1./1.15));\n", + "v1 = ((R*T1)/(P1*100));\n", + "T2 = T1*(P2/P1)*(v2/v1);\n", + "cv = 0.716;\n", + "Q = (cv+(R/(1-n)))*(T2-T1);\n", + "\n", + "print (\"If the fluid is in the air\")\n", + "print \"The specific volume is %.4f m3/Kg\"%v2\n", + "print \"The final temperature is %.1f K\"%T2\n", + "print \"Heat transferred per kg is %.f kJ\"%Q\n", + "\n", + "# Part (b)\n", + "v1 = 0.20596\n", + "u1 = 2621.9;\n", + "v2 = v1*(P1/P2)**(1./n);\n", + "x2 = (v2-0.001043)/(1.694-0.001043);\n", + "t2 = 99.62;\n", + "W = ((P1*100*0.13575)-(P2*100*1.525))/(n-1);\n", + "Q = 2366.1-u1+W;\n", + "\n", + "print (\"\\nIf the fluid is in the steam\")\n", + "print \"The specific volume is %.3f m3/Kg\"%v2\n", + "print \"The final temperature is \",t2,\"C\"\n", + "print \"Heat transferred per kg is %.2f kJ\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "If the fluid is in the air\n", + "The specific volume is 1.0053 m3/Kg\n", + "The final temperature is 350.3 K\n", + "Heat transferred per kg is 147 kJ\n", + "\n", + "If the fluid is in the steam\n", + "The specific volume is 1.525 m3/Kg\n", + "The final temperature is 99.62 C\n", + "Heat transferred per kg is -367.47 kJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.6 Page No : 359" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "P0 = 1000.;\n", + "T0 = 3.; \n", + "V0 = 0.001;\n", + "R = 287.;\n", + "\n", + "# Calculation\n", + "n = (P0*V0)/(R*T0); \t\t\t# Number of moles\n", + "\n", + "# Process ab\n", + "Wab = 0;\n", + "cv = (3/2.)*R;\n", + "Ta = T0; Tb = 300;\n", + "Qab = n*cv*(Tb-Ta);\n", + "Ua = 0; \t\t\t# Given internal energy\n", + "Ub = Qab+Ua;\n", + "Uab = Ub-Ua;\n", + "print Qab\n", + "# Process bc\n", + "Qbc = 0\n", + "Uc = 0\n", + "Ubc = Uc-Ub;\n", + "Wbc = -Ubc;\n", + "# Process ca\n", + "Tc = Ta;\n", + "g = 5./3; \t\t\t# gamma\n", + "Vcb = (Tb/Tc)**(3./2); \t\t\t# Vc/Vb\n", + "Wca = -n*R*Tc*math.log(Vcb);\n", + "Qca = Wca ;\n", + "Uca = 0;\n", + "\n", + "# Results\n", + "print \"Work done in the cycle is %.1f J\"%(Wbc)\n", + "print \"Internal energy change in the cycle is\",Ub,\"J\"\n", + "print \"Heat transfer in the cycle is %.2f\"%(Wca)\n", + "\n", + "# Part (b)\n", + "e = (Qab+Qca)/Qab;\n", + "print \"Thermal efficiency of the system is %.3f %%\"%(e)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "148.5\n", + "Work done in the cycle is 148.5 J\n", + "Internal energy change in the cycle is 148.5 J\n", + "Heat transfer in the cycle is -6.91\n", + "Thermal efficiency of the system is 0.953 %\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.7 Page No : 360" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "Pa = 1.5; \n", + "Ta = 273.+50; \n", + "ca = 0.5;\n", + "Pb = 0.6; \n", + "Tb = 20.+273; \n", + "mb = 2.5;\n", + "R = 8.3143;\n", + "\n", + "# Calculation\n", + "Va = (ca*R*Ta)/(Pa*1e03);\n", + "ma = ca*28;\n", + "Rn = R/28.;\n", + "Vb = (mb*Rn*Tb)/(Pb*1e03);\n", + "V = Va + Vb ;\n", + "m = ma + mb ;\n", + "Tf = 27+273.;\n", + "P = (m*Rn*Tf)/V;\n", + "g = 1.4;\n", + "cv = Rn/(g-1);\n", + "U1 = cv*(ma*Ta+mb*Tb);\n", + "U2 = m*cv*Tf;\n", + "Q = U2-U1;\n", + "\n", + "# Results\n", + "print \"The final equillibrium pressure is %.3f MPa\"%(P/1000)\n", + "print \"The amount of heat transferred to the surrounding is %.1f kJ\"%Q\n", + "T_ = (ma*Ta+mb*Tb)/m ;\n", + "P_ = (m*Rn*T_)/V;\n", + "print \"If the vessel is perfectly inslulated\"\n", + "print \"The final temperature is %.1f k\"%T_\n", + "print \"The final pressure is %.2f MPa\"%(P_/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The final equillibrium pressure is 1.169 MPa\n", + "The amount of heat transferred to the surrounding is -226.0 kJ\n", + "If the vessel is perfectly inslulated\n", + "The final temperature is 318.5 k\n", + "The final pressure is 1.24 MPa\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.8 Page No : 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "cp = 1.968; \n", + "cv = 1.507;\n", + "R_ = 8.314;\n", + "V = 0.3; \n", + "m = 2.; \n", + "T1 = 5.+273; \n", + "T2 = 100.+273;\n", + "\n", + "# Calculation\n", + "R = cp-cv;\n", + "mu = R_/R;\n", + "Q12 = m*cv*(T2-T1);\n", + "W12 = 0 ;\n", + "U21 = Q12;\n", + "H21= m*cp*(T2-T1);\n", + "S21 = m*cv*math.log(T2/T1);\n", + "\n", + "# Results\n", + "print \"Molecular weight and the gas constant of the gas are %.2f kJ/Kg mol and %.3f kJ/Kg K\"%(mu,R)\n", + "print \"Work done\",0,\"kJ\"\n", + "print \"The heat transferred %.2f kJ\"%Q12\n", + "print \"The change in internal energy \",U21,\"kJ\"\n", + "print \"Change in entropy %.1f kJ/K\"%S21\n", + "print \"Change in enthalpy\",H21,\"kJ\"\n", + "\n", + "# rounding off error would be there." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Molecular weight and the gas constant of the gas are 18.03 kJ/Kg mol and 0.461 kJ/Kg K\n", + "Work done 0 kJ\n", + "The heat transferred 286.33 kJ\n", + "The change in internal energy 286.33 kJ\n", + "Change in entropy 0.9 kJ/K\n", + "Change in enthalpy 373.92 kJ\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.9 Page No : 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "m = 1.5;\n", + "P1 = 5.6; \n", + "V1 = 0.06;\n", + "T2 = 273.+240;\n", + "a = 0.946; b = 0.662;\n", + "k = 0.0001;\n", + "\n", + "# Calculation\n", + "# Part (b)\n", + "R = a-b;\n", + "T1 = (P1*1e03*V1)/(m*R);\n", + "def f8(T): \n", + "\t return m*(b+k*T)\n", + "\n", + "W12 = - quad(f8,T1,T2)[0]\n", + "\n", + "# Results\n", + "print \"The work done in the expansion is %.0f kJ\"%W12\n", + "\n", + "# note : answer is different becaues of quad function." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work done in the expansion is 301 kJ\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.11 Page No : 363" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "m = 0.5;\n", + "P1 = 80e03; \n", + "T1 = 273.+60;\n", + "P2 = 0.4e06;\n", + "R = 0.287;\n", + "V1 = (m*R*T1)/P1 ;\n", + "g = 1.4; \t\t\t# Gamma\n", + "\n", + "# Calculation\n", + "T2 = T1*(P2/P1)**((g-1)/g);\n", + "W12 = (m*R*(T1-T2))/(g-1);\n", + "V2 = V1*((P1/P2)**(1./g));\n", + "W23 = P2*(V1-V2);\n", + "W = W12+W23;\n", + "V3 = V1;\n", + "T3 = T2*(V3/V2);\n", + "cp = 1.005;\n", + "Q = m*cp*(T3-T2);\n", + "\n", + "# Results\n", + "print \"The work transfer for the whole path is %.1f kJ\"%W\n", + "print \"The heat transfer for the whole path %.2f kJ\"%Q\n", + "\n", + "# note : incorrect answer in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work transfer for the whole path is 93.5 kJ\n", + "The heat transfer for the whole path 571.64 kJ\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.12 Page No : 365" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "P1 = 700e03\n", + "T1 = 273.+260; \n", + "T3 = T1;\n", + "V1 = 0.028; \n", + "V2 = 0.084;\n", + "R = 0.287;\n", + "\n", + "# Calculation\n", + "m = (P1*V1)/(R*T1);\n", + "P2 = P1;\n", + "T2 = T1*((P2*V2)/(P1*V1));\n", + "n = 1.5;\n", + "P3 = P2*((T3/T2)**(n/(n-1)));\n", + "cp = 1.005; cv = 0.718;\n", + "Q12 = m*cp*(T2-T1);\n", + "Q23 = m*cv*(T3-T2) + (m*R*(T2-T3))/(n-1);\n", + "Q31 = m*R*T1*math.log(P3/P1);\n", + "Q1 = Q12;\n", + "Q2 = -(Q23+Q31);\n", + "e = 1-(Q2/Q1);\n", + "\n", + "# Results\n", + "print \"The heat received in the cycle is\",round(Q1/1000,2),\"kJ\"\n", + "print \"The heat rejected in the cycle\",round(Q2/1000,2),\"J\"\n", + "print \"The efficiency of the cycle is %.2f\"%e\n", + "\n", + "# note : rounding error is there." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat received in the cycle is 137.27 kJ\n", + "The heat rejected in the cycle 84.27 J\n", + "The efficiency of the cycle is 0.39\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.13 Page No : 366" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "P1 = 300e03; \n", + "V1 = 0.07;\n", + "m = 0.25; \n", + "T1 = 80+273;\n", + "\n", + "# Calculation\n", + "R = (P1*V1)/(1000*m*T1);\n", + "P2 = P1;\n", + "V2 = 0.1;\n", + "T2 = (P2*V2)/(1000*m*R);\n", + "W = -25;\n", + "cv = -W/(m*(T2-T1));\n", + "cp = R+cv;\n", + "S21 = m*cp*math.log(V2/V1); \t\t\t# S21 = S2-S1\n", + "\n", + "# Results\n", + "print \"cv of the gas is %.3f kJ/Kg K\"%cv\n", + "print \"cp of the gas is %.3f kJ/Kg K\"%cp\n", + "print \"Increase in the entropy of the gas is %.2f kJ/Kg K\"%S21\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cv of the gas is 0.661 kJ/Kg K\n", + "cp of the gas is 0.899 kJ/Kg K\n", + "Increase in the entropy of the gas is 0.08 kJ/Kg K\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.14 Page No : 367" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "P1 = 1.;\n", + "P2 = 15.;\n", + "V1 = 800e-06;\n", + "V2 = V1/8;\n", + "cv = 0.718; \n", + "g = 1.4;\n", + "\n", + "# Calculation\n", + "n = (math.log(P2/P1))/(math.log(V1/V2))\n", + "T1 = 348; R = 0.287;\n", + "m = (P1*100*V1)/(R*T1);\n", + "T2 = T1*((P2*V2)/(P1*V1));\n", + "P3 = 50;\n", + "T3 = T2*(P3/P2);\n", + "S21 = m*(cv*math.log(T2/T1)+R*math.log(V2/V1));\n", + "S32 = m*cv*math.log(T3/T2);\n", + "Q = (m*cv*(g-n)*(T2-T1))/(1-n);\n", + "\n", + "# Results\n", + "print \"The index of compression process is %.1f\"%n\n", + "print \"T2 = %.1f K\"%T2\n", + "print \"S2-S1 is %.6f kJ/K\"%S21\n", + "print \"S3-S2 is %.6f kJ/k\"%S32\n", + "print \"The heat exchange is %.3f kJ\"%Q\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The index of compression process is 1.3\n", + "T2 = 652.5 K\n", + "S2-S1 is -0.000117 kJ/K\n", + "S3-S2 is 0.000692 kJ/k\n", + "The heat exchange is -0.057 kJ\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.15 Page No : 368" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "mn = 3.; \t\t\t# Mass of nitrogen in kg\n", + "mc = 5.; \t\t\t# mass of CO2 in kg\n", + "an = 28.; \t\t\t# Atomic weight of nitrogen\n", + "ac = 44.; \t\t\t# Atomic weight of CO2\n", + "\n", + "# Calculation and Results\n", + "# Part (a)\n", + "xn = (mn/an)/((mn/an)+(mc/ac)); \n", + "xc = (mc/ac)/((mn/an)+(mc/ac)); \n", + "print \"Mole fraction of N2 is %.3f\"%xn\n", + "print \"Mole fraction of CO2 is %.3f\"%xc\n", + "\n", + "# Part (b)\n", + "M = xn*an+xc*ac;\n", + "print \"Equivalant molecular weight of mixture is %.2f Kg\"%M\n", + "\n", + "# Part (c)\n", + "R = 8.314;\n", + "Req = ((mn*R/an)+(mc*R/ac))/(mn+mc);\n", + "print \"The equivalent gas consmath.tant of the mixture is %.3f kJ/Kg K\"%Req\n", + "\n", + "# Part (d)\n", + "P = 300.; \t\t\t# Pressure in kPa\n", + "T = 20.+273;\n", + "Pn = xn*P; \t\t\t# Partial pressure of Nitrogen\n", + "Pc = xc*P; \t\t\t# Partial pressure of CO2 \n", + "Vn = (mn*R*T)/(P*an); \t\t\t# Volume of nitrogen\n", + "Vc = (mc*R*T)/(P*ac); \t\t\t# Volume of CO2\n", + "print \"Partial pressures of nitrogen and CO2 are %.1f and %.1f kPa respectively\"%(Pn,Pc)\n", + "print \"Partial volume of nitrogen and CO2 are %.2f and %.2f m3 respectively\"%(Vn,Vc)\n", + "\n", + "# Part (e)\n", + "V = (mn+mc)*Req*T/P; \t\t\t# Total volume\n", + "rho = (mn+mc)/V;\n", + "print \"Volume of mixture is %.2f m3\"%V\n", + "print \"Density of mixture is %.2f Kg/m3\"%rho\n", + "\n", + "# Part (f)\n", + "gn = 1.4; \t\t\t# Gamma\n", + "gc = 1.286;\n", + "cvn = R/((gn-1)*an); \t\t\t# cp and cv of N2\n", + "cpn = gn*cvn; \n", + "cvc = R/((gc-1)*ac); \t\t\t# cp and cv of CO2\n", + "cpc = gc*cvc;\n", + "cp = (mn*cpn+mc*cpc)/(mn+mc) ; \t\t\t# of mixture\n", + "cv = (mn*cvn+mc*cvc)/(mn+mc) ;\n", + "print \"cp and cv of mixture are %.2f and %.2f kJ/Kg K respectively\"%(cp,cv)\n", + "\n", + "T1 = T; \n", + "T2 = 40.+273;\n", + "U21 = (mn+mc)*cv*(T2-T1);\n", + "H21 = (mn+mc)*cp*(T2-T1);\n", + "S21v = (mn+mc)*cv*math.log(T2/T1); \t\t\t# If heated at constant volume\n", + "\n", + "print \"Change in internal energy of the system heated at constant volume is %.1f kJ\"%U21\n", + "print \"Change in enthalpy of the system heated at constant volume is %.1f kJ\"%H21\n", + "print \"Change in entropy of the system heated at constant volume is %.3f kJ/Kg K\"%S21v\n", + "S21p = (mn+mc)*cp*math.log(T2/T1); \t\t\t# If heated at constant Pressure\n", + "print \"Change in entropy of the system heated at constant Pressure is %.2f kJ\"%S21p\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mole fraction of N2 is 0.485\n", + "Mole fraction of CO2 is 0.515\n", + "Equivalant molecular weight of mixture is 36.24 Kg\n", + "The equivalent gas consmath.tant of the mixture is 0.229 kJ/Kg K\n", + "Partial pressures of nitrogen and CO2 are 145.6 and 154.4 kPa respectively\n", + "Partial volume of nitrogen and CO2 are 0.87 and 0.92 m3 respectively\n", + "Volume of mixture is 1.79 m3\n", + "Density of mixture is 4.46 Kg/m3\n", + "cp and cv of mixture are 0.92 and 0.69 kJ/Kg K respectively\n", + "Change in internal energy of the system heated at constant volume is 110.6 kJ\n", + "Change in enthalpy of the system heated at constant volume is 147.3 kJ\n", + "Change in entropy of the system heated at constant volume is 0.365 kJ/Kg K\n", + "Change in entropy of the system heated at constant Pressure is 0.49 kJ\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.16 Page No : 370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "mo = 2.;\n", + "mn = 6.;\n", + "muo = 32.; \n", + "mun = 28.;\n", + "\n", + "# Calculation\n", + "o = mo/muo;\n", + "n = mn/mun;\n", + "xo = o/(n+o);\n", + "xn = n/(n+o);\n", + "R = 8.314;\n", + "Ro = R/muo; Rn = R/mun;\n", + "dS = -mo*Ro*math.log(xo)-mn*Rn*math.log(xn);\n", + "\n", + "# Results\n", + "print \"Increase in entropy is %.4f kJ/Kg K\"%dS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in entropy is 1.2292 kJ/Kg K\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.17 Page No : 371" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "an = 20.183; \t\t\t# molecular weight of neon\n", + "Pc = 2.73; \t\t\t# Critical pressure\n", + "Tc = 44.5;\n", + "Vc = 0.0416;\n", + "Pr = 2; \t\t\t# Reduced Pressure\n", + "Tr = 1.3; \n", + "Z = 0.7;\n", + "\n", + "# Calculation\n", + "P = Pr*Pc; \n", + "T = Tr*Tc;\n", + "R = 8.314;\n", + "v = (Z*R*T)/(P*1000*an);\n", + "vr = (v*an)/Vc ;\n", + "\n", + "# Results\n", + "print \"Specific volume is %.3e m3/Kg\"%v\n", + "print \"Specific temperature is\",T,\"K\"\n", + "print \"Specific pressure is\",P,\"MPa\"\n", + "print \"Reduced volume is %.2f\"%vr\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific volume is 3.055e-03 m3/Kg\n", + "Specific temperature is 57.85 K\n", + "Specific pressure is 5.46 MPa\n", + "Reduced volume is 1.48\n" + ] + } + ], + "prompt_number": 31 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |