<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 20, 2014 at 8:38 AM, Adriano Côrtes <span dir="ltr"><<a href="mailto:adrimacortes@gmail.com" target="_blank">adrimacortes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
I'm still trying to make MINRES and PCFIELDSPLIT working together in<br>
my code, but I am not understanding how things are going.<br>
Ok, first of all, I'm trying to solve a Stokes problem with an inf-sup<br>
stable element with all boundary of Dirichlet type, that is, my system<br>
is<br>
<br>
       [ A   B^t ]<br>
M = [            ]<br>
       [ B    0   ]<br>
<br>
and its kernel is the column vector [zeros(ndof_vel,1) ;<br>
ones(ndof_press,1) ] (using Matlab notation)<br>
<br>
Lets say some facts that I'm sure of, since I damped the matrices<br>
using MatView to a Matlab file and inspected them:<br>
<br>
a. M is symmetric for sure and singular, with the kernel mentioned above;<br>
b. The block A is SPD (all eigenvalues are positive);<br>
c. S = - B * A^{-1} * B^t negative semi-definite (with only one zero<br>
eigenvalue and all others negative); that is -S is positive<br>
semi-definite;<br>
<br>
Now I will talk about my tests using MINRES and PCFIELDSPLIT to solve<br>
this problem:<br>
<br>
1. MINRES without preconditioner converges (very slowly) to any<br>
specified tolerance;<br>
<br>
2. MINRES without preconditioner AND using KSPSetNullspace to set the<br>
null space of the matrix as [zeros(ndof_vel,1) ; ones(ndof_press,1) ]<br>
converges to any specified tolerance, but the number of iterations are<br>
almost the same of the test above;<br>
<br>
3. MINRES with PCFIELDSPLIT, using SPLIT = SCHUR, and SCHURFACT =<br>
DIAG, and letting Petsc managing the other options with default values<br>
(GMRES for the KPS and ILU(0) for PC). In this case I think Petsc is<br>
using<br>
<br>
       [  A    0 ]<br>
P  = [           ]<br>
       [  0   -S ]<br>
<br>
that in my case is symmetric positive semi-definite (by just one zero<br>
eigenvalue), but approximating with ksp(A) and ksp(-S). Before someone<br>
as I am also setting  KSPSetNullspace as above for the MINRES<br>
iterations, plus passing the option<br>
-fieldsplit_p_ksp_constant_null_space for the Schur block, and what I<br>
obtain (with -ksp_rtol 1e-7) is<br>
<br>
    0 KSP preconditioned resid norm 4.632440509011e-01 true resid norm<br>
2.987970930100e-02 ||r(i)||/||b|| 1.000000000000e+00<br>
    1 KSP preconditioned resid norm 1.484245122855e-01 true resid norm<br>
3.127586084436e-03 ||r(i)||/||b|| 1.046725740512e-01<br>
    2 KSP preconditioned resid norm 1.474500219584e-01 true resid norm<br>
3.303438991154e-03 ||r(i)||/||b|| 1.105579360855e-01<br>
    3 KSP preconditioned resid norm 3.685525320417e-06 true resid norm<br>
2.519862718263e-07 ||r(i)||/||b|| 8.433357543339e-06<br>
    4 KSP preconditioned resid norm 3.665488598091e-06 true resid norm<br>
2.739588290212e-07 ||r(i)||/||b|| 9.168724710853e-06<br>
    5 KSP preconditioned resid norm 9.845910914885e-07 true resid norm<br>
2.763504619849e-07 ||r(i)||/||b|| 9.248766753419e-06<br>
    6 KSP preconditioned resid norm 9.519073659560e-08 true resid norm<br>
1.490709049851e-07 ||r(i)||/||b|| 4.989034648343e-06<br>
    7 KSP preconditioned resid norm 9.490881783501e-08 true resid norm<br>
1.489003256545e-07 ||r(i)||/||b|| 4.983325779864e-06<br>
  Linear solve did not converge due to DIVERGED_INDEFINITE_MAT iterations 8<br>
<br>
So I ask: why this last line? What is computed inside Petsc that<br>
forces it to be printed? My guess is that o preconditioned norm used.<br>
Am I right?<br></blockquote><div><br></div><div>The problem here is the definition of S. In order for the theory to work, S needs to be</div><div>accurate, so you should always start by solving A exactly,</div><div><br></div>
<div>  -fieldsplit_u_ksp_type preonly</div><div>  -fieldsplit_y_pc_type lu</div><div><br></div><div>If after you see 3 iterate (I think) convergence, then you can back off this solver,</div><div>but you likely need to solve A inside S accurately, which you can do using</div>
<div><br></div><div>  -fieldsplit_p_inner_ksp_type preonly</div><div><div>  -fieldsplit_p_inner_pc_type lu</div></div><div><br></div><div>See <a href="http://people.cs.uchicago.edu/~knepley/presentations/SIAMCSE13.pdf">http://people.cs.uchicago.edu/~knepley/presentations/SIAMCSE13.pdf</a>. You</div>
<div>can then backoff LU and see the change in convergence. Eventually, if the solve</div><div>is inaccurate enough, you can destroy the definiteness.</div><div><br></div><div>   Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Then I decide to change some options for PCFIELDSPLIT, passing the options<br>
<br>
#Velocity<br>
-fieldsplit_u_ksp_type cg<br>
-fieldsplit_u_pc_type bjacobi<br>
-fieldsplit_u_ksp_rtol 1e-03<br>
<br>
#Pressure<br>
-fieldsplit_p_ksp_type cg<br>
-fieldsplit_p_pc_type bjacobi<br>
-fieldsplit_p_ksp_rtol 1e-03<br>
-fieldsplit_p_ksp_constant_null_space<br>
<br>
Then I obtained the -ksp_monitor (again with -ksp_rtol 1e-7):<br>
<br>
    0 KSP preconditioned resid norm 4.632522584339e-01 true resid norm<br>
2.987970930100e-02 ||r(i)||/||b|| 1.000000000000e+00<br>
    1 KSP preconditioned resid norm 1.485092747354e-01 true resid norm<br>
3.133707103392e-03 ||r(i)||/||b|| 1.048774294229e-01<br>
    2 KSP preconditioned resid norm 1.475544621957e-01 true resid norm<br>
3.307719603712e-03 ||r(i)||/||b|| 1.107011976051e-01<br>
    3 KSP preconditioned resid norm 3.647747431146e-04 true resid norm<br>
3.795610417928e-05 ||r(i)||/||b|| 1.270296969657e-03<br>
    4 KSP preconditioned resid norm 3.614914908198e-04 true resid norm<br>
4.114945598888e-05 ||r(i)||/||b|| 1.377170559939e-03<br>
    5 KSP preconditioned resid norm 1.289144645113e-04 true resid norm<br>
4.067177049739e-05 ||r(i)||/||b|| 1.361183607500e-03<br>
    6 KSP preconditioned resid norm 5.143993331403e-05 true resid norm<br>
2.794092581519e-05 ||r(i)||/||b|| 9.351137099001e-04<br>
    7 KSP preconditioned resid norm 2.361302329725e-05 true resid norm<br>
2.715477815463e-05 ||r(i)||/||b|| 9.088032912597e-04<br>
    8 KSP preconditioned resid norm 2.352126784416e-05 true resid norm<br>
2.732009930616e-05 ||r(i)||/||b|| 9.143361814852e-04<br>
  Linear solve did not converge due to DIVERGED_INDEFINITE_MAT iterations 9<br>
<br>
And again the same line is printed. Can somebody explain it for me?<br>
Thanks.<br>
<br>
Adriano Cortes<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>