CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   ldumatrix (https://www.cfd-online.com/Forums/openfoam-programming-development/67452-ldumatrix.html)

zaratustra August 15, 2009 04:35

ldumatrix
 
Hi folks,

i've got my own Algebraic Multigrid solver and try to use it as a solver in openFoam. Therefore i adapted the interface of GAMG, at least tried it. I'm new to OpenFoam and its very hard for me to understand the at most undocumented code. So my first question, to avoid a "RTFM"-answer

1) Is there somewhere a hidden (to me) Source-Code documentation?

I found the doxygen docu, but without comments in the code, it isnt very helpful. In fact I dont understand the most simplest issues:

2) What is the ldumatrix storage-format?

Ok, I found 3 arrays containing the data for the diagonal, the upper triangular und lower triangular part of the matrix. in addition there are 2 addressing arrays. More Precise:

2)' How does the LDU-Adressing work?

I browsed the source code for several hours, but i dont get it. I'm using a Compressed Row-Format for my matrices; but things are strange here. For example in the ldumatrix class something about "faces", "nodes" etc. is said; is the class strictly dependend on some geometry information? A mesh? I hope thats not true...

Please help me; i'm not really motivated to invest lots of more time in such a simple problem; for example building a demo-laplace-problem on a regular grid, to generate a matrix, from which i know, how it looks like...

Best regards ;-),
Markus

henrik August 15, 2009 08:28

Dear Marcus,

the key to understand OpenFOAM's addressing and linear solvers is understanding "face addressing".

There is no documentation apart from what's in the source code and a few threads on this forum. But I think it provides a good starting point.

http://www.cfd-online.com/Forums/ope...fficients.html
http://www.cfd-online.com/Forums/ope...ddressing.html
http://www.cfd-online.com/Forums/ope...m-solvers.html

Happy foaming,

Henrik

zaratustra August 17, 2009 04:27

Thanks!
 
Hallo Henrik!

Thanks for your reply. I read the Threads you mentioned, and i think, the information i needed is very simple. So, to be sure, i quickly write, what i found out.

A ldumatrix consists of
1) diag() -> Array of diag elements
2) lower() -> Array of lower-triangular elements
3) upper() -> --------upper-------------------
4) lowerAddr(), upperAddr() -> Coefficient position for off-diag entries.

All off-diag in the upper-triagonal matrix are numbered, say from 1 to n.
Now holds:

i = lowerAddr()[k] -> Row of k'th off-diag-entry in upper-triagonal
j = upperAddr()[k] -> Columns of k'th off-diag-entry in upper triagonal
a_ij = upper()[k]
a_ji = lower()[k]

It holds: lowerAddr()[k] < upperAddr()[k] ; maybe that explains the names "lowerAddr, upperAddr".

Because in fact the addressing is only stored for one half of the matrix, this storage format seems perfectly fitted to symmetric matrices. In this case upper() == lower() holds.
Considering a non-symmetric matrix, this format generates overhead, because an explicit "0" is stored for each a_ij, for which a_ji <> 0, and the other way round.

In Addition the matrix storage seems to have a corresondence for the mesh numbering and the other way round, so matrix addressing can be obtained from the mesh(addressing). But that seems irrelevant for purely algebraic purposes.

Is this right?

Thanks again,
Markus

henrik August 17, 2009 08:40

Hallo Markus,

yes, all correct! Also note that the mesh is stored such that face k is the face between the cells i and j.

@overhead: Correct, but in reality there is negligible overhead because most schemes add to a_ij and a_ji. In fact, only the matrix for pure upwind convection without any diffusion will have overhead.

There are other pieces of addressing in lduAddressing. For example losortAddr() for sweeps going from row n to row 0 as well as ownerStartAddr() and losortStartAddr() for individual row/column access.

Best Regards,

Henrik

augusto_bassan August 19, 2009 21:59

Convection Heat Transfer
 
hi someone have or know where I can found the solution manual of book Convection Heat Transfer, third edition of author Adrian Bejan, because I need very much in my pos- graduate , thanks.
my e mail is augusto_bassan@yahoo.com.br

augusto_bassan August 19, 2009 22:01

Quote:

Originally Posted by henrik (Post 226569)
Hallo Markus,

yes, all correct! Also note that the mesh is stored such that face k is the face between the cells i and j.

@overhead: Correct, but in reality there is negligible overhead because most schemes add to a_ij and a_ji. In fact, only the matrix for pure upwind convection without any diffusion will have overhead.

There are other pieces of addressing in lduAddressing. For example losortAddr() for sweeps going from row n to row 0 as well as ownerStartAddr() and losortStartAddr() for individual row/column access.

Best Regards,

Henrik

hi someone have or know where I can found the solution manual of book Convection Heat Transfer, third edition of author Adrian Bejan, because I need very much in my pos- graduate , thanks.
my e mail is augusto_bassan@yahoo.com.br

zaratustra August 20, 2009 05:48

ownerstartaddr....
 
Hi Henrik again,

thanks for your reply.

>>>
losortAddr() for sweeps going from row n to row 0 as well as ownerStartAddr() and losortStartAddr() for individual row/column access.
<<<

I tried, but i couldnt figure out, what you exactly mean by this, but i think/hope thats exactly what i need.
I generated an ownerstartlist for an example matrix by hand using the algorithm in the doxygen docu, but i couldnt interpret the result. Similar the losortAddr / losortStartAddr().

Do you have an idea?

Greetings,
Markus


All times are GMT -4. The time now is 14:21.