CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Help--Matrix Too Large (https://www.cfd-online.com/Forums/main/2762-help-matrix-too-large.html)

Paul Safier November 6, 2000 19:31

Help--Matrix Too Large
 
Hello,

My problem is that the finite element code I am using generates a very large matrix. I don't have the computer memory to store it. The matrix is, however, very sparse. I want to store only the non-zero elements, but I can't identify a specific form. Can anyone suggest a way to identify, then store the non-zero elements and ulimately invert this matrix?

Any suggestions would be appreciated...

Thank you. Paul Safier

Tareq Al-shaalan November 6, 2000 23:59

Re: Help--Matrix Too Large
 
You can use Conjecate Gradient methods

Nishikawa November 7, 2000 01:48

Re: Help--Matrix Too Large
 
If the matrix has a certain pattern, I think you can save your memory.

For example, if it is tridiagonal such as three elements in a row. Use three one-dimensional arrays, or nx3 matrix for which you can find a relation between the old and new indeces easily.

Sebastien Perron November 7, 2000 08:25

Re: Help--Matrix Too Large
 
If the mesh in not structured there will be no pattern. For such a case you will have to construct the following structures

1) a Vector ( or a vector of vectors) where the non-zero entries of the matrix will be store (type real)

2) a Vector ( or a vector of vectors) where the "pointers" (integer) will be store. These pointers will indicate what are the correspondance for your sparce matrix.

3) a Vector which contains the number of entries for each elements As an exemple: nb=[2,4,3,2]

A=[[4., 7.],[5.,8.,8.,9.],[1.,4.,6.],[3.,6]]

LI=[[1,4],[1,2,3,4],[1,2,3],[3,4]]

This will take far less storage. But, in the other hand, you will have to construct a routine to perform the matrix*vector product.

There is no easy way. But this is fearly easy in C++ or C.

kalyan November 7, 2000 12:18

Re: Help--Matrix Too Large
 
There are many ways to store a large sparse matrix. The easiest is perhaps the triad format.

You can find details on this at netlib.org. This is a link to a source code that uses sparse Gaussian elimination for solving a linear system.

www.netlib.org/toms/533

The storage of the large sparse matrix is explained here. Once you put your matrix in this format, in addition to the Gaussian elimination, you can try various methods like CG, CGS, GMRES etc. with relative ease since source codes for these methods are available in the netlib repository.

More efficient ways of storing would require either pointers and/or structured meshes with standard discretization stencils.


All times are GMT -4. The time now is 16:54.