summaryrefslogtreecommitdiff
path: root/Transport_Phenomena/ch3.ipynb
blob: a369004a5830a6ee0dbbf88f74f1533a951dafe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : The general property balance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.1 - Page No :65\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "(a) Find the heat flux if face 1 is maintained at 0\u00b0C.\n",
      "(b) If the same flux as in part (a) enters at face 2, find the flux at face 1 if there is\n",
      "now a uniform generation within the volume of 1.5 X lo6 J mm3 s-l.\n",
      "'''\n",
      "\n",
      "# Variables\n",
      "a = 0.0006;  \t\t #[m**2] - area\n",
      "l = 0.1;  \t\t\t #[m] - length\n",
      "\n",
      "# (a) using the fourier law\n",
      "deltax = 0.1;  \t\t #[m] - thickness of copper block\n",
      "T2 = 100.;  \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",
      "print \" a) The steady state heat flux across the copper block is q/A = %5.1e J*m**-2*sec**-1 \"%(g);\n",
      "\n",
      "# (b)\n",
      "V = a*l; \t\t\t #[m**3] - volume\n",
      "# using the overall balance equation with the accumulation and generation term\n",
      "Qgen = 1.5*10**6;  \t\t\t #[j*m**-3*sec**-1]\n",
      "SIx = (g*a-Qgen*V)/a;\n",
      "\n",
      "# Results\n",
      "print \" b) the flux at face 1 is %5.1e j*m**-2*sec**-1;the negative sign indicates that the \\\n",
      "\\nheat flux is from right to left negative x direction\"%(SIx);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a) The steady state heat flux across the copper block is q/A = -3.8e+05 J*m**-2*sec**-1 \n",
        " b) the flux at face 1 is -5.3e+05 j*m**-2*sec**-1;the negative sign indicates that the \n",
        "heat flux is from right to left negative x direction\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.2 - Page No :68\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find the temperature profile \n",
      "\n",
      "from sympy import *\n",
      "\n",
      "# Variables\n",
      "x = Symbol('x')\n",
      "SIx2 = -3.8*10**5;  \t\t #[j*m**-2*sec**-1] - flux at x = 0.1,i.e through face2\n",
      "Qgen = 1.5*10**6;  \t\t\t #[j*m**-3*sec**-1] - uniform generation in the volume\n",
      "T2 = 100+273.15;  \t\t\t #[K] temperature at face 2\n",
      "x2 = 0.1;  \t\t\t         #[m]\n",
      "k = 380.;  \t\t\t         #[W/mK] - thermal conductivity\n",
      "\n",
      "# Calculations\n",
      "# using the equation der(SIx)*x = SIx+c1;where c1 is tyhe constant of integration\n",
      "c1 = (Qgen*x2)-SIx2;\n",
      "SIx = Qgen*x-c1;\n",
      "\n",
      "# Results\n",
      "print \"SIx = \",SIx\n",
      "print \" where SIx is in units of J m**-2 sec**-1 and x is in units of m\"\n",
      "\n",
      "# using the equation -k*T = der(SIx)*x**2-c1*x+c2;where c2 is the constant of integration\n",
      "c2 = -k*T2-(Qgen*(x2)**2)/2+c1*x2;\n",
      "T = -(Qgen/k)*x**2+(c1/k)*x-(c2/k);\n",
      "print \"T = \",T\n",
      "print \" where T is in units of kelvin K\"\n",
      "\n",
      "\n",
      "# Answer may vary because of rouding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SIx =  1500000.0*x - 530000.0\n",
        " where SIx is in units of J m**-2 sec**-1 and x is in units of m\n",
        "T =  -3947.36842105263*x**2 + 1394.73684210526*x + 253.413157894737\n",
        " where T is in units of kelvin K\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.3 - Page No :69\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "(a) Find the rate of accumulation.\n",
      "(b) Find the equation for the temperature profile, and determine the temperature\n",
      "at face 1 after 1 min, if at the start face 2 is at 100\u00b0C.\n",
      "'''\n",
      "\n",
      "import math \n",
      "from sympy import *\n",
      "\n",
      "\n",
      "# Variables\n",
      "# given\n",
      "x = Symbol('x')\n",
      "t = Symbol('t')\n",
      "hf1 = -270.;  \t\t\t #[J/sec] - heat flow at face 1\n",
      "hf2 = -228.;  \t\t\t #[J/sec] - heat flow at face2\n",
      "Qgen = 1.5*10**6;  \t\t #[J*m**-3*sec**-1] generation per unit volume per unit time\n",
      "v = 6*10**-5;  \t\t\t #[m**3] volume\n",
      "Cp = 0.093;  \t\t\t #[cal*g**-1*K**-1] heat capacity of copper\n",
      "sp = 8.91;  \t\t\t #specific gravity of copper\n",
      "a = 0.0006;  \t\t\t #[m**2] - area\n",
      "\n",
      "# Calculation and Results\n",
      "# (a) using the overall balance\n",
      "acc = hf1-hf2+Qgen*v;\n",
      "print \"a) the rate of accumulation is %d J/sec \"%(acc);\n",
      "\n",
      "# (b) \n",
      "SIx1 = hf1/a;\n",
      "SIx2 = hf2/a;\n",
      "x1 = 0.;\n",
      "\n",
      "# solving for the constant of integration c1 in the equation [del(p*cp*T)/delt-der(SIx)]*x = -SIx+c1;\n",
      "c1 = 0+SIx1;\n",
      "x2 = 0.1;\n",
      "g = (-(SIx2)+c1)/x2+Qgen;\n",
      "SIx = c1-(g-Qgen)*x;\n",
      "print \"SI(x) = \",\"(b)\",SIx\n",
      "\n",
      "# solving for constant of integration c3 in the equation p*cp*T = g*t+c3\n",
      "T2 = 100+273.15;\n",
      "t2 = 0;\n",
      "p = sp*10**3;  \t\t\t #[kg/m**3] - density\n",
      "cp = Cp*4.1840;  \t\t\t #[J*kg**-1*K**-1]\n",
      "c3 = p*cp*T2-g*t2;\n",
      "T = (g*(10**-3)/(p*cp))*t+c3/(p*cp);\n",
      "print \"Relationship between T and t at x=0.1m is T = \",T\n",
      "\n",
      "# solving for constant of integration c2 in the equation -k*T = der(SIx)*x**2-c1*x+c2\n",
      "k = 380.;  \t\t\t #[w/m**1*K**1]\n",
      "x2 = 0.1;\n",
      "c2 = k*T+(3.5*10**5)*x2**2-(4.5*10**5)*x2;\n",
      "\n",
      "def T(t,x):\n",
      "    return (-(3.5*10**5)*x**2+(4.5*10**5)*x+87.7*t+1.00297*10**5)/k;\n",
      "\n",
      "# at face 1;\n",
      "x1 = 0.;\n",
      "t1 = 60.;  \t\t\t #[sec]\n",
      "T1 = T(t1,x1);\n",
      "print \"Temperature profile as a function of x and t is T = %.2f K, at face 1\"%T1\n",
      "\n",
      "# at face 2\n",
      "x2 = 0.1;\n",
      "t2 = 60.;  \t\t\t # [sec]\n",
      "T2 = T(t2,x2);\n",
      "print \"Temperature at face 2  = %.0f K ,at face 2\"%T2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) the rate of accumulation is 48 J/sec \n",
        "SI(x) =  (b) 700000.0*x - 450000.0\n",
        "Relationship between T and t at x=0.1m is T =  0.230747847543697*t + 373.15\n",
        "Temperature profile as a function of x and t is T = 277.79 K, at face 1\n",
        "Temperature at face 2  = 387 K ,at face 2\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}