- **OpenFOAM**
(*http://www.cfd-online.com/Forums/openfoam/*)

- - **boundary conditions in fvMatrix multiplication make me despair**
(*http://www.cfd-online.com/Forums/openfoam/92046-boundary-conditions-fvmatrix-multiplication-make-me-despair.html*)

boundary conditions in fvMatrix multiplication make me despair1 Attachment(s)
I need some help to understand what is going on in fvMatrix::solve and lduMatrix::Amul.
I attach a complete case directory which solves Code:
`fvm::laplacian(x)==b` The output of the code is: Quote:
However, for A*x I expect Quote:
If I display the matrix elements of A, I get: Quote:
Quote:
Code:
`A.Amul(b,x,interfaceBouCoeffs,interfaces,0);` Thank you very much Marek This is the solver code, also included in the attachment: Code:
`#include "fvCFD.H"` |

Hi (I like the thread title by the way!),
Matrix A does have the 'effect' of the boundary on the internal cells -> try printing out A.internalCoeffs(). You could add the internalCoeffs to the relevant cells before using Amul, but I'm not sure what you're trying to do to be honest, there's probably a 'better' way of going about what you're actually trying to achieve. |

Hello Laurence,
I am implementing a new discretisation scheme, and I need to verify where things go wrong. I narrowed the problem down to the boundary and internal coefficients of boundary patches. As you suggested, I am now adding the contributions from A.boundaryCoeffs() and A.internalCoeffs() to the matrix multiplication. It is somewhat involved, because I loop over each patch, then over each face, and finally have to get the face-to-cell addressing right. Do you know an OpenFOAM function that adds the boundary contributions to my solution b? I tried to find the corresponding code in the iterative solvers (PCG.C, PBiCG.C), but even there I was not able to find out how the boundary contributions are taken care of. Thanks Marek |

Hmmm, well if you look at the protected functions in fvMatrix, there are ones called "addToInternalField()" etc. I assume they do what you want.
I'm afraid that's about my limit! Maybe grep those functions to see where they are called. |

If anyone is interested, I have added a nested for-loop after the A.Amul() multiplication which solves the problem.
Is it possible to replace the inner loop with some existing function instead of multiplying element by element? Code:
`#include "fvCFD.H"` |

All times are GMT -4. The time now is 19:46. |