<p>It is because of the dafault convergence tolerances.</p>
<p>Try -ksp_rtol 1e-10</p>
<div class="gmail_quote">On Dec 8, 2011 10:12 AM, &quot;Hailong Xiao&quot; &lt;<a href="mailto:xiaohl1986@gmail.com">xiaohl1986@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br><br>I am using cell centered finite difference method for<br>-div K (grad p) = f<br>with Neumann boundary condtion.<br><br>I called<br>SNESGetKSP(snes, &amp;ksp);<br>MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, PETSC_NULL, &amp;nullsp);<br>

KSPSetNullSpace(ksp, nullsp);<br>MatNullSpaceDestroy(&amp;nullsp);<br><br>to handle the null space.<br><br>But I got the result like the following<br>  0 SNES Function norm 3.512407365520e+02 <br>  Linear solve converged due to CONVERGED_RTOL iterations 16<br>

  1 SNES Function norm 6.615335308038e-03 <br>  Linear solve converged due to CONVERGED_RTOL iterations 20<br>  2 SNES Function norm 3.979662741066e-08 <br><br>I checked my numerical solution with analytical solution (p=x,y,z,cos(pi*x),cos(pi*y), cos(pi*z).<br>

<br>These are the difference between the petsc result and analytical solution for <br>-da_grid_x 5<br>-da_grid_y 5<br>-da_grid_z 100<br><br>i j k 1 1 0<br>petsc      0.499959<br>true       0.495<br>petsc-true 0.00495888<br>

i j k 1 1 1<br>petsc      0.486626<br>true       0.485<br>petsc-true 0.00162554<br>i j k 1 1 2<br>petsc      0.475959<br>true       0.475<br>petsc-true 0.000958875<br>i j k 1 1 3<br>petsc      0.465673<br>true       0.465<br>

petsc-true 0.000673159<br><br>I think I got the correct solution.<br><br>I do not understand why snes took 2 iterations for a linear problem? Is it normal?<br><br clear="all"><br>-- <br>Hailong<br>
</blockquote></div>