CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Gauss Seidell Method (https://www.cfd-online.com/Forums/main/63788-gauss-seidell-method.html)

student_58 April 20, 2009 04:00

Gauss Seidell Method
 
Hi everyone;
I have a problem which will be solved by gauss seidel iterative method.My problem is poisson equation. I attain the main formula of my problem and make necesary arrangements.I will solve this problem with Matlab.
I have x,y,k direction.K is the iteration, x and y are displacements.I have a tolerans for the distaction of previous and present iteration.I have to continue iteration until necassary tolerance attain.When ı want to program this, How should I follow a program algorithm?
Because ı propogate both x and y direction and also k.
İf ı had only x and y direction, ı would make two "for cycle"(for j=2:N and for i=2:M)(like 2D parabolic crank nicholson)

neazen April 20, 2009 10:26

Hi,

Your post is not very clear but I think that I got your point.

Gauss-Seidel is a solver for linear system of equations Ax = F, so the appropriate procedure is the following:

Whatever is the approach you're adopting (finite difference, finite elements,...) the first step is to discretise your equation, the result being a set of discrete equations (one for each unknown node of your mesh). These equations are written in a matrix form, i.e. in A, and you are supposed to have also a vector F containing the right hand side. This must be done independently of the linear solver you're going to use.

The next step is to call your Gauss-Seidel function, or any other, such that its arguments will be the matrix A, and the vectors F and x.

Hope it's enough clear ;)

student_58 April 20, 2009 14:10

Quote:

Originally Posted by neazen (Post 213527)
Hi,

Your post is not very clear but I think that I got your point.

Gauss-Seidel is a solver for linear system of equations Ax = F, so the appropriate procedure is the following:

Whatever is the approach you're adopting (finite difference, finite elements,...) the first step is to discretise your equation, the result being a set of discrete equations (one for each unknown node of your mesh). These equations are written in a matrix form, i.e. in A, and you are supposed to have also a vector F containing the right hand side. This must be done independently of the linear solver you're going to use.

The next step is to call your Gauss-Seidel function, or any other, such that its arguments will be the matrix A, and the vectors F and x.

Hope it's enough clear ;)

Yes you are right.Gauss seidel is a solver for linear system of equations.
and I know that we have matrice form.(A.x=b)
My question was how ı can solve poisson equation by gauss seidel method.I will use MATLAB for solution.You told me gauss seidel matrice structure.But I know this.I wanted to tell how ı can solve poisson equation by Matlab,using gauss seidel method.

neazen April 20, 2009 14:53

I guess that you'll have to write your own function, there's many ressources on the web explaining the algorithm.
Or simply use this one :
http://matlabdb.mathematik.uni-stutt...ID=3&MP_ID=406

Now my advice, knowing the sparsity of Poisson equation matrix, is to use the conjuguate gradient method, specially if you're concerned by the time and the accuracy and if your matrix size is "large" :)

Hope I wasn't again way of the mark :o

student_58 April 20, 2009 17:01

Thank you for your interest...I know this link.
I will have been struggling for programming all weekend.:)

mr_fluent April 20, 2009 21:32

Quote:

Originally Posted by student_58 (Post 213545)
Yes you are right.Gauss seidel is a solver for linear system of equations.
and I know that we have matrice form.(A.x=b)
My question was how ı can solve poisson equation by gauss seidel method.I will use MATLAB for solution.You told me gauss seidel matrice structure.But I know this.I wanted to tell how ı can solve poisson equation by Matlab,using gauss seidel method.


since you know that
1. gauss seidel is for solving matrices of form AX = src
and
2. you want to solve poisson equation by it

I conclude by common sense that i need to represent Poisson equation in the form AX = src.

From you post it is not clear whether you are asking - how to represent poisson equation in form AX = src or are you asking how to solve AX = src by Gauss-Seidel method.

If you asked 1 that is how to represent poisson in form AX=src then you got to spend time with book talking about it.
If you asked how to solve by Gauss- Seidel then I hope you looked at wiki at cfd-online. Because for me no point in writing what is already written.

Good luck.

student_58 April 21, 2009 13:14

1 Attachment(s)
I will use numerical difference for poisson equation.I will write taylor central difference formula instead of second derivatives.I will program this in Matlab.We have five unknowns gauss seidel for poisson equation.So ı can`t use thomas algorihm.Therefor ı will use iterative method.

[IMG]file:///C:/DOCUME%7E1/Kalp_Ev/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG]


All times are GMT -4. The time now is 23:10.