From 206d0358703aa05d5d7315900fe1d054c2817ddc Mon Sep 17 00:00:00 2001 From: Jovina Dsouza Date: Wed, 18 Jun 2014 12:43:07 +0530 Subject: adding book --- Industrial_Instrumentation/ch8.ipynb | 966 +++++++++++++++++++++++++++++++++++ 1 file changed, 966 insertions(+) create mode 100644 Industrial_Instrumentation/ch8.ipynb (limited to 'Industrial_Instrumentation/ch8.ipynb') diff --git a/Industrial_Instrumentation/ch8.ipynb b/Industrial_Instrumentation/ch8.ipynb new file mode 100644 index 00000000..5b548006 --- /dev/null +++ b/Industrial_Instrumentation/ch8.ipynb @@ -0,0 +1,966 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Ideal and Real Gases" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page no : 392" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "How many kg of air must be removed from the chamber during the process ? Express this\n", + "mass as a volume measured at 1 bar and 25\u00b0C.\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "R = 287.; \t\t\t#J/kg K\n", + "V1 = 40.; \t\t\t#m**3\n", + "V2 = 40.; \t\t\t#m**3\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "p2 = 0.4*10**5; \t\t\t#Pa\n", + "T1 = 298.; \t\t\t#K\n", + "T2 = 278.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "m1 = p1*V1/R/T1;\n", + "m2 = p2*V2/R/T2;\n", + "#Let mass of air removed be m\n", + "m = m1-m2;\n", + "\n", + "# Results\n", + "print (\"Mass of air removed = %.3f\")% (m),(\"kg\")\n", + "\n", + "V = m*R*T1/p1;\n", + "print (\"Volume of gas removed = %.3f\")% (V), (\"m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air removed = 26.716 kg\n", + "Volume of gas removed = 22.849 m**3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page no : 393" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "(i) How many kg of nitrogen will the flask hold at the designed conditions ?\n", + "(ii) At what temperature must the fusible plug melt in order to limit the pressure of a full\n", + "flask to a maximum of 150 bar ?\n", + "'''\n", + "\n", + "# Variables\n", + "V = 0.04; \t\t\t#m**3\n", + "p = 120.*10**5; \t\t\t#Pa\n", + "T = 293.; \t\t\t#K\n", + "R0 = 8314.; \n", + "\n", + "# Calculations and Results\n", + "print (\"(i) kg of nitrogen the flask can hold\")\n", + "M = 28; \t\t\t#molecular weight of Nitrogen\n", + "R = R0/M;\n", + "\n", + "m = p*V/R/T;\n", + "print (\"kg of nitrogen = %.3f\")% (m), (\"kg\")\n", + "\n", + "print (\"(ii) Temperature at which fusible plug should melt\")\n", + "p = 150.*10**5; \t\t\t#Pa\n", + "T = p*V/R/m; \t\t\t#K\n", + "t = T-273; \t\t\t#0C\n", + "print (\"Temperature = %.3f\")% (t),(\"\u00b0C\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) kg of nitrogen the flask can hold\n", + "kg of nitrogen = 5.517 kg\n", + "(ii) Temperature at which fusible plug should melt\n", + "Temperature = 93.250 \u00b0C\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page no : 393" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "(i) What mass of original gas must have escaped if the dimensions of the balloon is not\n", + "changed ?\n", + "(ii) Find the amount of heat to be removed to cause the same drop in pressure at constant\n", + "volume.\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "T1 = 293.; \t\t\t#K\n", + "d = 6.; \t\t\t#m; diameter of the spherical balloon\n", + "p2 = 0.94*p1;\n", + "T2 = T1;\n", + "cv = 10400.; \t\t\t#J/kg K\n", + "R = 8314/2.;\n", + "r = 3.; \t\t\t#m\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Mass of original gas escaped\")\n", + "\n", + "mass_escaped = (p1-p2)/p1*100;\n", + "print (\"%mass_escaped = \"), (mass_escaped), (\"%\")\n", + "\n", + "print (\"(ii)Amount of heat to be removed \")\n", + "T2 = 0.94*T1;\n", + "m = p1*4/3*math.pi*r**3/R/T1;\n", + "\n", + "Q = m*cv*(T1-T2)/10**6;\n", + "print (\"Q = %.3f\")% (Q),(\"MJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Mass of original gas escaped\n", + "%mass_escaped = 6.0 %\n", + "(ii)Amount of heat to be removed \n", + "Q = 1.698 MJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page no : 394" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "(i) Calculate pressure and the specific volume of the gas.\n", + "(ii) evaluate the values of c p and c v .\n", + "(iii) evaluate the final pressure of gas.\n", + "(iv) Evaluate the increase in specific internal energy, the increase in specific enthalpy, increase\n", + "in specific entropy and magnitude and sign of heat transfer.\n", + "'''\n", + "\n", + "from numpy import *\n", + "import math \n", + "\n", + "# Variables\n", + "m = 28.; \t\t\t#kg\n", + "V1 = 3.; \t\t\t#m**3\n", + "T1 = 363.; \t\t\t#K\n", + "R0 = 8314.;\n", + "M = 28.; \t\t\t#Molecular mass of N2\n", + "R = R0/m;\n", + "V2 = V1;\n", + "T2 = 293.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Pressure (p1) and specific volume (v1) of the gas\")\n", + "\n", + "p1 = m*R*T1/V1/10**5; \t\t\t#bar\n", + "print (\"Pressure = %.3f\")% (p1), (\"bar\")\n", + "\n", + "v1 = V1/m;\n", + "print (\"specific volume = %.3f\")% (v1), (\"m**3/kg\")\n", + "\n", + "\n", + "#cp-cv = R/1000;\n", + "#cp-1.4cv = 0;\n", + "#solving the above two eqns \n", + "A = [[1,-1],[1,-1.4]];\n", + "B = [R/1000,0];\n", + "X = linalg.inv(A)*B;\n", + "cp = X[0,0]\n", + "print (\"cp = %.3f\")% (cp), (\"kJ/kg K\")\n", + "\n", + "cv = X[1][0];\n", + "print (\"cv = %.3f\")% (cv),(\"kJ/kg K\")\n", + "\n", + "print (\"(iii) Final pressure of the gas after cooling to 20\u00b0C\")\n", + "p2 = p1*T2/T1;\n", + "print (\"p2 = %.3f\")% (p2), (\"bar\")\n", + "\n", + "\n", + "du = cv*(T2-T1);\n", + "print (\"Increase in specific internal energy = %.3f\")% (du), (\"kJ/kg\")\n", + "\n", + "dh = cp*(T2-T1);\n", + "print (\"Increase in specific Enthalpy = %.3f\")%(dh), (\"kJ/kg\")\n", + "\n", + "v2 = v1;\n", + "ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n", + "print (\"Increase in specific entropy = %.3f\")%(ds),(\"kJ/kg K\")\n", + "\n", + "W = 0; \t\t\t#constant volume process\n", + "Q = m*du+W;\n", + "print (\"Heat transfer = %.3f\")%(Q), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Pressure (p1) and specific volume (v1) of the gas\n", + "Pressure = 10.060 bar\n", + "specific volume = 0.107 m**3/kg\n", + "cp = 1.039 kJ/kg K\n", + "cv = 0.742 kJ/kg K\n", + "(iii) Final pressure of the gas after cooling to 20\u00b0C\n", + "p2 = 8.120 bar\n", + "Increase in specific internal energy = -51.963 kJ/kg\n", + "Increase in specific Enthalpy = -72.748 kJ/kg\n", + "Increase in specific entropy = -0.159 kJ/kg K\n", + "Heat transfer = -1454.950 kJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page no : 396" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "(a) \n", + "determine :\n", + "(i) The final specific volume, temperature and increase in entropy ;\n", + "(ii) The work done and the heat transfer.\n", + "(b) Repeat (a) assuming the process to be irreversible and adiabatic between end states.\n", + "'''\n", + "\n", + "import math \n", + "\n", + "print (\"Part (a)\")\n", + "# Variables\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "y = 1.4;\n", + "m1 = 1.; \t\t\t#kg\n", + "p1 = 8.*10**5; \t\t\t#Pa\n", + "T1 = 373.; \t\t\t#K\n", + "p2 = 1.8*10**5; \t\t\t#Pa\n", + "cv = 0.717; \t\t\t#kJ/kg K\n", + "n = 1.2;\n", + "\n", + "# Calculations and Results\n", + "#pv**1.2 = consmath.tant\n", + "print (\"(i) The final specific volume, temperature and increase in entropy\")\n", + "\n", + "v1 = R*10**3*T1/p1;\n", + "v2 = v1*(p1/p2)**(1./n);\n", + "print (\"v2 = %.3f\")%(v2), (\"m**3/kg\")\n", + "\n", + "T2 = p2*v2/R/10**3; \t\t\t#K\n", + "t2 = T2-273; \t\t\t#0C\n", + "print (\"Final temperature = %.3f\")% (t2), (\"0C\")\n", + "\n", + "ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n", + "print (\"ds = %.3f\")%(ds), (\"kJ/kg K\")\n", + "\n", + "\n", + "W = R*(T1-T2)/(n-1);\n", + "print (\"Work done = %.3f\")% (W), (\"kJ/kg\")\n", + "\n", + "Q = cv*(T2-T1) + W;\n", + "print (\"Heat transfer = %.3f\")%(Q),(\"kJ/kg\")\n", + "\n", + "print (\"Part (b)\")\n", + "\n", + "print (\"(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\")\n", + "\n", + "\n", + "print (\"(ii) Adiabatic process\")\n", + "Q = 0;\n", + "print (\"Heat transfer = %.3f\")%(Q), (\"kJ/kg\")\n", + "\n", + "W = -cv*(T2-T1);\n", + "print (\"Work done = %.3f\")%(W),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part (a)\n", + "(i) The final specific volume, temperature and increase in entropy\n", + "v2 = 0.464 m**3/kg\n", + "Final temperature = 17.897 0C\n", + "ds = 0.179 kJ/kg K\n", + "Work done = 117.818 kJ/kg\n", + "Heat transfer = 58.950 kJ/kg\n", + "Part (b)\n", + "(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\n", + "(ii) Adiabatic process\n", + "Heat transfer = 0.000 kJ/kg\n", + "Work done = 58.868 kJ/kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page no : 397" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "determine the pressure in the spheres when the system attains equilibrium.\n", + "'''\n", + "\n", + "# Variables\n", + "d = 2.5; \t\t\t#m; diameter\n", + "V1 = 4./3*math.pi*(d/2)**3; \t\t\t#volume of each sphere\n", + "T1 = 298.; \t\t\t#K\n", + "T2 = 298.; \t\t\t#K\n", + "m1 = 16.; \t\t\t#kg\n", + "m2 = 8.; \t\t\t#kg\n", + "V = 2.*V1; \t\t\t#total volume\n", + "m = m1+m2;\n", + "R = 287.; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations\n", + "p = m*R*T1/V/10**5; \t\t\t#bar\n", + "\n", + "\n", + "# Results\n", + "print (\"pressure in the spheres when the system attains equilibrium = %.3f\")%(p),(\"bar\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure in the spheres when the system attains equilibrium = 1.254 bar\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page no : 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "evaluate the heat transfer rate from the gas and the power delivered by the turbine.\n", + "'''\n", + "\n", + "# Variables\n", + "m = 6.5/60; \t\t\t#kg/s\n", + "import math \n", + "cv = 0.837; \t\t\t#kJ/kg K\n", + "p1 = 10*10**5; \t\t\t#Pa\n", + "p2 = 1.05*10**5; \t\t\t#Pa\n", + "T1 = 453; \t\t\t#K\n", + "R0 = 8.314;\n", + "M = 44.; \t\t\t#Molecular mass of CO2\n", + "\n", + "\n", + "# Calculations and Results\n", + "R = R0/M;\n", + "cp = cv+R;\n", + "y = cp/cv;\n", + "\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "print T2\n", + "t2 = T2-273;\n", + "print (\"Final temperature = %.3f\")%(t2),(\"0C\")\n", + "\n", + "v2 = R*10**3*T2/p2; \t\t\t#m**3/kg\n", + "print (\"final specific volume = %.3f\")%(v2), (\"m**3/kg\")\n", + "\n", + "ds = 0; \t\t\t#Reversible and adiabatic process\n", + "print (\"Increase in entropy = \"), (ds)\n", + "\n", + "Q = 0; \t\t\t#Adiabatic process\n", + "print (\"Heat transfer rate from turbine = \"), (Q)\n", + "\n", + "W = m*cp*(T1-T2);\n", + "print (\"Power delivered by the turbine = %.3f\")% (W), (\"kW\")\n", + "\n", + "\n", + "# Note : answers wont match with the book because of the rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "299.106840283\n", + "Final temperature = 26.107 0C\n", + "final specific volume = 0.538 m**3/kg\n", + "Increase in entropy = 0\n", + "Heat transfer rate from turbine = 0\n", + "Power delivered by the turbine = 17.104 kW\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page no : 400" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Evaluate the following :\n", + "(i) The heat received in the cycle ;\n", + "(ii) The heat rejected in the cycle ;\n", + "(iii) Efficiency of the cycle.\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 8.*10**5; \t\t\t#Pa\n", + "V1 = 0.035; \t\t\t#m**3\n", + "T1 = 553.; \t\t\t#K\n", + "p2 = 8.*10**5; \t\t\t#Pa\n", + "V2 = 0.1; \t\t\t#m**3\n", + "n = 1.4;\n", + "R = 287.; \t\t\t#J/kg K\n", + "T3 = 553.; \t\t\t#K\n", + "cv = 0.71; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations and Results\n", + "m = p1*V1/R/T1;\n", + "T2 = p2*V2/m/R;\n", + "p3 = p2/((T2/T3)**(n/(n-1)));\n", + "V3 = m*R*T3/p3;\n", + "\n", + "print (\"(i) The heat received in the cycle\")\n", + "\n", + "#constant pressure process 1-2\n", + "W_12 = p1*(V2-V1)/10**3; \t\t\t#kJ\n", + "Q_12 = m*cv*(T2-T1) + W_12; \t\t\t#kJ\n", + "\n", + "#polytropic process 2-3\n", + "W_23 = m*R/10**3*(T2-T3)/(n-1);\n", + "Q_23 = m*cv*(T3-T2) + W_23;\n", + "\n", + "Q_received = Q_12 + Q_23;\n", + "print (\"Total heat received in the cycle = \"),(Q_received), (\"kJ\")\n", + "\n", + "print (\"(ii) The heat rejected in the cycle\")\n", + "\n", + "#Isothermal process 3-1\n", + "W_31 = p3*V3*math.log(V1/V3)/10**3; \t\t\t#kJ\n", + "Q_31 = m*cv*(T3-T1) + W_31;\n", + "print (\"Heat rejected in the cycle = %.3f\")% (-Q_31), (\"kJ\")\n", + "\n", + "\n", + "n = (Q_received - (-Q_31))/Q_received*100;\n", + "print (\"Efficiency of the cycle = %.3f\")% (n), (\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The heat received in the cycle\n", + "Total heat received in the cycle = 182.0 kJ\n", + "(ii) The heat rejected in the cycle\n", + "Heat rejected in the cycle = 102.883 kJ\n", + "Efficiency of the cycle = 43.471 %\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page no : 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Compute the pressure by\n", + "(i) Van der Waals\u2019 equation\n", + "(ii) Perfect gas equation.\n", + "'''\n", + "\n", + "\n", + "# Variables\n", + "v = 44.; \t\t\t#m**3/kg-mol\n", + "T = 373.; \t\t\t#K\n", + "\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Using Van der Waals\u2019 equation\")\n", + "a = 362850.; \t\t\t#N*m**4/(kg-mol)**2\n", + "b = 0.0423; \t\t\t#M**3/kg-mol\n", + "R0 = 8314.; \t\t\t#J/kg K\n", + "\n", + "p = ((R0*T/(v-b)) - a/v**2);\n", + "print (\"Pressure umath.sing Van der Waals equation = %.3f\")%(p), (\"N/m**2\")\n", + "\n", + "print (\"(ii) Using perfect gas equation\")\n", + "\n", + "p = R0*T/v;\n", + "print (\"Pressure using perfect gas equation = %.3f\")% (p), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Using Van der Waals\u2019 equation\n", + "Pressure umath.sing Van der Waals equation = 70360.445 N/m**2\n", + "(ii) Using perfect gas equation\n", + "Pressure using perfect gas equation = 70480.045 N/m**2\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page no : 425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Estimate the\n", + "pressure exerted by CO 2 by using :\n", + "(i) Perfect gas equation\n", + "(ii) Van der Waals\u2019 equation\n", + "(iii) Beattie Bridgeman equation.\n", + "'''\n", + "# Variables\n", + "V = 3.; \t\t\t#m**3\n", + "m = 10.; \t\t\t#kg\n", + "T = 300.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "R0 = 8314.;\n", + "M = 44.; \n", + "R = R0/M;\n", + "p = m*R*T/V;\n", + "print (\"Pressure Using perfect gas equation = %.3f\")% (p),(\"N/m**2\")\n", + "\n", + "a = 362850; \t\t\t#Nm**4/(kg-mol)**2\n", + "b = 0.0423; \t\t\t#m**3/(kg-mol)\n", + "v = 13.2; \t\t\t #m**3/kg-mol\n", + "\n", + "p = R0*T/(v-b) - a/v**2;\n", + "print (\"Pressure Using Van der Waals\u2019 equation = %.3f\")%(p), (\"N/m**2\")\n", + "\n", + "\n", + "A0 = 507.2836;\n", + "a = 0.07132;\n", + "B0 = 0.10476;\n", + "b = 0.07235;\n", + "C = 66*10**4;\n", + "A = A0*(1-a/v);\n", + "B = B0*(1-b/v);\n", + "e = C/v/T**3;\n", + "\n", + "p = R0*T*(1-e)/v**2*(v+B) - A/v**2;\n", + "print (\"Pressure Using Beattie Bridgeman equation = %.3f\")%(p), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure Using perfect gas equation = 188954.545 N/m**2\n", + "Pressure Using Van der Waals\u2019 equation = 187479.533 N/m**2\n", + "Pressure Using Beattie Bridgeman equation = 190090.365 N/m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page no : 404" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find :\n", + "(i) The work done during the process\n", + "(ii) The final pressure.\n", + "'''\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "a = 139250; \t\t\t#Nm**4/(kg-mol)**2\n", + "b = 0.0314; \t\t\t#m**3/kg-mol\n", + "R0 = 8314; \t\t\t#Nm/kg-mol K\n", + "v1 = 0.2*32; \t\t\t#m**3/kg-mol\n", + "v2 = 0.08*32; \t\t\t#m**3/kg-mol\n", + "T = 333; \t\t\t#K\n", + "print (\"(i) Work done during the process\")\n", + "\n", + "# Calculations\n", + "def f21( v): \n", + "\t return R0*T/(v-b) - a/v**2\n", + "\n", + "W = quad(f21, v1, v2)[0]\n", + "\n", + "\n", + "# Results\n", + "print (\"W = %.3f\")% (W),(\"Nm/kg-mol\")\n", + "\n", + "\n", + "print (\"(ii) The final pressure\")\n", + "p2 = R0*T/(v2-b) - a/v2**2;\n", + "print (\"p2 = %.3f\")%(p2), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Work done during the process\n", + "W = -2524722.415 Nm/kg-mol\n", + "(ii) The final pressure\n", + "p2 = 1073651.290 N/m**2\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12 Page no : 404" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "compute the temperature.\n", + "'''\n", + "\n", + "# Variables\n", + "pr = 20;\n", + "Z = 1.25;\n", + "Tr = 8.0;\n", + "Tc = 282.4; \t\t\t#K\n", + "\n", + "# Calculations\n", + "T = Tc*Tr;\n", + "\n", + "# Results\n", + "print (\"Temperature = %.3f\")%(T),(\"K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 2259.200 K\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Calculate the density using the compressibility chart\n", + "'''\n", + "\n", + "# Variables\n", + "p = 260.*10**5; \t\t\t#Pa\n", + "T = 288.; \t\t\t#K\n", + "pc = 33.94*10**5; \t\t\t#Pa\n", + "Tc = 126.2; \t\t\t#K\n", + "R = 8314./28;\n", + "\n", + "# Calculations\n", + "pr = p/pc;\n", + "Tr = T/Tc;\n", + "Z = 1.08;\n", + "rho = p/Z/R/T;\n", + "\n", + "# Results\n", + "print (\"Density of N2 = %.3f\")% (rho), (\"kg/m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Density of N2 = 281.517 kg/m**3\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.14 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "What should be the temperature of 1.3 kg of CO 2 gas to behave as an ideal ?\n", + "'''\n", + "# Variables\n", + "p = 200.*10**5; \t\t\t#Pa\n", + "pc = 73.86*10**5; \t\t\t#Pa\n", + "Tc = 304.2; \t\t\t#K\n", + "pr = p/pc;\n", + "Z = 1;\n", + "Tr = 2.48;\n", + "\n", + "# Calculations\n", + "T = Tr*Tc;\n", + "\n", + "# Results\n", + "print (\"Temperature = \"), (T), (\"K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 754.416 K\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Find the mass of H 2 in the balloon using real gas equation.\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 12.; \t\t\t#m; diameter of spherical balloon\n", + "V = 4./3*math.pi*(d/2)**3;\n", + "T = 303.; \t\t\t#K\n", + "p = 1.21*10**5; \t\t\t#Pa\n", + "pc = 12.97*10**5; \t\t\t#Pa\n", + "Tc = 33.3; \t\t\t#K\n", + "R = 8314./2;\n", + "\n", + "# Calculations\n", + "pr = p/pc;\n", + "Tr = T/Tc;\n", + "Z = 1;\n", + "m = p*V/Z/R/T;\n", + "\n", + "# Results\n", + "print (\"Mass of H2 in the balloon = %.3f\")% (m), (\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of H2 in the balloon = 86.917 kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.16 Page no : 406" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Determine the value of compressibility factor \n", + "'''\n", + "# Calculations\n", + "Z_cp = 3./2-9./8;\n", + "\n", + "# Results\n", + "print (\"Z_cp = \"),(Z_cp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Z_cp = 0.375\n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit