CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Non-orthogonality correction (

santiagomarquezd October 1, 2009 15:19

Non-orthogonality correction
Hi all! I'm checking out the scalarTransportFoam code and I can't realize how non-orthogonality corrections are applied:

From code we read:


00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049    Info<< "\nCalculating scalar transport\n" << endl;
00051 #  include "CourantNo.H"
00053    while (runTime.loop())
00054    {
00055        Info<< "Time = " << runTime.timeName() << nl << endl;
00057 #      include "readSIMPLEControls.H" 00058
00059        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00060        {
00061            solve 00062            (
00063                fvm::ddt(T)
00064              + fvm::div(phi, T)
00065              - fvm::laplacian(DT, T)
00066            );
00067        }
00069        runTime.write();
00070    }
00072    Info<< "End\n" << endl;
00074    return 0;
00075 }
00078 // ************************************************************************* //

for loop is repeated as times as nNonOrthCorr indicates, but What changes in solve arguments? As is written the code is solving the same many times. I know that this corrections are about laplacian calculus but I couldn't find the source code that show us changes that happens in each loop.


olwi October 1, 2009 17:13

Hi Santiago,

The linear solvers solve a system Ax=b, where A is a matrix, x is a vector of all your unknowns (your field varaible) and b is a vector of source terms. Solving gives you x.

In the laplacian operator above, only the *orthogonal* contributions go into the matrix coeffcients of A. This keeps the "discretization molecule" small and the matrix A simple and sparse, with references only to the cells on either side of the respective faces. The non-orthogonal corrections instead go into the source term b. Although you don't see that. So, after you solve the equation once, you must recompute the explicit non-orthogonal contribution in the source term b again, with the latest values of your solution. And then solve again. Etcetera.

The correction is hopefully small, so that only a small number of iterations are required for the correction to converge and stabilize.

I warmly recommend downloading the PhD thesis of Hrvoje Jasak. All you want to know is in Chapter 3! You can download it from (First link on the page; the PDF is a bit large, so be patient...)

You can also look for the book of Versteeg et al on the Finite Volume method. The latest issue (2008?) has been updated with methods for unstructured grids. Hrv:s text is just as good, however, and corresponds well to what is actually inside Op-nFOAM.

Happy FOAMing,


santiagomarquezd October 1, 2009 22:05

Ola, thanks for your support, It is invaluable for me! Your answer is very interesting and useful. I've been reading Jasak's thesis for the last weeks, is one of the best materials available about FVM I've ever read. I've read the books from Patankar, Versteerg and Ferziger, these are very good at the concepts but, some details in the implementation, specially for non-structured grids are not covered. The new edition of Versteeg you've indicated is welcome, I have to obtain a new copy, the one from my institute's library is the first.
As I put in my first post I know that non-orthogonal corrections are related with laplacian terms or diffusion terms as are named in Jasak's thesis. Although in this text the implementation is not present, and was looking for it in the code. I revised the code of fvm::laplacian and fvMatrix::solve but I couldnt't found it. You really surprised me, now I have new knowledge. Regarding this topic I would appreciate that you tell me in what source files are implemented the corrections. to continue my revising.

Thanks in advance.

All times are GMT -4. The time now is 14:38.