CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Difference between solve() and solve(...finalInnerIter())? (https://www.cfd-online.com/Forums/openfoam-programming-development/172872-difference-between-solve-solve-finalinneriter.html)

elmo555 June 8, 2016 06:01

Difference between solve() and solve(...finalInnerIter())?
 
Hello,

can you help me understand the difference between a simple call to
Code:

p_rghEqn.solve();
and
Code:

p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
?

Your help is much appreciated!

jherb June 8, 2016 17:59

The second version uses the settings for p_rghFinal in the system/fvSolutions file (for solver settings) for the last iteration in the pimple outer loop (so for the last iteration step per time step) whereas the first version *always* use the p_rgh settings. So the p_rghFinal settings are ignore in the first case.

elmo555 June 9, 2016 03:56

Thanks for the quick and clear answer!

My settings for p_rgh and p_rghFinal are the same, except for the relTol, which is 0.05 and 0, respectively. So naturally, the solver needs more iterations in the last outer pimple loop because it can't stop at any relative tolerance. I was wondering if it's normal that THAT much more iterations are required:

Code:

DICPCG:  Solving for p_rgh, Initial residual = 0.0509331, Final residual = 0.00187709,
No Iterations 3
time step continuity errors : sum local = 9.11852e-06, global = 7.5083e-06, cumulative = -0.00101879
DICPCG:  Solving for p_rgh, Initial residual = 0.00738722, Final residual = 0.000365238,
No Iterations 80
time step continuity errors : sum local = 7.85558e-06, global = 7.48801e-06, cumulative = -0.0010113
DICPCG:  Solving for p_rgh, Initial residual = 0.00345672, Final residual = 9.48528e-08,
No Iterations 250
time step continuity errors : sum local = 7.50304e-06, global = 7.50295e-06, cumulative = -0.0010038

Or is this suggesting that there's another problem with my code?

jherb June 9, 2016 04:30

It would say it is normal.

akidess June 9, 2016 04:40

Just look at your residuals. At first you are reducing them by 10, then in the final iteration 10'000x. Of course that will require a lot more iterations. By the way, GAMG typically shows much better performance for the solution of the pressure equation.

Quote:

Originally Posted by elmo555 (Post 604023)
Thanks for the quick and clear answer!

My settings for p_rgh and p_rghFinal are the same, except for the relTol, which is 0.05 and 0, respectively. So naturally, the solver needs more iterations in the last outer pimple loop because it can't stop at any relative tolerance. I was wondering if it's normal that THAT much more iterations are required:

Code:

DICPCG:  Solving for p_rgh, Initial residual = 0.0509331, Final residual = 0.00187709,
No Iterations 3
time step continuity errors : sum local = 9.11852e-06, global = 7.5083e-06, cumulative = -0.00101879
DICPCG:  Solving for p_rgh, Initial residual = 0.00738722, Final residual = 0.000365238,
No Iterations 80
time step continuity errors : sum local = 7.85558e-06, global = 7.48801e-06, cumulative = -0.0010113
DICPCG:  Solving for p_rgh, Initial residual = 0.00345672, Final residual = 9.48528e-08,
No Iterations 250
time step continuity errors : sum local = 7.50304e-06, global = 7.50295e-06, cumulative = -0.0010038

Or is this suggesting that there's another problem with my code?



All times are GMT -4. The time now is 23:09.