How to write 2D heat conduction exact solution for Inf n?

11 vues (au cours des 30 derniers jours)
병권 이
병권 이 le 5 Juin 2023
Commenté : 병권 이 le 8 Juin 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 commentaire
Torsten
Torsten le 5 Juin 2023
I doubt your formula to compute T is correct.

Connectez-vous pour commenter.

Réponse acceptée

Alan Stevens
Alan Stevens le 5 Juin 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
  1 commentaire
병권 이
병권 이 le 8 Juin 2023
Oh, thank you! I couldn't see the misspelling of the exact sol. and kept struggling in vain.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by