CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Questions about addressing

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By hjasak
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2005, 14:13
Default Hi All, I wanted to implem
  #1
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 17
sampaio is on a distinguished road
Hi All,

I wanted to implement a new scheme, and I was trying to understand the following structure (taken from fvmlaplacian scheme):

fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalFie ld();
fvm.negSumDiag();

How the "classical" coeficients (-1 2 -1) that multiply "u(i-1) u(i) u(i+1)" fit in these lines?

Well, I suppose the "-1" is attributed to fvm.upper() (throught the value of deltaCoeff*GammaSf), and then somehow must go to the lower() also (probably inside negSumDiag()) but I am still not very familiar with fvm.upper() addressing. Looks like you just need to say fvm.upper() = to your scalarField, as if their addressing was completely compatible.

Digging in the code, I found the negSumDiag(), which do this:

const scalarField& Lower = ((const lduMatrix&)(*this)).lower();
const scalarField& Upper = ((const lduMatrix&)(*this)).upper();
scalarField& Diag = diag();

const unallocLabelList& l = lduAddr_.lowerAddr();
const unallocLabelList& u = lduAddr_.upperAddr();

for (register label face=0; face<l.size(); face++)
{
Diag[l[face]] -= Lower[face];
Diag[u[face]] -= Upper[face];
}


I think I almost getting it, but still dont understand the addressing Diag[l[face]].

Is Diag suppose to be of the same size as l?

Or is it like if lower stands for owner of the face while upper stands for neighbour?

Is there any place where this addressing used by OpenFOAM is detailed explained?

Thanks a lot,
luiz
sampaio is offline   Reply With Quote

Old   October 28, 2005, 18:01
Default Sorry to say it, but you're a
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Sorry to say it, but you're a bit off. This kind of matrix format is sometimes called an "arrow" format. Here, the diagonal, upper and lower triangle are stored in separate arrays. It is nice and compact and saves you a lot over the CR format in the case of symmetric matrices.

There are 3 arrays:
- one for the diagonal, the size of the matrix
- one for the upper triangle, the size of the nomber of off-diag coefficients
- one for the lower triangle, see above

For the off-diagonal entries, the l and u gives you the row and column of the (off-diag) coefficient position. Additionally, for the standard FVM, the faces in the mesh are re-ordered in such a way that they directly map into the off-diag coefficiant array. In short, the l and u for each face give you the owner and neighbour cell index and all is well. Also, everything is ordered such that you visit the faces in the proper "row" order and that the face owner cell index is always lower than the neighbour (I like my life to be tidy) :-)

When you try to address the diagonal fro the off-diagonal, the row-diag will be diag[l[face]].

Please note that this is being rewritten at the moment to give more flexibility, but the basic matrix format will remain the same.

Enjoy,

Hrv
fumiya and songwukong like this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   November 1, 2005, 09:29
Default Hi Hrv, In src/OpenFOAM/matri
  #3
Member
 
Leosding
Join Date: Mar 2009
Posts: 51
Rep Power: 17
leosding is on a distinguished road
Hi Hrv,
In src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H, description:
There exists an alternative way of ..., This reduces the size of owner addressing from a list over all edges to a list over all points + 1.

I think it should be "to a list over all points - 1".
leosding is offline   Reply With Quote

Old   November 3, 2005, 05:35
Default Nope, The alternative forma
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Nope,

The alternative format stores the start of each row and the row indices go until the start of the next row. Thus, n+1. You could potentially imply that the first row starts on zero and keep checking the size of the array to reduce the storage, but this considerably complicates the looping and in my opinion is not worth saving 2 integers.

Hrv
songwukong likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addressing matrix element and reuse of system matrix marziolettich OpenFOAM Running, Solving & CFD 2 February 19, 2008 05:04
UDS questions Z FLUENT 1 March 31, 2005 14:54
UDS Questions Y FLUENT 0 March 19, 2005 11:58
Few questions phi FLUENT 0 March 4, 2005 09:23
Some questions P FLUENT 3 February 3, 2005 10:10


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