diff options
author | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
---|---|---|
committer | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
commit | 206d0358703aa05d5d7315900fe1d054c2817ddc (patch) | |
tree | f2403e29f3aded0caf7a2434ea50dd507f6545e2 /Materials_science_and_engineering_an_introduction/CH5.ipynb | |
parent | c6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff) | |
download | Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2 Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip |
adding book
Diffstat (limited to 'Materials_science_and_engineering_an_introduction/CH5.ipynb')
-rw-r--r-- | Materials_science_and_engineering_an_introduction/CH5.ipynb | 302 |
1 files changed, 302 insertions, 0 deletions
diff --git a/Materials_science_and_engineering_an_introduction/CH5.ipynb b/Materials_science_and_engineering_an_introduction/CH5.ipynb new file mode 100644 index 00000000..5b193d64 --- /dev/null +++ b/Materials_science_and_engineering_an_introduction/CH5.ipynb @@ -0,0 +1,302 @@ +{
+ "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": [
+ "#Diffusion Flux Computation\n",
+ "\n",
+ "#Given\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",
+ "#Calculation\n",
+ "D=3*10**-11 #Diffusion coefficient in m**2/s\n",
+ "J=-D*(Ca-Cb)/(xa-xb)\n",
+ "\n",
+ "#Result\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": [
+ "#Nonsteady-State Diffusion Time Computation I\n",
+ "from scipy.optimize import fsolve\n",
+ "#Given\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",
+ "#Calculation\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",
+ "#Result\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": [
+ "#Nonsteady-State Diffusion Time Computation II\n",
+ "\n",
+ "#Given\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",
+ "#Calcuation\n",
+ "t500=D600*t600/D500\n",
+ "\n",
+ "#Result\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": [
+ "#Diffusion Coefficient Determination\n",
+ "\n",
+ "#Given\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",
+ "#Calculation\n",
+ "import math\n",
+ "D=D0*math.exp(-Qd/(R*T))\n",
+ "\n",
+ "#Result\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": [
+ "#Diffusion Coefficient Activation Energy and Preexponential Calculations\n",
+ "\n",
+ "#Given\n",
+ "#From graph log D ad 1/T are deducted\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",
+ "#Calculation\n",
+ "Qd=-2.3*R*(logD1-logD2)/(inv_T1-inv_T2)\n",
+ "print\"Activation energy is\",round(Qd/1000,0),\"KJ\"\n",
+ "\n",
+ "#For calculating Peexponential factor\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": [
+ "#Diffusion Temperature\u2013Time Heat Treatment Specification\n",
+ "\n",
+ "#Given\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",
+ "#Dt=D0*exp(-Qd/RT)*t = value of variable Dt\n",
+ "D=Dt/D0\n",
+ "\n",
+ "#The tempratures are\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",
+ "#Result\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": {}
+ }
+ ]
+}
\ No newline at end of file |