CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Problem with residual and their definition! (

batta31 February 9, 2013 13:06

Problem with residual and their definition!
Hi guys, I was troubling a little with the definition of the residuals in OF. Following this thread "", I've figured out that, at each step, the residual is calculated as follow: (focusing over an hypothetical momentum equation)


res = b - Ax
which is the "classical" definition of the residual, with x the unknown.
Then, the normalization factor is calculated as:


xRef = gAverage(x)
Then we have the definition of these two fields:


wA = A x;
pA = A xRef;
So the normalization factor is:


normFactor =
gSum(cmptMag(wA - pA) + cmptMag(b - pA))
+ matrix.small_;
And it is a sum of the magnitude of the vector fields all over the domain.

Finally the residual (normalized, so dimensionless) is:


residual =
gSum(cmptMag(b - wA))/normFactor;
In the momentum equation is the difference between the RHS and LHS summed allover the domain, divide by the normFactor.

My questions are:

1) Is my interpretation correct?
2) Could someone explains what the average function do? I think it makes an average of a field (vector or scalar) in the domain but I'm not really sure
3) How can residual be equal 1 at step 0?
4) At each iterative step (I'm thinking about simpleFoam) the "initial Value" of residual at each time step is the difference between the residual calculated as before at the i-th step and the (i-1)th step or the first?

Thanks in advance


batta31 February 11, 2013 07:00

Any answer guys? :)

batta31 February 14, 2013 08:36

Isn't really anyone that can help me to figure out my problem?

batta31 March 27, 2013 05:56

Hi guys I return on this post! I wanted to ask again if there is someone that can explain me if my interpretation of the residuals is particular I wanted some explanation about the normalization factor that is used..

is it really variable at each iteration or am I wrong?
Please someone answers me.


santiagomarquezd April 1, 2013 11:01

Bazinga July 18, 2016 10:39

I am wondering why the procedure for normalization is rather complex for the OpenFOAM code. Is there an advantage for the OF normalization type compared to lets say Fluent where we only divide by the l.h.s of the equation sum(A_p*Phi_p)

Is there any text book that somebody can recommend?

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