Steady state heat equation:-((∂^2 T)/(∂x^2 )+(∂^2 T)/(∂y^2 )=-Q(x,y)

In summary, the conversation is about solving the heat equation using Finite Difference Method in MATLAB. The program successfully works but takes a long time when the number of points is increased. The user is looking for help in increasing the speed of the program. The provided code includes the main matrix and right hand side matrix, as well as boundary conditions and plotting options. The conversation also includes a discussion on the purpose and functionality of the program.
  • #1
range.rover
16
0
Hi friends i am trying to solve heat equation for a single time domain,with Finite Difference Method. I wrote a program in MATLAB,it sucessfully worked, but as i increse the number of points, my program is taking lots of time to give out result.

Can anybody help me in increasing the speed of my Program:-clear;
close all;
clc;
n = 5;% n grids and has n - 2 interior points per dimension

x = linspace(0,1,n);% line in x direction of 0 to 1 and divided into n parts

dx = x(2)-x(1); % distance between grids

y = x;

dy = dx;

k=1; %thermal conductivity

Q=300 ; % heat source
m=(n-2)^2;

%Right hand side matrix

B=zeros(m,1);

if (mod(m,2)==0)
B(m/2,1)=Q;
else
B((m+1)/2,1)=Q;
end

%Main Matrix

Tsol = zeros(n);
%boundry conditions
Tsol(1,1:n) = 0; %TOP
Tsol(n,1:n) = 0; %BOTTOM
Tsol(1:n,1) = 0; %LEFT
Tsol(1:n,n) = 0; %RIGHT

tic
error = 1; z = 0;
while error > 0.000001
z = z+1;
c=1;
Torg = Tsol;
for i = 2:n-1
for j = 2:n-1
Tsol(i,j) =abs(((dx^2*B(c,1))+((Torg(i+1,j)+Torg(i-1,j)+Torg(i,j+1)+Torg(i,j-1))*k))/(4*k));
c=c+1;
end
end

error = max(max(abs(Torg-Tsol)));
endtoc

%% plotting

figure, contour(x,y,Tsol),
title('Temperature (Steady State)'),xlabel('x'),ylabel('y'),colorbar
figure,pcolor(x,y,Tsol),shading interp,
title('Temperature (Steady State)'),xlabel('x'),ylabel('y'),colorbar
 
Physics news on Phys.org
  • #2
I'm sorry you are not generating any responses at the moment. Is there any additional information you can share with us? Any new findings?
 
  • #3
Are you sure it even works at it stands now? What I think you might be trying to do is to solve the heat equation with a source term in the middle of a 2d system and with zero dirichlet boundary condition. Is that correct? Because that is not what I see when I change n.
 

What is the steady state heat equation?

The steady state heat equation is a mathematical equation that describes the distribution of heat in a given system over time. It is used to model the flow of heat in a stationary system, where the temperature at any point does not change with time.

What does the equation (∂^2 T)/(∂x^2 )+(∂^2 T)/(∂y^2 )=-Q(x,y) represent?

The equation represents the balance of heat flow in two dimensions. The first term, (∂^2 T)/(∂x^2 ), represents the change in temperature with respect to the x-axis, while the second term, (∂^2 T)/(∂y^2 ), represents the change in temperature with respect to the y-axis. The third term, -Q(x,y), represents the heat sources or sinks in the system at any given point.

What are the units of the variables in the steady state heat equation?

The units of temperature, T, in the equation are typically in degrees Celsius (°C) or Kelvin (K). The units of the heat source, Q, depend on the specific application, but can be in units of watts (W) or Joules per second (J/s).

What are some real-world applications of the steady state heat equation?

The steady state heat equation has many applications in various fields, including engineering, physics, and chemistry. It can be used to model heat transfer in buildings, electronic devices, and chemical reactions. It is also used in the study of weather patterns and climate change.

What are the boundary conditions for the steady state heat equation?

The boundary conditions for the steady state heat equation refer to the specific conditions at the edges or boundaries of the system. These conditions can include the temperature at the boundaries, the rate of heat transfer at the boundaries, and any heat sources or sinks present at the boundaries. These conditions are necessary to solve the equation and obtain a unique solution.

Similar threads

Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
132
  • Differential Equations
Replies
1
Views
2K
  • Differential Equations
Replies
2
Views
2K
Replies
1
Views
1K
Replies
6
Views
1K
  • Differential Equations
Replies
3
Views
1K
  • Differential Equations
Replies
11
Views
2K
Replies
39
Views
490
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
Back
Top