All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim : Solving the steady and unsteady 2D heat conduction problem Objective : Solve the 2D heat conduction equation by using the point iterative techniques that were taught in the class. The Boundary conditions for the problem are as follows; Top Boundary = 600 K Bottom Boundary = 900 K Left Boundary = 400 K Right Boundary…
chetankumar nadagoud
updated on 02 Feb 2022
Aim : Solving the steady and unsteady 2D heat conduction problem
Objective :
Solve the 2D heat conduction equation by using the point iterative techniques that were taught in the class. The Boundary conditions for the problem are as follows;
Top Boundary = 600 K
Bottom Boundary = 900 K
Left Boundary = 400 K
Right Boundary = 800 K
Theory:
Three dimension heat conduction equation is given as :
δTδt=α(δ2Tδx2+δ2Tδy2+δ2Tδz2)δTδt=α(δ2Tδx2+δ2Tδy2+δ2Tδz2)
For steady state 2D problem the above equation becomes: δTδt=0δTδt=0
For unsteady 2D state the equation becomes : δTδt=α(δ2Tδx2+δ2Tδy2)δTδt=α(δ2Tδx2+δ2Tδy2)
1. 2D steady state problem:
We apply central difference method for the above steady state equation. We get:
T(i)= Δx2Δy22(Δx2+Δy2)(T(i+1,j)+T(i-1,j)Δx2+T(i,j+1)+T(i,j-1)Δy2)T(i)= Δx2Δy22(Δx2+Δy2)(T(i+1,j)+T(i−1,j)Δx2+T(i,j+1)+T(i,j−1)Δy2)
Here we assign : k = 2(Δx2+Δy2)Δx2Δy22(Δx2+Δy2)Δx2Δy2
Methods used:
1.jacobian method: In jacobian method we use values from previous iterations therefore the right side is already knowsn.Here we use values from nth time step while calculating values of n+1 time.
(T(i,j))n+1= (1k).(T(i+1,j)+T(i-1,j)Δx2+T(i,j+1)+T(i,j-1)Δy2)n(T(i,j))n+1= (1k).(T(i+1,j)+T(i−1,j)Δx2+T(i,j+1)+T(i,j−1)Δy2)n
2.Gauss sidel method : We update values after each iterations and we use the update values.
(T(i,j))n+1= (1k).(T(i+1,j)+T(i-1,j)Δx2+T(i,j+1)+T(i,j-1)Δy2)n+1(T(i,j))n+1= (1k).(T(i+1,j)+T(i−1,j)Δx2+T(i,j+1)+T(i,j−1)Δy2)n+1
3.Successive over relaxation: It is used either over jacobian or Gauss sidel method it enhances the performance of other iterative solver. It uses the scaling factor omega. It either makes solution to converge faster or slower based on the value of Omega. If we choose the value of omega above treshold values may shoot over the required results and would never converege. Therefore we need to be carefull while choosing the value of omega.
T(i,j)=Told(i,j) +ω(T(i,j)-Told(i,j))T(i,j)=Told(i,j) +ω(T(i,j)−Told(i,j))
Where T(i,j) are the updated values from Gauss sidel method.
Steps in coding:
Main code:
clear all
close all
clc
%inputs
L = 1;
nx = 20;
ny = nx;
x = linspace(0,1,nx);
y = linspace(0,1,ny);
[X, Y]=meshgrid(x,y);
T = 300*(ones(nx,ny));
T(1,:)=600;
T(ny,:)=900;
T(:,1)=400;
T(:,ny)=800;
Told = T;
T_new = T;
dx = L/(nx-1);
dy = L/(ny-1);
k = (2*(dx^2+dy^2))/((dx^2)*(dy^2));
q = k^-1;
q1 = q/dx^2;
q2 = q/dy^2;
e = 8e888;
tol = 1e-4;
e = 1;
omega = 1.73;
iteration_method = 1;
%jacobian method
if iteration_method == 1
tic
iteration =1;
while e > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
TR = Told(i+1,j);
TL = Told(i-1,j);
Tt = Told(i,j+1);
Tb = Told(i,j-1);
T(i,j) = q1*(TR+TL)+q2*(Tt+Tb);
end
end
error = max(abs(T-Told));
e = max(abs(error));
Told = T;
iteration = iteration+1;
end
timetaken = toc;
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['Jacobian method'];title_text;['time taken = ',num2str(timetaken)]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
%Gauss sidel method
elseif iteration_method == 2
tic
iteration =1;
while e > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
TR = T_new(i+1,j);
TL = T_new(i-1,j);
Tt = T_new(i,j+1);
Tb = T_new(i,j-1);
T(i,j) = q1*(TR+TL)+q2*(Tt+Tb);
T_new = T;
end
end
error = max(abs(T-Told));
e = max(abs(error));
Told = T;
iteration = iteration+1;
end
timetaken = toc;
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['Gauss sidel method'];title_text;['time taken = ',num2str(timetaken)]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
%successive over relaxation method applyed to Gauss sidel
elseif iteration_method == 3
tic
iteration =1;
while e > 1e-4
for i = 2:(nx-1)
for j = 2:(ny-1)
TR = T_new(i+1,j);
TL = T_new(i-1,j);
Tt = T_new(i,j+1);
Tb = T_new(i,j-1);
T(i,j) = q1*(TR+TL)+q2*(Tt+Tb);
T(i,j) = Told(i,j)+omega*(T(i,j)-Told(i,j));
T_new = T;
end
end
error = max(abs(T-Told));
e = max(abs(error));
Told = T;
iteration = iteration+1;
end
timetaken = toc
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
ax = gca;
ax.YDir = 'reverse';
colorbar
title_text = sprintf('Number of iteration = %d',iteration);
title({['SOR method'];title_text;['time taken = ',num2str(timetaken)]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
end
Results:
Conclusion : Based on number of iterations
Jacobian > Gauss sidel > SOR
Therefore we can see that jacobian takes lot of iterations to arrive at the solution where as SOR takes least and Gauss sidel lies in between them.
2. 2D unsteady state:
For 2D unsteady state transient 3D heat conduction equation becomes:
δTδt=α(δ2Tδx2+δ2Tδy2)δTδt=α(δ2Tδx2+δ2Tδy2)
The above equation can be discretized in two ways:
1. Explicit
2.Implicit
1.Explicit: In this method the temperature values of previous time steps are inputed on the right side i.e:
T(i,j)n+1=T(i,j)n+k1(T(i+1,j)+T(i-1,j))n+k2(T(i,j+1)+T(i,j-1))nT(i,j)n+1=T(i,j)n+k1(T(i+1,j)+T(i−1,j))n+k2(T(i,j+1)+T(i,j−1))n
where:
k1=αΔtΔx2 k2=αΔtΔy2
α=Thermal diffusivity
Here we know the all the values on the right hand side.
Main code:
clear all
close all
clc
nx = 20;
ny = 20;
dt = 1e-4;
L = 1;
alpha = 1.4;
dx= L/(nx-1);
dy= L/(ny-1);
x = linspace(0,L,nx);
y = linspace(0,L,ny);
[X Y] = meshgrid(x,y);
T = 300*(ones(nx,ny));
T(1,:)=600;
T(ny,:)=900;
T(:,1)=400;
T(:,ny)=800;
Told = T;
tol = 1e-4;
k1 = (alpha*dt)/(dx^2);
k2 = (alpha*dt)/(dy^2);
Term1 = (1-2*k1-2*k2);
Term2 = k1;
Term3 = k2;
iteration = 0;
error = 8e88;
while error > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
T(i,j)=Told(i,j)*Term1+Term2*(Told(i+1,j)+Told(i-1,j))+Term3*(Told(i,j+1)+Told(i,j-1));
end
end
error = max(max(abs(T-Told)));
Told = T;
iteration = iteration+1;
end
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['explicit method for Transient heat conduction'];[title_text]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
Result:
2.Implicit method:
T(i,j)n+1=T(i,j)n+k1(T(i+1,j)+T(i-1,j))n+1+k2(T(i,j+1)+T(i,j-1))n+1
where:
k1=αΔtΔx2 k2=αΔtΔy2
α=Thermal diffusivity
Here the right side values are unknown.
We have 3 iteration methods to solve for explicit type.
1. jacobian method
2.gauss sidel method
3.Successive over relaxation method
Main code:
clear all
close all
clc
nx = 20;
ny = 20;
nt = 1400;
dt = 0.01;
L = 1;
alpha = 1;
dx= L/(nx-1);
dy= L/(ny-1);
x = linspace(0,L,nx);
y = linspace(0,L,ny);
[X Y] = meshgrid(x,y);
T = 300*(ones(nx,ny));
T(1,:)=600;
T(ny,:)=900;
T(:,1)=400;
T(:,ny)=800;
Told = T;
Tprevious = T;
tol = 1e-4;
k1 = (alpha*dt)/(dx^2);
k2 = (alpha*dt)/(dy^2);
Term1 = ((1+2*k1+2*k2))^-1;
Term2 = k1*Term1;
Term3 = k2*Term1;
iteration = 0;
solver = 1;
if solver == 1
for k = 1:nt
error = 8e88
while error > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
T(i,j)=Tprevious(i,j)*Term1+Term2*(Told(i+1,j)+Told(i-1,j))+Term3*(Told(i,j+1)+Told(i,j-1));
end
end
error = max(max(abs(T-Told)));
Told = T;
iteration = iteration+1;
end
Tprevious = T;
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['implicit jacobian method for Transient heat conduction'];[title_text]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
end
end
if solver == 2
T_update = T;
for k = 1:nt
error = 8e88
while error > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
T(i,j)=Tprevious(i,j)*Term1+Term2*(T_update(i+1,j)+T_update(i-1,j))+Term3*(T_update(i,j+1)+T_update(i,j-1));
end
T_update = T;
end
error = max(max(abs(T-Told)));
Told = T;
iteration = iteration+1;
end
Tprevious = T;
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['implicit Gauss sidel method for Transient heat conduction'];[title_text]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
end
end
%SOR method
if solver == 3
T_update = T;
omega = 1.2;
for k = 1:nt
error = 8e88
while error > tol
for i = 2:(nx-1)
for j = 2:(ny-1)
T(i,j)=Tprevious(i,j)*Term1+Term2*(T_update(i+1,j)+T_update(i-1,j))+Term3*(T_update(i,j+1)+T_update(i,j-1));
T(i,j)=Told(i,j)+omega*(T(i,j)-Told(i,j));
end
T_update = T;
end
error = max(max(abs(T-Told)));
Told = T;
iteration = iteration+1;
end
Tprevious = T;
[m, n]=contourf(X,Y,T);
clabel(m,n);
colormap(jet);
colorbar
ax = gca;
ax.YDir = 'reverse';
title_text = sprintf('Number of iteration = %d',iteration);
title({['implicit SOR method for Transient heat conduction'];[title_text]})
xlabel('x-axis')
ylabel('y-axis')
zlabel('Temperature')
end
end
Results:
Conclusion : SOR method converges faster then the gauss sidel and jacobian method.
Number of iterations: Jacobian>Gauss sidel>SOR
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 1 : Exploring the GUI of GT-POWER
Aim : Explore the GUI of GT-Suite and run the intercooler setup. GT SUITE: GT-SUITE is the industry-leading simulation tool with capabilities and libraries aimed at a wide variety of applications and industries. It offers engineers functionalities ranging from fast concept design to detailed system or sub-system/component…
05 Dec 2022 09:52 AM IST
Project 1 : CFD Meshing for Tesla Cyber Truck
CFD Meshing of Tesla Cyber Truck Aim : CFD meshing for Tesla Cyber Truck. Objectives: For…
04 Dec 2022 10:50 AM IST
Week 4 Challenge : CFD Meshing for BMW car
CFD Meshing for BMW car Aim: CFD meshing for BMW car using ANSA Objectives: For the given model, check and solve all geometrical errors on half portion and Assign appropriate PIDs. Perform meshing with the given Target length and element Quality criteria. After meshing the half model, Do symmetry to the other side. Target…
30 Nov 2022 06:45 AM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.