CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   initial residual and final residual (https://www.cfd-online.com/Forums/openfoam-solving/117484-initial-residual-final-residual.html)

 mscheng May 9, 2013 04:16

initial residual and final residual

Hi FOAMERs,
what is the definition of the initial residual and final residual, which can be used to decide convergence ?

 Anne Lincke May 15, 2013 05:20

The initial residual is evaluated based on the current values of the field before solving an equation for a particular field . The final residual is evaluated after the solution of the equation is performed.
The intial residual is more important to decide whether a computation converges, or not.

 timo_IHS May 15, 2013 08:23

Hi Anne,

can you give some rule of thumbs for values, which should be achieved for the initial/final residual and how many iterations should be used for pEqn per cycle e.g. for a transient simulation with a standard PCG solver.

Best Timo

 Anne Lincke May 15, 2013 08:29

Initial residual: e^-4 or e^-5 is a good result. Final residual has to be smaller (e^-8).

 Manm August 17, 2016 15:45

Quote:
 Originally Posted by Anne Lincke (Post 427664) The initial residual is evaluated based on the current values of the field before solving an equation for a particular field . The final residual is evaluated after the solution of the equation is performed. The intial residual is more important to decide whether a computation converges, or not.

Hi, based on this definition, I was curious as to why the final residual in one time step NOT equal to initial residual in NEXT time step?

 blais.bruno August 17, 2016 15:55

Assuming you are solving in steady state, it is because the equations are non-linear.

If you solve the momentum equation for U, at the next iteration, P and phi will have been changed. Therefore, the initial residual will be different from the final residual of the last iteration.

If you were to solve a linear equation, non-coupled with any other variables, in steady-state, then you would solve it in a single iteration... and therefore your "next initial" residual would be your last final one...

Quote:
 Originally Posted by Manm (Post 614415) Hi, based on this definition, I was curious as to why the final residual in one time step NOT equal to initial residual in NEXT time step?

 Manm August 17, 2016 17:13

Quote:
 Originally Posted by blais.bruno (Post 614418) Assuming you are solving in steady state, it is because the equations are non-linear. If you solve the momentum equation for U, at the next iteration, P and phi will have been changed. Therefore, the initial residual will be different from the final residual of the last iteration. If you were to solve a linear equation, non-coupled with any other variables, in steady-state, then you would solve it in a single iteration... and therefore your "next initial" residual would be your last final one...
Thank you. That helped to understand my question.

If I understand it right,
Say : U =f(p,phi,t) where f is a complex function

If t0 =0:
During 1 st iteration, we start with a p0, phi0 and dt time step and get U1 =f(p0, phi0,dt) as well as p1, phi1 values. The corresponding final error/ residual is calculated from U1 and true U expected.

Before 2nd iteration starts, a (say) U12 is calculated based on new available values:
U12 =f(p1,phi1,dt) and this is used to calculate the initial error/ residual before the 2nd time step starts.
and then we go on to calculate U2 =f(p1, phi1, dt+dt) and corresponding p2, phi2 and final error/ residual at the end of 2nd time step and so on....

 blais.bruno August 18, 2016 08:31

Yup, That is exactly so.
OpenFOAM is a segregated solver, that is U, V, W, phi and P are solved segregated. This is why such a thing happen.

There are block coupled solvers in foam-extend, but those are still linear solver and don't implement a non-linear newton method or something like that.

Quote:
 Originally Posted by Manm (Post 614421) Thank you. That helped to understand my question. If I understand it right, Say : U =f(p,phi,t) where f is a complex function If t0 =0: During 1 st iteration, we start with a p0, phi0 and dt time step and get U1 =f(p0, phi0,dt) as well as p1, phi1 values. The corresponding final error/ residual is calculated from U1 and true U expected. Before 2nd iteration starts, a (say) U12 is calculated based on new available values: U12 =f(p1,phi1,dt) and this is used to calculate the initial error/ residual before the 2nd time step starts. and then we go on to calculate U2 =f(p1, phi1, dt+dt) and corresponding p2, phi2 and final error/ residual at the end of 2nd time step and so on....

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