Question: % Heat transfer through fin using finite volume method clear all; clc; h = 50.0; k= 100.0; Tinf = 373.15; % 100 C is converted
% Heat transfer through fin using finite volume method clear all; clc;
h = 50.0; k= 100.0; Tinf = 373.15; % 100 C is converted to Kelvin Tb = 473.15; % base temperature in K
Tinf0 = 473.15; % 200 C is converted to Kelvin hinf = 10E20;
L = 1.0; % fin length in m
d = 0.08; % fin diameter in m
m = 4.0*h/(k*d);
%N = 40; % no. of cellslices
for N = [160]
dx = L/N; % cell size % By taking base of fin as node 1 % Dirichelet boundary condition aw(1) = 0; ae(1) = 0; sp(1) = 0; su(1) = Tb; % 200 C is converted to Kelvin ap(1) = 1;
% node in first cell- node 2 aw(2) = 2/dx; ae(2) = 1/dx; sp(2) = -m*m*dx; su(2) = m*m*Tinf*dx; ap(2) = aw(2)+ae(2)-sp(2);
% for internal nodes
for i =3 : N aw(i) = 1/dx; ae(i) = 1/dx; sp(i) = -m*m*dx; su(i) = m*m*Tinf*dx; ap(i) = aw(i)+ae(i)-sp(i); end
% For Node at fin tip
aw(N+1) = 1/dx; ae(N+1) = 0; sp(N+1) = -m*m*dx; su(N+1) = m*m*Tinf*dx; ap(N+1) = aw(N+1)+ae(N+1)-sp(N+1);
% rearrange coefficient for TDMA for i=1:N+1 a(i) = ap(i); b(i) = ae(i); c(i) = aw(i); d(i) = su(i); end % solving using TDMA
P(1) = b(1)/a(1); Q(1) = d(1)/a(1); for i = 2: N+1 P(i) = b(i)/( a(i)-c(i)*P(i-1) ); Q(i) = ( d(i)+c(i)*Q(i-1) )/( a(i)-c(i)*P(i-1)); end
T(N+1) = Q(N+1); for i = N:-1:1 T(i) = P(i)*T(i+1)+Q(i); end
x(1) = 0; x(2) = dx/2; x(N+1) = L; for i=3:N x(i) = x(2)+(i-2)*dx; end
end % end N loop
% analytical solution xa=0:L/40:L; Ta = Tinf+ (Tb-Tinf)cosh(m(L-xa))/cosh(m*L);
plot(xa,Ta,'ok','Linewidth',1) set(gca,'fontsize',16); ylabel('Temperature(K)','fontsize',16); xlabel('X (m)','fontsize',16); hold on;
plot(x,T,'r','Linewidth',2) set(gca,'fontsize',16); ylabel('Temperature(K)','fontsize',16); xlabel('X (m)','fontsize',16);
legend('Numerical','Analytial')
%--------------
Can someone help me fix the problem with this code (line 92 parse error)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
