Assignment 1

Problem 1: ∫ √ Evaluate the integral shown using Romberg’s method of integration. Determine the fewest number of times the integrand must be evaluated in order to give the correct answer to five significant figures. Governing equations: ( ) ( )( ( ) ( ))

(

)

(

)

∑ (

(

)

)

( where

)

(

)

(

)( (

)

(

))

For this integral,

Solution: A matlab program for Romberg’s method was written to evaluate this integral. After running the loop eleven times, it was seen that the updated value stopped changing to five significant figures. The loop was updated to run ten times so that the fewest number of times the integrand had to be evaluated could be determined. The integrand was evaluated 1025 times in order to solve the integral to five significant figures for a value of 1.5708. Both the code and the resulting table are shown below. Matlab code:

1

m)). eval = eval + 1. calc=10. for k=1:2^(n-1) sum=sum+funcR(a+(2*k-1)*h).5)*(b-a)*(funcR(a)+funcR(b)).m+1)=R(n+1. b=1.i-1)) < 0.5)*R(n.m)-R(n.00001 disp(i).1)=(0.5461 2 . eval = 2.4979 1 2 3 4 5 6 7 8 9 10 11 1. 0 1 2 3 0 0.3660 1. R(1.0000 1. end end % To Determine # R to stop at for i = 2:calc if abs(R(i.5454 1.4880 1.3333 1.1)+h*sum.1)=(0.4983 1.clear all clc %Constants a=-1. sum=0. for n=1:calc h=(b-a)/(2^n).5418 1. end for n=1:calc for m=1:calc R(n+1.m)+1/(4^m-1)*(R(n+1.0000 1. break end end disp(eval).R(i-1. end R(n+1.i) .

5707 1.5678 1.5707 1. Boltzmann constant.5707 1.5708 1.5708 1.5606 1.5704 1.5708 1.5676 1. Given: Nonchanging parameters: Length of the bar.5708 1.5708 Results: Problem 2: To Tn r L A cylindrical bar that exists in a vacuum transfers heat to its surroundings through radiation.5708 1.5618 1.5708 1.5707 1.5707 1.5697 1.5622 1.5707 1.5707 1.5707 1.5708 1.5696 1. Varying parameters: 3 .5708 1.5706 1.5678 1.5621 1.5676 1.5707 1.5704 1.5704 1.5708 1.5707 1.5449 1.5707 1.5695 1.5707 1.5707 1.5708 1.5708 1.5697 1.5708 1.5708 1.5708 1.5704 1. Approximate the temperature at each node as well as the heat transfer into and out of the bar. Emissivity of the bar.5707 1.5708 1.5707 1.5708 1.4 5 6 7 8 9 10 11 1.5708 1.5708 1.5707 1.5672 1. Radius of the bar.5697 1.5697 1.5677 1.5708 1.5708 1.5707 1.5707 1.57079 1.5704 1.5703 1.5704 1.5697 1.5616 1.5704 1. A chosen number of nodes n are equally spaced on the bar.

4 (Silica) 14 14 To (K) 300 300 300 500 600 T∞ (K) 4 4 4 4 300 Governing Equations: ( )( where ( )) ( )( ( )) ( ) ( ) ̇ ̇ ∫ ( ) ( ) ( ) In this study To was used to represent the temperature at the base of the bar and was denoted node 1. problem 2 %This is a program to solve for the temperature at n nodes on a pin fin %experiencing heat transfer through radiation clear all 4 . Tn.n=total number of nodes Case A B C D E k (W/m·K) 237 (Copper) 14 (Stainless steel) 1. Newton’s method was also used to create a Jacobian matrix that could then be used to solve for the unknown values. a Taylor series expansion was used to produce n equations with n unknowns. Matlab code: %Melissa Peacock %HW 1. the temperature at the tip of the bar. Since the nodes were equally spaced on the bar. the distance between nodes was calculated by the equation Solution: To solve this problem. was denoted by node n.

j)=1.length between nodes c=(2*ep*boltz*(dx^2)*(To^3))/(k*r). %These values vary dx=L/(n-1).1)=theta(i-1. for m = 1:100 %Calculate f_i for i=2:n if i==n f(i-1. %Kelvin.1)-2*theta(i. error=zeros(100.67*10^-8.1)=theta(i-1. %c is a constant theta=T/To.j)=-2-4*c*theta(j+1. %W/(m*K).005. T(1. elseif i==j && j~=n-1 && i~=n-1 d_f(i. theta_inf=Tinf/To.1)(c/2)*(1+(r/dx))*theta(i. %Kelvin. %W/(m^2*K^4).1)^4+theta(i+1. end end %Calculate derivatives for Jacobian matrix for i=1:(n-1) for j=1:(n-1) if i==j+1 || i==j-1 d_f(i.1). d_f=zeros(n-1.clc %To is node 1. %meters. theta=zeros(n. length %Matrices T=zeros(n.1)c*theta(i.1). %number of nodes %Constants for every case ep=0. Boltzmann constant r=0.1)+c*theta_inf^4. %epsilon boltz=5.1) = To. the tip node is node n %Boundary conditions properties k=14.1). radius L=1. f=zeros(n-1.1). T base Tinf=300. T infinity n=500.1)-theta(i. %meters. else f(i-1.5.1)^3.n-1). 5 . %meters. thermal conductivity To=600.1)^4+(c/2)*(1+(r/dx))*theta_inf^4.

j)=1.1)-T(2.1).1). end end 6 . q_diff=zeros(1.1) < 0.1)+d_theta(i-1.1) + abs(f(i-1. q_in=zeros(1.j)=-1-2*c*(1+(r/dx))*theta(n.1)=theta(i.1)). %Radiation out from node 1 to node n for i=1:n if i~=n q_out=ep*boltz*2*pi*r*dx*(T(i.1)^3. % Calculate q total_q_in=zeros(1.1)^4-Tinf^4).1). %Heat in q_in=(k*pi*r^2/dx)*(T(1. total_q_out=total_q_out + q_out. else q_tip=(ep*boltz*pi*r^2)*(T(i.1).1)=error(m. end end % Calculate T T = theta*To.elseif i==n-1 && j==n-1 d_f(i. end %calculate error for i=2:n error(m.1). end %Check for convergence if error(m. %calculate new d_theta for i=2:n theta(i.1).00001 break elseif m==100 disp('Did not converge').1)).1)^4-Tinf^4). elseif i==j+1 || i==j-1 d_f(i. total_q_out=zeros(1. end end end %calculation of d_theta d_theta=d_f\-f. q_tip=zeros(1.

disp(q_diff).8 1 distance x (m) Figure 1 7 . Case A: Copper 350 300 250 Temperature 200 (K) 150 100 50 0 0 0.4 0.6 0. Results: Figures 1-5 show the temperature decay along the bar. q_diff=abs(total_q_out-q_in). When comparing Figure 1 to Figure 2. disp(q_in). it can be deducted that a steeper line demonstrates a lower conductivity material. These figures display the results when there are n=100 nodes. while the other cases would need a much higher number of nodes before getting within a degree of the surrounding temperature. disp(total_q_out).total_q_out=total_q_out + q_tip. The tip temperature in Case E in Figure 5 progresses very close to the temperature of the surroundings with 100 nodes.2 0.

6 0.6 0.Case B: Stainless Steel 350 300 250 Temperature 200 (K) 150 100 50 0 0 0.2 0.8 1 distance x (m) Figure 3 8 .8 1 distance x (m) Figure 2 Case C: Silica 350 300 250 Temperature 200 (K) 150 100 50 0 0 0.2 0.4 0.4 0.

4 0.2 0.8 1 distance x (m) Figure 5 9 .Case D: Stainless Steel 600 500 400 Temperature 300 (K) 200 100 0 0 0.4 0.6 0.8 1 distance x (m) Figure 4 Case E: Stainless Steel 700 600 500 Temperature 400 (K) 300 200 100 0 0 0.2 0.6 0.

temperature decreases nonlinearly. When n=2. Case E does not converge until around ten iterations are completed. the more accurate the calculated temperature becomes. For Case A. it is obvious that the more nodes that are included when evaluating the temperatures. 10 . Perhaps the quicker convergence in the first four cases was due to a higher driving temperature difference in those cases. The similar factor in these cases was the surrounding temperature T ∞. Figure 7 displays the error amount versus the number of iterations. In reality. When there are more than three nodes. and Case D.6 0. the values began to converge after three iterations.Case A: Effect of n on results 350 300 250 Temperature 200 (K) 150 100 50 0 0 0.4 0. Case C. the figure indicated a linear decrease in temperature. the way the temperature decreases down the bar experiences little change. Case B.2 0. On the other hand.8 1 distance x (m) n=2 n=3 n=5 n=9 n=11 n=21 n=100 Figure 6 From Figure 6.

Convergence Rate 30 25 20 Error 15 10 5 0 -1 1 3 5 7 9 11 13 15 Case A Case B Case C Case D Case E Number of Iterations Figure 7 Calculated Qin versus Number of Nodes 6 5 4 Qin (W) 3 2 1 0 0 100 200 300 400 500 600 700 800 900 1000 Number of Nodes Case A Case B Case C Case D Case E Figure 8 11 .

Both values eventually converge with each other to satisfy the Law of Conservation of Energy.Calculated Qout versus Number of Nodes 10 8 6 Qout (W) 4 2 0 0 100 200 300 400 500 600 700 800 900 1000 Number of Nodes Case A Case B Case C Case D Case E Figure 9 Figure 8 and Figure 9 both show the calculate heat transfer as a function of the number of nodes. As the node number was increased. both Q in and Qout arrived closer to their true values. 12 .

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times