CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Explanation of "solve"-function (

Linse February 15, 2012 06:16

Explanation of "solve"-function
Hello out there in the big OpenFOAM-world.

Is there anybody who can really explain to me the solve-function?
If I look at

->solve(psiCmpt, sourceCmpt, cmpt);
within finiteVolume/lnInclude/fvMatrixSolve.C at line 148 it seems to me there the real solver is pointed to, which uses the parameters psiCmpt, sourceCmpt and cmpt.
- But where is that solver really defined?
- Where can i find the actual definition of the function "solve()"?

And if there is somebody really knowing about that solve-function:
- Is there a way to call that solve() for a specific cell only?

I am kind of lost with the C++ stuff or at least inside the structure of OpenFOAM, so any help is welcome!

Taozi February 1, 2015 01:41

Hi Bernhard, did you find any information regarding the functionality of the solve() function? Thanks.

alberto February 2, 2015 00:30

The solve function you are looking at is a virtual function ( ) which is redefined for each solver (diagonalSolver, GAMGSolver, ...).

If you want to solve a linear system directly in a cell or a limited number of cells, you probably want to follow a simpler way. You can, for example, use a scalarSquareMatrix and use LU decomposition on it (OF can do it).

All times are GMT -4. The time now is 01:50.