Finite difference temperature distribution with TDMA

73 Ansichten (letzte 30 Tage)
Cubii4
Cubii4 am 29 Nov. 2022
Bearbeitet: Torsten am 7 Mär. 2023
A stainless steel (thermal conductivity, k = 20 W/mK) fin has a circular cross-sectional area (diameter, D=4 cm) and length L=16 cm. The wing is attached to a wall with a temperature of 200C. The ambient temperature of the fluid surrounding the fin is 20C and the heat transfer coefficient is h=10 W/m2K. Fin tip is insulated. Determine the following by applying finite differences with TDMA.
1. Temperatures inside the fin and the amount of heat radiated from the fin. Plot the temperature distribution.
2. Discuss the effect of the number of element dimensions for N = 5, 10, 50, and 100. Plot the temperature distribution.
The temperature distribution from the analitic solution is like this: T1=150.54, T2=111.107, T3=78.671, T4=50.741, T5=25.172, my code does not give these values.
clc
clear all
L=0.16; %lenght
N=6; %number of nodes
dx=L/(N-1); %lenght between nodes
T=zeros(N+1,1);
Tb=200; %the wall temperature (boundary condition)
k=6; %number of iterations
for j=1:1:k
T(1,1)=Tb;
T(5,1)=T(7,1); %the second boundary condition due to the isulation on the tip of the fin
for i=2:1:N
T(i,1)=(T(i+1,1)+T(i-1,1)+1.536)/2.0768; %FDE narrowed down
end
T(N,1)=T(N-1,1);
plot(T);
hold on
end
hold off
If I can get some help with my code.
  16 Kommentare
Cubii4
Cubii4 am 30 Nov. 2022
clc
clear all
L=0.16;
N=6;
dx=L/(N-1);
T=zeros(N+1,1);
Tb=200;
k=1000;
for i=1:1:k
T(1,1)=Tb;
for j=2:1:N
T(j,1)=(T(j+1,1)+T(j-1,1)+1.024)/2.0512;
end
T(N+1)=T(N-1);
plot(T);
hold on
end
hold off
for j=1:N
disp(T(j,1));
end
I just corrected the code like this and it gave me the temperature results as the analytic solutions. I can't thank you enough, is there anything else I have to correct in my code.
Cubii4
Cubii4 am 30 Nov. 2022
Thank you very much I really appreciated Your help. Can you write it as an answer so I can accept it.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 30 Nov. 2022
Verschoben: Torsten am 30 Nov. 2022
You solve the system iteratively. But you were told to solve it with the Thomas-Algorithm. So apply this algorithm to the matrix A below.
k = 20;
T_inf = 20;
h = 10;
D = 0.04;
L = 0.16;
T_at_wall = 200;
N = 6;
dL = L/(N-1);
A = zeros(N+1);
b = zeros(N+1,1);
A(1,1) = 1.0;
b(1) = T_at_wall;
for i = 2:N
A(i,i-1) = k/dL^2;
A(i,i) = -(2*k/dL^2 + 4/D*h);
A(i,i+1) = k/dL^2;
b(i) = -4/D*h*T_inf;
end
A(N+1,N-1) = -1.0;
A(N+1,N+1) = 1.0;
b(N+1) = 0;
T = A\b;
T = T(1:N)
T = 6×1
200.0000 171.3794 150.5095 136.3216 128.0894 125.3914
  2 Kommentare
EGE
EGE am 7 Mär. 2023
can you please explain the line after "end"? I could not figure out what it is. Thanks in advance.
Torsten
Torsten am 7 Mär. 2023
Bearbeitet: Torsten am 7 Mär. 2023
It's the discretized insulated Neumann condition at x=L: 0 = dT/dx ~ T_(n+1)-T_(n-1).
And the point (n+1) is a ghost node in the discretization.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by