All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM-Steady state analysis & Transient State Analysis OBJECTIVE-To solve the 2D heat conduction equation by using point iterative techniques. LET AX=B [abcd]⋅[x1x2]=[b1b2] A=D+L+U where D=diagonal matrix L=lower triangular matrix U=upper triangular matrix JACOBI TECHNIQUE …
Mainak Bhowmick
updated on 09 Sep 2020
AIM-Steady state analysis & Transient State Analysis
OBJECTIVE-To solve the 2D heat conduction equation by using point iterative techniques.
LET AX=B
[abcd]⋅[x1x2]=[b1b2]
A=D+L+U
where
D=diagonal matrix
L=lower triangular matrix
U=upper triangular matrix
JACOBI TECHNIQUE
The solution obtained iteratively
Xk+1=D-1⋅(b-(L+U)k)
here xkis the kth iteration xk+1is the k+1 iteration
xik+1=1aij(bi-∑aijxjk)
GAUSS SEIDEL
linear equation
L⋅x=b-Ux
x=L-1(b-Uxk)
Using forward substitution
xik+1=1aij(bi-i-1∑j=0aijxjk+1-n∑j=i+1aijxjk)
SUCESSIVE OVER RELAXATION
linear solution
(D+ωL)x=ωb-(ωu+(ω-1)D)x
where ωis the relaxation factor
The solution obtained iteratively
(xik+1)=(D+ωL)-1⋅(ωb-[ωu+(ω-1)D]xk)
STEADY STATE HEAT CONDUCTION EQUATION
It is the form of conduction that happens when the temperature difference driving the conduction are constant so that the temperature field in te conducting object doesnot change any further.Thus, all the partial derivatives of temperature concernng space may be either zero or have non zero values, but all the derivatives of temperature at any point concerning time are uniformly zero.
∂2T∂x2+∂2T∂y2=0
SOLVING TECHNIQUE
∂2T∂x2+∂2T∂y2=0
T-L2⋅T+pTRΔx2+TT-2⋅Tp+TBΔy2=0
2⋅Tp(Δx)2+2⋅Tp(Δy)2=TL+TRΔx2+TT+TBΔy2
TP⋅(2⋅Δx2+Δy2(Δx2⋅Δy2))=TL+TRΔx2+TT+TBΔy2
TP=1k(TL+TRΔx2+TT+TBΔy2)
where,k=(2⋅Δx2+Δy2(Δx2⋅Δy2))
here
TL=Ti-1,j
TR=Ti+1,j
TT=Ti,j+1
TB=Ti,j-1
TP=Ti,,j
CODE
close all
clear
clc
%Solving steady state heat conduction using iterative methods
%inputs
%no of grid points in x and y axis
nx=10;
ny=nx;
w=1.5;%relaxation factor
x=linspace(0,1,nx);
y=linspace(0,1,ny);
dx=x(2)-x(1);
dy=y(2)-y(1);
%Boundary conditions
Tp=300*ones(nx,ny);
Tp(1,:)=600;
Tp(:,end)=800;
Tp(end,:)=900;
Tp(:,1)=400;
Tp(1,1)=500;
Tp(1,end)=700;
Tp(end,end)=850;
Tp(end,1)=650;
k=2*((dx^2+dy^2)/(dx^2*dy^2));
T_old=Tp;
%iterative_solver=1;
%error
tol=1e-4;
error=9e9;
%selection statement
iterative_solver = input('Enter your choice (1 for Jacobi, 2 for GS, 3 for SOR) : ');
if iterative_solver==1
j_iter=1;
%convergence loop
while error>tol
%space loop
for i=2:nx-1
for j=2:ny-1
xterm=(T_old(i+1,j)+T_old(i-1,j))/(dx^2);
yterm=(T_old(i,j+1)+T_old(i,j-1))/(dy^2);
Tp(i,j)=(xterm+yterm)/k;
end
end
error=max(max(abs(T_old-Tp)));
T_old=Tp;
j_iter=j_iter+1;
end
%plotting in graphical form
contourf(x,y,Tp,'showtext','on');
xlabel('x');
ylabel('y');
colorbar;
axis ij;
a2=sprintf('niteration=%d',j_iter);
title(['Gauss Jacobi',a2]);
end
if iterative_solver==2
gs_iter=1;
tic
%convergence loop
while error>tol
%space loop
for i=2:nx-1
for j=2:ny-1
xterm=(Tp(i+1,j)+Tp(i-1,j))/(dx^2);
yterm=(Tp(i,j+1)+Tp(i,j-1))/(dy^2);
Tp(i,j)=(xterm+yterm)/k;
end
end
error=max(max(abs(T_old-Tp)));
T_old=Tp;
gs_iter=gs_iter+1;
end
%plotting in graphical form
contourf(x,y,Tp,'showtext','on');
colorbar;
axis ij;
xlabel('x');
ylabel('y');
a2=sprintf('niteration=%d',gs_iter);
title(['Gauss Seidal',a2]);
end
if iterative_solver==3
sor_iter=1;
tic
%convergence loop loop
while error>tol
%space loop
for i=2:nx-1
for j=2:ny-1
xterm=(Tp(i+1,j)+Tp(i-1,j))/(dx^2);
yterm=(Tp(i,j+1)+Tp(i,j-1))/(dy^2);
Tp(i,j)=(1-w)*T_old(i,j)+w*(xterm+yterm)/k;
end
end
error=max(max(abs(T_old-Tp)));
T_old=Tp;
sor_iter=sor_iter+1;
end
%plotting in graphical form
contourf(x,y,Tp,'showtext','on');
xlabel('x');
ylabel('y');
colorbar;
axis ij;
a2=sprintf('niteration=%d',sor_iter);
title(['SOR METHOD',a2]);
end
OUTPUT
CLICKING 1 JACOBI ITERATION IS SOLVED
CLICKING 2 GAUSS SIEDEL ITERATION IS SOLVED
CLICKING 3 SOR ITERATION IS SOLVED
TRANSIENT STATE HEAT CONDUCTION EQUATION
During period in which temperatures changes in time at any place within an object, the mode of thermal energy flow is termed transient heat conduction.
∂T∂t=∂2T∂x2+∂2T∂y2
solving procedure
Explicit way
Tpn+1-TpnΔt=α⋅(TL-2⋅Tp+TRΔx2+TB-2⋅Tp+TTΔy2)n
Tpn+1=Tpn+(Δtα)(TL-2⋅Tp+TRΔx2)+(Δtα)(TB-2⋅Tp+TTΔy2)n
CFL number,k1=CFLx=αΔtΔx2
k2=CFLy=αΔtΔy2
if CFL<0.5 stable
if CFL>0.5 unstable
CODE
close all
clear all
clc
%solving unsteady 2D heat conduction equation using explicit scheme
%input
nx=10;
ny=nx;
%defining x and y axis
x=linspace(0,1,nx);
y=linspace(0,1,ny);
dx=x(2)-x(1);
dy=y(2)-y(1);
%time step
nt=1400;
dt=1e-4;
%boundary conditions
T=300*ones(nx,ny);
T(1,:)=600;
T(end,:)=900;
T(:,1)=400;
T(:,end)=800;
T(1,1)=500;
T(1,end)=700;
T(end,end)=850;
T(end,1)=650;
Told=T;
Tpre=T;
iter=1;
%Thermal diffusivity
alpha=2;
k1=(alpha*dt)/(dx^2);
k2=(alpha*dt)/(dy^2);
tol=1e-4;
%iterative statement
if iter==1
explicit_iter=1;
for k=1:nt
error=9e9;
%converging loop
while error>tol
%space loop
for i=2:nx-1
for j=2:ny-1
xterm=k1*((Told(i-1,j)-2*Told(i,j)+Told(i+1,j)));
yterm=k2*((Told(i,j-1)-2*Told(i,j)+Told(i,j+1)));
T(i,j)=Told(i,j)+xterm+yterm;
end
end
error=max(max(abs(Told-T)));
Told=T;
explicit_iter=explicit_iter+1;
end
end
end
%plotting
figure(1)
contourf(x,y,T,'showtext','on');
colorbar;
colormap(jet)
set(gca,'YDIR','reverse')
xlabel('x')
ylabel('y')
a2=sprintf('niteration=%d',explicit_iter);
title(a2);
OUTPUT
IMPLICIT WAY
∂T∂t=α(∂2T∂x2+∂2T∂y2)
Tpn+1-TpnΔt=α⋅(TL-2⋅Tp+TRΔx2+TB-2⋅Tp+TTΔy2)n+1
Tpn+1=11+2k1+k2⋅[Tpn+k1⋅(TL+TR)n+1+k2⋅(TL+TR)n+1]
%solving unsteady heat conduction equation implicit method
close all
clear all
clc
%inputs
nx=10;
ny=nx;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
dx=x(2)-x(1);
dy=y(2)-y(1);
%relaxation factor
w=1.6;
%time step
nt=1400;
dt=0.001;
tol=1e-4;
%boundary conditions
T=300*ones(nx,ny);
T(1,:)=600;
T(end,:)=900;
T(:,1)=400;
T(:,end)=800;
T(1,1)=500;
T(1,end)=700;
T(end,end)=850;
T(end,1)=650;
Told=T;
Tpre=T;
%tol=1e-4;
iteration=input('enter 1 for Gauss Jacobi 2 for Gauss Seidal 3 for succesive relaxation:');
%thermal diffusion
alpha=1.5;
k1=(alpha*dt)/(dx^2);
k2=(alpha*dt)/(dy^2);
%jacobi iteration
if iteration==1
tic
%iteration loop
j_iter=1;
for k=1:nt
tic
error=9e9;
%converging loop
while (error>tol)
%space loop
for i=2:nx-1
for j=2:ny-1
const=((1+(2*k1)+(2*k2)))^-1;
term1=k1*((Told(i+1,j)+Told(i-1,j)));
term2=k2*((Told(i,j+1)+Told(i,j-1)));
T(i,j)=const*(Told(i,j)+term1+term2);
end
end
error=max(max(abs(Told-T)));
Told=T;
j_iter=j_iter+1;
end
Tpre=T;
end
time=toc;
%plotting
figure(1)
contourf(x,y,T,'showtext','on');
colorbar;
colormap(jet)
set(gca,'YDIR','reverse')
xlabel('x')
ylabel('y')
a2=sprintf('\niteration=%d',j_iter);
title(['jacobi',a2]);
end
%Gauss Seidal
if iteration==2
tic
Gs_iter=1;
%space loop
for k=1:nt
tic
error=9e9;
while error>tol
for i=2:nx-1
for j=2:ny-1
const=((1+(2*k1)+(2*k2)))^-1;
term3=k1*((T(i+1,j)+T(i-1,j)));
term4=k2*((T(i,j+1)+T(i,j-1)));
T(i,j)=const*(T(i,j)+term3+term4);
end
end
error=max(max(abs(Told-T)));
Told=T;
Gs_iter=Gs_iter+1;
end
Tpre=T;
end
time=toc;
%plottong
figure(1)
contourf(x,y,T,'showtext','on');
colorbar;
colormap(jet)
set(gca,'YDIR','reverse')
xlabel('x')
ylabel('y')
a2=sprintf('\niteration=%d',Gs_iter);
title(['Gauss seidal',a2]);
end
OUTPUT
Conclusion
It was expected that
Jacobi iterations >Gauss Seidal Iterations >SOR it is observed the same for Steady State.
i.e.206>112>26
Jacobi iterations >Gauss Seidal Iterations >SOR it is observed the same for UnSteady State.
i.e. 1986>1903>1692
thus can be concluded that SOR has the least iterations.
By applying the appropriate value of relaxation factor the least iterations can be obtained.
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 11 - Simulation of Flow through a pipe in OpenFoam
AIM- Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes For a baseline mesh, show that the velocity profile matches with the Hagen poiseuille's equation Show that the velocity profile is fully developed Post process velocity and shear stress…
29 Oct 2020 06:38 PM IST
Week 9 - FVM Literature Review
FINITE VOLUME METHOD - The finite volume is a discretisation method which is well suited for numerical simulations of various types namely hyperbolic, elliptic and parabolic for instance of conservation laws. It has been extensively used in several engineering fields, such as fluid mechanics, heat and mass transfer or…
20 Oct 2020 10:43 AM IST
Week 8 - BlockMesh Drill down challenge
AIM-to create a BlockMesh and to simulate it . OBJECTIVES:- How does the velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5,0.8 Measure the velocity profile at 0.085 m from the inlet of the geometry Plot must be a line plot Compare velocity magnitude contours near the step region…
15 Oct 2020 09:58 AM IST
Week 7 - Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method
AIM- Simulation of 1D supersonic nozzle flow simulation using Macormack method OBJECTIVES- 1. Steady-state distribution of primitive variables inside the nozzle2. Time-wise variation of the primitive variables3. Variation of Mass flow rate distribution inside the nozzle at different time steps during the time-marching…
30 Sep 2020 08:16 PM 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.