Project

Solving Steady and Unsteady 2 Dimensional heat conduction

AIM: To solve the conduction equation using a Transient solver and a Steady state solver using Iterative techniques like Jacobi,Gauss Seidal and Successive Over Relaxation

ASSUMPTONS:

Boundary conditions for steady and transient case

1. Left:400K

2. Top:600K

3. Right:800K

4. Bottom:900K

absolute error criteria = 1e-4

Assume that the domain is a unit square.

Assume nx = ny [Number of points along the x direction is equal to the number of points along the y direction]

THEORY:

Steady state condition

The 2 Dimensional Steady State heat conduction equation is given by

Applying Central difference approximation we get

TR - Right Point TL - Left Point TT - Top Point TB - Bottom Point TP - Current Point

Also ∆x = ∆y

Simplyfing and solving

JACOBI METHOD:

Jacobi method is an iterative algorithm for determining the solutions of a strictly diagonally dominant system of linear equations. Each diagonal element is solved for, and an approximate value is plugged in. The process is then iterated until it converges

U--->Upper triangular matrix L---> Lower triangular matrix D---> Diagonal matrix

GAUSS SEIDEL (G S) METHOD:

It is also called as method of successive displacements. It is an iterative method used to solve a linear system of equations. It can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric.

With the Jacobi method, the values of Xi(k) obtained in the kth iteration remain unchanged until the entire (k+1)th iteration has been calculated. With the Gauss-Seidel method, we use the new values Xi(k+1) as soon as they are known. For example,once we have computed X1(k+1) from the first equation, its value is then used in the second equation to obtain the new X2(k+1)and so on.

SUCCESSIVE OVER RELAXATION (SOR)METHOD :

SOR is also an iterative method which can be used on Jacobi or G S method. It is the enhanced iterative solver which can be used to enhance the performance of GS or Jacobi method. The SOR is devised by applying extrapolation to the Gauss seidel method. The extrapolation tales the form of weighted average between the previous iterate and computed Gauss seidel iterate successively for each component. This method of successive over-relaxation is an iterative technique that solves the left hand side of this expression for x, using previous value for x on the right hand side.

Xinew = w*Xi +(1-w)*Xiold

Transient condition

If we are running a transient simulation we are interested in capturing the effect of time on a particular parameter.

2 Dimensional Transient heat conduction equation is given by

Applying Central difference approximation we get

If we have Time derivative term in the governing equation we can use Time Marching Solution

where

simplifying and solving further

CFL Condition

CFL condition for 2 dimensional heat equation is given as below

α---> Thermal diffusivity Δx & Δy-----> length between mesh elements Δt---> Time Step

In the transient condition case if we increase the value for dx by a factor of 2 we have to decrease the value for time step dt by a factor of 4 in order for CFL number to be small. In case of diffusion the CFL number should be less than 0.5. When we increase the number of grid points the simulation is going to slower because we are solving more equations. When we are trying to run with large number of grid points the simulation is going to run really slow not because of increase number of grid points but also because of stability criterion and decrease in time step.

1] STEADY STATE ANALYSIS USING \'JACOBI\' METHOD  

%2D steady state heat conduction equation 
clear all
close all 
clc

nx = 10;
ny = 10;
x = linspace(0,1,nx);
dx = x(2)-x(1)
y = linspace(0,1,ny);
dy = y(2)-y(1)

% Define a 2D Temperature Matrix 
T = 200*ones(nx,ny);
T(:,1) = 400; %Left 
T(:,nx) = 800; %Right
T(1,:) = 900; %Bottom 
T(ny,:) = 600; %Top 
Told = T;
k1 = 0.5*(dy^2/(dy^2+dx^2));
k2 = 0.5*(dx^2/(dy^2+dx^2));
iterative_solver = 1;
error = 100;
tol = 1e-4;

if iterative_solver == 1 
  jacobi = 1;
  while(error>tol)
  for i = 2:nx-1
  for j = 2:ny-1
  T(i,j) = k1*(Told(i-1,j) + Told(i+1,j)) + k2*(Told(i,j-1) + Told(i,j+1));
