All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
…
SHAIK SYDAVALI
updated on 30 Jan 2021
Date: 30-01-2021
STEADY STATE AND TRANSIENT STATE ANALYSIS OF 2D-HEAT CONDUCTION EQUATION
Main Objective: -
Given input values: -
Boundary conditions are
Top Boundary = 600 K
Bottom Boundary = 900 K
Left Boundary = 400 K
Right Boundary = 800 K
Absolute error criteria is 1e-4
Description of domain: -
Fig(1): - Domain discretisation
I) Steady state -Implicit Scheme-Iterative solvers: -
2D-Heat conduction equation in spatial coordinates or simply Laplacian heat conduction equation in 2D as follows
ꝺ2T/ ꝺx2 + ꝺ2T/ ꝺy2 = ∇2T =0
Mathematical formulation: -
(TR -2 TP+ TL) / Δx2 + (TT -2 TP+ TB) / Δy2 = 0 ---------------1
Where,
TP = T (i, j) = our main aim to find the value of this point for different i,j values
TR = T(i+1,j)
TL = T(i-1,j)
TT = T(i,j+1)
TB = T(i,j-1)
Δx – distance between two successive points in x-direction which is constant .
Δy – distance between two successive points in y-direction which is constant
We can understand equation1 by help of below figure
Fig(2): - Domain discretisation
TP = (1/k) *[(TL + TR/ Δx2) + (TT + TB/ Δy2) ] ------2
Where ,
k=2*(Δx2+ Δy2)/(Δx2* Δy2)
(TP ) new= (1/k) *[ (TL + TR/ Δx2)old + (TT + TB/ Δy2)old ]
OUTPUT:-
Fig (3): -Jacobi iterative solver steady state at 208 iterations
2. Gauss seidel-iterative solver: -
(TP ) new= (1/k) *[ (TL + TR/ Δx2) + (TT + TB/ Δy2) ]
(Or)
T(i,j)= (1/k) *[ (T(i-1,j) + T(i+1,j)/ Δx2) + (T(i,j+1)+ T(i,j-1)/ Δy2)]
While applying Gauss Seidel Method
T(i,j)new= (1/k) *[ (T(i-1,j)new+ T(i+1,j)old/ Δx2) + (T(i,j+1)old+ T(i,j-1)new/ Δy2)]
OUTPUT:-
Fig (4): -Gauss seidel iterative solver steady state at 112 iterations
3.Successive Over Relaxation-iterative solver: -
(T(i,j))new = (1- ω) Told + ω *{GS (or) jacobi} ------------3
If ω>1 over relaxation
If ω<1 under relaxation
OUTPUT:-
Fig (5): - SOR solver steady state at 29 iterations
Conclusion form above graphs: -
From above three plots we can say that regarding number of iterations
Jacobi > Gauss seidel > SOR
So, that means by the help of SOR iterative technique in implicit scheme, we can obtain steady state solution with less number of iterations (or) in other words ,SOR iterative technique took less computational time to achieve steady state solution.
II) TRANSIENT ANALYSIS: -
2D-Heat conduction equation in both spatial and temporal coordinates or simply transient heat conduction equation in 2D as follows
ꝺT/ ꝺt +α (ꝺ2T/ ꝺx2 + ꝺ2T/ ꝺy2) = 0
or
ꝺT/ ꝺt +α ∇2T =0
Mathematical formulation: -
((Tpn+1 -Tpn)/Δt) + α* [(TR -2 TP+ TL) / Δx2] + α* [(TT -2 TP+ TB) / Δy2] = 0 -----4
Where ‘n’ indicates number of time steps
Transient analysis by using Explicit scheme: -
Form equation 4 we can write
Tpn+1(LHS) = {Tpn + α *Δt* [(TR -2 TP+ TL)n / Δx2]+ α *Δt* [(TT -2 TP+ TB)n / Δy2]}(RHS)---5
Where ‘n’ indicates number of time steps
Tpn+1 = Tpn + k1* [(TR -2 TP+ TL)n / Δx2]+ k2* [(TT -2 TP+ TB)n / Δy2]
Where
k1 = α *(Δt/ Δx2)
k2 = α *(Δt/ Δy2)
OUTPUT: -
Fig (6): - At t=0.44 seconds we achieved steady state in transient analysis of 2d- heat conduction by using explicit method
Conclusion form above graphs: -
In explicit scheme we do time marching until we achieve steady state. Courant number (CFL) place an important role in explicit method to check stability criteria of solution for each time step.
Transient analysis by using Implicit scheme: -
Mathematical formulation: -
Tpn+1 = Tpn + k1* [(TR -2 TP+ TL)n+1 / Δx2]+ k2* [(TT -2 TP+ TB)n+1 / Δy2] -----6
Tpn+1=(term1*Ttn +(term2*H)+(term3*V) -----7
Where,
Tpn+1 – new temperature values at n+1 time step
Ttn - temperature values at previous time step (or) at ‘n’ time step
H=TLn+1 + TRn+1
V= TTn+1 + TBn+1
term1=1/(1+(2*k1) + (2*k2))
term2=k1*term1
term3=k2*term1
OUTPUT:-
Fig (7): -Jacobi iterative solver achieves steady state in transient simulation at 832 iterations
2. Gauss seidel-iterative solver: -
OUTPUT:-
Fig (8): - GS iterative solver achieves steady state in transient simulation at 473 iterations
3. Successive Over Relaxation-iterative solver: -
OUTPUT: -
Fig (9): - SOR iterative solver achieves steady state in transient simulation at 178 iterations
Conclusion form above graphs: -
From above three plots we can say that regarding number of iterations
Jacobi > Gauss seidel > SOR
So, that means by the help of SOR iterative technique in implicit scheme, we can obtain unsteady state (or) transient solution with less number of iterations (or) in other words, SOR iterative technique took less computational time to achieve steady state solution.
At same ‘Δt’ ,‘α’ values ,implicit scheme took more computational time compare to explicit scheme.
MATLAB code for both steady state and transient state analysis: -
% this below programmes devided into two categories steady state and transient
%steady-state have one main programme and 3 function programme. files should be in same folder
%transient have one main programme and four function programmes including explicit function programme. files should be in same folder
%% FIRST PART
%% steady state 2d-heat conduction equation Numerical solution
% Main programme
clear all;
close all;
clc;
%% Assigning Geometric values
nx=10;
ny=nx;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
[xx,yy] = meshgrid(x,y); %using meshgrid for future use in the contourf command
T=300*ones(10);% Here intial guess value is 300kelvin.Our convergence time will depend on our intial guess value
%% Given values of Boundary conditions
T_lb = 400;
T_rb = 800;
T_tb = 600;
T_bb = 900;
error = 9e9;
tol=1e-4;
%% Assigning Boundary conditions
T(1,:) = T_tb;
T(:,1) = T_lb;
T(:,end) = T_rb;
T(end,:) = T_bb;
T(1,1) = (T_tb+T_lb)/2;
T(1,10) = (T_tb+T_rb)/2;
T(10,1) = (T_bb+T_lb)/2;
T(10,10) = (T_bb+T_rb)/2;
%%
Told=T;
dx= x(2)-x(1);
dy=y(2)-y(1);
k=2*(dx^2+dy^2)/(dx*dy)^2;
%% Jacobi Method
[jac_iter] = jacobi(dx,dy,nx,ny,k,tol,T,error,xx,yy); %function calling
%% GS Method
[gs_iter] = gs(dx,dy,nx,ny,k,tol,T,error,xx,yy); %function calling
%% SOR Method
q=1.5;
[sor_iter] = sor(dx,dy,nx,ny,k,tol,T,error,xx,yy,q);%function calling
%% from here onwards we have to make different files for functions programme and main programme and put them in a single folder
%% Jacobi method function programme
function [jac_iter] = jacobi(dx,dy,nx,ny,k,tol,T,error,xx,yy)
Told=T;
iterations=1;
while(error > tol)%convergence loop
for i=2:nx-1 %space loop along x-direcion
for j=2:ny-1 %space loop along y-direction
s1 =(1/k)*((Told(i-1,j)+Told(i+1,j))/(dx^2));
s2 =(1/k)*((Told(i,j-1)+Told(i,j+1))/(dy^2));
T(i,j) = s1+s2;
end
end
error= max(max(abs(Told-T)));
Told=T;
iterations=iterations+1;
jac_iter = iterations;
figure(1)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('Jacobi iteration number=%d at steady state',iterations);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
end
end
%% Gauss seidel method function programme
function [gs_iter] = gs(dx,dy,nx,ny,k,tol,T,error,xx,yy)
Told=T;
iterations=1;
while(error>tol) %convergence loop
for i=2:nx-1 %space loop along x-direction
for j=2:ny-1 %space loop along y-direction
s1 =(1/k)*((T(i-1,j)+Told(i+1,j))/(dx^2));
s2 =(1/k)*((T(i,j-1)+Told(i,j+1))/(dy^2));
T(i,j) = s1+s2;
end
end
error=max(max(abs(Told-T)));
Told=T;
iterations=iterations+1;
gs_iter =iterations;
figure(2)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('gauss seidel iteration number=%d at steady state',iterations);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
end
end
%% Successive Over Relaxation method function programme
function [sor_iter] = sor(dx,dy,nx,ny,k,tol,T,error,xx,yy,q)
Told=T;
iterations=1;
while (error>tol) %convergence loop
for i=2:nx-1 %space loop along x-direction
for j=2:ny-1 %space loop along y-direction
s1 =(1/k)*((T(i-1,j)+Told(i+1,j))/(dx^2));
s2 =(1/k)*((T(i,j-1)+Told(i,j+1))/(dy^2));
z=s1+s2;
T(i,j) = ((1-q).*Told(i,j))+(q.*z); % q is the omega which is sor factor
end
end
error= max(max(abs(Told-T)));
Told=T;
iterations=iterations+1;
sor_iter = iterations;
figure(3)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('Successive Over Relaxation iteration number=%d at steady state',iterations);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
end
end
%% SECOND PART
% Explicit function programme
function [explicit_transient_time]=explicit(nx,ny,T,xx,yy,nt,Told,k1,k2,dt,t)
for k=1:nt % time loop
for i=2:nx-1%space loop
for j=2:ny-1%space loop
z1=Told(i-1,j)-2*Told(i,j)+Told(i+1,j);
z2=Told(i,j+1)-2*Told(i,j)+Told(i,j-1);
T(i,j)=Told(i,j)+k1*z1+k2*z2;
end
end
Told=T;
figure(4)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('Transient behaviour of 2D-heat conduction at=%d seconds',k*dt);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
end
explicit_transient_time = t; %final time we need to achive steady state
end
%Implicit jacobi transient state function programme
function [implicit_transient_jacobi_iter]=implicit_jac_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t)
iteration=1;
for k=1:nt %time loop
error=100;
while(error > tol) % convergence loop
for i=2:nx-1 % space loop
for j=2:ny-1 % space loop
H=Told(i-1,j)+Told(i+1,j);
V=Told(i,j-1)+Told(i,j+1);
T(i,j)=(term1*T_t(i,j))+(term2*H)+(term3*V);
end
end
error= max(max(abs(Told-T)));
Told=T;
iteration=iteration+1;
figure(5)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('Jacobi iteration number=%d at unsteady state',iteration);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
implicit_transient_jacobi_iter = iteration;
end
T_t=T;
end
end
%Implicit Gauss seidel transient state function programme
function [implicit_transient_gs_iter]=implicit_gs_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t)
iteration=1;
for k=1:nt % time loop
error=100;
while(error > tol) % convergence loop
for i=2:nx-1 % time loop
for j=2:ny-1 % time loop
H=T(i-1,j)+Told(i+1,j);
V=T(i,j-1)+Told(i,j+1);
T(i,j)=(term1*T_t(i,j))+(term2*H)+(term3*V);
end
end
error= max(max(abs(Told-T)));
Told=T;
iteration=iteration+1;
figure(6)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('GS iteration number=%d at unsteady state',iteration);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
implicit_transient_gs_iter = iteration;
end
T_t=T;
end
end
%Implicit SOR transient state function programme
function [implicit_transient_sor_iter]=implicit_sor_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t,q)
iteration=1;
for k=1:nt % time loop
error=100;
while(error > tol) % convergence loop
for i=2:nx-1 % space loop
for j=2:ny-1 % space loop
H=T(i-1,j)+Told(i+1,j);
V=T(i,j-1)+Told(i,j+1);
z=(term1*T_t(i,j))+(term2*H)+(term3*V);
T(i,j) = ((1-q).*Told(i,j))+(q.*z); % q is the SOR factor for over relaxation
end
end
error= max(max(abs(Told-T)));
Told=T;
iteration=iteration+1;
figure(7)
[c,d]=contourf(xx,yy,T);
colormap(jet)
colorbar
title_text=sprintf('SOR iteration number=%d at unsteady state',iteration);
title(title_text)
xlabel('X-axis')
ylabel('Y-axis')
clabel(c,d)
set(gca,'YDIR','reverse') %required to correct the plot as by default it reverses the top and bottom values
implicit_transient_sor_iter = iteration;
end
T_t=T;
end
end
% Function programme '.m'files and main programme '.m'file should be in same folder
%%Main programme
clear all;
close all;
clc;
%% Assigning Geometric values
nx=10;
ny=nx;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
[xx,yy] = meshgrid(x,y); %using meshgrid for future use in the contourf command
T=300*ones(10);% Here intial guess value is 300kelvin.Our convergence time will depend on our intial guess value
%% Given values of Boundary conditions
T_lb = 400;
T_rb = 800;
T_tb = 600;
T_bb = 900;
error = 9e9;
tol=1e-4;
%% Assigning Boundary conditions
T(1,:) = T_tb;
T(:,1) = T_lb;
T(:,end) = T_rb;
T(end,:) = T_bb;
T(1,1) = (T_tb+T_lb)/2;
T(1,10) = (T_tb+T_rb)/2;
T(10,1) = (T_bb+T_lb)/2;
T(10,10) = (T_bb+T_rb)/2;
%%
Told=T;
dx= x(2)-x(1);
dy=y(2)-y(1);
%% Transient simulation EXPLICIT Scheme
dt=0.001;
t=0.44;
nt=t/dt;
alpha=1.4;
k1=alpha*(dt/dx^2);%CFL1 number along x-direction.Which is very important for explicit method to maintain stability
k2=alpha*(dt/dy^2);%CFL2 number along y-direction.Which is very important for explicit method to maintain stability
% CFl1+CFL2 <= 0.5 is the stability criteria for this explicit scheme
%%
[explicit_transient_time]=explicit(nx,ny,T,xx,yy,nt,Told,k1,k2,dt,t);%calling explicit function
%% Transient simulation IMPLICIT Scheme
% Implicit scheme is independent of CFL number.
% dt,nt,t and alpha values are such away that we can achive steady state.
dt=0.1;
t=1;
nt=t/dt;
alpha=1.4;
k1=alpha*(dt/dx^2);
k2=alpha*(dt/dy^2);
T_t=T;
term1=1/(1+(2*k1)+(2*k2));
term2=k1*term1;
term3=k2*term1;
%% Jacobi_solver
[implicit_transient_jacobi_iter]=implicit_jac_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t);%calling functio
%% GS_solver
[implicit_transient_gs_iter]=implicit_gs_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t);% calling function
%% SOR_solver
q=1.5; % q is noting but omega,which is main reason for over relaxation
[implicit_transient_sor_iter]=implicit_sor_transient(nx,ny,tol,T,xx,yy,nt,Told,term1,term2,term3,T_t,q);%calling function
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 4 - CHT Analysis on Exhaust port
CHT ANALYSIS ON EXHAUST PORT About CHT analysis: - CHT means Conjugate Heat Transfer which can tell combination of heat transfer in solids and fluids. This numerical analysis will give brief idea about conduction, convection and radiation or coupling of anyone of these three. The CHT analysis is used in process…
21 Jun 2021 12:26 PM IST
Week 3 - External flow simulation over an Ahmed body.
EXTERNAL FLOW SIMULATION OVER AN AHMED BODY AHMED BODY: - Ahmed body is a simplified car, used in automotive industry to investigate the flow analysis and find the wake flow around the body. This is made up of round front part, a moveable slant plane in ear…
20 Jun 2021 03:05 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.