Using Euler's method to solve temperature distribution for triangular fin
8 次查看(过去 30 天)
显示 更早的评论
The cross section of the triangle changes with x, i am trying to plot a code that plots T against all values of x with a change in cross section.
Please if someone could help get this code working would be much appreciated.
%Maths CODE for heat transfer using Euler's method.
%rectangular based triangular fin
clear; clc
%variables we know
L=0.05; %Length in m
t=0.005; %Diameter in m
w=0.05; %width
K=237; %Thermal Conductivity
H=50; %Heat transfer coefficient
p=w*t; %Perimeter
Tb=60; %base temperature(celcius)
Ta=15; %Ambient Temperature
To=Tb-Ta;
m1=(2*H/K*t)^1/2; %fin parameter
x1=(0:0.0004:L); %x values
I0=0.48951; %Bessel equation values
I1=0.2024;
Ac=w*t(x1,:/L); %Cross,sectional,area m^2
Af=2*w.*[L^2+(t/2)^2]^1/2; %Area of Fin
n_f=(1/m1*L)*(I1(2*m1*L)/I0*(2*m1*L)); %fin efficiency
%Inputs
h = 0.0004; %Step size(m)
x_final = 0.05; %Total length of split pin
N = x_final/h; %Number of steps
q=n_f*H*Af*(Tb-Ta);
dx=L/(N-1);
%Initial conditions.
x(1)=0;
T(1)=60;
z(1)=0;
z10=0;
m=1;
%loop for euler's
while m > 0.00001
for i = 1:N
x(i+1)=x(i)+h;
T(i+1)=T(i)+h*z(i);
z(i+1)=z(i)+h*(((H*p)/(K*Ac))*(T(i)-Ta));
end
z(1)=z(1)-z(i+1);
m=abs(z(i+1)-z10);
end
disp(z(1))
disp(T(i+1))
disp(z(i+1))
disp(q)
figure(1); clf(1)
plot(x,T)
xlabel('length(m)')
ylabel('Temperature(C)')
3 个评论
回答(1 个)
Ravi
2023-12-28
Hi Michael Pine,
I understand that you are facing an issue in plotting the temperature change across the cross-sections.
Please find the below modification that would resolve the issue you are facing.
Depending on whether the “x” values are computed from tip to base or base to tip of the triangular cross-section, please use the piece of code respectively.
Ac=w*t*(x1/L); % if x1 is calculated from tip to base
Ac=w*t*(1 - x1/L); % otherwise
Hope this helps.
Thanks,
Ravi Chandra
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Thermal Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!