Sunteți pe pagina 1din 16

King Saud University College of Engineering Chemical Engineering Department ChE 406: Computational Techniques

Term Project By
Jassim Mohammed AlDraisi 428101168

Term Project

Study the heat conduction in cylindrical metallic rod extended surface

Part1: Steady State Analysis


Steady state systems:
( )

This can be discretized by find it difference AND


WE CAN DEFAINE A SYSTEM OF LINEAR EQUATIONS:

THE OBGCTOR OF THE GIVEN MATLAB PROGRAM IS TO DEFINE THR MATRIX "A" AND THE VECROT "B" THEN SOLVE FOR "T"

Term Project

A=ZERO(npoints, npoints)

B=-b * ONE(npoints,1)

=-b *( )

FOR LOOP
i=1-4 j =1 4 IF i=j =, A(i,j) = -a = -(2+( Else if j=i+1 or j=i-1 A(i,j)=1 Else if A(i,j)=0 )) = - (2+ ( ) )

Term Project

A= ( ) ( )

B(1)=-b=-112.5 B(end)= -b-

( )

B=(

= ( (

) )

Commend to slove T
T=A\B

Term Project

Matlab Codes
% working out problems of midterm one spring 2012 % solution of prblem % A Matlab program to solve a system of %linear equations to obtain % the temperature profile in a metallic %rod subject to a base temperature of %100deg-C % Define all known parameters %(1.2)Obtain and plot the solution for npoints=20 and for (k=50W/m/K) for natural convection (h=5W/m2/K) when d=2mm, L=50cm Too=25; To=100; TL=Too; h=5; k=50; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B % for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] % T=A\B; % % Display the result in a graphic form % plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

Term Project

Term Project

%(1.3) Obtain and plot the solution for various thermal conductivities (k=[50]) Too=25; To=100; TL=Too; h=5; k=50; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B % for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] % T=A\B; % % Display the result in a graphic form % plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

Term Project

Term Project

%(1.3) Obtain and plot the solution for various thermal conductivities (k=[100]) Too=25; To=100; TL=Too; h=5; k=100; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B % for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] % T=A\B; % % Display the result in a graphic form % plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

Term Project

10

Term Project

%(1.3) Obtain and plot the solution for various thermal conductivities (k=[150]) Too=25; To=100; TL=Too; h=5; k=150; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B % for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] % T=A\B; % % Display the result in a graphic form % plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

11

Term Project

12

Term Project

%(1.4) For a value of k=500 (highly conductive metal) forced convection (h=100) Too=25; To=100; TL=Too; h=100; k=500; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] T=A\B; % Display the result in a graphic form plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

13

Term Project

%(1.4) For a value of k=500 (highly conductive metal) natural convection (h=5) Too=25; To=100; TL=Too; h=5; k=500; L=0.5; D=0.002; P=0.15; S=0.002; % calculate defined parameters npoints=20; m=h*P/(k*S); Dx=L/(npoints+1); a=2+(m*Dx^2); b=(m*Dx^2)*Too; A=zeros(npoints,npoints); B=-b*ones(npoints,1); % Define the system: matrix A and vector B for i=1:npoints for j=1:npoints if i==j A(i,j)=-a; elseif j==i+1 | j==i-1 A(i,j)=1; else A(i,j)=0; end end end

14

Term Project

B(1)=-b-To;B(end)=-b-TL; % % Compute the solution T=[T1 T2 T3 T4] T=A\B; % Display the result in a graphic form plot([0:Dx:L],[To;T;TL],'*b') xlabel('Position in (m)'); ylabel('Temperature in deg-C');

15

Term Project

Refrance
Bathe K.J., Finite Element Procedures In Engineering Analysis, Prentice-Hall,1982

16

Term Project

S-ar putea să vă placă și