All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To solve the Steady and Transient state 2D Heat Conduction Equation by using the point iteration techniques for both implicit and explicit schemes. Jacobi Gauss-Seidel Successive Over Relaxation Theory: The heat equation is a partial differencial equation that describes how the heat is distributed over time…
Ravi Shankar Yadav
updated on 30 Dec 2021
Aim:
To solve the Steady and Transient state 2D Heat Conduction Equation by using the point iteration techniques for both implicit and explicit schemes.
Theory:
The heat equation is a partial differencial equation that describes how the heat is distributed over time in a solid.
The three dimensional temperature heat conduction equation has both time and spatial derivative.
∂T∂t+α(∂2T∂x2+∂2T∂y2+∂2T∂z2)=0
here, α is thermal diffusivity.
This equation can be solved in two ways:
1. Steady-State Condition:
In this condition, the rate of change of temperature wrt time is equal to zero.
So, the 2D Steady-state heat equation becomes,
∂2T∂x2+∂2T∂y2=0
2. Transient State Condition:
In this condition, both terms are considered,
So, the 2D Transient state heat equation becomes,
∂T∂t+α(∂2T∂x2+∂2T∂y2)=0
Now, equations (a) and (b), will be solved by using iterative methods, in 2 different ways.
1. Explicit Method
2. Implicit Method
Note: We will use both these methods to solve the transient state equation.
Assumptions:
A. Solving the steady state equation
∂2T∂x2+∂2T∂y2=0
Tp=(1K){(TL+TRΔx2)+(TT+TBΔy2)}
T(i,j)=(1K){(Told(i−1,j)+Told(i+1,j)dx2)+(Told(i,j−1)+Told(i,j+1)dy2)}
K=2â‹…dx2+dy2dx2â‹…dy2
MATLAB Code for solving the equation using 3 iterative methods
Using Jacobi Iteration
% Solving the steady-state equation by using
% Jacobi Method
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
k = 2*((dx^2 + dy^2)/(dx^2 * dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
% Average temperature at corners
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
iterative_solver = 1;
if iterative_solver == 1
jacobi_iter_value = 1;
while(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*(dy^2));
T(i,j) = term1 + term2;
end
end
error = max(max(abs(Told -T)));
Told = T;
jacobi_iter_value = jacobi_iter_value +1;
end
end
% Plotting
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('Jacobi iteration number for steady state = %d', jacobi_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
fprintf(' Number of Iterations for Jacobi Method for Steady state condition = %d', jacobi_iter_value)
Graph:
Using Gauss-Seidel Iteration
% Solving the steady-state equation by using
% Gauss Seidel
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
k = 2*((dx^2 + dy^2)/(dx^2 * dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
% Average temperature at corners
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
iterative_solver = 2;
if iterative_solver == 2
gauss_iter_value = 1;
while(error > tol)
for i=2:nx-1
for j=2:ny-1
term1 = (T(i-1,j) + Told(i+1,j))/(k*(dx^2));
term2 = (T(i,j-1) + Told(i,j+1))/(k*(dy^2));
T(i,j) = term1 + term2;
end
end
error = max(max(abs(Told -T)));
Told = T;
gauss_iter_value = gauss_iter_value +1;
end
end
% Plotting
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('Gauss seidel iteration number for steady state = %d', gauss_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
fprintf(' Number of Iterations for Gauss Seidel Method for Steady state condition = %d', gauss_iter_value)
Graph:
Successive Over Relaxation Iteration
% Solving the steady-state equation by using
% successive over-relaxation method
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
omega = 1.2;
k = 2*((dx^2 + dy^2)/(dx^2 * dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
iterative_solver = 3;
if iterative_solver == 3
sor_iter_value = 1;
while(error > tol)
for i=2:nx-1
for j=2:ny-1
term1 = (T(i-1,j) + Told(i+1,j))/(k*(dx^2));
term2 = (T(i,j-1) + Told(i,j+1))/(k*(dy^2));
T(i,j) = omega*(term1 + term2)+ (1-omega)*Told(i,j);
end
end
error = max(max(abs(Told -T)));
Told = T;
sor_iter_value = sor_iter_value +1;
end
end
% Plotting
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('SOR iteration number for steady state = %d', sor_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
fprintf(' Number of Iterations for SOR Method for Steady state condition = %d', sor_iter_value)
Graph:
B. Solving the Transient state equation
Using Implicit Scheme
∂T∂t+α(∂2T∂x2+∂2T∂y2)=0
Tn+1P=TnP+(αΔt)(TR−2TP+TLΔx2+TT−2TP+TBΔy2)
Tn+1P=(11+2k1+2k2)(TnP+k1(Tn+1L+Tn+1R)+k2(Tn+1T+Tn+1B))
k1=α(ΔtΔx2),k2=α(ΔtΔy2)
Ti,j=(11+2k1+2k2)(Ti,j+k1(Ti−1,j+Ti+1,j)+k2(Ti,j−1+Ti,j+1))
MATLAB Code for solving the equation using 3 iterative methods
Using Jacobi Iteration
% Solving the steady-state equation by using
% Jacobi method
% Implicit Method
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
nt = 1400;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
dt = 1e-3;
alpha = 1.4
k1 = alpha*(dt/(dx^2));
k2 = alpha*(dt/(dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T = 300*ones(nx,ny);
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
jacobi_iter_value = 1;
for k = 1:nt
error = 9e9;
while(error > tol)
for i=2:nx-1
for j=2:ny-1
term1 = 1/(1 + (2*k1) + (2*k2));
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_initial(i,j)*term1) + H*(term2) + V*(term3);
end
end
error = max(max(abs(Told -T)));
Told = T;
jacobi_iter_value = jacobi_iter_value +1;
end
% Plotting
T_initial = T
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('Jacobi iteration number for unsteady state = %d', jacobi_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
end
fprintf(' Number of Iterations for Implicit Jacobi Method for Transient State Condition = %d', jacobi_iter_value)
Graph:
Using Gauss-Seidel Iteration
% Solving the steady-state equation by using
% Gauss-Seidel method
% Implicit Method
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
nt = 1400;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
dt = 1e-3;
alpha = 1.4
k1 = alpha*(dt/(dx^2));
k2 = alpha*(dt/(dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T = 300*ones(nx,ny);
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
Gauss_iter_value = 1;
for k = 1:nt
error = 9e9;
while(error > tol)
for i=2:nx-1
for j=2:ny-1
term1 = 1/(1 + (2*k1) + (2*k2));
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) = (T_initial(i,j)*term1) + H*(term2) + V*(term3);
end
end
error = max(max(abs(Told -T)));
Told = T;
Gauss_iter_value = Gauss_iter_value +1;
end
% Plotting
T_initial = T
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('Gauss iteration number for unsteady state = %d', Gauss_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
end
fprintf(' Number of Iterations for Implicit Gauss Seidel Method for Transient State Condition = %d', Gauss_iter_value)
Graph:
Successive Over Relaxation Iteration
% Solving the steady-state equation by using
% Successive Over-Relaxation method
% Implicit Method
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
nt = 1400;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
dt = 1e-3;
omega = 1.2
alpha = 1.4;
k1 = alpha*(dt/(dx^2));
k2 = alpha*(dt/(dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T = 300*ones(nx,ny);
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
T_end = T
% solving
SOR_iter_value = 1;
for k = 1:nt
error = 9e9;
while(error > tol)
for i=2:nx-1
for j=2:ny-1
term1 = 1/(1 + (2*k1) + (2*k2));
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) = (T_initial(i,j)*term1) + H*(term2) + V*(term3);
T_end(i,j) = ((1-omega)*Told(i,j))+ (T(i,j)*omega);
end
end
error = max(max(abs(Told -T)));
Told = T_end;
SOR_iter_value = SOR_iter_value +1;
end
% Plotting
T_initial = T
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('SOR iteration number for unsteady state = %d', SOR_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
end
fprintf(' Number of Iterations for Implicit SOR Method for Transient State Condition = %d', SOR_iter_value)
Graph:
Using Explicit Scheme
∂T∂t+α(∂2T∂x2+∂2T∂y2)=0
Tn+1P=TnP+(αΔt)(TR−2TP+TLΔx2+TT−2TP+TBΔy2)
Tn+1p=(Tnp+k1(TnL−2TnP+TnR)+k2(TnT−2TnP+TnB))
k1=α(ΔtΔx2),k2=α(ΔtΔy2)
Ti,j=(Ti,j+k1(Ti−1,j−2Ti,j+Ti+1,j)+k2(Ti,j−1−2Ti,j+Ti,j+1))
MATLAB Code for solving the equation
Using Jacobi Iteration
% Solving the steady-state equation by using
% Jacobi method
% Explicit scheme
clear all
close all
clc
% Inputs
% nx = number of grids
nx = 10;
ny = nx;
nt = 1400;
% Domain length
l = 1;
x = linspace(0, l, nx)
y = linspace(0, l, ny)
dx = x(2) - x(1)
dy = y(2) - y(1)
% Tolerance error, start error
tol = 1e-4;
error = 9e9;
dt = 1e-3;
alpha = 1.4
k1 = alpha*(dt/(dx^2));
k2 = alpha*(dt/(dy^2));
% Boundary conditions
T_L = 400;
T_R = 800;
T_T = 600;
T_B = 900;
T = 300*ones(nx,ny);
T(2:ny-1, 1) = T_L;
T(2:ny-1, nx) = T_R;
T(1, 2:nx-1) = T_T;
T(ny, 2:nx-1) = T_B;
T(1,1) = (T_T + T_L)/2;
T(nx,ny) = (T_R + T_B)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_L + T_B)/2;
T_initial = T;
Told = T;
% solving
jacobi_iter_value = 1;
for k = 1:nt
error = 9e9;
while(error > tol)
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
error = max(max(abs(Told -T)));
Told = T;
jacobi_iter_value = jacobi_iter_value +1;
end
% Plotting
figure(1)
contourf(x, y, T)
clabel(contourf(x, y, T))
colormap(jet)
colorbar
set(gca, 'ydir', 'reverse')
title_text = sprintf('Jacobi iteration number for unsteady state = %d', jacobi_iter_value);
title(title_text)
xlabel('X axis')
ylabel('Y axis')
end
fprintf(' Number of Iterations for Explicit Jacobi for Transient method = %d', jacobi_iter_value)
Graph:
Conclusion:
Type of scheme | Methods used | No. of Iterations |
Implicit Steady State |
1. Jacobi
2. Gauss Seidel
3. SOR |
1. 217
2. 117
3. 78 |
Implicit Transient State |
1. Jacobi
2. Gauss Seidel
3. SOR |
1. 3666
2. 3117
3. 2791 |
Explicit Transient State | 1. Jacobi | 1. 1833 |
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 : Discretization of 3D intake manifold using GEM-3D
Aim: Discretization of 3D intake manifold using GEM-3D Objective: 1. Tutorial- single cyl DI add case 2 with discretization length 0.1 mm for intake runner and compare with default case 1 Parameters-Torque, BSFC, max cylinder pressure simulation time 2. Explore tutorial no 2 (GEM3D) - “Building intake…
31 Aug 2022 05:57 AM IST
Week-7 : Converting a detailed engine model to a FRM model
Aim: Converting a detailed engine model to an FRM model. Objective: Explore tutorial number 9 and write a detailed report. Build FRM Model for the following configuration using the FRM builder approach. Bore 102 mm stroke 115 mm CR 17 No of cylinder 6 CI engine Twin Scroll Turbine GT Controller Run all cases…
30 Aug 2022 02:54 AM IST
Week-6 : Turbocharger Modelling
Aim: Turbocharger Modelling using GT POWER Objective: List down different TC and locate examples from GT Power Explore tutorial number 6 and 7 Plot operating points on compressor and turbine maps In which application Variable Geometry Turbine is beneficial? Explore example- Diesel VGT EGR and understand the modeling…
22 Aug 2022 10:30 AM IST
Week-4 : Basic Calibration of Single cylinder CI-Engine
Aim: Basic Calibration of Single cylinder CI-Engine Objective: 1. Compare SI vs CI and list down differences (assignment no 2-SI) 2. Comments on the following parameters BSFC Exhaust Temperature A/F ratios 3. Change MFB 50 and observe the impact on performance Comparison: SI vs CI S.No./Engine type …
15 Aug 2022 03:48 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.