Poisson equation with finite difference method

In summary, if the mesh size is reduced to a small enough value, the temperatures should approach final constant values.
  • #1
range.rover
16
0
Hi guys , i am solving this equation by Finite difference method.
(dt2/dx2 + dt2/dy2 )= -Q(x,y)
i have developed a program on this to calculate the maximum temperature, when i change the mesh size the maximum temperature is also changing,

Should the maximum temperature change with mesh size (or) it should be constant ?

an anybody help me out on this...please
 
Physics news on Phys.org
  • #2
range.rover said:
Hi guys , i am solving this equation by Finite difference method.
(dt2/dx2 + dt2/dy2 )= -Q(x,y)
i have developed a program on this to calculate the maximum temperature, when i change the mesh size the maximum temperature is also changing,

Should the maximum temperature change with mesh size (or) it should be constant ?

an anybody help me out on this...please
When the mesh size is reduced to a small enough value, the temperatures should approach final constant values. Show us your finite difference equation.

Chet
 
  • #3
Thanx for your reply Chestermiller,
B(i,j) is the right hand side matrix,
I just applied central defference to the equation and took out the value of point(i,j)

Tnew(i,j) = ((T((i+1,j) +T(i-1,j) +T(i,j+1)+T(i,j-1) )*k)+(B(i,j)*〖dx〗^2)))/(4*k)
 
  • #4
range.rover said:
Thanx for your reply Chestermiller,
B(i,j) is the right hand side matrix,
I just applied central defference to the equation and took out the value of point(i,j)

Tnew(i,j) = ((T((i+1,j) +T(i-1,j) +T(i,j+1)+T(i,j-1) )*k)+(B(i,j)*〖dx〗^2)))/(4*k)
The term in parenthesis involving the T's should also be divide by 4k.

Chet
 
  • #5
yes, you are true the whole term is divided by 4k
my above equation is like

T = (((a+b+c+d)*k)+(B(i,j)*dx^2))/(4*k)

a = T((i+1,j)
b =T(i-1,j)
c =T(i,j+1)
d =T(i,j-1)
B(i,j) is right hand side where dx is space between the nodes.
 
  • #6
range.rover said:
yes, you are true the whole term is divided by 4k
my above equation is like

T = (((a+b+c+d)*k)+(B(i,j)*dx^2))/(4*k)

a = T((i+1,j)
b =T(i-1,j)
c =T(i,j+1)
d =T(i,j-1)
B(i,j) is right hand side where dx is space between the nodes.
Yes, better. Does this resolve your problem now?

Chet
 
  • #7
NO it has'nt solved my problem. if you can be kind enough i am posting my code have a look at it%%%%%% STRICTLY ONLY FOR ODD NUMBERS %%%%%%%%%

clear all
close all
clc
n = 153;% 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=8000 ; % 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

%Initialize a heat source matrix
A = zeros(n);
A(2:n-1,2:n-1) = reshape(B,n-2,n-2);
A = (dx^2*A)/(4*k);

Tsol = A;
%boundary 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;
i = 2:n-1;
j = 2:n-1;

while error > 0.000001
z = z+1;
Torg = Tsol;
Tsol(i,j) = abs(((Torg(i+1,j)+Torg(i-1,j)+Torg(i,j+1)+Torg(i,j-1))*k))/(4*k);
Tsol = Tsol + A;
error = max(max(abs(Torg-Tsol)));
end
toc
figure,surf(x,y,Tsol),
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
 
  • #8
Hi Range.Rover,

I looked over your code briefly, and it looks like you have the right idea. But I'm not going to debug your code for you. That's up to you. I would suggest that you start out by putting lots of print statements into the code, and seeing what the different variables are doing. You can also go through the calculation by hand, according to what the code dictates.

What is the symptom of your issue? Is the maximum temperature changing as you change n? If you plot the maximum temperature from successive solutions as a function of 1/n2, the plot should approach a straight line, and the true maximum temperature should be the intercept at 1/n2 approaching zero.

Chet
 

1. What is the Poisson equation and how is it used in finite difference method?

The Poisson equation is a partial differential equation used to describe the relationship between a scalar function and its sources or sinks. In the context of finite difference method, it is used to discretize the continuous form of the equation into a set of algebraic equations that can be solved numerically.

2. What is the finite difference method and why is it important in solving the Poisson equation?

The finite difference method is a numerical technique for solving partial differential equations. It involves dividing the continuous domain into a discrete grid and approximating the derivatives of the function using finite difference approximations. This method is important in solving the Poisson equation as it allows for the efficient and accurate solution of the equation in complex geometries.

3. What are the key steps involved in solving the Poisson equation using finite difference method?

The key steps involved in solving the Poisson equation using finite difference method are:

  • Creating a discrete grid over the domain of the problem
  • Approximating the derivatives of the function using finite difference approximations
  • Discretizing the Poisson equation into a set of algebraic equations
  • Solving the resulting system of equations using iterative methods
  • Interpolating the solution back to the continuous domain for visualization and analysis

4. What are the advantages of using finite difference method to solve the Poisson equation?

Some advantages of using finite difference method to solve the Poisson equation are:

  • It can handle complex geometries and boundary conditions
  • It is relatively easy to implement and computationally efficient
  • It allows for the solution of non-linear problems
  • The accuracy of the solution can be improved by refining the grid
  • It can be extended to solve higher-order partial differential equations

5. Are there any limitations or drawbacks of using finite difference method for solving the Poisson equation?

Some limitations or drawbacks of using finite difference method for solving the Poisson equation are:

  • It can be computationally expensive for problems with fine grids or high dimensions
  • It may not accurately capture sharp gradients or discontinuities in the solution
  • It may not be suitable for problems with irregular geometries or complex boundary conditions
  • The convergence of the solution may be slow for certain types of problems
  • It may require careful consideration of numerical stability and accuracy issues

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
Replies
4
Views
748
  • Engineering and Comp Sci Homework Help
Replies
7
Views
705
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
Replies
6
Views
3K
Replies
3
Views
799
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
Replies
1
Views
952
Back
Top