All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
INTRODUCTION: The two dimensional heat conduction equation have both time deravative and space deravative. we can solve it by two approch 1 steady state equation in this the rate of change of temp remains 0. therefore the time deratavie is equated to zero 2 transient state equation in this the both term are consider …
Arun Reddy
updated on 04 Jan 2022
INTRODUCTION:
The two dimensional heat conduction equation have both time deravative and space deravative.
we can solve it by two approch
1 steady state equation
in this the rate of change of temp remains 0. therefore the time deratavie is equated to zero
2 transient state equation
in this the both term are consider
above equation for transient can solve by two method implicit method second is explicit method
* SOLVING THE STEADY STATE EQUATION:
Two dimensional steady state equation
discretising the equation by applying the central differencing scheme
*SOLVING ABOVE EQUATION USING 3 ITERATIVE METHODS:
MATLAB CODE
% solving the staedy state of different solvers like jacobi,gauss
% seidal,sucessive over relaxation
clear all
close all
clc
%defining the 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);
[xx,yy]=meshgrid(x,y);
%defining the boundary condition
t=ones(nx,ny);
t(1,:)=900;
t(end,:)=600;
t(:,1)=400;
t(:,end)=800;
told=t;
%errors start and tol
error_tol=1e-4;
start_error=9e9;
k=2*((dx^2+dy^2)/(dx^2*dy^2));
%defining the solver
iterative_solver=input('desirable number respect to solver:');
if iterative_solver==1
tic;
t_jacobi=jacobi_iter_steady(start_error,error_tol,xx,yy,nx,ny,dx,dy,t,k,told);
time_jacobi=toc
elseif iterative_solver==2
tic;
t_gauss=gauss_iter_steady(start_error,error_tol,x,y,nx,ny,dx,dy,t,k,told);
time_gauss=toc
elseif iterative_solver==3
tic;
t_sor=sor_iter_steady(start_error,error_tol,x,y,nx,ny,dx,dy,t,k,told);
time_sor=toc
end
FUNCTION CODE OF JACOBI
%function for jacobi method for solving stady state equation
function t= jacobi_iter_steady(start_error,error_tol,xx,yy,nx,ny,dx,dy,t,k,told)
jacobi_iter=1;
while(start_error>error_tol)
for i=2:nx-1
for j=2:ny-1
term1=(told(i-1,j)+told(i+1,j))/(k*(dx^2));
term2=(told(i,j-1)+told(i,j+1))/(k*(dx^2));
t(i,j)=term1+term2;
end
end
start_error=max(max(abs(told-t)));
told=t;
jacobi_iter=jacobi_iter+1;
figure(1)
[c,d]=contourf(xx,yy,t);
colormap(jet)
colorbar
title_text=sprintf('jacobi iteration number=%d @steadt state',jacobi_iter);
title(title_text)
xlabel=('x')
ylabel('y')
clabel(c,d)
pause(0.03)
end
fprintf('no of iteration in jacobi=%d',jacobi_iter);
end
FUNCTION CODE FOR GAUSS SEIDAL:
%function for gauss method for solving stady state equation
function t= gauss_iter_steady(start_error,error_tol,xx,yy,nx,ny,dx,dy,t,k,told)
gs_iter=1;
while(start_error>error_tol)
for i=2:nx-1
for j=2:ny-1
t(i,j)=(((t(i-1,j)+told(i+1,j))/dx^2)+((t(i,j-1)+told(i,j+1))/dy^2))/k;
end
end
start_error=max(max(abs(told-t)));
told=t;
gs_iter=gs_iter+1;
figure(2)
[c,d]=contourf(xx,yy,t);
colormap(jet)
colorbar
title_text=sprintf('gs iteration number=%d @steady state',gs_iter);
title(title_text)
xlabel=('x')
ylabel('y')
clabel(c,d)
pause(0.03)
end
fprintf('no of iteration in gs=%d',gs_iter);
end
FUNCTION CODE FOR SOR:
%function for sor method for solving stady state equation
function t= sor_iter_steady(start_error,error_tol,xx,yy,nx,ny,dx,dy,t,k,told)
sor_iter=1;
omega=1.7;
while(start_error>error_tol)
for i=2:nx-1
for j=2:ny-1
t_gs=(((t(i-1,j)+told(i+1,j))/dx^2)+((t(i,j+1))/dy^2))/k;
t(i,j)=omega*(t_gs)+(1-omega)*(told(i,j));
end
end
start_error=max(max(abs(told-t)));
told=t;
sor_iter=sor_iter+1;
figure(3)
[c,d]=contourf(xx,yy,t);
colormap(jet)
colorbar
title_text=sprintf('sor iteration number=%d@steadt state',sor_iter);
title(title_text)
xlabel=('x')
ylabel('y')
clabel(c,d)
pause(0.03)
end
fprintf('no of iteration in sor=%d',sor_iter);
end
RESULTS
JACOBI METHOD
GAUSS SEIDAL
SOR METHOD
From above all plots it can deravie that sor method has taken less number of iterations when compare to others two.yhere fore sor is good and fastest among all.
*SOLVING TRANSIENT STATE EQUATION
This equation is solve by both transient and emplicity following two d heat conduction equation
Solving by equation by explicity:
explicit method calculate the state of a system at a later time from the state of a sysytem at the current time.
here the most important in this each equation approch contains only one unknown and can be solved explicity for the one unknown using this method
here the time deravative term are calculated by first ODE where as second order is eliptical in nature so information need to take by all the side equally.therefore central differencing scheme is applied
CODE FOR 2D TRANSIENT HEAT CONDUCTION EQUATION FOR SOLVING EXPLICITY:
%solving transient heat conduction explicity
clear all
close all
clc
% defining inputs
nx=41;
ny=nx;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
dx=x(2)-x(1);
dy=y(2)-y(1);
dt=0.01;
alpha=1.88e-5;
[xx,yy]=meshgrid(x,y);
%degining the boundary
t=ones(nx,ny);
t(1,:)=900;
t(end,:)=600;
t(:,1)=400;
t(:,end)=800;
told=t;
%rounding of the corner value
t(1,1)=(400+900)/2;
t(1,ny)=(900+800)/2;
t(nx,1)=(400+600)/2;
t(nx,ny)=(600+800)/2;
% errors term
error_tol=1e-4;
start_error=9e9;
k1=alpha*(dt/dx^2);
k2=alpha*(dt/dy^2);
% defining the solver
iterative_solver=1;
tic;
if iterative_solver==1
t_jacobi=jacobi_iter_transient_expli(xx,yy,nx,ny,t,k1,k2,told);
end
time_jacobi=toc
FUNCTION FOR JACOBI
% function for transient jacobi explicit
function t=jacobi_iter_transient_expli(xx,yy,nx,ny,t,k1,k2,told)
jacobi_iter=1;
for k=1:120000
for i=2:nx-1
for j=2:ny-1
term1=(told(i,j));
term2=k1*(told(i+1,j)-2*told(i,j)+told(i-1,j));
term3=k2*(told(i,j+1)-2*told(i,j)+told(i,j-1));
t(i,j)=term1+term2+term3;
end
end
start_error=max(max(abs(told-t)));
told=t;
jacobi_iter=jacobi_iter+1;
end
figure(1)
[c,d]=contourf(xx,yy,t);
colormap(jet)
colorbar
title_text=sprintf('jacobi iteration number=%d @transient explicit',jacobi_iter);
title(title_text)
xlabel('x')
ylabel('y')
clabel(c,d)
pause(0.03)
fprintf('num of iteration in jacobi=%d/2',jacobi_iter);
end
RESULT
SOLVING THE ABOVE EQUATION IMPLICITY:
In implicity method its find the solution by an equation involving both current state of the system and later one.
CODE FOR 2D TRANSIENT STATE HEAT CONDUCTION EQUATION SOLVING BY IMPLICITY:
clear all
close all
clc
% defining inputs
nx=41;
ny=nx;
l=1;
x=linspace(0,1,nx);
y=linspace(0,1,ny);
dx=x(2)-x(1);
dy=y(2)-y(1);
dt=0.01;
alpha=1.88e-5;
[xx,yy]=meshgrid(x,y);
%degining the boundary
t=298*ones(nx,ny);
t(1,:)=900;
t(end,:)=600;
t(:,1)=400;
t(:,end)=800;
%rounding of the corner value
t(1,1)=(400+900)/2;
t(1,ny)=(900+800)/2;
t(nx,1)=(400+600)/2;
t(nx,ny)=(600+800)/2;
told=t;
tprev=told;
% errors term
error_tol=1e-4;
start_error=9e9;
k1=alpha*(dt/dx^2);
k2=alpha*(dt/dy^2);
omega=2/(1+sin(pi*dx));
cfl=alpha*(dt/(dx^2));
% solving iter
iterative_solver=input('appromiate number required:');
if iterative_solver==1
tic;
t=jacobi_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev);
elseif iterative_solver==2
tic;
t_gs=gs_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev);
elseif iterative_solver==3
tic;
t_sor=sor_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev,omega);
end
FUNCTION FOR JACOBI
% dunction jacobi transient implisit
function t=jacobi_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev)
jacobi_iter=1;
for k=1:120000
start_error=9e9;
while(start_error>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)=(tprev(i,j)*term1)+term2*h+term3*v;
end
end
start_error=max(max(abs(told-t)));
told=t;
jacobi_iter=jacobi_iter+1
end
tprev=t;
end
time_jacobi=toc;
contourf(xx,yy,t,'ShowText','on')
colormap(jet)
colorbar
xlabel('x')
ylabel('y')
title_text=sprintf('2d dimensional heat conduction implicit using jacobi=%d',jacobi_iter,time_jacobi);
title(title_text)
fprintf('no of iteration in jacobi=%d ',jacobi_iter,time_jacobi);
end
FUNCTION FOR GAUSS
% dunction gauss transient implisit
function t=gs_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev)
gs_iter=1;
for k=1:120000
start_error=9e9;
while(start_error>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)=(tprev(i,j)*term1)+term2*h+term3*v;
end
end
start_error=max(max(abs(told-t)));
told=t;
gs_iter=gs_iter+1
end
tprev=t;
end
time_gs=toc;
contourf(xx,yy,t,'ShowText','on')
colormap(jet)
colorbar
xlabel('x')
ylabel('y')
title_text=sprintf('2d dimensional heat conduction implicit using gauss=%d',gs_iter,time_gs);
title(title_text)
fprintf('no of iteration in gauss=%d ',gs_iter,time_gs);
end
FUNCTION FOR SOR
% dunction sor transient implisit
function t=sor_iter_transient_impli(error_tol,xx,yy,nx,ny,t,k1,k2,told,tprev,omega)
sor_iter=1;
for k=1:120000
start_error=9e9;
while(start_error>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=(t(i-1,j)+told(i+1,j));
v=(t(i,j-1)+told(i,j+1));
t(i,j)=omega*(tprev(i,j)*term1+term2*h+term3*v)+(1-omega)*tprev(i,j);
end
end
start_error=max(max(abs(told-t)));
told=t;
sor_iter=sor_iter+1
end
tprev=t;
end
time_sor=toc;
contourf(xx,yy,t,'ShowText','on')
colormap(jet)
colorbar
xlabel('x')
ylabel('y')
title_text=(sprintf('2d dimensional heat conduction implicit using sor=%d',sor_iter,time_sor));
title(title_text)
fprintf('no of iteration in sor=%d ',sor_iter,time_sor);
end
RESULTS
JACOBI METHOD
GAUSS METHOD
BY SOR METHOD
Conclusion:
Here the transient equation the time required to solve is more when compare to steady state equation
In transient state equation is solved implicity jacobi method take less time compare to the other two methods .
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...
Project 1-Meshing of Rear Wheel Holder challenge
Aim :- Meshing of Rear Wheel Holder with mentioned quality criteria. OBJECTIVE: Extract the mid surface Geometry cleanup Meshing given door model using the given quality criteria checks Good mesh flow. Assign thickness PROCEDURE : Import the component and click F to see the component in the GUI area as shown below. As…
10 Jun 2023 03:22 PM IST
Week 7- Meshing of Backdoor Challenge
AIM: Mesh the backdoor model as per the given quality criteria using Hypermesh. OBJECTIVE: Extract the mid surface Geometry cleanup Meshing given hood model using the given quality criteria checks Good mesh flow. Assign thickness PROCEDURE : Import the component and click F to see the component in the GUI area as shown…
10 Jun 2023 03:21 PM IST
Week 6-Meshing of Hood Challenge
AIM: To extract the mid surface of the given component individually, mesh the obtained mid surface, and assign the thickness. The given model has to be imported and auto cleanup has to be done on the component then the mid surface has to be extracted from the components and have to be meshed individually with an average…
22 Jan 2023 12:06 PM IST
Week 4-1D Element Creation Challenge
THEORY: PROJECT METHODOLOGY: 1. MID SURFACE: Auto mid surface has been used to extract the midsurface for this simple bracket. Components has been created and assigned to the particular mid surfaces. 2. ASSIGN MATERIAL: Create material. Here I have created a material and assigned to steel. …
04 Jan 2023 11:52 AM 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.