# Stopping criterion for outer iteration loop

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 15, 2017, 17:01 Stopping criterion for outer iteration loop #1 New Member   Join Date: Jul 2011 Posts: 6 Rep Power: 13 Hey, I am working on an implicit pressure based finite volume solver for incompressible and compressible flows. The momentum and continuity equations were solved segregated. At present the stopping criterion for the outer iteration loop (solution of momentum equations + pressure correction) depends on the maximum difference of the flow field from one iteration to another. Hence, the definition of the stopping criterion depends on the magnitude of the flow quantities and is very case specific. Now, I am going to revise the code and change the stopping criterion. I am planning to use instead a relative quantity to obtain a criterion that is less case specific. Precisely, I am planning to compute difference between to iterations and relate it to the value at the last iteration. Then the maximum (absolute) value is compared with the (user) defined stopping criterion. What do you think? Is this proper definition of the stopping criterion for the outer iteration loop or do I need to use another one? Thanks in advance! With best regards, Michel

 February 15, 2017, 18:25 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,293 Rep Power: 67 Why do not use the residual of each equation?

 February 16, 2017, 05:04 #3 New Member   Join Date: Jul 2011 Posts: 6 Rep Power: 13 Hey, this is a good idea, thank you. At the moment, it will increase the computational cost since I have to recompute the complete coefficient matrix and source termfor each momentum equation at the end of one outer iteration. If the code has to do another outer iteration, the complete coefficient matrix and source term has to be recomputed again since each equation uses the same arrays to store the linear equation system. I will now introduce new arrays to store the linear equation system for each momentum equation. Hence, I do not need to recompute it again at the beginning of a new outer iteration. This will increase the memory consumption but only slightly increase the computational cost.

 February 22, 2017, 08:59 #4 Senior Member   Lucky Join Date: Apr 2011 Location: Orlando, FL USA Posts: 5,148 Rep Power: 61 Usually you are not doing matrix inversion (very expensive) but some type of system solver. You need a metric to determine whether you've solved the system or not at the inner iterations, so these residual matrices should already have been computed. Numerically you don't just say "solve this system" because you cannot numerically solve it exactly. You always say "solve this system, within this tolerance" and that tolerance is the residual. So you should have been doing these checks at the inner iteration level. At the outer iteration, you should do one final update and re-calculate your residuals. Usually at the start of a calculation you calculate the residuals to determine whether the system needs to be solved or not and only solve it if needed. I mean it's not extra memory or computation if you consider it a common best practice.