CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Accessing the residuals from the solver (https://www.cfd-online.com/Forums/openfoam-solving/58763-accessing-residuals-solver.html)

juho July 1, 2008 07:01

Hi, I'm working on a modifi
 
Hi,

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

pEqn.initialResidual()

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:
http://foam.sourceforge.net/doc/Doxygen/html/classFoam_1_1lduMatrix_1_1solverPer formance.html

This object contains all the information that you need

Bernhard

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 10:56.