0% found this document useful (0 votes)
47 views

Final HT Code

This MATLAB code simulates heat transfer through a cylindrical object over time. It defines parameters like thermal conductivity, initial and ambient temperatures, calculates the temperature distribution at varying radii and times, and plots the results. The code sets up arrays to store temperature and heat transfer values, uses Bessel functions to calculate temperature distribution, and outputs a table and graph of temperature versus radius and time.

Uploaded by

api-302257258
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Final HT Code

This MATLAB code simulates heat transfer through a cylindrical object over time. It defines parameters like thermal conductivity, initial and ambient temperatures, calculates the temperature distribution at varying radii and times, and plots the results. The code sets up arrays to store temperature and heat transfer values, uses Bessel functions to calculate temperature distribution, and outputs a table and graph of temperature versus radius and time.

Uploaded by

api-302257258
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Heat Transfer MATLAB Code

clear;
clc;
r=[0 .05 .10 .15 .175];
%variation in radius [m]
r0=.175;
%constant outer radius r0
V=(pi*(r0^2));
%volumetric flow rate (per 1 m)
k=14.9;
%thermal conductivity [W/m*K]
ro=7900;
%density [kg/m^3]
Cp=477;
%heat capacity [J/kg*K]
alpha=3.95*10^(-6);
%thermal diffusivity[m^2/s]
Ti=400;
%initial temperature[deg C]
Tinf=150;
%surrounding temperature[deg C]
h=60;
%heat transfer coefficient[W/m^2*K]
Bi=((h*r0)/(k));
%constant biot number
t=[300 600 900 1200 1800 2400 3000 3600 5400]; %variation in time [s]
A1=((1.1539+((Bi-0.7)/(0.8-0.7))*(1.1724-1.1539)));
lamda1=(1.0873+((Bi-0.7)/(0.8-0.7))*(1.149-1.0873));
Tau=((alpha*t)/(r0)^2);
%fourier number at each time
Qmax=(ro*V*Cp*(Ti-Tinf));
E=(lamda1*(r/r0));
j=besselj(0,E);
%built in Bessel functions
newj=besselj(1,lamda1);
T=zeros(5,9);
%creating arrays of zeros
Qact=zeros(0,9);
%computing temperature distribution at varying times and distances
for a=1:5;
for b=1:9;
T(a,b)=(((Ti-Tinf)*(A1*exp((-(lamda1)^(2)*Tau(b))))*j(a))+Tinf);
b=b+1;
end
a=a+1;
end
%computing heat transferred at varying time and space
for c=1:1;
for d=1:9;
Q(c,d)=(((Ti-Tinf)*(A1*exp((-(lamda1)^(2)*Tau(d))))*j(c))+Tinf);

Qact(c,d)=((-Qmax*(1-(2*(Q(c,d))-150)/(Ti-Tinf)))*(newj/lamda1));
d=d+1;
end
c=c+1;
end
T=T';
%transpose matrices
Qact=Qact';
%for constructing table output
Time=[300/60 600/60 900/60 1200/60 1800/60 2400/60 3000/60 3600/60
5400/60]';
Touter=T(1:9,5);
T15cm=T(1:9,4);
T10cm=T(1:9,3);
T5cm=T(1:9,2);
T0cm=T(1:9,1);
Heat_Transferred=Qact
table(Time,T0cm,T5cm,T10cm,T15cm,Touter,Heat_Transferred)
%creating radius v temp graph
plot(r,T)
xlabel('Radius [m]')
ylabel('Temperature [degC]')
title('Temperature v Radius')
legend('5min','10min','15min','20min','30min','40min','50min','60min','90min')

You might also like