<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Oops, the message below was not sent to the mailing list.<br>
    Sorry.<br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Original Message --------
      <table class="moz-email-headers-table" cellpadding="0"
        cellspacing="0" border="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>Re: Fieldsplit schur complement with preonly solves</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Tue, 11 Mar 2014 11:22:32 -0400</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Luc <a class="moz-txt-link-rfc2396E" href="mailto:luc.berger.vergiat@gmail.com"><luc.berger.vergiat@gmail.com></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td>Matthew Knepley <a class="moz-txt-link-rfc2396E" href="mailto:knepley@gmail.com"><knepley@gmail.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Here are the -ksp_monitor and
        -ksp_view.<br>
        For some reason I don't get anything out of<br>
            -fieldsplit_0_ksp_monitor or -fieldsplit_1_ksp_monitor<br>
        Is the output of these options stored in some file?<br>
        <br>
        <br>
        <pre class="moz-signature" cols="72">Best,
Luc</pre>
        On 03/11/2014 11:06 AM, Matthew Knepley wrote:<br>
      </div>
      <blockquote
cite="mid:CAMYG4GmBiKAkxiW1dWddB57N4-v67M6pu0x8UWbc8_x6ygJMxQ@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>For any convergence question, we need the output of
                -ksp_view -ksp_monitor, and for this we would also like</div>
              <div><br>
              </div>
              <div>  -fieldsplit_0_ksp_monitor -fieldsplit_1_ksp_monitor</div>
              <div><br>
              </div>
              <div> Yes, something is wrong. Very often this is caused
                by submatrices which have a null space. Of course that
                null space</div>
              <div>should show up in LU, unless you are perturbing the
                factorization.</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>
      <br>
    </div>
    <br>
  </body>
</html>