2D Implicit Transient Heat conduction Problem

21 ビュー (過去 30 日間)
Sunag R A
Sunag R A 2018 年 6 月 3 日
回答済み: darova 2020 年 6 月 11 日
Dear all,
I am trying to solve a 2D transient implicit Heat conduction problem using Iterative methods like Jacobi, Gauss Siedel and SOR method.
I have written a code for it. But I have a little problem in looping the inner nodes. I have properly assigned Boundary conditions, also given the inner loop
Iteration. But I am not able to figure out the reason for the proper profile. The solution is stopping after only 3 Iterations.
I have attached the code below. Please let me know if anyone get it. Thanks !!
% Space Initialization
Lx = 1; Ly = 1;
nx = 11;
ny = 11;
dx = Lx/(nx-1); dy = Ly/(ny-1);
% Time Initialization
time = 0.2;
k = 1.65e-4; % Thermal Diffusivity
dt = 1e-4;
nt = time/dt;
k1 = k*dt/(dx^2);
k2 = k1;
% Mesh
x = linspace(0,Lx,nx);
y = linspace(0,Ly,ny);
[X, Y] = meshgrid(x,y);
% Limits
tol = 1e-4;
error = 9e9;
% Temp Initialization
T = ones(nx,ny);
% Boundary conditions
T(:,1) = 400; % Left
T(:,end) = 800; % Right
T(1,2:end-1) = 600; % Top
T(end,2:end-1) = 900; % Bottom
% Copying T
Told = T;
% Implicit method
iter = 1;
T_prev_dt = Told;
% Loop
for k = 1:nt
while(error > tol)
for i = 2:nx-1
for j = 2:ny-1
term1 = (1+(2*k1)+(2*k2))^-1;
term2 = k1*term1;
term3 = k2*term1;
H = (Told(i-1,j)+Told(i+1,j));
V = (Told(i,j-1)+Told(i,j+1));
T(i,j) = (T_prev_dt(i,j)*term1)+(H*term2)+(V*term3);
end
end
error = max(max(abs(Told - T)));
Told = T;
iter = iter+1;
end
T_prev_dt = T;
end
%%Plotting
C = contourf(X,Y,T,'edgecolor','none');
set(gca,'YDIR','reverse');
colormap(jet);
clabel(C,'FontSize',12);
  2 件のコメント
Sunag R A
Sunag R A 2018 年 6 月 3 日
編集済み: Sunag R A 2018 年 6 月 3 日
Typo error !!
x = linspace(0,Lx,nx) by the way!!
Vineet Sengar
Vineet Sengar 2020 年 6 月 10 日
Guys, don't get confused. This is an explicit method, not an implicit one. This guy lied to us and said it's an implicit method.

サインインしてコメントする。

回答 (1 件)

darova
darova 2020 年 6 月 11 日
  • the first problem is that you are using both variable Told and T_prev_dt - use the one only
  • second problem: dt value is too smal. It causes large difference between term1 and term2/term3 (solving is very slow)
I suggest you to add these lines inside your script to see solution process

Community Treasure Hunt

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

Start Hunting!

Translated by