{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 3 - Properties of pure substances" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.1 Page: 88" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.1 - Page: 88\n", "\n", "\n", "Molar Volume of the gas is 1.29e-02 cubic metres\n" ] } ], "source": [ "from __future__ import division\n", "print \"Example: 3.1 - Page: 88\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "P = 2*10**5## [Pa]\n", "T = 273 + 37## [K]\n", "R = 8.314## [J/mol K]\n", "#****************\n", "# Since the gas behaves ideally:\n", "V = R*T/P## [cubic metres]\n", "print \"Molar Volume of the gas is %.2e cubic metres\"%(V)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.2 Page: 89" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.2 - Page: 89\n", "\n", "\n", "The pressure of air after compression is 1200 kPa\n", "\n" ] } ], "source": [ "print \"Example: 3.2 - Page: 89\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "V1 = 8## [cubic m]\n", "P1 = 300## [kPa]\n", "V2 = 2## [cubic m]\n", "#**************\n", "# Apptying the ideal gas Eqn. & since the Temperature remains constant:\n", "P2 = P1*V1/V2## [kPa]\n", "print \"The pressure of air after compression is %d kPa\\n\"%(P2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.3 Page: 89" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.3 - Page: 89\n", "\n", "\n", "The pressure of the remaining air is 400 kPa\n", "\n" ] } ], "source": [ "print \"Example: 3.3 - Page: 89\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "V1 = 6## [cubic m]\n", "P1 = 500## [kPa]\n", "R = 0.287## [kJ/kg K]\n", "#*************\n", "# Applying the charectarstic equation to the gas initially:\n", "# P1*V1 = m1*R*T1.......................................(i)\n", "# Applying the charectarstic equation to the gas which was left in the vessel after one-fifth of the gas has been removed:\n", "# P2*V2 = m2*R*T2.......................................(ii)\n", "# V2 = V1# T2 = T1# m2 = (4/5)*m1# Eqn (ii) becomes:\n", "# P2*V1 = (4/5)*m1*R*T1..................................(iii)\n", "# Dividing eqn (i) by eqn (iii), we get:\n", "P2 = (4/5)*P1## [kPa]\n", "print \"The pressure of the remaining air is %d kPa\\n\"%(P2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.4 Page: 90" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.4 - Page: 90\n", "\n", "\n", "Final Temperature of the air when the piston reaches stop is 361.5 K\n", "\n", "Pressure of air inside the cylinder is 2.51 bar\n", "\n" ] } ], "source": [ "print \"Example: 3.4 - Page: 90\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "T1 = 450 + 273## [K]\n", "P1 = 3## [bar]\n", "#***************\n", "# Soluton(a)\n", "# From Fig. 3.7, (Page 90)\n", "# Since the weight remains the same, therefore, the final pressure is equal to the initial pressure.\n", "# Therefore it is a constant pressure process.\n", "P2 = P1## [bar]\n", "# Volumetric Ratio:\n", "V2_by_V1 = 2.5/(2.5 + 2.5)# Applying ideal gas law & P1 = P2\n", "T2 = T1*V2_by_V1## [K]\n", "print \"Final Temperature of the air when the piston reaches stop is %.1f K\\n\"%(T2)\n", "# Solution (b)\n", "# When the piston rests ot the stops, the pressure exerted by the weight, air & the atmosphere will be different. But there will beno further decrease in volume.\n", "# This is a constant volume process.\n", "T3 = 273 + 30## [K]\n", "# Applying ideal gas law & V2 = V3\n", "P3 = T3*P2/T2## [bar]\n", "print \"Pressure of air inside the cylinder is %.2f bar\\n\"%(P3)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.5 Page: 95" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.5 - Page: 95\n", "\n", "\n", "The temperature at which ammonia exists in the cylinder is 321.5 K\n", "\n" ] } ], "source": [ "print \"Example: 3.5 - Page: 95\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "m = 1.373## [kg]\n", "P = 1.95*10**(6)## [Pa]\n", "V = 0.1## [cubic m]\n", "a = 422.546*10**(-3)## [cubic m/square mol]\n", "b = 37*10**(-6)## [cubic m/mol]\n", "M = 17*10**(-3)## [kg/mol]\n", "R = 8.314## [J/mol K]\n", "#****************\n", "n = m/M## [moles]\n", "Vm = V/n## [molar volume, cubic m]\n", "# Applying Van der Waals equation of state:\n", "T = (P + (a/Vm**2))*((Vm - b)/R)## [K]\n", "print \"The temperature at which ammonia exists in the cylinder is %.1f K\\n\"%(T)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.6 Page: 96" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.6 - Page: 96\n", "\n", "\n", "Ideal Equation of State\n", "\n", "Molar Volume of the gas is 4.284e-03 cubic m/mol\n", "\n", "\n", "\n", "Van der Wall Equation of State\n", "\n", "Molar Volume of the gas is 4.292e-03 cubic m/mol\n", "\n", "\n", "\n", "Virial Equation of State\n", "\n", "Molar Volume of the gas is 7.000e+00 cubic m/mol\n", "\n", "\n", "\n", "Redlich Kwong Equation of State\n", "\n", "Molar Volume of the gas is 7.000e+00 cubic m/mol\n", "\n" ] } ], "source": [ "from scipy.optimize import fsolve\n", "print \"Example: 3.6 - Page: 96\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "P = 15*10**5## [Pa]\n", "T = 773## [K]\n", "R = 8.314## [J/mol K]\n", "#**************\n", "# Solution (a)\n", "print \"Ideal Equation of State\\n\"\n", "# Applying ideal Eqn. of State:\n", "Vm = R*T/P## [cubic m/mol]\n", "print \"Molar Volume of the gas is %.3e cubic m/mol\\n\"%(Vm)\n", "print \"\\n\"\n", "\n", "# Solution (b)\n", "print \"Van der Wall Equation of State\\n\"\n", "a = 0.2303## [Nm**4/square mol]\n", "b = 4.3073*10**(-5)## [cubic m/mol]\n", "#deff('[y] = f1(Vm)','y = P - (R*T/(Vm-b)) + (a/Vm**2)')\n", "def f1(Vm):\n", " y = P - (R*T/(Vm-b)) + (a/Vm**2)\n", " return y\n", "Vm = fsolve(f1,Vm)## [cubic m/mol]\n", "print \"Molar Volume of the gas is %.3e cubic m/mol\\n\"%(Vm)\n", "print \"\\n\"\n", "\n", "#Solution (c)\n", "print \"Virial Equation of State\\n\"\n", "# Z = 1 + B/V\n", "# (P*V/(R*T)) = (1 + B/V)\n", "# V**2 - V*R*T/P - B*R*T/P = 0\n", "B = 1.3697*10**(-5)## [cubic m/mol]\n", "#deff('[y] f2(Vm)','y = Vm**2 - (Vm*R*T/P) - (B*R*T/P)')\n", "def f2(vm):\n", " y = Vm**2 - (Vm*R*T/P) - (B*R*T/P)\n", " return y\n", "Vm = fsolve(f2,7)## [cubic m/mol]\n", "print \"Molar Volume of the gas is %.3e cubic m/mol\\n\"%(Vm)\n", "print \"\\n\"\n", "\n", "# Solution (d)\n", "print \"Redlich Kwong Equation of State\\n\"\n", "Tc = 190.6## [K]\n", "Pc = 45.99*10**5## [Pa]\n", "a = 0.4278*R**2*Tc**2.5/Pc## [N/m**4 square mol]\n", "b = 0.0867*R*Tc/Pc## [cubic m/mol]\n", "#deff('[y] = f3(Vm)','y = P - (R*T/(Vm - b)) + (a/((T**0.5)*Vm*(Vm+b)))')\n", "def f3(vm):\n", " y = P - (R*T/(Vm - b)) + (a/((T**0.5)*Vm*(Vm+b)))\n", " return y\n", "\n", "Vm = fsolve(f3,Vm)## [cubic m/mol]\n", "print \"Molar Volume of the gas is %.3e cubic m/mol\\n\"%(Vm)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.8 Page: 101" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.8 - Page: 101\n", "\n", "\n", "Ideal Equation of State\n", "\n", "Molar Volume of gas is 5.196e-04 cubic m/mol\n", "\n", "\n", "\n", "Virial Equation of State\n", "\n", "Molar Volume of gas is 5.20e-04 cubic m/mol\n", "\n" ] } ], "source": [ "print \"Example: 3.8 - Page: 101\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "T = 500## [K]\n", "P = 8*10**6## [Pa]\n", "R = 8.314## [J/mol K]\n", "#*************\n", "# Solution (a)\n", "# By ideal gas equation of state:\n", "print \"Ideal Equation of State\\n\"\n", "Vm = R*T/P## [cubic m/mol]\n", "print \"Molar Volume of gas is %.3e cubic m/mol\\n\"%(Vm)\n", "print \"\\n\"\n", "\n", "# Solution (b)\n", "# By Virial Equation of State:\n", "print \"Virial Equation of State\\n\"\n", "B = -0.265*10**(-3)## [cubic m/mol]\n", "C = 0.3025*10**(-7)## [m**6/square mol]\n", "#deff('[y] = f(Vm)','y = (P*Vm/(R*T)) - 1 -(B/Vm) - (C/Vm**2)')\n", "def f(vm):\n", " y = (P*Vm/(R*T)) - 1 -(B/Vm) - (C/Vm**2)\n", " return y\n", "Vm = fsolve(f,Vm)\n", "print \"Molar Volume of gas is %.2e cubic m/mol\\n\"%(Vm)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.10 Page: 103" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.10 - Page: 103\n", "\n", "\n", "Value of derivative is 23.98 bar/OC\n", "\n", "The pressure generated by heating at constant Volume is 240.84 Pa\n", "\n", "The change in Volume is -0.038 cubic cm/g\n", "\n" ] } ], "source": [ "from math import exp\n", "print \"Example: 3.10 - Page: 103\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "beeta = 1.487*10**(-3)## [1/OC]\n", "alpha = 62*10**(-6)## [1/bar]\n", "V1 = 1.287## [cubic cm /g]\n", "#************\n", "# Solution (a)\n", "# The value of derivative (dP/dT) at constant V:\n", "# dV/V = beeta*dT - alpha*dP\n", "# dV = 0\n", "# dP/dT = beeta/alpha\n", "# Value = dP/dT\n", "Value = beeta/alpha## [bar/OC]\n", "print \"Value of derivative is %.2f bar/OC\\n\"%(Value)\n", "# Solution (b)\n", "P1 = 1## [bar]\n", "T1 = 20## [OC]\n", "T2 = 30## [OC]\n", "# Applying the same equation:\n", "P2 = P1 +(beeta/alpha)*(T2 - T1)## [bar]\n", "print \"The pressure generated by heating at constant Volume is %.2f Pa\\n\"%(P2)\n", "# Solution (c)\n", "T2 = 0## [OC]\n", "T1 = 20## [OC]\n", "P2 = 10## [bar]\n", "P1 = 1## [bar]\n", "# The change in Volume can be obtained as:\n", "V2 = V1*exp((beeta*(T2 - T1)) - alpha*(P2 - P1))## [cubic cm/g]\n", "deltaV = V2 - V1## [cubic cm/g]\n", "print \"The change in Volume is %.3f cubic cm/g\\n\"%(deltaV)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 3.11 Page: 107" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 3.11 - Page: 107\n", "\n", "\n", "Acentric factor is 0.6447\n" ] } ], "source": [ "from math import log10\n", "print \"Example: 3.11 - Page: 107\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data*****\n", "Tc = 513.9## [K]\n", "Pc = 61.48*10**5## [Pa]\n", "#************\n", "Tr = 0.7\n", "T = Tr*Tc - 273.15## [OC]\n", "P_sat = 10**(8.112 - (1592.864/(T + 226.184)))## [mm Hg]\n", "P_sat = P_sat*101325/760## [Pa]\n", "Pr_sat = P_sat/Pc## [Pa]\n", "omega = -1 - log10(Pr_sat)## [Acentric factor]\n", "print \"Acentric factor is %.4f\"%(omega)#" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }