Controlling maximym number of iterations
Posted: Mon Sep 15, 2025 10:05 am
Hello. It's an old question, but it's arised again so I needed to cope with it somehow...
In some situations, like start of calculation or convergence problems, Saturne make lots of linear solver iterations (10000+). It's not compatible with practice when we need just to pass through this period, not to converge ideally to "classic" 10^-5 tolerance. Calculation becomes so long so it, really, just cannot be performed in realistic time.
One can use large tolerances, but:
1. It requires additional run with high tolerance.
2. Program will not automatically converge to 10^-5 when possible and drop linear iterations otherwise.
3. It does not guarantee, for example, that solver will converge to 0.1 error.
So I prefere to limit number of linear iterations at 100...300. In older versions there was a GUI option, but now it's removed due to more complex solver setting.
I tried to experiment with setting number of iterations with user routine. Calculation was just temperature field (frozen flow). I set multigrid for temperature just for testing and max coarse iterations to 100 (default is 10000) in cs_multigrid_set_solver_options. As a result, first iteration lasted "forever" instaed of ~30 min with defaults so I just stopped the process. Another problem is that, even if it will give positive result, user setting will override Saturne automatic solver selection that is not optimal.
Currently, I use another simple method. I set _n_max_iter_default to 300 in cs_sles_param.c and recompile. It gives exactly required effect, but it's hard-coded and the same for all fields. Would you, please, add this variable (_n_max_iter_default) to GUI? If I add it myself, changes will reset with new version.
In some situations, like start of calculation or convergence problems, Saturne make lots of linear solver iterations (10000+). It's not compatible with practice when we need just to pass through this period, not to converge ideally to "classic" 10^-5 tolerance. Calculation becomes so long so it, really, just cannot be performed in realistic time.
One can use large tolerances, but:
1. It requires additional run with high tolerance.
2. Program will not automatically converge to 10^-5 when possible and drop linear iterations otherwise.
3. It does not guarantee, for example, that solver will converge to 0.1 error.
So I prefere to limit number of linear iterations at 100...300. In older versions there was a GUI option, but now it's removed due to more complex solver setting.
I tried to experiment with setting number of iterations with user routine. Calculation was just temperature field (frozen flow). I set multigrid for temperature just for testing and max coarse iterations to 100 (default is 10000) in cs_multigrid_set_solver_options. As a result, first iteration lasted "forever" instaed of ~30 min with defaults so I just stopped the process. Another problem is that, even if it will give positive result, user setting will override Saturne automatic solver selection that is not optimal.
Currently, I use another simple method. I set _n_max_iter_default to 300 in cs_sles_param.c and recompile. It gives exactly required effect, but it's hard-coded and the same for all fields. Would you, please, add this variable (_n_max_iter_default) to GUI? If I add it myself, changes will reset with new version.