summaryrefslogtreecommitdiff
path: root/Applied_Thermodynamics/Chapter1.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Applied_Thermodynamics/Chapter1.ipynb')
-rwxr-xr-xApplied_Thermodynamics/Chapter1.ipynb1252
1 files changed, 1252 insertions, 0 deletions
diff --git a/Applied_Thermodynamics/Chapter1.ipynb b/Applied_Thermodynamics/Chapter1.ipynb
new file mode 100755
index 00000000..136a766b
--- /dev/null
+++ b/Applied_Thermodynamics/Chapter1.ipynb
@@ -0,0 +1,1252 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3d30e44891eb37ef00ed656432995cc8c4288cfa1fdb5a14ded0356bbe856a8e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1: Fundamental Concepts and Definitions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1, page no. 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "h = 30*10**-2 #Manometer deflection of Mercury(in m):\n",
+ "d = 13550 #Density of mercury(in kg/m**3)\n",
+ "g = 9.78 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculations:\n",
+ "P = d*g*h #Pressure difference(in Pa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Pressure Difference: \" ,round(P,2),\"Pa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure Difference: 39755.7 Pa\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2, page no. 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math\n",
+ "#Variable Declaration: \n",
+ "d = 30*10**-2 #Diameter of the vessel(in m):\n",
+ "g = 9.78 #Accelertion due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "p = 76*(10**-2)*13550*g #Atmospheric pressure(in Pa):\n",
+ "a = (round(math.pi,2)*d**2)/4 #Area:\n",
+ "F = p*a #Effort required:\n",
+ "\n",
+ "#Results:\n",
+ "print \"Effort required: \",round(F,2),\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Effort required: 7115.48 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3, page no. 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "h = 30*10**-2 #Difference in mercury column(in m):\n",
+ "pa = 101 #Atmospheric Pressure(in kPa):\n",
+ "g = 9.78 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "gp = 13550*g*h*10**-3 #Guage pressure(in kPa):\n",
+ "ap = gp+pa #Actual pressure:\n",
+ "\n",
+ "#Results:\n",
+ "print \"Actual pressure of air : \",round(ap,2),\" Kpa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Actual pressure of air : 140.76 Kpa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4, page no. 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "h = 1 #Depth of tank(in m):\n",
+ "s = 0.8 #Specific gravity:\n",
+ "d = 1000 #Density of water(in kg/m**3):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "dO = s*d #Density of oil(in kg/m3):\n",
+ "gp = dO*g*h*10**-3 #Gauge pressure(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Gauge pressure\",gp,\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Gauge pressure 7.848 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5, page no. 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "h = 76*10**-2 #Barometer Reading(in m):\n",
+ "d = 13.6*10**3 #Density of mercury(in kg/m**3):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "h1 = 40*10**-2 #Difference of heights in gas barometer(in m):\n",
+ "pg = (d*g*h1+d*g*h)*10**-3 #Pressure of gas(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Pressure of gas:\",round(pg,2),\"kPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure of gas: 154.76 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6, page no. 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "m = 1 #Mass of water(in kg):\n",
+ "h = 1000 #Altitude(in m):\n",
+ "c = 4.18*10**3 #Specific heat of water(in J/kg-K):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m*g*h #Heat required for heating = Potential energy \n",
+ "dT = Q/c\n",
+ "\n",
+ "#Results\n",
+ "print \"The change in temperature: \",round(dT,2),\"\u00baC\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in temperature: 2.35 \u00baC\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7, page no. 24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "w = 100 #Weight of object at standard gravitational acceleration(in N):\n",
+ "g = 9.81 #Standard acceleration due to gravity(in m/s**2):\n",
+ "g1 = 8.5 #Gravitation acceleration at given location(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "m = w/g #Mass of object(in kg):\n",
+ "s = m*g1 #Spring balance reading(in N):\n",
+ "\n",
+ "#Results:\n",
+ "print \"The spring balance reading:\",round(s,2),\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The spring balance reading: 86.65 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8, page no. 24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math\n",
+ "#Variable Declaration: \n",
+ "dia = 15*10**-2 #Diameter of cylinder(in m):\n",
+ "h = 12*10**-2 #Manometer difference in Hg column(in m):\n",
+ "d = 13.6*10**3 #Density of mercury(in kg/m**3):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "w = h*d*g*math.pi*dia**2/4 #Weight of piston(in N): pressure*area\n",
+ "m = w/g #Mass of the piston(in kg):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Mass of the piston:\",round(m,2),\"Kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass of the piston: 28.84 Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9, page no. 24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "Hab = 2*10**-2 #Height of water column in limb AB(in m):\n",
+ "Hcd = 10*10**-2 #Height of mercury column in limb CD(in m):\n",
+ "h = 76*10**-2 #Barometer reading for atmospheric pressure(in m):\n",
+ "dm = 13.6*10**3 #Density of mercury(in kg/m**3):\n",
+ "dw = 1000 #Density of water(in kg/m**3):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "Patm = dm*h*g*10**-3 #Atmospheric pressure(in kPa):\n",
+ "Pab = dw*Hab*g*10**-3 #Pressure of water in column AB(in kPa):\n",
+ "Pcd = dm*Hcd*g*10**-3 #Pressure of mercury in column CD(in kPa):\n",
+ "Ps = Patm+Pcd-Pab #Pressure of steam(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Pressure of steam:\",round(Ps,2),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure of steam: 114.54 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10, page no. 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "Pa = 400 #Pressure in compartment A(in kPa):\n",
+ "Pb = 150 #Pressure in compartment B(in kPa):\n",
+ "h = 720*10**-3 #Reading of barometer(in m):\n",
+ "d = 13.6*10**3 #Density of mercury(in kg/m**3):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "Patm = d*g*h*10**-3 #Atmospheric pressure from barometer reading(in kPa):\n",
+ "PaA = Pa+Patm #Absolute pressure in compartment A(in kPa):\n",
+ "PaB = Pb+Patm #Absolute pressure in compartment B(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Absolute pressure in compartment A:\",round(PaA,2),\"KPa\"\n",
+ "print \"Absolute pressure in compartment B:\",round(PaB,2),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure in compartment A: 496.06 KPa\n",
+ "Absolute pressure in compartment B: 246.06 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11, page no. 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "Patm = 90 #Atmospheric pressure(in kPa):\n",
+ "dw = 1000 #Density of water(in kg/m**3):\n",
+ "doil = 850 #Density of oil(in kg/m**3):\n",
+ "dm = 13600 #Density of mercury(in kg/m**3):\n",
+ "h1 = 0.15 #Height of water column(in m):\n",
+ "h2 = 0.25 #Height of oil column(in m):\n",
+ "h3 = 0.40 #Height of mercury column(in m):\n",
+ "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "Pw = dw*g*h1*10**-3 #Pressure due to water column at reference line(in kPa):\n",
+ "Po = doil*g*h2*10**-3 #Pressure due to oil column at reference line(in kPa):\n",
+ "Pm = dm*g*h3*10**-3 #Pressure due to mercury column at reference line(in kPa):\n",
+ "Pa = Patm+Pm-Pw-Po #Pressure due to air(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Air pressure:\" ,round(Pa,2),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Air pressure: 139.81 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12, page no. 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "v = 750.0 #Velocity of the object(in m/s):\n",
+ "F = 4000.0 #Gravitational force acting on the body(in N):\n",
+ "g = 8.0 #Acceleration due to gravity(in m/s**2):\n",
+ "\n",
+ "#Calculation:\n",
+ "m = F/g #Mass of the object(in kg):\n",
+ "KE = (m*v**2)/2 #Kinetic energy of the body(in J):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Kinetic energy:\",round(KE/10**8,1),\"x 10^8 J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Kinetic energy: 1.4 x 10^8 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13, page no. 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "Cp = 2.286 #Specific heat at constant pressure(in kJ/kg-K):\n",
+ "Cv = 1.768 #Specific heat at constant volume(in kJ/kg-K):\n",
+ "Ru = 8.314 #Universal gas constant(in kJ/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "R = Cp-Cv #Gas constant(in kJ/kg-K):\n",
+ "m = Ru/R #Molecular weight of gas(in kg/K mol):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Molecular weight of gas:\" ,round(m,2),\"Kg/K mol\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Molecular weight of gas: 16.05 Kg/K mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14, page no. 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "p1 = 750*10**3 #Initial pressure(in Pa):\n",
+ "t1 = 600 #Initial temperature(in K):\n",
+ "v1 = 0.2 #Initial volume(in m**3):\n",
+ "p2 = 2*10**5 #Final pressure(in Pa):\n",
+ "v2 = 0.5 #Final volume(in m**3):\n",
+ "\n",
+ "#Calculation:\n",
+ "t2 = p2*v2*t1/(p1*v1) #Final temperature(in K):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Final temperature:\",t2,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final temperature: 400.0 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15, page no. 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "p1 = 100 #Initial pressure(in kPa):\n",
+ "t1 = 300 #Initial temperature(in K):\n",
+ "v1 = 5 #Initial volume(in m**3):\n",
+ "p2 = 50 #Final pressure(in kPa):\n",
+ "t2 = 280 #Final temperature(in K):\n",
+ "v2 = 5 #Final volume(in m**3):\n",
+ "R = 287.0 #Gas constant for air(in J/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "m1 = p1*v1/(R*t1)*10**3 #Initial mass(in kg):\n",
+ "m2 = p2*v2/(R*t2)*10**3 #Final mass(in kg):\n",
+ "dm = m1-m2 #Mass removed(in kg):\n",
+ "V = dm*R*t1/p1/1000 #Volume of this mass of air at initial states(in m**3):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Mass of air removed: \",round(dm,3),\"Kg\"\n",
+ "print \"Volume of air at initial states: \",round(V,2),\"m^3\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass of air removed: 2.696 Kg\n",
+ "Volume of air at initial states: 2.32 m^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16, page no. 27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math\n",
+ "#Variable Declaration: \n",
+ "d = 1 #Diameter of the vessel(in m):\n",
+ "h = 4 #Height of the vessel(in m):\n",
+ "p1 = 100 #Initial pressure(in kPa):\n",
+ "t1 = 300 #Initial temperature(in K):\n",
+ "p2 = 125 #Final pressure(in kPa):\n",
+ "Cp = 14.307 #Cp of hydrogen(in kJ/kg-K):\n",
+ "Cv = 10.183 #Cv of volume(in kJ/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "v = math.pi*d**2*h/4 #Volume of the vessel(in m**3):\n",
+ "t2 = p2*t1/p1 #Final temperature(in K):\n",
+ "R = Cp-Cv #Gas constant for hydrogen:\n",
+ "m = round(p1*v/(R*t1),3) #Mass of hydrogen(in kg):\n",
+ "Q = m*Cv*(t2-t1) #Heat supplied at const. volume(in kJ):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Heat to be supplied: \",round(Q,2),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat to be supplied: 193.99 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17, page no. 28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declaration: \n",
+ "v = 2+2 #Total volume(in m**3):\n",
+ "m1 = 20 #Mass of air in container 1(in kg):\n",
+ "m2 = 4 #Mass of air in container 2(in kg):\n",
+ "t = 300 #Temperature of the system(in K):\n",
+ "R = 287 #Gas constant for air(in J/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "m = m1+m2 #Total mass after the valve is opened(in kg):\n",
+ "p = m*R*t/v*10**-3 #Final pressure(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Final pressure: \" ,p,\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final pressure: 516.6 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18, page no. 28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "m = 5 #Mass of gas(in kg):\n",
+ "v = 2 #Volume of the container(in m**3):\n",
+ "t = 300 #Temperature in the container(in K):\n",
+ "R = 8.314 #Universal gas constant(in kJ/kg-K):\n",
+ "a = 3628.5*10**2 #Vander-Waals Constant(from table):\n",
+ "b = 3.14*10**-2 #Vander-Waals Constant(from table):\n",
+ "mw = 44.01 #Molecular weight of CO2:\n",
+ "\n",
+ "#Calculation:\n",
+ "Rp = R*10**3/mw #Gas constant for CO2(in j/kg-K):#Considering it as a perfect gas\n",
+ "pp = m*Rp*t/v #Pressure of the gas(in N/m**2):\n",
+ "v1 = v*mw/m #Molar specific volume(in m**3/kg.mol): #Considering it as a real gas:\n",
+ "pr = R*10**3*t/(v1-b)-a/(v1**2)\t#Vanderwall eqn:\n",
+ "\n",
+ "#Results:\n",
+ "print \"Pressure if considered perfect gas: \" ,round(pp/10**5,3),\"x 10^5 N/m^2\"\n",
+ "print \"Pressure if considered real gas: \",round(pr/10**5,3),\"x 10^5 N/m^2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure if considered perfect gas: 1.417 x 10^5 N/m^2\n",
+ "Pressure if considered real gas: 1.408 x 10^5 N/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 19, page no. 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "p = 17672 #Pressure of steam(in kPa):\n",
+ "t = 712 #Temperature of steam(in K):\n",
+ "Pc = 22.09*10**3 #Critical pressure(in kPa):\n",
+ "Tc = 647.3 #Critical temperature(in K):\n",
+ "Rs = 0.4615 #Gas constant for steam(in kJ/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "vp = Rs*t/p #Specific volume(in m**3/kg) Considering perfect gas:\n",
+ "Rp = p/Pc #Reduced pressure: Considering real gas:\n",
+ "Rt = t/Tc #Reduced temperature:\n",
+ "Z = 0.785 #Value of compressibility factor(from chart for Rp & Rt):\n",
+ "vr = Z*vp #Specific volume(in m**3/kg):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Specific volume considering perfect gas: \",round(vp,4),\"m**3/kg\"\n",
+ "print \"Specific volume considering real gas: \",round(vr,4),\"m**3/Kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Specific volume considering perfect gas: 0.0186 m**3/kg\n",
+ "Specific volume considering real gas: 0.0146 m**3/Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 20, page no. 30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "d = 5.0 #Diameter of the balloon(in m):\n",
+ "p = 1.013*10**5 #Atmospheric pressure(in N/m**2):\n",
+ "t = 17+273 #Temperature of the surroundings(in K):\n",
+ "R = 8.314*10**3 #Universal gas constant(in J/kg-K):\n",
+ "mw = 2 #Molecular weight of hydrogen:\n",
+ "Ra = 287 #Gas constant for air(in J/kg-K):\n",
+ "th = 273+27 #Temperature of Hydrogen (in K):\n",
+ "\n",
+ "#Calculation:\n",
+ "v = round(4.0/3.0*math.pi*(d/2)**3,2) #Volume of the balloon(in m**3):\n",
+ "Rh = R/mw #Gas constant for H2(in kJ/kg-K):\n",
+ "mh = p*v/(Rh*th) #Mass of H2 in balloon(in kg):\n",
+ "vd = v #Volume of air printlaced(in m**3):\n",
+ "ma = round(p*vd/(Ra*t),2) #Mass of air printlaced(in kg):\n",
+ "L = ma-mh #Load lifting capacity due to buoyant force(in kg):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Load lifting capacity: \",round(L,3),\"Kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Load lifting capacity: 74.344 Kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21, page no. 31"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math as m\n",
+ "#Variable Declaration: \n",
+ "v = 20 #Volume of vessel(in m**3):\n",
+ "q = 0.25 #Rate at which air is drawn(in m**3/min):\n",
+ "Pr = 4 #Initial pressure/final pressure (ratio):\n",
+ "\n",
+ "#Calculation:\n",
+ "t = v/q*m.log(Pr) #Time required(in min):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Time required: \",round(t,1),\"Minutes\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required: 110.9 Minutes\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 22, page no. 32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "M = 5.0 #Total mass of system of gas(in kg):\n",
+ "n = 0.80 #Compostion of Nitrogen:\n",
+ "o = 0.18 #Compostion of Oxygen:\n",
+ "c = 0.02 #Composition of Carbon dioxide:\n",
+ "ro = 1.4 #Compression ratio for Oxygen:\n",
+ "rn = 1.4 #Compression ratio for Nitrogen:\n",
+ "rc = 1.3 #Compression ratio for Carbon dioxide:\n",
+ "R = 8314.0 #Universal gas constant(in J/kg-K):\n",
+ "mwn = 28.0 #Molecular weight of Nitrogen:\n",
+ "mwo = 32.0 #Molecular weight of Oxygen:\n",
+ "mwc = 44.0 #Molecular weight of Carbon dioxide:\n",
+ "\n",
+ "#Calculation:\n",
+ "Rn = round(R/mwn,1) #Gas constant for Nitrogen(in J/kg-K):\n",
+ "Ro = round(R/mwo,1) #Gas constant for Oxygen(in J/kg-K):\n",
+ "Rc = round(R/mwc,1) #Gas constant for Carbon dioxide(in J/kg-K):\n",
+ "Rm = round(n*Rn+o*Ro+c*Rc,2) #Gas constant for mixture(in J/kg-K):\n",
+ "Cpn = round((rn/(rn-1))*Rn,3) #Specific heat at constant pressure for Nitrogen(in kJ/kg-K):\n",
+ "Cpo = round((ro/(ro-1))*Ro,3) #Specific heat at constant pressure for Oxygen(in kJ/kg-K):\n",
+ "Cpc = round(rc/(rc-1)*Rc,3) #Specific heat at constant pressure for Carbon dioxide(in kJ/kg-K):\n",
+ "Cpm = round(n*Cpn+o*Cpo+c*Cpc,3) #Specific heat at constant pressure for the mixture(in kJ/kg-K):\n",
+ "nn = n*M/mwn #Number of moles of Nitrogen:\n",
+ "no = o*M/mwo #Number of moles of Oxygen:\n",
+ "nc = c*M/mwc #Number of moles of Carbon dioxide:\n",
+ "nt = nn+no+nc #Total number of moles:\n",
+ "xn = nn/nt #Mole fraction of Nitrogen:\n",
+ "xo = no/nt #Mole fraction of Oxygen:\n",
+ "xc = nc/nt #Mole fraction of Carbon dioxide:\n",
+ "mwm = xn*mwn+xo*mwo+xc*mwc #Molecular weight of the mixture\n",
+ "\n",
+ "#Results:\n",
+ "print \"Gas constant for Nitrogen: \",round(Rn,1),\"J/Kg-K\"\n",
+ "print \"Gas constant for Oxygen: \",round(Ro,1),\"J/Kg-K\"\n",
+ "print \"Gas constant for Carbon Diaoxide: \",round(Rc,1),\"J/Kg-K\"\n",
+ "print \"Gas constant for Mixture: \",round(Rm,2),\"J/Kg-K\"\n",
+ "print \"Specific heat at constant pressure for Nitrogen: \",round(Cpn/10**3,3),\"kJ/kg-K\"\n",
+ "print \"Specific heat at constant pressure for Oxygen: \",round(Cpo/10**3,3),\"kJ/kg-K\"\n",
+ "print \"Specific heat at constant pressure for Carbon Diaoxide: \",round(Cpc/10**3,3),\"kJ/kg-K\"\n",
+ "print \"Specific heat at constant pressure for Mixture: \",round(Cpm/10**3,3),\"kJ/kg-K\"\n",
+ "print \"The molecular weight of the mixture: \" ,round(mwm,2),\"Kg/Kmol\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Gas constant for Nitrogen: 296.9 J/Kg-K\n",
+ "Gas constant for Oxygen: 259.8 J/Kg-K\n",
+ "Gas constant for Carbon Diaoxide: 189.0 J/Kg-K\n",
+ "Gas constant for Mixture: 288.06 J/Kg-K\n",
+ "Specific heat at constant pressure for Nitrogen: 1.039 kJ/kg-K\n",
+ "Specific heat at constant pressure for Oxygen: 0.909 kJ/kg-K\n",
+ "Specific heat at constant pressure for Carbon Diaoxide: 0.819 kJ/kg-K\n",
+ "Specific heat at constant pressure for Mixture: 1.011 kJ/kg-K\n",
+ "The molecular weight of the mixture: 28.86 Kg/Kmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 23, page no. 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "o = 0.18 #Composition of Oxygen:\n",
+ "n = 0.75 #Composition of Nitrogen:\n",
+ "c = 0.07 #Composition of Carbon dioxide:\n",
+ "p = 0.5 #Pressure of mixture(in MPa):\n",
+ "t = 107+273 #Temperature of the mixture(in K):\n",
+ "m = 5 #Total mass of the mixture(in kg):\n",
+ "mwn = 28 #Molecular weight of Nitrogen:\n",
+ "mwo = 32 #Molecular weight of Oxygen:\n",
+ "mwc = 44 #Molecular weight of Carbon dioxide:\n",
+ "v = 1 #Total values of mixture(assume):\n",
+ "\n",
+ "#Calculation:\n",
+ "xvo = o/v #Mole fraction of Oxygen(by volume):\n",
+ "xvn = n/v #Mole fraction of Nitrogen(by volume):\n",
+ "xvc = c/v#Mole fraction of Carbon dioxide(by volume):\n",
+ "mwm = o*mwo+n*mwn+c*mwc #Molecular weight of the mixture(in kg/kmol):\n",
+ "xmn = n*mwn/mwm#Mole fraction of Nitrogen(by mass):\n",
+ "xmo = o*mwo/mwm#Mole fraction of Oxygen(by mass):\n",
+ "xmc = c*mwc/mwm#Mole fraction of Carbon dioxide(by mass):\n",
+ "po = o*p#Partial pressure of Oxygen:\n",
+ "pn = n*p#Partial pressure of Nitrogen:\n",
+ "pc = c*p#Partial pressure of Carbon dioxide:\n",
+ "\n",
+ "#Results:\n",
+ "print \"Mole fraction of Oxygen by mass: \",round(xmo,3)\n",
+ "print \"Mole fraction of Nitrogen by mass: \",round(xmn,3)\n",
+ "print \"Mole fraction of Carbon dioxide by mass: \",round(xmc,3)\n",
+ "print \"Partial pressure of Oxygen: \",round(po,2),\"MPa\"\n",
+ "print \"Partial pressure of Nitrogen: \",round(pn,3),\"MPa\"\n",
+ "print \"Partial pressure of Carbon dioxide: \",round(pc,3),\"MPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mole fraction of Oxygen by mass: 0.193\n",
+ "Mole fraction of Nitrogen by mass: 0.704\n",
+ "Mole fraction of Carbon dioxide by mass: 0.103\n",
+ "Partial pressure of Oxygen: 0.09 MPa\n",
+ "Partial pressure of Nitrogen: 0.375 MPa\n",
+ "Partial pressure of Carbon dioxide: 0.035 MPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 24, page no. 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "V = 3.0 #Volume of gas in 1 chamber(in m**3):\n",
+ "pn = 800.0 #Partial pressure of Nitrogen(in kPa):\n",
+ "pc = 400.0 #Partial pressure of Carbon dioxide(in kPa):\n",
+ "tn = 480.0 #Temperature of Nitrogen(in K):\n",
+ "tc = 390.0 #Temperature of Carbon dioxide(in K):\n",
+ "rn = 1.4 #Compression ratio for Nitrogen:\n",
+ "rc = 1.3 #Compression ratio for Carbon dioxide:\n",
+ "R = 8314.0 #Universal gas constant(in J/kg-K):\n",
+ "mwn = 28.0 #Molecular weight of Nitrogen:\n",
+ "mwc = 44.0 #Molecular weight of Carbon dioxide:\n",
+ "\n",
+ "#Calculation:\n",
+ "nn = pn*V/(R*tn) #Moles of Nitrogen:\n",
+ "nc = pc*V/(R*tc) #Moles of Carbon dioxide:\n",
+ "nt = round(nn+nc,6) #Total no of moles:\n",
+ "cvn = (R/mwn)/(rn-1) #Specific heat for Nitrogen at constant volume(in J/kg-K):\n",
+ "cvc = (R/mwc)/(rc-1) #Specific heat for Carbon dioxide at constant volume(in J/kg-K):\n",
+ "mn = nn*mwn #Mass of Nitrogen(in kg):\n",
+ "mc = nc*mwc #Mass of Carbon dioxide(in kg):\n",
+ "t = (mn*cvn*tn+mc*cvc*tc)/(mn*cvn+mc*cvc) #Equilibrium temperature of the mixture(in K):\n",
+ "p = nt*R*round(t,1)/(V+V) #Equilibrium pressure of the mixture(kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Equilibrium temperature: \",round(t,1),\"K\"\n",
+ "print \"Equilibrium pressure: \",round(p,3),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Equilibrium temperature: 439.4 K\n",
+ "Equilibrium pressure: 591.205 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 25, page no. 35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable Declaration: \n",
+ "mh = 2 #Mass of hydrogen taken(in kg):\n",
+ "mhe = 3 #Mass of helium taken(in kg):\n",
+ "Ch = 11.23 #Specific heat at constant pressure for hydrogen(in kJ/kg-K):\n",
+ "Che = 5.193 #Specific heat at constant pressure for helium(in kJ/kg-K):\n",
+ "\n",
+ "#Calculation:\n",
+ "mt = mh+mhe #Total mass of the mixture(in kg):\n",
+ "Cm = (Ch*mh+Che*mhe)/mt #Specific heat at constant pressure for the mixture(in kJ/kg-K):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Specific heat at constant pressure for the mixture: \",round(Cm,3),\"KJ/Kg-K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Specific heat at constant pressure for the mixture: 7.608 KJ/Kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 26, page no. 36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "mh = 18 #Mass of Hydrogen(in kg):\n",
+ "mn = 10 #Mass of Nitrogen(in kg):\n",
+ "mc = 2 #Mass of Carbon dioxide(in kg):\n",
+ "t1 = 27+273.15 #Initial temperature(in K):\n",
+ "t2 = 2*t1 #Final temperature(in K):\n",
+ "R = 8.314 #Universal gas constant(in kJ/kg-K):\n",
+ "mwh = 2 #Molecular weight of Hydrogen:\n",
+ "mwn = 28 #Molecular weight of Nitrogen:\n",
+ "mwc = 44 #Molecular weight of Carbon dioxide:\n",
+ "p1 = 101.325 #Initial pressure of the gases(in kPa)\n",
+ "\n",
+ "#Calculation:\n",
+ "Rh = R/mwh #Gas constant for Hydrogen(in kJ/kg-K):\n",
+ "Rn = R/mwn #Gas constant for Nitrogen(in kJ/kg-K):\n",
+ "Rc = R/mwc #Gas constant for Carbon dioxide(in kJ/kg-K):\n",
+ "Rm = (mh*Rh+mn*Rn+mc*Rc)/(mh+mn+mc) #Gas constant for the mixture(in kJ/kg-K):\n",
+ "V = (mh+mn+mc)*Rm*t1/p1 #Capacity of the vessel(in m**3):\n",
+ "p2 = p1*t2/t1 #Final pressure of the mixture(in kPa):\n",
+ "\n",
+ "#Results:\n",
+ "print \"Volume of the vessel: \",round(V,2),\"m**3\"\n",
+ "print \"Final pressure of the mixture\",round(p2,2),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Volume of the vessel: 231.57 m**3\n",
+ "Final pressure of the mixture 202.65 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 27, page no. 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import math as m\n",
+ "#Variable Declaration: \n",
+ "t1 = 27+273.15 #Temperature of entering air(in K):\n",
+ "t2 = 500 #Temperature to which it gets heated up to(in K):\n",
+ "\n",
+ "#Calculation:\n",
+ "R = m.sqrt(t2/t1) #Ratio of exit to inlet diameter:\n",
+ "\n",
+ "#Results:\n",
+ "print \"Ratio of exit to inlet diameter: \",round(R,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ratio of exit to inlet diameter: 1.29\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 28, page no. 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable Declaration: \n",
+ "v = 2.0 #Volume of vessel(in m**3):\n",
+ "R = 8.314 #Univeresal gas constant(in kJ/kg-K):\n",
+ "mwh = 2.0 #Molecular weight of hydrogen:\n",
+ "\n",
+ "#Calculation:\n",
+ "p1 = 76/76*101.325 #Atmospheric pressure(in kPa):\n",
+ "t1 = 27+273.15 #Temperature of gas(in K):\n",
+ "t2 = t1\n",
+ "dp = 70.0/76*101.325 #Pressure difference(in kPa):\n",
+ "t3 = 10+273.15 #Temperature after cooling(in case 2)(in K):\n",
+ "Rh = R/mwh #Gas constant of hydrogen(in kJ/kg-K): #Case 1:\n",
+ "p2 = p1-dp #Final pressure of hydrogen(in kPa):\n",
+ "m = (p1-p2)*v/(Rh*t1) #Mass pumped out(in kg):\n",
+ "p3 = (t3/t2)*p2 #Pressure after cooling(in kPa): #Case 2:(temperature reduces till 10 degrees isochorically)\n",
+ "\n",
+ "#Results:\n",
+ "print \"Mass pumped out: \",round(m,2),\"Kg\"\n",
+ "print \"Final pressure fter cooling: \",round(p3,3),\"KPa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass pumped out: 0.15 Kg\n",
+ "Final pressure fter cooling: 7.546 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file