CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Residuals Calculation (http://www.cfd-online.com/Forums/openfoam-solving/95540-residuals-calculation.html)

 ic3wall December 21, 2011 16:54

Residuals Calculation

Hi all,

Does anybody know how the residuals displayed when running simpleFoam are calculated in OpenFoam 1.7.1 ?

I can't find any precise info on this ...

I'm solving a problem where the pressure should converge to 0, but I'm wondering if the solver normalises the residuals by some factor like the mean pressure for example, if this is the case, it would explain why I obtain quite high residuals.

Thank you

 ic3wall December 22, 2011 17:51

Nobody knows how exactly they are calculated ??

 vatavuk December 23, 2011 07:22

Hi ic3wall,
There is an old thread that has the information you want:
http://www.cfd-online.com/Forums/ope...d-solvers.html

I hope this helps

 ic3wall December 23, 2011 15:57

Cool, thank you very much, exactly what I was looking for!

 ic3wall March 8, 2012 14:18

3 Attachment(s)
Sorry to bring back this thread up but I think it's an interesting topic that many could benefit from...
----------------------------------------------------------
According to hjasak, residuals are calculated as follow:

For matrix

A x = b,

residual is defined as

res = b - Ax

We then apply residual scaling with the following normalisation factor procedure:

Type xRef = gAverage(x);

wA = A x;
pA = A xRef;

normFactor =
gSum(cmptMag(wA - pA) + cmptMag(source - pA))
+ matrix.small_;

and the scaled residual is:

residual =
gSum(cmptMag(source - wA))/normFactor;

-------------------------------------------------------------------

My situation:

I'm modeling an atmospheric boundary layer over a flat terrain using k-eps RANS. The flow is driven by a shear stress applied at the top boundary. I set the pressure to 0 at one point in my domain and apply zeroGradient at every boundary. The velocity components (V & W) perpendicular to the flow should be zero (coriolis is ignored) as well as the pressure.

My problem is that residuals for V,W and P won't go down (please see attached images). I'm suspecting that the normFactor is responsible for that. What happen to the normFactor when wA, pA and source approaches 0, normFactor also approaches 0 ? The consequence is high residuals ...

In my case, the results agree with the analytical solutions, but accoding to residuals convergence is not reached. In the pictures attached, you'll find the standard residuals calculated by OpenFoam, the residuals multiplied by the normFactor which are "absolute residuals" and finally the normFactor alone. Everything is plotted versus iterations.

According to "absolute residuals", I'm very close to the solution.

I'd like to have opinions of others on that ?

 All times are GMT -4. The time now is 00:05.