## 2D Heat Conduction

This Problem is solved in two steps:

1.Steady State Conduction through Explicit Method:

2.UnSteady State Conduction through Explicit and Implicit Method:

Energy Equation in 2D state is given  by:

(delT)/(delt)+(del(uT))/(delx)+(del(vT))/(dely)=alpha((del^2T)/(delx^2)+(del^2T)/(dely^2))+q

Where First term on the Left side indicates Unsteady term or Time Derivative.

Second term on the left side indicates Convective Term.

where as first term on the right side indicates Diffussion Term

Second term on the Rigth side indicates Source Term.

For Solving 2D heat Conduction:

Above Equation Reduces to

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

Using Finite Difference Method discretizing the above equation we get:

1.Steady State Conduction through Explicit Method:

Code for the Steady State Heat Conduction using Explicit Method is given as:

%Steady State Heat Conduction using Explicit method
close all
clc

%inputs
l=input('Enter the length of the domain: ');
b=input('Enter the Width of the domain: ');

nx=input('Enter the Number of nodes in x direction: ');
ny=input('Enter the number of nodes in y direction: ');

solver=input('Enter the Number for the solver method: \n Gauss Jacobi= 1 \n Gauss seidel= 2  \n SOR= 3 \n Your Choice of the Solver: ');

%specifying the grid
x=linspace(0,l,nx);
y=linspace(0,b,ny);

dx=x(2)-x(1);
dy=y(2)-y(1);

omega=1.25;
%Initialisation
T=298*ones(nx,ny);
Told=T;

error=9e9;
tol=1e-5;

%Boundary Conditions

T(:,1)=400;
T(:,end)=800;
T(end,:)=600;
T(1,:)=900;

%EdgeRefinement
T(1,1)=(900+400)/2;
T(1,end)=(900+800)/2;
T(end,1)=(400+600)/2;
T(end,end)=(800+600)/2;

%defining Constants
k=(2/dx^2)+(2/dy^2);

[xx,yy]=meshgrid(x,y);

%Jacobi Method

if (solver==1)

tic

counter_1=1;

while(error > tol)
for i=2:nx-1
for j=2:ny-1

Term(1)=(Told(i-1,j)+Told(i+1,j))/(k*dx^2);
Term(2)=(Told(i,j+1)+Told(i,j-1))/(k*dy^2);
T(i,j)=Term(1)+Term(2);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_1=counter_1+1;
end
timecounter_1=toc;
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
figure(1)
title(sprintf('2d Steady State Heat Conduction \n Method:Jacobi Explicit \n No of iterations=%d \n Time: %f s',counter_1,timecounter_1));
end

%Gauss Seidel Method
if (solver==2)
tic
counter=1;
while(error > tol)
for i=2:nx-1
for j=2:ny-1

Term(1)=(T(i-1,j)+T(i+1,j))/(k*dx^2);
Term(2)=(T(i,j+1)+T(i,j-1))/(k*dy^2);
T(i,j)=Term(1)+Term(2);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter=counter+1;
end
timecounter=toc;
figure(1)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Steady State Heat Conduction \n Method:Gauss Seidel Explicit \n No of iterations= %d \n Time: %f s',counter,timecounter));
end

%Successive Over Relaxation method
if (solver==3)
tic
counter_2=1;
while(error > tol)
for i=2:nx-1
for j=2:ny-1

Term(1)=(T(i-1,j)+T(i+1,j));
Term(2)=(T(i,j+1)+T(i,j-1));
T(i,j)=(1-omega)*Told(i,j)+(omega/4)*(Term(1)+Term(2));

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_2=counter_2+1;
end
timecounter_2=toc;
figure(1)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Steady State Heat Conduction \n Method:Successive Over Relaxation Explicit \n No of iterations= %d \n Time: %f s',counter_2,timecounter_2));
end


Plot for Jacobi Method:

Inputs:

Output:

Plot for Gauss Seidel Method:

Inputs:

Output:

Plot for Successive Over Relaxation Method:

Inputs:

Output:

