# Gauss-Seidel iterations node spacing

I am working on an assignment where I am determining the temperature distribution of a chip on a substrate. When I decrease the nodal spacing the results change drastically. The smaller the nodal spacing the larger the temperatures i get. However when the nodal spacing is really small as in .00001m the temperature is nearly 0. Should this happen? What should i look for in the code to possibly remedy this situation? I am using MATLAB.

Ok. Guess I need to add more info. I think the best way to show my equations is to show my code. I am fairly confident about the equations used at each node. I derived them all by hand. When I use a nodal spacing, delta of 0.003 I get really low temperatures. At a delta of 0.001 I get reasonable temperatures. I think think the reason is that at 0.003 meters there are not enough node with heat generation.

    %**********************************************
%--------Thermo Lab Numerical Project---------|
%-----------------Paul Fjare------------------|
%**********************************************
clear; clc
%Cooling of a silicon chip mounted in a dielectric
%substrate.

ks=5; % W/m-K
kc=50;
ksc=(ks+kc)/2;

h=500; % W/m^2-K
qgen=10^7; %W/m^3
L=.027; % meters
H=.012;
Tamb=293.15; % temperature of coolant in Kelvin
delta=.003; % meters
N=100000; %iterations
B=h*delta/ks; %dimensionless
sectionL=L/3;
sectionH=H/4;
%Determine size of matrix
cols = round(L/delta + 1)    % Columns
rows = round(H/delta + 1)    % Rows
sectioncols=round(sectionL/delta+1)
sectionrows=round(sectionH/delta+1)

% Build beginning zeros matrix from size above
T = zeros([rows,cols]);
%T=80*ones([rows,cols]);

for i=1:N
% 4 nodes conduction no heat gen
for m = sectionrows+1:rows-1
for n = 2:cols-1
T(m,n) = 0.25 *(T(m,n+1) + T(m,n-1) + T(m+1,n) + T(m-1,n));
end
end
%upper space between the chip and walls
%left
for m=2:sectionrows
for n=2:sectioncols-1
T(m,n)=0.25 *(T(m,n+1) + T(m,n-1) + T(m+1,n) + T(m-1,n));
end
end

%right
for m=2:sectionrows
for n=2*sectioncols:cols-1
T(m,n)=0.25 *(T(m,n+1) + T(m,n-1) + T(m+1,n) + T(m-1,n));
end
end

%------chip------
%top
for n=sectioncols+1:2*sectioncols-2
T(1,n)=(T(m,n-1)+T(m,n+1)+2*T(m+1,n)+qgen*delta^2/kc+2*h*delta/kc)/(4+2*h*delta/kc);
end
%top corners
for n=sectioncols
T(1,n)=(ks*T(1,n-1)+kc*T(1,n+1)+ksc*T(2,n)+2*qgen*delta^2/4+2*h*delta*Tamb)/(ks+kc+ksc+2*h*delta);
end
for n=2*sectioncols-1
T(1,n)=(ks*T(1,n+1)+kc*T(1,n-1)+ksc*T(2,n)+2*qgen*delta^2/4+2*h*delta*Tamb)/(ks+kc+ksc+2*h*delta);
end

%bottom and bottom corners
for m=sectionrows
for n=sectioncols+1:2*sectioncols-2
T(m,n)=(ks*T(m+1,n)+ksc*(T(m,n+1)+T(m,n-1))+kc*T(m-1,n)+qgen*delta^2/2)/(ks+2*ksc+kc);
end
%bottom corners
for n=sectioncols
T(m,n)=(ks*T(m,n-1)+ks*T(m+1,n)+ksc*T(m,n+1)+ksc*T(m-1,n)+qgen*delta^2/4+h*delta*Tamb)/(ks+2*ksc+ks+delta*h);
end
for n=2*sectioncols-1
T(m,n)=(ks*T(m,n+1)+ks*T(m+1,n)+ksc*T(m,n-1)+ksc*T(m-1,n)+qgen*delta^2/4+h*delta*Tamb)/(ks+2*ksc+ks+delta*h);
end
end
if sectionrows>2
for m=2:sectionrows-1
for n=sectioncols+1:2*sectioncols-2
T(m,n) = 0.25 *(T(m,n+1) + T(m,n-1) + T(m+1,n) + T(m-1,n)+qgen*delta^2) ;
end
end
end
%chip sides
if sectionrows>2

for m=2:sectionrows-1
for n=2*sectioncols-1
T(m,n)=(ks*T(m,n+1)+ksc*(T(m+1,n)+T(m-1,n))+kc*T(m,n-1)+qgen*delta^2/2)/(ks+2*ksc+kc);
end
for n=sectioncols
T(m,n)=(ks*T(m,n-1)+ksc*(T(m+1,n)+T(m-1,n))+kc*T(m,n+1)+qgen*delta^2/2)/(ks+2*ksc+kc);
end
end
end
%------end of chip-----

%top of substrate between chip and walls
%left
for n=2:sectioncols-1
T(1,n)=(T(1,n-1)+T(1,n+1)+2*T(1+1,n)+2*h*delta/ks)/(4+2*h*delta/ks);
end
%right
for n=2*sectioncols:cols-1
T(1,n)=(T(1,n-1)+T(1,n+1)+2*T(1+1,n)+2*h*delta/ks)/(4+2*h*delta/ks);
end

%upper left corner of substrate: node 1,1
T(1,1)=(T(1,2)+T(2,1)+Tamb*B)/(2+B);
%upper right corner of substrate: node 1,cols
T(1,cols)=(T(1,cols-1)+T(2,cols)+Tamb*B)/(2+B);

%left side of substrate
for m=2:rows-1
T(m,1)=(T(m-1,1)+T(m+1,1)+2*T(m,2))/4;
end
%right side of substrate
for m=2:rows-1
T(m,cols)=(T(m-1,cols)+T(m+1,cols)+2*T(m,cols-1))/4;
end

%lower left corner: node 5,1
T(rows,1)=(T(rows-1,1)+T(rows,2))/2;
%lower right corner: node 5,10
T(rows,cols)=(T(rows-1,cols)+T(rows,cols-1))/2;

%bottom of substrate
for n=2:cols-1
T(rows,n)=(T(rows,n-1)+T(rows,n+1)+2*T(rows-1,n))/4;
end
end

T=T; %temperature distribution in Kelvin
TC=T-273.15 %temperature distribution in degrees Celsius


A picture of the physical situation is shown below.

• I guess you are using Gauss-Seidel, because it is so simple to implement. But then, you should consider using an ADI method (en.wikipedia.org/wiki/Alternating_direction_implicit_method) like Douglas-Gunn or Douglas-Rachford (web.njit.edu/~matveev/documents/adi.pdf) instead. These methods are also simple to implement, and actually quite popular for the heat conduction equation. Apr 23 '12 at 10:34
• It would really help if you could write out the PDE that you are solving, and the discretization scheme that you are using to solve it.
– Paul
Apr 23 '12 at 13:12

You might also be having problems with the problem that you are setting up. I suspect that you are modeling the temperature using Poisson's equation which might be written $-\Delta u = f$. The advantage of this form is that upon discretization, you get a positive definite system (which the Gauss-Seidel method will converge for). If you have a negative sign on the wrong side of your equation, I recommend multiplying so that you have this form. When you discretize this, you should have a $\frac{1}{h^2}$ factor and a matrix with twos on the diagonal (assuming 1D) and -1s above and below the diagonal. If you have the wrong number of $h$ factors appearing in your equation, then you might have the solution grow as $h$ decreases.