end 
end 
error = max(max(abs(Told-T)));
Told = T;
jacobi = jacobi + 1;
contourf(x,y,T)
[C,h] = contourf(x,y,T);
clabel(C,h)
colormap(jet)
colorbar;
xlabel(\'X length\')
ylabel(\'Y length\')
title_text = sprintf(\'jacobi_iteration_number = %d\', jacobi);
title(title_text);
pause(0.03)
end
end

2] STEADY STATE ANALYSIS USING \'GAUSS SEIDEL\' METHOD 


%2D steady state heat conduction equation 
clear all
close all 
clc

nx = 10;
ny = 10;
x = linspace(0,1,nx);
dx = x(2)-x(1)
y = linspace(0,1,ny);
dy = y(2)-y(1)

% Defint a 2D Temperature Matrix 
T = 200*ones(nx,ny);
T(:,1) = 400; %left 
T(:,nx) = 800; %Right
T(1,:) = 900; %Bottom
T(ny,:) = 600;  %Top 
Told = T;
k1 = 0.5*(dy^2/(dy^2+dx^2));
k2 = 0.5*(dx^2/(dy^2+dx^2));
iterative_solver = 2;
error = 100;
tol = 1e-4;

if iterative_solver == 2 
  gs = 1;
  while(error>tol)
  for i =2:nx-1
  for j = 2:ny-1
  T(i,j) = k1*(T(i-1,j) + Told(i+1,j)) + k2*(T(i,j-1) + Told(i,j+1));
end 
end 
error = max(max(abs(Told-T)));
Told = T;
gs = gs + 1;
contourf(x,y,T)
[C,h] = contourf(x,y,T);
clabel(C,h)
colormap(jet)
colorbar;
xlabel(\'X length\')
ylabel(\'Y length\')
title_text = sprintf(\'Gauss_iteration_number = %d\', gs);
title(title_text);
pause(0.02)
end
end

3] STEADY STATE ANALYSIS USING \'SUCCESSIVE OVER RELAXATION\' METHOD

%2D steady state heat conduction equation 
clear all
close all 
clc

nx = 10;
ny = 10;
x = linspace(0,1,nx);
dx = x(2)-x(1)
y = linspace(0,1,ny);
dy = y(2)-y(1)

% Defining  a 2D Temperature Matrix 
T = 200*ones(nx,ny);
T(:,1) = 400; %left 
T(:,nx) = 800; %Right
T(1,:) = 900; %Bottom
T(ny,:) = 600;  %Top 
Told = T;
k1 = 0.5*(dy^2/(dy^2+dx^2));
k2 = 0.5*(dx^2/(dy^2+dx^2));
iterative_solver = 3;
error = 100;
tol = 1e-4;

if iterative_solver == 3 
  SOR = 1;
  while(error>tol)
  for i =2:nx-1
  for j = 2:ny-1
  Tgauss(i,j) = k1*(T(i-1,j) + Told(i+1,j)) + k2*(T(i,j-1) + Told(i,j+1));
  T(i,j) = (1-w)*Told(i,j)+ w*Tgauss(i,j)
end 
end 
error = max(max(abs(Told-T)));
Told = T;
SOR = SOR + 1;
contourf(x,y,T)
[C,h] = contourf(x,y,T);
clabel(C,h)
colormap(jet)
colorbar;
xlabel(\'X length\')
ylabel(\'Y length\')
title_text = sprintf(\'SOR_iteration_number = %d\', SOR);
title(title_text);
pause(0.02)
end
end

4] TRANSIENT ANALYSIS USING EXPLICIT CONDITION 

%2D Transient heat conduction equation 
clear all
close all 
clc

nx = 20;
ny = 20;
x = linspace(0,1,nx);
dx = x(2)-x(1)
y = linspace(0,1,ny);
dy = y(2)-y(1)

% Define a 2D Temperature Matrix 
T = 200*ones(nx,ny);
T(:,1) = 400; %Left 
T(:,nx) = 800; %Right
T(1,:) = 900; %Bottom 
T(ny,:) = 600; %Top 
Told = T;

alpha = 1.25;
t = 0.1;
dt = 5e-4;
nt = t/dt;
k1 = (alpha*dt)/dx^2;
k2 = (alpha*dt)/dy^2;

error = 100;
tol =  1e-4;
time = 0;


for k = 1:nt
for i =2:nx-1
  for j = 2:ny-1
T(i,j) = (1-2*k1-2*k2)*Told(i,j)+k1*(Told(i+1,j)+Told(i-1,j))+k2*(Told(i,j-1)+Told(i,j+1));
end 
end 
time = time +dt ;
Told = T;
contourf(x,y,T)
[C,h] = contourf(x,y,T);
clabel(C,h)
colormap(jet)
colorbar;
xlabel(\'X length\')
ylabel(\'Y length\')
title_text = sprintf(\'total_time = %d\', time );
title(title_text);
pause(0.03)
end

Analysis of Steady state using \'Jacobi\' method

Analysis of Steady state using \'Gauss Siedel\' method

Analysis of Steady state using \' Successive Over Relaxation\' method

OBSERVATIONS: Number of interation by \'Jacobi\' method = 211, Number of interation by \'Gauss Siedel\' method = 113 Number of interation by \'SOR\' method = 61

CONCLUSION: The number of iterations for Jacobi method >>> Gauss Siedel method >>> SOR method

The time of convergence for SOR method is very less when compared to other 2 methods. This is mainly because of the w, \"Scaling factor\"

‘w’>>1 then the solver is aggressive and is called as Over relax

‘w’<<1 then he solver is less aggressive and is called as Under relax.

In this Steady state case by SOR method the value of \'w\' is assumed to be equal to 1.3 and we are getting 61 iterations. As the value of \'w\' increases the the number of iterations decreases ,at some point reaches the saturation value and again the number of iterations starts to increase as the \'w\' becomes higher and higher.

Analysis of Transient state using Explicit condition

OBSERVATIONS:

For analysis of Transient state we have considered 20 grid points. The simulation was made to run for 0.1 seconds. The value of Time step is assumed to 5e-4

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.