2.Unsteady State Conduction through Explicit and Implicit Method:

A.Explicit Method:

Code for the UnSteady State Heat Conduction using Explicit Method is given as:

%Unsteady State Heat Conduction using Explicit method
close all
clc

%inputs
l=input('Enter the length of the domain: ');
b=input('Enter the Width of the domain: ');

nx=input('Enter the Number of nodes in x direction: ');
ny=input('Enter the number of nodes in y direction: ');

t=input('Enter the Time: ');

solver=input('Enter the Number for the Solver method: \n Gauss Jacobi= 1 \n Gauss seidel= 2  \n SOR= 3 \n Your Choice of the Solver: ');

%specifying the grid
x=linspace(0,l,nx);
y=linspace(0,b,ny);

dx=x(2)-x(1);
dy=y(2)-y(1);

%Initialisation
T=298*ones(nx,ny);
Told=T;

error=9e9;
tol=1e-5;

%Boundary Conditions

T(:,1)=400;
T(:,end)=800;
T(end,:)=600;
T(1,:)=900;

%EdgeRefinement
T(1,1)=(900+400)/2;
T(1,end)=(900+800)/2;
T(end,1)=(400+600)/2;
T(end,end)=(800+600)/2;

%Input for time step
dt=0.01;
alpha=1e-4;
k1=(alpha*dt)/dx^2;
k2=(alpha*dt)/dy^2;
tic;
[xx,yy]=meshgrid(x,y);
nt=t/dt;

c=alpha*dt*((1/dx^2)+(1/dy^2));

%Jacobi Method
if (solver==1)
tic;
counter_1=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Told(i,j);
Term(2)=k1*(Told(i-1,j)-2*Told(i,j)+Told(i+1,j));
Term(3)=k2*(Told(i,j+1)-2*Told(i,j)+Told(i,j-1));
T(i,j)=Term(1)+Term(2)+Term(3);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_1=counter_1+1;
end
end
timecounter_1=toc;
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
figure(1)
title(sprintf('2d Unsteady State heat Conduction \n Method: Jacobi Explicit \n No of iterations=%d \n Time: %f s \n CFL No: %d',counter_1,timecounter_1,c));
end

%Gauss Seidel Method

if (solver==2)
tic;
counter=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Told(i,j);
Term(2)=k1*(T(i-1,j)-2*T(i,j)+Told(i+1,j));
Term(3)=k2*(Told(i,j+1)-2*T(i,j)+T(i,j-1));
T(i,j)=Term(1)+Term(2)+Term(3);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter=counter+1;
end
end
timecounter=toc;
figure(1)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Unsteady State heat Conduction \n Method: Gauss Seidel Explicit  \n No of iterations= %d \n Time: %f s',counter,timecounter));
end

%Successive over Relaxation Method

if (solver==3)
tic
counter_2=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Told(i,j);
Term(2)=k1*(T(i-1,j)-2*T(i,j)+Told(i+1,j));
Term(3)=k2*(Told(i,j+1)-2*T(i,j)+T(i,j-1));
T(i,j)=(1-1.2)*Told(i,j)+1.2*(Term(1)+Term(2)+Term(3));

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_2=counter_2+1;
end
Tprev=T;
end
timecounter_2=toc;
figure(1)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Unsteady State heat Conduction\n Method: Successive Over Relaxation Explicit \n No of iterations= %d \n Time: %f s',counter_2,timecounter_2));
end

Plot for Jacobi Method:

Inputs:

Output:

Plot for Gauss Seidel Method:

Inputs:

Output:

Plot for Successive Over Relaxation Method:

Inputs:

Output:

B.Implicit Method:

Code for the UnSteady State Heat Conduction using Implicit Method is given as:

close all
clc

%inputs
l=input('Enter the length of the domain: ');
b=input('Enter the Width of the domain: ');

nx=input('Enter the Number of nodes in x direction: ');
ny=input('Enter the number of nodes in y direction: ');

t=input('enter the time: ');

solver=input('Enter the Number for the solver method: \n Gauss Jacobi=1 \n Gauss seidel=2  \n SOR=3 \n Your Choice of the Solver: ');

%specifying the grid
x=linspace(0,l,nx);
y=linspace(0,b,ny);

dx=x(2)-x(1);
dy=y(2)-y(1);

%Initialisation
T=298*ones(nx,ny);
Told=T;
Tprev=T;

error=9e9;
tol=1e-5;

%Boundary Conditions

T(:,1)=400;
T(:,end)=800;
T(end,:)=600;
T(1,:)=900;

%EdgeRefinement
T(1,1)=(900+400)/2;
T(1,end)=(900+800)/2;
T(end,1)=(400+600)/2;
T(end,end)=(800+600)/2;

%Input for time step
dt=0.01;
alpha=1e-4;
k1=(alpha*dt)/dx^2;
k2=(alpha*dt)/dy^2;
tic;
[xx,yy]=meshgrid(x,y);
nt=t/dt;
c=alpha*dt*((1/dx^2)+(1/dy^2));

%Jacobi Method
if (solver==1)
tic
counter_1=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Tprev(i,j);
Term(2)=k1*(Told(i-1,j)+Told(i+1,j));
Term(3)=k2*(Told(i,j+1)+Told(i,j-1));
T(i,j)=(Term(1)+Term(2)+Term(3))/(1+2*k1+2*k2);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_1=counter_1+1;
error_1=max(max(abs(Told-T)));
Tprev=T;
timecounter_1=toc;

end

end
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
figure(1)
title(sprintf('2d Unsteady State heat Conduction\n Method:Jacobi Implicit \n No of iterations=%d \n Time: %f s \n CFL No: %d',counter_1,timecounter_1,c));
end

%Gauss Seidel Method

if (solver==2)
tic
counter_2=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Tprev(i,j);
Term(2)=k1*(T(i-1,j)+T(i+1,j));
Term(3)=k2*(T(i,j+1)+T(i,j-1));
T(i,j)=(Term(1)+Term(2)+Term(3))/(1+2*k1+2*k2);

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_2=counter_2+1;
error_1=max(max(abs(Told-T)));
Tprev=T;
timecounter_2=toc;
end
end
figure(2)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Unsteady State heat Conduction\n Method:Gauss Seidel Implicit \n No of iterations=%d \n Time: %f s',counter_2,timecounter_2));
end

%succeesive Over Relaxation
if (solver==3)
tic
counter_3=1;
while(error > tol)
for k=1:nt
for i=2:nx-1
for j=2:ny-1

Term(1)=Tprev(i,j);
Term(2)=k1*(T(i-1,j)+T(i+1,j));
Term(3)=k2*(T(i,j+1)+T(i,j-1));
T(i,j)=(1-1.3)*(Tprev(i,j))+(1.3*(Term(1)+Term(2)+Term(3))/(1+2*k1+2*k2));

end
end
error=max(max(abs(Told-T)));
Told=T;
counter_3=counter_3+1;
error_1=max(max(abs(Told-T)));
Tprev=T;
timecounter_3=toc;

end

end
figure(3)
[C,h]=contourf(xx,yy,T);
colorbar
colormap(jet)
clabel(C,h);
title(sprintf('2d Unsteady State heat Conduction\n Method:sor Implicit \n No of iterations=%d \n Time: %f s',counter_3,timecounter_3));
end



Plot for Jacobi Method:

Inputs:

Output:

Plot for Gauss Seidel Method:

Inputs:

Output:

Plot for Succesive Over Relaxation Method:

Inputs:

Output:

1.From Steady State Heat Conduction, we can see that time taken by Successive Over Relaxation is less than the Jacobi and Gauss seidel method.

2.And it also takes less no of iterations to solve compare to Jacobi & Gauss Seidel method.

2.In short we can conclude that time taken for computation is Jacobi>Gauss Seidel>Successive Over Relaxation Method.

1.From transient solvers we can conclude that explicit method converges faster than implicit method.

2.In both implicit and explicit method, computation time trend follows the same way as it follows in steady state heat conduction results.

3.For the same CFL Number comparing jacobi explicit with jacobi implicit we can say that computation time as well as number of iterations performed are more.

But in a Nutshell we can conclude that Successive Over Relaxation method is the method is the best whether it is steady or unsteady state heat conduction or implicit or explicit method.

### Compact Notation Derivation for a simple Mechanism Tejas Shankhpal · 2020-03-03 19:08:46

Reaction Mechanism: CO+O2 rarr_(k_(r1))^(k_(f1)) CO2+O O + H2O rarr_(k_(r2))^(k_(f2)) OH + OH CO + OH rarr_(k_(r3))^(k_(f3)) CO2 + H H + O2 rarr_(k_(r4))^(k_(f4)) OH + O kf1 and kr1 represent the forward and backward rate coefficients respectively. The rat Read more

### Combustion Efficiency Calculation after Preheating Tejas Shankhpal · 2020-02-17 12:57:33

Objective: 1.What is the effect of preheating on the adiabatic flame temperature? Change pre-heating from 298 to 600K Explain your results. For this problem, Methane is considered as fuel and combusted with air. CH4+2(O2+3.76N2)=CO2+2H2O+7.52N2 Code for the pr Read more

### Transient simulation of flow over a throttle body Tejas Shankhpal · 2020-02-15 20:24:58

Geometery :Geometery is imported to Converge Cfd as stl input file. Simulation Time Parameters: Start Time:0 s End Time:0.01s Boundary Conditions: Inlet Pressure:150000Pa Outlet pressure: 100000Pa Elbow and Throttle Plate: Wall Type Boundary Condition(law of wa Read more

### Steady state simulation of flow over a throttle body Tejas Shankhpal · 2020-02-15 17:24:00

Geometery :Geometery is imported to Converge Cfd as stl input file. Simulation Time Parameters: Start Time:0 Cycle End Time:15000 cycles Boundary Conditions: Inlet Pressure:150000Pa Outlet pressure: 100000Pa Elbow and Throttle Plate: Wall Type Boundary Conditio Read more

### combustion in fluent Tejas Shankhpal · 2019-11-25 20:23:21

Possible types of Combustion in fluent:Computational Fluid dyanmics modelling of combustion calls upon the proper selection and implementation of model suitable to faithfully represent the complex physical and chemical phenomenon associated with any combustion process. Read more

### cyclone seperator challenge Tejas Shankhpal · 2019-11-25 19:17:52

Empirical models used for cyclone separator efficiency: 1.IOZIA AND LEITH MODEL: Iozia and Leith (1990) logistic model is a modified version of Barth (1956) model which is developed based on force balance. The model assumes that a particle carried by thevortex endur Read more

### Rayleigh taylor instability Tejas Shankhpal · 2019-11-25 17:12:25

1.Practical CFD models that have been based on the mathematical analysis of Rayleigh Taylor waves. Kelvin–Helmholtz instability: The theory predicts the onset of instability and transition to turbulent flow in fluids of different densities moving at various spe Read more

### Meshing of Cylinder using ANSA Tejas Shankhpal · 2019-11-19 10:37:37

1.Geomtery: Geometery is imported in the ANSA from open option from file menu. 2.Meshing Select PID option from the bottom part of the menu. Now Go to presentation parametres and check the checkmark on the Draw cons,mid mode, like in ENT mode. Click A Read more

### Gate Valve Parametric Study Tejas Shankhpal · 2019-11-18 15:00:55

1.Gate Valve: Gate Valve is a valve that opens up by lifting a barrier or gate out of the path of the fluid.Gate Valve requires very little space along the pipe axis and hardly restricts the fluid flow when the gate is fully opened. 2.Geometry & Material Propertie Read more

### CHT analysis on an exhaust manifold Tejas Shankhpal · 2019-11-12 21:12:47

What is Conjugate Heat Transfer? The term conjugate heat transfer is used to describe processes which involve variations of temperature within solids and fluids, due to thermal interaction between the solids and fluids. A typical example is the heating or cooling of Read more