On Mon, Mar 8, 2010 at 9:05 AM, <span dir="ltr"><<a href="mailto:hxie@umn.edu">hxie@umn.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
<br>
On Mar 8 2010, Jed Brown wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 06 Mar 2010 15:41:12 -0600, <a href="mailto:hxie@umn.edu" target="_blank">hxie@umn.edu</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am solving incompressible navier-stokes equations. The code implements the Newton iteration and just uses the KSP solver for each iteration. It takes 14 nonlinear iterations (~8min) to converge using the default solver<br>
in PETSc. But it takes 6 nonlinear iterations (~30min) using boomeramg from<br>
hypre.<br>
</blockquote>
<br>
Can you confirm that these are the number of NONLINEAR iterations?<br>
</blockquote>
<br></div>
Yes.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Changing the preconditioner should not change this if it behaving<br>
correctly. Are you solving incompressible NS in a coupled manner,<br>
sending the indefinite (momentum + continuity equations) to the<br>
preconditioner? <br>
</blockquote>
<br></div>
It is a temperature driven flow. Temperature field is also included. We use high order method (2nd order for velocity) to discretize the system and solve it in a coupled manner. We do a small shifting for the preconditioner to avoid zero diagonals.<div>
<div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In this case, BoomerAMG can be giving you completely<br>
the wrong answer. For example, on a different Navier-Stokes example, it<br>
produces very nice preconditioned residuals<br>
<br>
0 KSP Residual norm 9.526419214320e+00 1 KSP Residual norm 9.406988599189e-02 2 KSP Residual norm 2.767040414824e-03 3 KSP Residual norm 1.649604812054e-03 4 KSP Residual norm 1.611023301144e-03 5 KSP Residual norm 7.073431543229e-04 6 KSP Residual norm 1.404066303578e-04 7 KSP Residual norm 1.347821147393e-04 8 KSP Residual norm 7.713640141302e-05 9 KSP Residual norm 5.121198361232e-05 10 KSP Residual norm 4.790100151952e-05 11 KSP Residual norm 1.769376148248e-05 12 KSP Residual norm 1.671836687758e-05 13 KSP Residual norm 9.561298137614e-06 14 KSP Residual norm 6.509746067580e-07 15 KSP Residual norm 5.863323408081e-07 16 KSP Residual norm 5.120192651612e-07 17 KSP Residual norm 3.403122131501e-07 18 KSP Residual norm 3.342529361191e-07 19 KSP Residual norm 9.178974981883e-08 <br>
but converges to completely the WRONG answer. This is because the<br>
preconditioner is singular, and the unpreconditioned residuals (using<br>
right-preconditioned GMRES) look like<br>
<br>
0 KSP Residual norm 9.899494936612e+05<br>
1 KSP Residual norm 3.460941545811e-02<br>
2 KSP Residual norm 3.411670842883e-02<br>
3 KSP Residual norm 3.406431296292e-02<br>
4 KSP Residual norm 3.376198186394e-02<br>
5 KSP Residual norm 3.374434209905e-02<br>
6 KSP Residual norm 3.370086274150e-02<br>
7 KSP Residual norm 3.334190783058e-02<br>
8 KSP Residual norm 3.321057363881e-02<br>
9 KSP Residual norm 3.321055343672e-02<br>
10 KSP Residual norm 3.318392045928e-02<br>
<br>
which is NO CONVERGENCE at all after the penalty boundary conditions<br>
were enforced. So CPU time aside, the nonlinear iteration count could<br>
occur because Newton is failing due to an incorrect search direction or<br>
a vanishing step size, but the answer could be completely wrong.<br>
<br>
You have to clear up subtleties like getting the wrong answer before<br>
looking any further at the amount of time the various preconditioners<br>
are taking. Always run with<br>
<br>
-snes_converged_reason -ksp_converged_reason<br>
<br>
and check the unpreconditioned residuals, especially when dealing with<br>
indefinite problems.<br>
<br>
Jed<br>
<br>
</blockquote>
<br></div></div>
The result looks correct. I will double check by computing the real residual by b-Ax. For all the methods I set the same options "-ksp_max_it 500 -ksp_gmres_restart 50". And each nonlinear iteration will take 500 gmres iteration. Maybe the 500 V cycles takes much more time than the ilu0. Will there be a big difference to implement the amg directly from hypre? Thanks.<br>
</blockquote><div><br></div><div>This is the problem. The inner linear systems are just not really being solved. Have you looked at</div><div>the convergence (-ksp_monitor)? You can get different nonlinear iteration counts this way.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Bests,<br>
Hui <br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>