- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Questions about addressing**
(*https://www.cfd-online.com/Forums/openfoam-solving/60442-questions-about-addressing.html*)

Hi All,
I wanted to implemHi 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 |

Sorry to say it, but you're a 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 |

Hi Hrv,
In src/OpenFOAM/matriHi 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". |

Nope,
The alternative formaNope,
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 |

All times are GMT -4. The time now is 15:08. |