{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 5 : Diffusion" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 5.1 Page No. 114" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "Ca=1.2 #Concentration at A in kg/m**3\n", "Cb=0.8 #Concentration at B in kg/m**3\n", "xa=5*10**-3 #Position 1 in m\n", "xb=10*10**-3 #Position 2 in m\n", "\n", "D=3*10**-11 #Diffusion coefficient in m**2/s\n", "J=-D*(Ca-Cb)/(xa-xb)\n", "\n", "print\"Diffusion flux is \",J,\"kg/m**2-s\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Diffusion flux is 2.4e-09 kg/m**2-s\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 5.2 Page No. 117" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from scipy.optimize import fsolve\n", "Co=0.25 #Initial Conc. in wt%\n", "Cs=1.2 #Surface conc. in wt%\n", "Cx=0.8 #Conc. at any x in wt%\n", "x=5*10**-4 #Position in m\n", "D=1.6*10**-11 #Diffusion coeff in m**2/s\n", "\n", "import math\n", "C=1-((Cx-Co)/(Cs-Co))\n", "\n", "def f(z):\n", " return(0.4210-math.erf(z))\n", "z=fsolve(f,1)\n", "t=x**2/(4.0*D*z**2.0)\n", "\n", "print\"Time required is \",round(t/3600.0,1),\"h\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Time required is 7.0 h\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 5.3 Page No. 118" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "D500=4.8*10**-14 #Diffusion coefficient at 500 C\n", "D600=5.3*10**-13 #Diffusion coefficient at 600 C\n", "t600=10 #Time in hours to diffuse\n", "\n", "t500=D600*t600/D500\n", "\n", "print\"Time to diffuse at 500 C is \",round(t500,1),\"h\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Time to diffuse at 500 C is 110.4 h\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 5.4 Page No. 121" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "T=550+273 #in K\n", "D0=1.2*10**-4 #Temperature independent preexponential in m**2/s\n", "Qd=131000 #Activation energy in J/mol-K\n", "R=8.31 #Universal Gas constt\n", "\n", "import math\n", "D=D0*math.exp(-Qd/(R*T))\n", "\n", "print\"Diffusion coefficient is \",round(D,14),\"m**2/s\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Diffusion coefficient is 5.8e-13 m**2/s\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 5.5 Page No.121" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "inv_T1=0.8*10**-3 #Reciprocal of temp. in K**-1\n", "inv_T2=1.1*10**-3 #Reciprocal of temp. in K**-1\n", "logD1=-12.4\n", "logD2=-15.45\n", "R=8.31 #Gas law Constant in J/mol-K\n", "\n", "Qd=-2.3*R*(logD1-logD2)/(inv_T1-inv_T2)\n", "print\"Activation energy is\",round(Qd/1000,0),\"KJ\"\n", "\n", "D0=10**(logD2+(Qd*inv_T2/(2.3*R)))\n", "print\"Preexponential factor is\",round(D0,6),\"m**2/s\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Activation energy is 194.0 KJ\n", "Preexponential factor is 5.4e-05 m**2/s\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Design Example 5.1, Page No.122" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "C0=0.2 #Initial concentration in wt%\n", "Cs=1 #Surface conc in wt%\n", "Cx=0.6 #Conc at any position X in wt%\n", "x=7.5*10**-4 #Position in m\n", "D0=2.3*10**-5 #Preexponential factor in m**2/s\n", "R=8.31 #Gas law constant in J/mol-K\n", "Qd=148000 #Activation energy in J/mol\n", "\n", "C=1-((Cx-C0)/(Cs-C0))\n", "z=0.4747\n", "Dt=(x/(2*z))**2\n", "\n", "D=Dt/D0\n", "\n", "T1=900.0\n", "T2=950.0\n", "T3=1000.0\n", "T4=1050.0\n", "t1=D/math.exp(-Qd/(R*(T1+273)))/3600.0\n", "t2=D/math.exp(-Qd/(R*(T2+273)))/3600.0\n", "t3=D/math.exp(-Qd/(R*(T3+273)))/3600.0\n", "t4=D/math.exp(-Qd/(R*(T4+273)))/3600.0\n", "\n", "print\"Temperature in Celcius are\",T1,T2,T3,T4\n", "print\"Time is respectively \",round(t1,1),\"h,\",round(t2,1),\"h,\",round(t3,1),\"h,\",round(t4,1),\"h\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Temperature in Celcius are 900.0 950.0 1000.0 1050.0\n", "Time is respectively 29.6 h, 15.9 h, 9.0 h, 5.3 h\n" ] } ], "prompt_number": 23 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }