CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Accessing the residuals from the solver (

juho July 1, 2008 07:01

Hi, I'm working on a modifi

I'm working on a modified version of the twoPhaseEulerFoam and I would like to make the number of PISO loops (or iterations within the timestep) adaptive.

ie. the solver would vary the number of loops based on the convergence.

How could I access the initial residual or the number of iterations of the pressure solver?

I see that the lduMatrix.H includes a member function initialResidual()

which I tried to use to access the residual with a command


This however resulted in an error message by the compiler:

"Foam::fvScalarMatrix has no member named 'initialResidual'"

This obviously isn't the right way to do it and no such functions can be found in the scalarMatrix.H

Any help or tips would be appreciated!

olesen July 1, 2008 07:23

You could try something like t
You could try something like this:

// retain the residual from the first iteration
if (nonOrth == 0)
eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);

Where maxResidual has been initialized elsewhere ...

gschaider July 1, 2008 07:35

Hi Juho! Every call to solv
Hi Juho!

Every call to solve returns such an object: formance.html

This object contains all the information that you need


juho July 1, 2008 07:49

Thank you very much! Just what
Thank you very much! Just what I needed!

All times are GMT -4. The time now is 04:23.