|
[Sponsors] |
Interface between OF and external linear solvers |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 29, 2019, 12:11 |
Interface between OF and external linear solvers
|
#1 |
New Member
Davide Cortellessa
Join Date: Jul 2019
Posts: 4
Rep Power: 7 |
Dear Foamers,
Currently I知 trying to code an OpenFOAM face-centered finite volume solver. Within this code I知 assembling a big sparse matrix, using the lduMatrix class. Now, I知 at the point in which I would like to link my code to an external linear solver, since the lduMatrix solvers are not very suitable for my problem. The ideal library to use would be Mumps, but others like Petsc, Hypre, Pardiso, etc could be fine as well. I tried to look for an existing interface between OF and one of these libraries, but I couldn稚 find anything. Could you point me in the right direction? Or this simply does not exist and I need to code one myself? Thank you very much for your time! Davide |
|
November 6, 2019, 02:34 |
|
#2 |
New Member
zizhou huang
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Hi Davide,
I'm also looking for ways using external linear solvers to substitute the ones in OpenFOAM. I replaced part of codes in PBiCG.C, and I was able to solve equations with Eigen library. I exported the matrix, source, and solution to matlab, and I'm sure the linear solver worked successfully. However, the final result of icoFoam is totally wrong. Are you able to replace the solver now? Thank you! Last edited by zizhou; November 8, 2019 at 00:30. |
|
November 12, 2019, 07:13 |
|
#3 |
New Member
Davide Cortellessa
Join Date: Jul 2019
Posts: 4
Rep Power: 7 |
Hi Zizhou,
Still no unfortunately. The only thing that I was able to do is to export source, values and addressing to Matlab using OFstream, assemble a Matlab sparse matrix and solve the linear system with backslash. Of course this is a very "ugly" solution, that I did only to run some tests. I kept looking but I still wasn't able to find an already existing interface / way of using an external linear solver. I guess that now I will select, with my PhD supervisors, a suitable library and I will code an interface to that. But I immagine it will take some time. |
|
November 12, 2019, 22:43 |
|
#4 |
New Member
zizhou huang
Join Date: Jul 2019
Posts: 18
Rep Power: 7 |
Hi Davide,
I noticed that openfoam stores the coeffcients from transport equation (in upper, diag, lower), but boundary conditions are not inside. The only way to get the actual matrix is by a function called 'Amul(...)'. So I can use O(n*n) time to get the actual sparse matrix and solve it with external library. The only problem is that it doubles the time. I'm wondering if you have any good idea to get the matrix? |
|
November 13, 2019, 05:41 |
|
#5 |
New Member
Davide Cortellessa
Join Date: Jul 2019
Posts: 4
Rep Power: 7 |
Hi Zizhou,
I'm sorry but this is not something I looked much into. In my application I'm building my own lduMatrix, so boundary contributions are already inside the matrix coeffcients and/or the source term. Therefore, I am actually caring only for upper lower and diag... Anyway this "function" that exports a lduMatrix to a different sparse matrix format, compatible with external solver, was precisely that interface I was looking for and I couldn't find. |
|
March 6, 2020, 15:02 |
|
#6 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 281
Rep Power: 22 |
This might help: https://github.com/fppimenta/rheoTool
Maybe you can even use MUMPS through Petsc's interface. But don't expect miracles! Klaus |
|
Tags |
external solver, interface, ldumatrix, linear solvers, mumps |
|
|