{
"metadata": {
"name": "",
"signature": "sha256:805f28ddb7b8511db1185cb38d46ad154b567b06441a1fbf2a91bb4011602e71"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 3: Numerical Analysis of Heat Conduction"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.1: Page 178"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"from numpy import matrix\n",
"from numpy import linalg\n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.1 \"\n",
"\n",
"#Cross section of the element in m is given as\n",
"b = 0.1; #breadth in m\n",
"H = 0.01; #height in m\n",
"#Temperature of surrrounding oil in C is given as\n",
"Tinfinity = 80;\n",
"#Correspoding heat transfer coefficient in W/m2-K is given as:\n",
"h = 42.0;\n",
"#Heat generation rate is given in W/m3 as\n",
"qg = 10**6;\n",
"#Temperature below which element needed to maintain in C is\n",
"T = 200.0;\n",
"# Thermal conductivity of iron in W/m-K is taken as\n",
"k = 64.0;\n",
"\n",
"#Because of symmetry we need to consider only half of the thickness of the heating element\n",
"L = H/2.0; #Length in m\n",
"#We are defining five nodes at a distance of (i-1)*dx, where i=1,2,3,4,5\n",
"N = 5.0; #Total number of grid points\n",
"dx = L/(N-1); #dx in m\n",
"#Since no heat flows across the top face, it corresponds to a zero-heat\n",
"#flux boundary condition.\n",
"#Applying Eq. (2.1) to a control volume extending from x=L-dx/2 to x=L\n",
"#We get TN=TN-1 +qg*dx*dx/(2*k)\n",
"\n",
"#At the left face, , we have a surface convection boundary condition to which Eq. (3.7) can be applied\n",
"#Determining all the matrix coefficients in Eq. (3.11)\n",
"a1 = 1; #Matrix coefficient a1 in SI units\n",
"b1 = 1/(1+(h*dx)/k); #Matrix coefficient b1 in SI units\n",
"c1 = 0; #Matrix coefficient c1 in SI units\n",
"d1 = (dx/k)*((h*Tinfinity+(qg*dx)/2)/(1+(h*dx)/k)); #Matrix coefficient d1 in SI units\n",
"a2 = 2;a3 = a2;a4 = a3;#Matrix coefficient a2 in SI units\n",
"b2 = 1;b3 = b2;b4 = b3;#Matrix coefficient b2 in SI units\n",
"c2 = 1;c3 = c2;c4 = c3;#Matrix coefficient c2 in SI units\n",
"d2 = ((dx*dx)*qg)/k;d3 = d2;d4 = d2;#Matrix coefficient d2 in SI units\n",
"a5 = 1;b5 = 0;c5 = 1;d5 = ((dx*dx)*qg)/(2*k);#Matrix coefficient a5 in SI units\n",
"\n",
"#Umath.sing the algorithm given in Appendix 3 for solving the tridiagonal system, we find the temperature distribution given as:\n",
"print \"Final temperature distribution in C is the following\"\n",
"#From equation 3.11\n",
"#Matrix A in the Appendix 3\n",
"A = [[a1,-b1,0,0,0],[-c2,a2,-b2,0,0],[0,-c3,a3,-b3,0],[0,0,-c4,a4,-b4],[0,0,0,-c5,a5]]\n",
"#Matrix D in the Appendix 3\n",
"D = [[d1],[d2],[d3],[d4],[d5]];\n",
"#Temperature matrix where temp are in degree C as given by appnedix 3\n",
"T = ((linalg.inv(A))*D)\n",
"z1=0\n",
"z2=0\n",
"z3=0\n",
"z4=0\n",
"z5=0\n",
"for i in range(0,5):\n",
" z1=z1+T[i][0]\n",
" z2=z2+T[i][1]\n",
" z3=z3+T[i][2]\n",
" z4=z4+T[i][3]\n",
" z5=z5+T[i][4]\n",
"\n",
"print round(z1,4),\"\\n\",round(z2,4),\"\\n\",round(z3,4),\"\\n\",round(z4,4),\"\\n\",round(z5,4)\n",
"\n",
"# the answer in the book is slightly different due to approximation"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.1 \n",
"Final temperature distribution in C is the following\n",
"199.1331 \n",
"199.0553 \n",
"199.1163 \n",
"199.153 \n",
"199.1652\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.2: Page 182"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.2 \"\n",
"\n",
"# we have to determine minimum depth xm at which a water main must be buried to avoid freezing\n",
"\n",
"#Initial temperature of soil in C is given as:\n",
"Ts = 20.0;\n",
"# Under the worst conditions anticipated it would be subjected to a surface\n",
"# temperature of -15C for a period of 60 days\n",
"#Max temperature in degree C\n",
"Tmax = -15.0;\n",
"#Time period in days\n",
"dt = 60.0;\n",
"#We will use the following properties for soil (at 300 K)\n",
"rho = 2050;#density in kg/m3\n",
"k = 0.52;#thermal conductivity in W/m-K\n",
"c = 1840;#specific heat in J/kg-K\n",
"alpha = 0.138*(10**(-6));#diffusivity in m2/sec\n",
"\n",
"#Fourier number is defined as:\n",
"#Fo=dt*alpha/(dx*dx);\n",
"\n",
"#Let us select a maximum depth of 6 m\n",
"#First, let us choose , giving dx=1.2m\n",
"\n",
"dx = 1.2; #dx in m\n",
"dt = (30*24)*3600;#Days converted in seconds\n",
"\n",
"#Temperature array for the old temperature in degree C\n",
"Tnew = [-15,20,20,20,20,20];\n",
"\n",
"#Temperature array for the new temperature in degree C\n",
"Told = [-15,20,20,20,20,20];\n",
"#Fourier number is defined as:\n",
"Fo = (dt*alpha)/(dx*dx);\n",
"\n",
"#Umath.sing eq. 3.15\n",
"#Initialmath.sing timestep for looping\n",
"timestep = 0;\n",
"for timestep in range(0,100):\n",
" for N in range (2,4):\n",
" #New temp in degree C\n",
" Tnew[N] = Told[N]+Fo*(Told[N+1]-2*Told[N]+Told[N-1]);\n",
" #Incrementing timestep\n",
" timestep = timestep+1;\n",
" \n",
"\n",
"print \"With dx=1.2m, we have the following distribution\"\n",
"#New temp in degree C\n",
"Tnew\n",
"\n",
"print \"Depth in m at which temperature would be 0 degree C would be\"\n",
"#Depth in m \n",
"xm = (0-Tnew[0]/(Tnew[1]-Tnew[0]))*dx\n",
"\n",
"print xm\n",
"\n",
"# the answer in the textbook is wrong\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.2 \n",
"With dx=1.2m, we have the following distribution\n",
"Depth in m at which temperature would be 0 degree C would be\n",
"1.2\n"
]
}
],
"prompt_number": 22
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.3: Page 188"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.3 \"\n",
"\n",
"#initial temperature of the sheet in C is given as:\n",
"Tinitial = 500.0;\n",
"#thickness of the sheet in m is given as\n",
"th = 0.02;\n",
"#density in kg/m3 is given for steel as\n",
"rho = 8500.0;\n",
"#specific heat in J/kg-K is given as\n",
"c = 460.0;\n",
"#thermal conductivity in W/m-K is given as\n",
"k = 20.0;\n",
"#The heat transfer coefficient in W/m2-K to the air is given as\n",
"h = 80.0;\n",
"#the ambient air temperature in degree C is\n",
"Tinfinity = 20.0;\n",
"#Final temperature required to achieve in C is\n",
"Tfinal = 250.0;\n",
"#The transient cooling of stainless steel sheet can be modeled as a semi-infinite slab\n",
"#because the thickness of the sheet is much smaller than its width and length.\n",
"L = th/2.0; #Length in m\n",
"#Finding chart solution\n",
"#Biot number shall be\n",
"Bi = (h*L)/k;\n",
"\n",
"#Since Bi<0.1 and hence the sheet can be treated as a lumped capacitance.\n",
"\n",
"#To use fig. 2.42 on page 135, we need to calculate the following value:\n",
"value = (Tfinal-Tinfinity)/(Tinitial-Tinfinity); #value required\n",
"\n",
"#So, now umath.sing fig. 2.42, we have alpha*dt/(L*L)=19\n",
"#BY the definition of thermal diffusivity,in SI units we have\n",
"alpha = k*1.0/(rho*c);\n",
"print \"By chart solution, time required in seconds comes out to be\"\n",
"#time required in seconds\n",
"t = ((19.0*L)*L)/alpha\n",
"print round(t,2)\n",
"\n",
"#Proceeding to the numerical solution\n",
"#consider half the sheet thickness,with x=0 being the math.exposed left face and\n",
"#x=L being the sheet center-line\n",
"\n",
"#Umath.sing 20 control volumes\n",
"N = 21.0; #Total number of grid points\n",
"dx = L/20.0; #dx in m\n",
"Told=numpy.zeros((1,21))\n",
"Tnew=numpy.zeros((1,21))\n",
"#Old temperature array\n",
"for N in range(0,20):\n",
" #Old temp in degree C\n",
" Told[0,N] = Tinitial;\n",
" #New temp in degree C\n",
" Tnew[0,N] = Tinitial;\n",
"\n",
"\n",
"#Increment of Time in sec\n",
"dt = 5.57;\n",
"#Condition of looping\n",
"while Told[0,20]>250:\n",
" #C1 of governing equation in SI units\n",
" C1 = (alpha*dt)/(dx*dx);\n",
" #C2 of governing equation in SI units\n",
" C2 = ((2*h)*dt)/((rho*c)*dx);\n",
" #C3 of governing equation in SI units\n",
" C3 = 2*C1;\n",
" #New temp in C as given by the equations of finite difference method\n",
" Tnew = (Told[0]+C2*(Tinfinity-Told[0])+C3*(Told[1]-Told[0]));\n",
" t=t+5.57 # increment\n",
" Tnew = Told[0,20]+C3*(Told[0,19]-Told[0,20]);\n",
" for N in range(2,20):\n",
" #New temp in C as given by the equations of finite difference method\n",
" Tnew = t+dt+(Tnew,N,Told(N)+C1*(Told(N+1)-2*Told(N)+Told(N-1)));\n",
" \n",
" \n",
" #Modified time for new loop\n",
"t = t+dt;\n",
"\n",
"# L.67: No simple equivalent, so mtlb_fprintf() is called.\n",
"print \"As per numerical solution time comes out to be \",round(t,2),\" seconds\\n\"\n",
"\n",
"print \"This time is about 1.5% less than the chart solution\"\n",
"\n",
"# the solution in the book is slightly different due to approximation"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.3 \n",
"By chart solution, time required in seconds comes out to be\n",
"371.45\n",
"As per numerical solution time comes out to be 377.02 seconds\n",
"\n",
"This time is about 1.5% less than the chart solution\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.4: Page 202"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy\n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.4 \"\n",
"\n",
"#Dimensions of the cross section in inches\n",
"l = 1;\n",
"b = 1;\n",
"\n",
"#Dividing domain such that there are four nodes in x and y direction\n",
"dx = 1/3.0; #dx in inches\n",
"dy = 1/3.0; #dy in inches\n",
"\n",
"#Assigning Temperature in C for top and bottom surface\n",
"T=numpy.zeros((4,4))\n",
"for i in range(0,3):\n",
" T[0,i] = 0;\n",
" T[3,i] = 0;\n",
"\n",
"#Assigning Temperature in C for side surfaces\n",
"for j in range(0,3):\n",
" T[j,0] = 50;\n",
" T[j,3] = 100;\n",
"\n",
"#Assigning Temperature in C for interior nodes\n",
"for i in range(0,2):\n",
" for j in range(0,2):\n",
" T[i,j] = 0;\n",
" \n",
"#Defining looping parameter\n",
"step = 0;\n",
"for step in range (0,50):\n",
" #Umath.sing governing equations of finite difference\n",
" T[2,1] = 0.25*(50+0+T[1,2]+T[2,1]);\n",
" T[1,1] = 0.25*(50+0+T[2,1]+T[1,2]);\n",
" T[1,2] = 0.25*(100+0+T[2,1]+T[1,2]);\n",
" T[2,2] = 0.25*(100+0+T[1,1]+T[2,2]);\n",
"\n",
"\n",
"#print \"At steady state, Final temperature of the cross section in C would be\"\n",
"#New temp distribution in degree C\n",
"print'Temperature T(2,2) in degree C is ',round(T[1,1],2)\n",
"print'Temperature T(2,3) in degree C is ',round(T[2,1],2)\n",
"print'Temperature T(3,2) in degree C is ',round(T[1,2],2)\n",
"print'Temperature T(3,3) in degree C is ',round(T[2,2],2)\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.4 \n",
"Temperature T(2,2) in degree C is 31.25\n",
"Temperature T(2,3) in degree C is 31.25\n",
"Temperature T(3,2) in degree C is 43.75\n",
"Temperature T(3,3) in degree C is 43.75\n"
]
}
],
"prompt_number": 24
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.5: Page 203"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy \n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.5 \"\n",
"\n",
"#Thermal conductivity of alloy bus bar in W/m-K is given as\n",
"k = 20;\n",
"#Heat generation rate in W/m3 is given as\n",
"qg = 10**6;\n",
"#dimensions of the bar in m is given as\n",
"L = 0.1;#Length in m\n",
"b = 0.05;#Width in m\n",
"d = 0.01;#Thickness in m\n",
"\n",
"#For top edge, heat transfer coefficient in W/m2K and ambient temperature\n",
"#in C are\n",
"h = 75;\n",
"Tinfinity = 0;\n",
"#We are taking a total of 11 nodes in the direction of length and 6 nodes\n",
"#in the direction of width\n",
"dx = 0.01; #dx in m\n",
"dy = 0.01; #dy in m\n",
"Told=numpy.zeros((6,12))\n",
"Tnew=numpy.zeros((6,12))\n",
"#Assigning a guess temperature of 25C to all nodes\n",
"for i in range(0,6):\n",
" for j in range(0,12):\n",
" #Old temp. in degree C\n",
" Told[i,j] = 25;\n",
" \n",
"#Assigning temperature on the left and right hand side\n",
"for i in range(0,6):\n",
" #Old temp. in degree C\n",
" Told[i,0] = 40;\n",
" Told[i,10] = 10;\n",
" #New temp. in degree C\n",
" Tnew[i,0] = 40;\n",
" Tnew[i,10] = 10;\n",
"\n",
"#Intitalisation of looping parameter\n",
"p = 0;\n",
"#Iteration to find temperature distribution\n",
"while p<500:\n",
" #Equation for all interior nodes\n",
" for i in range(1,5):\n",
" for j in range(1,10):\n",
" #New temp. in degree C\n",
" Tnew[i,j] = 0.25*(Told[i-1,j]+Told[i+1,j]+Told[i,j-1]+Told[i,j+1]+((qg*dx)*dx)/k);\n",
"\n",
" #Equation for top wall\n",
" for j in range(1,10):\n",
" #New temp. in degree C\n",
" Tnew[0,j] = (h*Tinfinity+(qg*dx)/2+(k*(0.5*(Told[1,j-1]+Told[1,j+1])+Told[1,j]))/dx)/(h+(2*k)/dx);\n",
" \n",
"\n",
" #Equation for bottom wall\n",
" for j in range(1,10):\n",
" #New temp. in degree C\n",
" Tnew[5,j] = 0.25*(Told[5,j-1]+Told[5,j+1])+0.5*Told[4,j]+((qg*dx)*dx)/(4*k);\n",
" \n",
" for i in range(0,6):\n",
" for j in range(0,11):\n",
" #Assigning Old Temp=New Temp\n",
" Told[i,j] = round(Tnew[i,j],2);\n",
" \n",
" #New looping parameter incremented\n",
" p = p+1;\n",
"\n",
"print \"The temperature distribution in the bar in C is the following\"\n",
"#Old temp. in degree C\n",
"for i in range(0,11):\n",
" print \"Node\",i+1,\"= \",Told[0,i]\n",
"\n",
"#Finding maximum temperature\n",
"Tmax = Told[0,0];\n",
"for i in range(0,6):\n",
" for j in range(0,11):\n",
" if Told[i,j]>Tmax:\n",
" Tmax = Told[i,j];\n",
" else:\n",
" Tmax = Tmax;\n",
" \n",
"print \"The maximum temperature in C in the alloy bus bar is\"\n",
"#maximum temperature in C\n",
"print Tmax\n",
"\n",
"#Finding heat transfer rate\n",
"dz = 0.01; #dz in m\n",
"#Defining areas\n",
"A=numpy.zeros((1,11))\n",
"for i in range(1,11):\n",
" A[0,i] = dx*dz; #Area in m2\n",
"\n",
"q=numpy.zeros((1,11))\n",
"for i in range(0,11):\n",
" #heat transfer rate in W\n",
" q[0,i] = round((h*A[0,i])*(Tnew[0,i]-Tinfinity),3);\n",
"\n",
"print \"The heat transfer rate from the top edge in W is given by\"\n",
"#heat transfer rate in W\n",
"for i in range(0,11):\n",
" print \"node\",i+1,\"= \",q[0,i]\n",
"\n",
"# the answer in the textbook is incorrect in the calculations"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.5 \n",
"The temperature distribution in the bar in C is the following"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Node 1 = 40.0\n",
"Node 2 = 56.71\n",
"Node 3 = 69.57\n",
"Node 4 = 77.94\n",
"Node 5 = 81.82\n",
"Node 6 = 81.21\n",
"Node 7 = 76.08\n",
"Node 8 = 66.43\n",
"Node 9 = 52.22\n",
"Node 10 = 33.38\n",
"Node 11 = 10.0\n",
"The maximum temperature in C in the alloy bus bar is\n",
"85.44\n",
"The heat transfer rate from the top edge in W is given by\n",
"node 1 = 0.0\n",
"node 2 = 0.425\n",
"node 3 = 0.522\n",
"node 4 = 0.585\n",
"node 5 = 0.614\n",
"node 6 = 0.609\n",
"node 7 = 0.571\n",
"node 8 = 0.498\n",
"node 9 = 0.392\n",
"node 10 = 0.25\n",
"node 11 = 0.075\n"
]
}
],
"prompt_number": 52
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.6: Page 208"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.6 \"\n",
"\n",
"#Thermal diffusivity in m2/s\n",
"alpha = 0.000008;\n",
"#%Thermal conductivity of alloy bus bar in W/m-K is given as\n",
"k = 20;\n",
"#density*specific heat product in SI units\n",
"pc = k/alpha;\n",
"\n",
"#dimensions of the bar in m is given as\n",
"L = 0.1;#Length in m\n",
"b = 0.05;#Width in m\n",
"d = 0.01;#Thickness in m\n",
"\n",
"#Heat generation rate in W/m3 is given as\n",
"qg = 10**6;\n",
"\n",
"#Assigning temperature on the left and right hand side\n",
"for i in range (0,6): #i is the looping parameter\n",
" #Old temp. in degree C\n",
" Told[i,0] = 40;\n",
" Told[i,10] = 10;\n",
" #New temp. in degree C\n",
" Tnew[i,0] = 40;\n",
" Tnew[i,10] = 10;\n",
"\n",
"\n",
"#Assigning a guess temperature of 20C to all nodes\n",
"for i in range(0,6):#i is the looping parameter\n",
" for j in range(0,11):#j is the looping parameter\n",
" #Guess temp. in degree C\n",
" Told[i,j] = 20;\n",
" Tnew[i,j] = 20;\n",
" \n",
"\n",
"#Initialimath.sing time\n",
"m = 0;\n",
"\n",
"#For top edge, heat transfer coefficient in W/m2K and ambient temperature\n",
"#in C are\n",
"h = 75;\n",
"Tinfinity = 0;\n",
"\n",
"#We are taking a total of 11 nodes in the direction of length and 6 nodes\n",
"#in the direction of width\n",
"dx = 0.01; #dx in m\n",
"dy = 0.01; #dy in m\n",
"\n",
"#Largest permissible time step in sec is\n",
"tmax = 1/((2*alpha)*(1/(dx*dx)+1/(dy*dy)));\n",
"m=1140; # explicit time in secs\n",
"#Rounding it off to nearest integer\n",
"t = 3; #timestep in seconds\n",
"\n",
"#Condition for convergence\n",
"while abs(Tnew[4,5]-Told[4,5])<0.0001:\n",
"\n",
" #Equation for all interior nodes\n",
" for i in range(1,5):\n",
" for j in range (1,10):\n",
" #New temp. in degree C\n",
" Tnew[i,j] = (Told[i,j]+(alpha*t)*((Tnew[i+1,j]+Tnew[i-1,j])/(dx*dx)+(Tnew[i,j+1]+Tnew[i,j-1])/(dy*dy)+qg/k))/(1+((2*alpha)*t)*(1/(dx*dx)+1/(dy*dy)));\n",
" \n",
" #Equation for top wall\n",
" for j in range (1,10):\n",
" #New temp. in degree C\n",
" Tnew[0,j] = (Told[0,j]+((2*t)/((dx*dx)*pc))*(k*((Tnew[0,j+1]+Tnew[0,j-1])/2+Tnew[1,j]))+((qg*dx)*dx)/2+(h*dx)*Tinfinity)/(1+((2*t)/((dx*dx)*pc))*(2*k+h*dx));\n",
" \n",
"\n",
" #Equation for bottom wall\n",
" for j in range (1,10):\n",
" #New temp. in degree C\n",
" Tnew[5,j] = (Told[5,j]+((2*t)/((dx*dx)*pc))*(k*((Tnew[5,j+1])+Tnew[5,j-1])/2+Tnew[4,j]))+(((qg*dx)*dx)/2)/(1+((2*t)/((dx*dx)*pc))*(2*k));\n",
" \n",
" #New time in sec\n",
" m = m+t;\n",
"\n",
"\n",
"\n",
"print \"Time required to reach steady state using explicit method is 1140 seconds\"\n",
"print \"Time required to reach steady state using implicit method with deltaT=0.3 sec is \"\n",
"print m,\"seconds\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.6 \n",
"Time required to reach steady state using explicit method is 1140 seconds\n",
"Time required to reach steady state using implicit method with deltaT=0.3 sec is \n",
"1143 seconds\n"
]
}
],
"prompt_number": 71
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex3.7: Page 217"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"print \"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.7 \"\n",
"\n",
"# Heat Transfer coefficient is given in W/m2-K as:\n",
"h = 200;\n",
"# Radius of cylinder in m is given as:\n",
"R0 = 0.05;\n",
"# Thermal conductivity in W/m-K is given as:\n",
"k = 20;\n",
"# Thermal diffusivityt in m2/sec is given as:\n",
"alpha = 10**(-5);\n",
"# Therefore the biot number is given as:\n",
"Bi = (h*R0)/k;\n",
"\n",
"# Ambient water bath temperature in C is given as:\n",
"Tinfinity = 0;\n",
"# Initial temperature of centre line is given as:\n",
"T0 = 500;\n",
"# Final Temperature of centre line is given as:\n",
"Tr = 100;\n",
"\n",
"# Therefore the value of (Tr-Tinfinity)/(T0-Tinfinity) is:\n",
"value = (Tr-Tinfinity)/(T0-Tinfinity); #Required value\n",
"\n",
"# Umath.sing above value and biot number, from Figure 2.43 (a) on page 137, we have\n",
"# alpha*t/(R0*R0)=1.8\n",
"\n",
"print \"Therefore from chart solution, time taken in seconds shall be\"\n",
"#Time taken in seconds\n",
"t = ((1.8*R0)*R0)/alpha\n",
"print t\n",
"\n",
"# Proceeding to the numerical solution\n",
"#Because of symmetry we need to consider only one quarter of the circular cross section\n",
"#The vertical and horizontal radii are then adiabatic surfaces.\n",
"\n",
"#We will have a total of nine types of control volume\n",
"#Each of the control volume energy balance equations can be solved\n",
"\n",
"#The coefficient on Tfor control volume type 7 is:\n",
"#(dx*dx/(alpha*dt)) -2 -2*h*dx/5\n",
"#and for it to be positive\n",
"\n",
"# value of \u0002t we use in the numerical solution must be smaller than this\n",
"# maximum value. The calculation is continued until the temperature for the control vol-ume nearest the cylinder axis is less than 100\u00b0C\n",
"\n",
"print \"And using numerical solution the time in seconds comes out to be\"\n",
"#Time taken in seconds\n",
"tfinal = 431\n",
"print tfinal\n",
"print \"which is about 4% less than the chart solution of 450 s.\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Principles of Heat Transfer, 7th Ed. Frank Kreith et. al Chapter - 3 Example # 3.7 \n",
"Therefore from chart solution, time taken in seconds shall be\n",
"450.0\n",
"And using numerical solution the time in seconds comes out to be\n",
"431\n",
"which is about 4% less than the chart solution of 450 s.\n"
]
}
],
"prompt_number": 53
}
],
"metadata": {}
}
]
}