CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Inversion of large sparse linear systems (http://www.cfd-online.com/Forums/main/77467-inversion-large-sparse-linear-systems.html)

pankos June 23, 2010 14:34

Inversion of large sparse linear systems
 
Can anyone tell me some libraries for C languange which inverts large sparse linear systems? It would be better if its install is for linux systems (gcc compiler).

DoHander June 23, 2010 16:55

GSL - GNU Scientific Library
Cblas
Clapack

and so on ... any Linux distribution should have the above.

Do

jed June 23, 2010 18:13

These suggestions are worthless for sparse systems. I recommend PETSc (http://mcs.anl.gov/petsc), it runs everywhere (Linux, Mac, Windows, exotic Unix, and even iPhone ;-)), scales to very large problems (5*10^11 unknowns, ~300k processors), and perhaps most importantly, is easy to extend with custom (physics-specific) solver components, or by composing existing components (including many third-party libraries) at runtime.

pankos June 24, 2010 02:03

OK. Thanks. I have installed PETCs library but i havent concerned it still. Yesterday, i try to use SuperLU library but cant invert matrices (only solve systems). In my problem use the same right large matrix more times. Therefore its not efficient to solve a system at each time. Of course, if i use iterative procedure maybe is ok.

jed June 24, 2010 06:24

You never want the inverse
 
Maybe you misunderstand the process of "solving". You don't want the inverse because it's dense and numerically unstable. Instead, you factor the matrix, and then solve with sparse triangular factors. This requires far fewer operations than actually creating the inverse, and the triangular solves are also much faster than multiplying by the inverse (roughly O(n \log n) in 2D or O(n^{4/3}) in 3D vs. O(n^2), time and space). If you use PETSc, you just call KSPSolve() repeatedly (without updating the matrices), this will reuse the factorization that was computed on the first solve. A standard direct solver would be obtained with
Code:

-ksp_type preonly -pc_type lu -pc_factor_mat_solver_package superlu
(or mumps or umfpack, which are likely faster). Note that larger problems, especially in 3D, may be better suited to iterative methods (domain decomposition or multigrid), even if you need to solve many times.


All times are GMT -4. The time now is 03:44.