How to write 2D heat conduction exact solution for Inf n?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
병권 이
el 5 de Jun. de 2023
Comentada: 병권 이
el 8 de Jun. de 2023
Hi, I'm Currently going to perform numberical analysis with a Exact solution of the 2-D heat conduction equation.
That, H is y-grid length, L is x-grid Length, T1 is bottom Temperature. I try to write code like this.
However, the figure in the code is wrong and the figure I want is as follows.
how can i derive that equations? Thank you for your reply.
clc;
clear;
close all;
%% grid input
xnum = 51;
ynum = 101;
%% Given Data
xmax = 1; % L
ymax = 2; % H
T1 = 100; % bottom Temperature
T2 = 0;
T3 = 0;
T4 = 0;
%% Data
dx = xmax/(xnum-1);
dy = ymax/(ynum-1);
beta = dx/dy;
alpha = -2*(1+beta^2);
k = 1;
%% Boundary Condition
T = zeros(xnum,ynum,k); % Initial Condition Temperature = 0
for i = 1:1:xnum
T(i,1,1) = T1;
T(i,ynum,1) = T3;
end
for j = 2:1:ynum-1
T(1,j,1) = T2;
T(xnum,j,1) = T4;
end
% Calcultae T = T_1 * [2*sum( f(sinh) )]
for j = 2 : 1: ynum-1
for i = 1 : 1 : xnum
for n = 1 : 1 : 100
T(i,j) = T(i,j) + 2*T1*(1 -(-1)^n)/(n*pi) * sinh(n*pi*(ymax-j*dy)/1) / sinh(n*pi*ymax/1) * sinh(n*pi*i*dx);
end
end
end
figure(1)
contourf(T(:,:,1));
% contourf(T(:,:,1),'ShowText','on');
hold on;
view(90,270);
grid on
hold on
axis('equal')
xticks([1 0.25*(ynum-1)+1 0.5*(ynum-1)+1 0.75*(ynum-1)+1 ynum])
xticklabels({'0','0.5','1','1.5','2'})
yticks([1 0.5*(xnum-1)+1 xnum])
yticklabels({'0','0.5','1'})
xlabel('y [ ft ]')
ylabel('x [ ft ]')
colormap jet
colorbar
1 comentario
Respuesta aceptada
Alan Stevens
el 5 de Jun. de 2023
Your term sinh(n*pi*x/L) should be sin(n*pi*x/L). See the following code (which can be made more efficient!):
L = 1; H = 2;
nx = 51; ny = 101;
dx = L/(nx-1); dy = H/(ny-1);
x = 0:dx:L; y = 0:dy:H;
T1 = 100;
m = 31;
T = zeros(numel(y), numel(x));
for j = 1:numel(y)
for k = 1:numel(x)
for n = 1:m
u = (1 - (-1)^n)/(n*pi);
sinhterms = sinh(n*pi*(H-y(j))/L)/sinh(n*pi*H/L);
sinterm = sin(n*pi*x(k)/L);
T(j,k) = u*sinhterms*sinterm + T(j,k);
end
end
end
T = 2*T1*T;
figure
contourf(x,y,T,9)
axis equal
colormap jet
colorbar
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!