<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hum,<br>
      would a <b>-pc_fieldsplit_schur_precondition self </b>use the
      full Schur as preconditioner for itself?<br>
      I made some special choices in order to keep A diagonal which
      makes it cheap to inverse.<br>
      Actually I am assuming that Schur will be blazing fast with my
      type of discretization... <br>
      <pre class="moz-signature" cols="72">Best,
Luc</pre>
      On 03/11/2014 11:36 AM, Matthew Knepley wrote:<br>
    </div>
    <blockquote
cite="mid:CAMYG4G=ykA1y6mcrXO2oqaC0hoxubED5_ae8pr03eYTGKFOcgg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Tue, Mar 11, 2014 at 9:56 AM, Luc
            Berger-Vergiat <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:luc.berger.vergiat@gmail.com"
                target="_blank">luc.berger.vergiat@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div style="word-wrap:break-word">Hi all,
                <div>I am testing some preconditioners for a FEM problem
                  involving different types of fields (displacements,
                  temperature, stresses and plastic strain).</div>
                <div>To make sure that things are working correctly I am
                  first solving this problem with: </div>
                <blockquote style="margin:0 0 0
                  40px;border:none;padding:0px">
                  <div><font face="'Lucida Console'">-ksp_type preonly
                      -pc_type lu,</font> which works fine obviously.</div>
                </blockquote>
                <br>
                <div>Then I move on to do:</div>
                <blockquote style="margin:0 0 0
                  40px;border:none;padding:0px">
                  <div><font face="'Lucida Console'">-ksp_type gmres
                      -pc_type lu,</font> and I get very good
                    convergence (one gmres linear iteration per time
                    step) which I expected.</div>
                </blockquote>
                <br>
                <div>So solving the problem exactly in a preconditioner
                  to gmres leads to optimal results.</div>
                <div>This can be done using a Schur complement, but when
                  I pass the following options:</div>
                <blockquote style="margin:0 0 0
                  40px;border:none;padding:0px">
                  <div><font face="'Lucida Console'">-ksp_type gmres
                      -pc_type fieldsplit -pc_fieldsplit_type schur
                      -pc_fieldsplit_schur_factorization_type full
                      -pc_fieldsplit_0_fields 2,3
                      -pc_fieldsplit_1_fields 0,1 -fieldsplit_0_ksp_type
                      preonly -fieldsplit_0_pc_type
                      lu -fieldsplit_1_ksp_type
                      preonly -fieldsplit_1_pc_type lu</font></div>
                </blockquote>
                <div>My results are terrible, gmres does not converge
                  and my FEM code reduces the size of the time step in
                  order to converge.</div>
                <div>This does not make much sense to me...</div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>The problem is the Schur complement block. We have</div>
            <div><br>
            </div>
            <div>  S = C A^{-1} B</div>
            <div><br>
            </div>
            <div>PETSc does not form S explicitly, since it would
              require forming the dense</div>
            <div>inverse of A explicitly. Thus we only calculate the
              action of A. If you look in</div>
            <div>-ksp_view, you will see that the preconditioner for S
              is formed from A_11,</div>
            <div>which it sounds like is 0 in your case, so the LU of
              that is a crud preconditioner.</div>
            <div>Once you wrap the solve in GMRES, it will eventually
              converge.</div>
            <div><br>
            </div>
            <div>You can try using the LSC stuff if you do not have a
              preconditioner matrix</div>
            <div>for the Schur complement.</div>
            <div><br>
            </div>
            <div>  Thanks,</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">
              <div style="word-wrap:break-word">
                <div>Curiously if I use the following options:</div>
                <blockquote style="margin:0 0 0
                  40px;border:none;padding:0px">
                  <div><font face="'Lucida Console'">-ksp_type gmres
                      -pc_type fieldsplit -pc_fieldsplit_type schur
                      -pc_fieldsplit_schur_factorization_type full
                      -pc_fieldsplit_0_fields 2,3
                      -pc_fieldsplit_1_fields 0,1 -fieldsplit_0_ksp_type
                      gmres -fieldsplit_0_pc_type
                      lu -fieldsplit_1_ksp_type gmres
                      -fieldsplit_1_pc_type lu</font></div>
                </blockquote>
                then the global gmres converges in two iterations.
                <div><br>
                </div>
                <div>So using a pair of ksp gmres/pc lu on the A00 block
                  and the Schur complements works, but using lu directly
                  doesn't.</div>
                <div><br>
                </div>
                <div>Because I think that all this is quite strange, I
                  decided to dump some matrices out. Namely, I dumped
                  the complete FEM jacobian, I also do a MatView on
                  jac->B, jac->C and the result of KSPGetOperators
                  on kspA. These returns three out of the four blocks
                  needed to do the Schur complement. They are correct
                  and I assume that the last block is also correct.</div>
                <div>When I import jac->B, jac->C and the matrix
                  corresponding to kspA in MATLAB to compute the inverse
                  of the Schur complement and pass it to gmres as
                  preconditioner the problem is solved in 1 iteration.</div>
                <div>
                  <br>
                </div>
                <div>So MATLAB says:</div>
                <blockquote style="margin:0 0 0
                  40px;border:none;padding:0px">
                  <div><span style="font-family:'Lucida Console'">-ksp_type
                      gmres -pc_type fieldsplit -pc_fieldsplit_type
                      schur -pc_fieldsplit_schur_factorization_type full
                      -pc_fieldsplit_0_fields 2,3
                      -pc_fieldsplit_1_fields 0,1 -fieldsplit_0_ksp_type
                      preonly -fieldsplit_0_pc_type
                      lu -fieldsplit_1_ksp_type
                      preonly -fieldsplit_1_pc_type lu</span></div>
                </blockquote>
                <div>
                  <div>should yield only one iteration (maybe two
                    depending on implementation).</div>
                  <div><br>
                  </div>
                  <div>Any ideas why the Petsc doesn't solve this
                    correctly?</div>
                  <div><br>
                    <div>
                      <span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                        <div>
                          Best,</div>
                        <div>Luc</div>
                      </span>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </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>
    </blockquote>
    <br>
  </body>
</html>