Challenge

Week 5.1 - Mid term project - Solving the steady and unsteady 2D heat conduction problem

SOLVING THE STEADY AND UNSTEADY 2D HEAT CONDUCTION PROBLEM:

2D STEADY STATE EQUATION:

`(del^2T)/(delx^2)+(del^2T)/(dely^2)=0 ; nabla^2T=0`

2D TRANSIENT STATE EQUATION:

`(delT)/(delx)+alpha((del^2t)/(delx^2)+(del^2T)/(del^2y))=0 ;`

JACOBI METHOD:

Jacobi iterative method is considered as an iterative algorithm which is used for determining the solutions for the system of linear equations in numerical linear algebra, which is diagonally dominant. In this method, an approximate value is filled in for each diagonal element.

`X_i^(k+1)=1/(a_(ii))[b_i-sum_(j=1)^(i-1)a_iX_j^(k)-sum_(i=i+1)^na_(i,j)X_j^k]`

GAUSS SEIDEL METHOD:

Gauss-Seidel is considered an improvement over Gauss Jacobi Method. In this method, just like any other iterative method, an approximate solution of the given equations is assumed, and iteration is done until the desired degree of accuracy is obtained.

`X_i^(k+1)=1/(a_(ii))[b_i-sum_(j=1)^(i-1)a_iX_j^(k+1)-sum_(i=i+1)^na_(i,j)X_j^(k+1)]`

SUCCESSIVE OVER RELAXATION:

Sucessive over relaxation is a variant of the gauss seidal method for solving a linear system of equations, resulting in faster convergence.

`X_i^(k+1)=(1-omega)x_i^(k)1/(a_(ii))[b_i-sum_(j=1)^(i-1)a_iX_j^(k+1)-sum_(i=i+1)^na_(i,j)X_j^(k)]`

BOUNDARY CONDITION:

Top Boundary = 600 K

Bottom Boundary = 900 K

Left Boundary = 400 K

Right Boundary = 800 K

STEADY STATE :

MAIN PROGRAM:

%Steady State 2D Heat conduction code : d^2T/dx^2 + d^2T/dy^2 = 0
clear all
close all
clc
%inputs
nx=10;
ny=nx;

x=linspace(0,1,nx);
y=linspace(0,1,ny);

T = 300*ones(nx,ny);
alpha = 2; 
%BC
T(:,1) = 400; %Left
T(1,:) = 600; %Top
T(:,end) = 800; %Right
T(end,:) = 900; %Down
T(1,1) = (400+600)/2;
T(end,end) = (800+900)/2;
T(1,end) = (800+600)/2;
T(end,1) = (400+900)/2;

Told = T;
Tinitial = T;

k1 = 0; % alpha*dt/dx^2
k2 = 0;% alpha*dt/dy^2



iterative_solver = 3;
error=9e9;
tol = 1e-4;

% %jacobi method
if iterative_solver==1 
    jacobi_iter=0;
    while(error > tol)
  
        for i=2:nx-1
            for j=2:ny-1
        
        T_H = Told(i-1,j) + Told(i+1,j);
        T_V = Told(i,j-1) + Told(i,j+1);
        T(i,j) = 0.25*(T_H+T_V);
            end
        end
        error = max(max(abs(T-Told)));
        Told = T;
%         contourf(x,fliplr(y),T,'ShowText','ON');
%         title(sprintf('Iterations = %d',jacobi_iter));
%         pause(0.01)
%         colorbar;
%         jacobi_iter=jacobi_iter+1;
        
    end
end

if iterative_solver==2
    gs_iter=0;
    while(error>tol)
  
        for i=2:nx-1
            for j=2:ny-1
        
        T_H = T(i-1,j) + Told(i+1,j);
        T_V = T(i,j-1) + Told(i,j+1);
        T(i,j) = 0.25*(T_H+T_V);
            end
        end
        error = max(max(abs(T-Told)));
        Told = T;
        contourf(x,fliplr(y),T,'ShowText','ON');
         title(sprintf('Iterations = %d',gs_iter));
         pause(0.01)
         colorbar;
         gs_iter=gs_iter+1;
        
    end
end

if iterative_solver==3
    omega = 1.5;
    sor_iter=0;
    while(error>tol)
  
        for i=2:nx-1
            for j=2:ny-1
        
        T_H = T(i-1,j) + Told(i+1,j);
        T_V = T(i,j-1) + Told(i,j+1);
        T_GS = 0.25*(T_H+T_V);
        T(i,j) = (1-omega)*Told(i,j) + omega*T_GS;
            end
        end
        error = max(max(abs(T-Told)));
        Told = T;
        contourf(x,fliplr(y),T,'ShowText','ON');
         title(sprintf('Iterations = %d',sor_iter));
         pause(0.01)
         colorbar;
         sor_iter=sor_iter+1;
        
    end
end

`alpha`- Thermal diffusivity

k1,k2-CFL number

T_H=T_Horizontal

T_V=T_Vertical

T_GS=T_Gauss seidel

Three iterative solvers are defined to obtain convergence rate of Three method(Implicit method) such as jacobi,gauss seidel,successive over relaxation.

When error value is less than tolerance value,solution is to be converged.

OBTAINED PLOT:

JACOBI METHOD:



GAUSS SEIDEL METHOD:



SUCCESSIVE OVER RELAXATION:

METHOD ITERATION
JACOBI 206
GAUSS SEIDEL 110
SOR 27

RESULT:

By the obtained plot,SOR method takes minimum time /iteration to converge when compared to jacobi and gauss seidal method while solving heat conduction equation.

Jacobi>Gauss seidel>SOR.

Transient state takes more computational time/iteration to converge than steady state.

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.