summaryrefslogtreecommitdiff
path: root/Transport_Phenomena/ch2.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Transport_Phenomena/ch2.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Transport_Phenomena/ch2.ipynb')
-rw-r--r--Transport_Phenomena/ch2.ipynb548
1 files changed, 548 insertions, 0 deletions
diff --git a/Transport_Phenomena/ch2.ipynb b/Transport_Phenomena/ch2.ipynb
new file mode 100644
index 00000000..a2d46e38
--- /dev/null
+++ b/Transport_Phenomena/ch2.ipynb
@@ -0,0 +1,548 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2 : Molecular transport mechanisms"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.1 - Page No :28\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculate the steady-state heat flux across a copper block\n",
+ "\n",
+ "# Variables\n",
+ "deltax = 0.1; \t\t\t #[m] - thickness of copper block\n",
+ "T2 = 100.; \t\t\t #[degC] - temp on one side of copper block\n",
+ "T1 = 0.; \t\t\t #[degC] - temp on other side of the copper block\n",
+ "k = 380.; \t\t\t #[W/mK] - thermal conductivity\n",
+ "\n",
+ "# Calculations\n",
+ "# using the formula (q/A)*deltax = -k*(T2-T1)\n",
+ "g = -k*(T2-T1)/deltax;\n",
+ "g1 = (g/(4.184*10000));\n",
+ "\n",
+ "# Results\n",
+ "print \" The steady state heat flux across the copper block is q/A = %.1e W/m**2 \\\n",
+ "\\n or in alternate units is q/A = %.1f cal/cm*sec\"%(g,g1);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The steady state heat flux across the copper block is q/A = -3.8e+05 W/m**2 \n",
+ " or in alternate units is q/A = -9.1 cal/cm*sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.2 - Page No :29\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculate the momentum flux and force per unit area necessary to maintain a plate in motion\n",
+ "\n",
+ "# Variables\n",
+ "dely = 0.1; \t\t\t #[m] - distance between two parralel plates\n",
+ "delUx = 0.3; \t\t\t #[m/sec] - velocity of a plate\n",
+ "mu = 0.001; \t\t\t #[kg/m*sec] - viscosity\n",
+ "\n",
+ "# Calculations\n",
+ "# using the formula tauyx = F/A = -mu*(delUx/dely)\n",
+ "tauyx = -mu*(delUx/dely);\n",
+ "\n",
+ "# Results\n",
+ "print \"The momentum flux and the the force per unit area, \\nwhich are the same thing \\\n",
+ " is tauyx = F/A = %.3f N/m**2\"%(tauyx);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The momentum flux and the the force per unit area, \n",
+ "which are the same thing is tauyx = F/A = -0.003 N/m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.3 - Page No :30\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# find the new velocity of the top plate\n",
+ "\n",
+ "# Variables\n",
+ "tauyx = -0.003; \t\t #[N/m**2] - momentum flux\n",
+ "dely = 0.1; \t\t\t #[m] - distance between two parallel plates\n",
+ "mu = 0.01; \t\t\t #[kg/m*sec] - viscosity\n",
+ "\n",
+ "# Calculations\n",
+ "# using the formula tauyx = F/A = -mu*(delUx/dely)\n",
+ "delUx = -((tauyx*dely)/mu)*100;\n",
+ "\n",
+ "# Results\n",
+ "print \" Velocity of the top plate is deltaUx = %d cm/sec\"%(delUx);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Velocity of the top plate is deltaUx = 3 cm/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.5 - Page No :31\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "Find:\n",
+ "(a) the amount of heat transferred in joules per second;\n",
+ "(b) the number of grams of ice that melt in 30 minutes.\n",
+ "'''\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "d = 0.0013; \t\t\t #[m] - diameter of the tube\n",
+ "delx = 1.; \t\t\t #[m] - length of the glass tube\n",
+ "T2 = 110.6; \t\t\t #[degC] - temperature on one end of the rod\n",
+ "T1 = 0.; \t\t\t #[degC] - temperature on other side of the rod\n",
+ "k = 0.86; \t \t\t #[W/m*K] - thermal conductivity\n",
+ "Hf = 333.5; \t\t\t #[J/g] - heat of fusion of ice\n",
+ "\n",
+ "# Calculations\n",
+ "# (a)using the equation (q/A) = -k*(delt/delx)\n",
+ "A = (math.pi*d**2)/4;\n",
+ "q = A*(-k*(T2-T1)/delx);\n",
+ "\n",
+ "# Results\n",
+ "print \"a) the heat flow is q = %.2e J/sec\"%(q);\n",
+ "\n",
+ "# (b) dividing the total heat transfer in 30minutes by the amount of heat required to melt 1g of ice\n",
+ "a = abs((q*30*60)/333.5);\n",
+ "print \"b) the amount or grams of ice melted in 30 minutes is %.1e g\"%(a);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a) the heat flow is q = -1.26e-04 J/sec\n",
+ "b) the amount or grams of ice melted in 30 minutes is 6.8e-04 g\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.6 - Page No :36\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "(a) Find the molar flux of CO,.\n",
+ "(b) Find the number of pounds of CO, that pass through the hole in the iron in\n",
+ "one hour.\n",
+ "'''\n",
+ "\n",
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\n",
+ "# Variables\n",
+ "d = 1.2*10**-2; \t\t #[m] - diameter of the hole\n",
+ "Ca1 = 0.083; \t\t\t #[kmol/m**3]\n",
+ "Ca2 = 0.; \t\t\t #[kmol/m**3]\n",
+ "L = 0.04; \t\t\t #[m] - thickness of the iron piece \n",
+ "Dab = 1.56*10**-3; \t #[m**2/sec] - diffusion coefficient of CO2\n",
+ "A = (math.pi*d**2)/4; \t #area\n",
+ "\n",
+ "# Calculations\n",
+ "# (a)using the formula (Na/)A = (Ja/A) = -Dab(delCa/delx)\n",
+ "def f0(Ca): \n",
+ "\t return 1\n",
+ "\n",
+ "intdCa = quad(f0,Ca2,Ca1)[0]\n",
+ "\n",
+ "def f1(x): \n",
+ "\t return 1\n",
+ "\n",
+ "intdx = quad(f1,0,0.04)[0]\n",
+ "\n",
+ "g = (intdCa/intdx)*Dab;\n",
+ "\n",
+ "# Results\n",
+ "print \"a) The molar flux with respect to stationary coordinates is Na/A) = %.3e kmol/m**2*sec\"%(g);\n",
+ "\n",
+ "# using the formula na/A = (Na/A)*Ma\n",
+ "Ma = 44.01; \t\t\t #[kg/mol] - molcular weight of co2\n",
+ "na = (intdCa/intdx)*Dab*Ma*A*(3600/0.4539);\n",
+ "print \"b) The mass flow rate is %.3f lb/hr\"%(na);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a) The molar flux with respect to stationary coordinates is Na/A) = 3.237e-03 kmol/m**2*sec\n",
+ "b) The mass flow rate is 0.128 lb/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.7 - Page No :38\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "(a) Calculate the concentration of CO1 entering in kg me3.\n",
+ "(b) Calculate the concentration of NZ entering in the air stream in lb mol fim3.\n",
+ "(c) Calculate the concentration of CO, exiting in mol cmm3.\n",
+ "(d) Calculate the concentration of Oz exiting in kmol me3.\n",
+ "'''\n",
+ "\n",
+ "# Variables\n",
+ "T = 30+273.15; \t\t\t #[K] temperature\n",
+ "pA = 3.; \t\t\t #[atm] partial pressure of the component A\n",
+ "R = 0.082057; \t \t\t #[atm*m**3*/kmol*K] gas constant\n",
+ "\n",
+ "# Calculation and Results\n",
+ "# (a) using the equation Ca = n/V = pA/(R*T)\n",
+ "Cco2 = pA/(R*T);\n",
+ "Cco2 = Cco2*(44.01);\n",
+ "print \" a) The concentarion of Co2 entering is %.2f kg/m**3\"%(Cco2);\n",
+ "\n",
+ "# (b) using the same equation as above\n",
+ "pN2 = (0.79)*3; \t\t\t #[atm] partial pressure of mitrogen(as nitrogen is 79% in air)\n",
+ "R = 0.7302; \t\t \t #[atm*ft**3*lb/mol*R] - gas constant\n",
+ "T = T*(1.8); \t\t\t #[R] temperature\n",
+ "CN2 = pN2/(R*T);\n",
+ "print \" b) The concentration of N2 entering is %.2e lb mol/ft**3\"%(CN2);\n",
+ "\n",
+ "# (c) using the same equation as above\n",
+ "nt = 6.;\n",
+ "nCo2 = 4.;\n",
+ "nO2 = 2.*(0.21);\n",
+ "nN2 = 2.*(0.79);\n",
+ "yCo2 = nCo2/nt;\n",
+ "yO2 = nO2/nt;\n",
+ "yN2 = nN2/nt;\n",
+ "R = 82.057; \t\t\t #[atm*cm**3/mol*K] - gas constant\n",
+ "T = 30+273.15; \t\t\t #[K] - temperature\n",
+ "pCo2 = 3*yCo2;\n",
+ "Cco2 = pCo2/(R*T);\n",
+ "print \" c) The concentartion of Co2 in the exit is %.2e mol/cm**3\"%(Cco2);\n",
+ "\n",
+ "# (d) using the same equation as above\n",
+ "R = 8.3143; \t\t\t #[kPa*m**3/kmol*K] - gas constant\n",
+ "pO2 = 3*(yO2)*(101.325); \t\t\t #[kPa] - partial pressure\n",
+ "CO2 = pO2/(R*T);\n",
+ "print \" d) The concentration of O2 in the exit stream is %.2e kmol/m**3\"%(CO2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " a) The concentarion of Co2 entering is 5.31 kg/m**3\n",
+ " b) The concentration of N2 entering is 5.95e-03 lb mol/ft**3\n",
+ " c) The concentartion of Co2 in the exit is 8.04e-05 mol/cm**3\n",
+ " d) The concentration of O2 in the exit stream is 8.44e-03 kmol/m**3\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.8 - Page No :39\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculate the initial rate of mass transfer of the CO,. Is the air transferred?\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Variables\n",
+ "delx = 0.3-0; \t \t\t #[m] - length\n",
+ "d = 0.05-0; \t \t \t #[m] - diameter\n",
+ "A = (math.pi*d**2)/4; \t\t\t #[m**2] - area;\n",
+ "R = 8.314*10**3; \t\t\t #[N*m/kmol*K] - gas constant\n",
+ "xco1 = 0.15; \t\t\t # mole prcent of co in one tank\n",
+ "xco2 = 0.; \t\t\t # mole percent of co in other tank\n",
+ "p2 = 1.; \t\t \t #[atm] - pressure in one tank\n",
+ "p1 = p2; \t\t\t #[atm] - pressure in other tank\n",
+ "D = 0.164*10**-4; \t \t\t #[m**2/sec] - diffusion coefficient\n",
+ "T = 298.15; \t\t\t #[K] - temperature\n",
+ "\n",
+ "# Calculations\n",
+ "# using the formula (Na/A) = (Ja/A) = -D*(delca/delx) = -(D/R*T)*(delpa/delx);\n",
+ "delpa = (p2*xco2-p1*xco1)*10**5; \t\t\t #[N/m**2] - pressure difference\n",
+ "Na = -((D*A)/(R*T))*(delpa/delx);\n",
+ "\n",
+ "# Results\n",
+ "print \"The initial rate of mass transfer of co2 is %.1e kmol/sec\"%(Na);\n",
+ "print \"In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite\\\n",
+ " direction \\nand equal to %.1e kmol/sec\"%(Na);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The initial rate of mass transfer of co2 is 6.5e-10 kmol/sec\n",
+ "In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite direction \n",
+ "and equal to 6.5e-10 kmol/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.9 - Page No :44\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculate the viscosity of toluene in centipoise.\n",
+ "\n",
+ "# Variables\n",
+ "# given\n",
+ "A = 5.; \t\t\t #[m**2] - area of the plates\n",
+ "Ft = 0.083 \t\t\t #[N] - force on the top plate\n",
+ "Fb = -0.027; \t\t\t #[N] - force on the bottom plate\n",
+ "ut = -0.3; \t\t\t #[m/sec] - velocity of the top plate\n",
+ "ub = 0.1; \t\t\t #[m/sec] - velocity of the bottom plate\n",
+ "dely = 0.01; \t\t\t #[m]\n",
+ "delux = ut-ub; \t\t #[m/sec]\n",
+ "\n",
+ "# Calculations\n",
+ "# using the formula tauyx = F/A = -mu(delux/dely)\n",
+ "tauyx = (Ft-Fb)/A;\n",
+ "mu = tauyx/(-delux/dely); \t\t\t #[Ns/m**2]\n",
+ "mu = mu*10**3; \t\t\t #[cP]\n",
+ "\n",
+ "# Results\n",
+ "print \" The viscosity of toulene in centipose is %.2f cP\"%(mu);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The viscosity of toulene in centipose is 0.55 cP\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.11 - Page No :51\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Predict the diffusion coefficient of water vapor\n",
+ "\n",
+ "# Variables\n",
+ "po = 1.; \t\t\t #[atm] - pressure\n",
+ "p = 2.; \t\t \t #[atm] - pressure\n",
+ "To = 0+273.15; \t\t\t #[K] - temperature\n",
+ "T = 75+273.15; \t\t\t #[K] - temperature\n",
+ "Do = 0.219*10**-4; \t #[m**2/sec];\n",
+ "n = 1.75;\n",
+ "\n",
+ "# Calculations\n",
+ "# usin the formula D = Do*(po/p)*(T/To)**n\n",
+ "D = Do*(po/p)*(T/To)**n;\n",
+ "\n",
+ "# Results\n",
+ "print \"The diffusion coefficient of water vapour in air at %d atm and %d degC is \\nD \\\n",
+ " = %.3e m**2/sec\"%(p,T-273.15,D);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The diffusion coefficient of water vapour in air at 2 atm and 75 degC is \n",
+ "D = 1.674e-05 m**2/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.12 - Page No :52\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimate the viscosity of air and of water\n",
+ "\n",
+ "from scipy.optimize import fsolve \n",
+ "import math \n",
+ "\n",
+ "# Variables\n",
+ "# given\n",
+ "T = 53+273.15; \t\t\t #[K] - temperature\n",
+ "mu1 = 1.91*10**-5;\n",
+ "mu2 = 2.10*10**-5;\n",
+ "T1 = 313.15; \t\t\t #[K] - temperature \n",
+ "T2 = 347.15; \t\t\t #[K] - temperature\n",
+ "\n",
+ "# Calculations\n",
+ "# for air\n",
+ "# using linear interpolation of the values in table 2.2\n",
+ "def f(a):\n",
+ " return math.log(mu1/a)/math.log(T1);\n",
+ "\n",
+ "def g(a):\n",
+ " return math.log(mu2)-math.log(a)-f(a)*math.log(T2);\n",
+ "\n",
+ "a1 = 10**-7;\n",
+ "A = fsolve(g,a1)\n",
+ "B = f(A);\n",
+ "\n",
+ "# using the formula ln(mu) = lnA+Bln(t)\n",
+ "mu = math.e**(math.log(A)+B*math.log(T))*10**3; \t\t\t #[cP]\n",
+ "\n",
+ "# Results\n",
+ "print \" the viscosity of air at %d degC is %.4f cP\"%(T-273.15,mu);\n",
+ "\n",
+ "# similarly for water\n",
+ "BdivR = 1646;\n",
+ "A = 3.336*10**-8;\n",
+ "mu = A*math.e**(BdivR/T)*10**5 \t\t\t #[cP]\n",
+ "print \" the viscosity of water at %d degC is %.3f cP\"%(T-273.15,mu);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the viscosity of air at 53 degC is 0.0198 cP\n",
+ " the viscosity of water at 53 degC is 0.519 cP\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file