<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 21, 2014 at 3:10 PM, Sharp Stone <span dir="ltr"><<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@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 dir="ltr">Hi Barry,<div><br></div><div>Thank you very much for your reply. They are illustrating. </div><div><br></div><div>I use LU and gmres in the solver. When I use a rather small size of grids, the KSP solver works fine. However, when a larger domain is used (still small in the problem I'm trying to solve), I still got the error "Zero pivot in LU factorization" from Petsc.  As you previously suggested, I solved the problem in Matlab, and got the solution, though the matrix is close to singular. Do I have any options to solve such a system with Petsc? For the completeness, I attached the matrix and rhs vector, </div></div></blockquote><div><br></div><div>You can possibly use an iterative method with a specified null space. Do you know what the null space is?</div><div>Do you have an idea what preconditioner would be effective for your operator, since block box PCs tend not</div><div>to work on singular problems?</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 dir="ltr"><div>and look forward to hearing from you. Thank you in advance!</div>







</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 20, 2014 at 11:38 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  What exact options are you running with?  I tried ILU and LU and all was fine.<br>
<br>
$ ./ex10 -f0 ~/Desktop/binaryoutput -rhs 0 -mat_view -pc_type lu -ksp_view<br>
Mat Object: 1 MPI processes<br>
  type: seqaij<br>
row 0: (0, 1)  (1, 0)  (3, 0)<br>
row 1: (0, 0)  (1, 1)  (2, 0)  (4, 0)<br>
row 2: (1, 0)  (2, 1)  (5, 0)<br>
row 3: (0, -0.219298)  (3, 1)  (4, -0.561404)  (6, -0.219298)<br>
row 4: (1, -0.304878)  (3, -0.097561)  (4, 1)  (5, -0.292683)  (7, -0.304878)<br>
row 5: (2, 0)  (4, 0)  (5, 1)  (8, 0)<br>
row 6: (3, 0)  (6, 1)  (7, 0)<br>
row 7: (4, 0)  (6, 0)  (7, 1)  (8, 0)<br>
row 8: (5, 0)  (7, 0)  (8, 1)<br>
KSP Object: 1 MPI processes<br>
  type: gmres<br>
    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement<br>
    GMRES: happy breakdown tolerance 1e-30<br>
  maximum iterations=10000, initial guess is zero<br>
  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000<br>
  left preconditioning<br>
  using PRECONDITIONED norm type for convergence test<br>
PC Object: 1 MPI processes<br>
  type: lu<br>
    LU: out-of-place factorization<br>
    tolerance for zero pivot 2.22045e-14<br>
    matrix ordering: nd<br>
    factor fill ratio given 5, needed 1.54545<br>
      Factored matrix follows:<br>
        Mat Object:         1 MPI processes<br>
          type: seqaij<br>
          rows=9, cols=9<br>
          package used to perform factorization: petsc<br>
          total: nonzeros=51, allocated nonzeros=51<br>
          total number of mallocs used during MatSetValues calls =0<br>
            not using I-node routines<br>
  linear system matrix = precond matrix:<br>
  Mat Object:   1 MPI processes<br>
    type: seqaij<br>
    rows=9, cols=9<br>
    total: nonzeros=33, allocated nonzeros=33<br>
    total number of mallocs used during MatSetValues calls =0<br>
      not using I-node routines<br>
Number of iterations =   1<br>
  Residual norm < 1.e-12<br>
~/Src/petsc/src/ksp/ksp/examples/tutorials (barry/fix-setters *)<br>
$ ./ex10 -f0 ~/Desktop/binaryoutput -rhs 0 -mat_view -pc_type ilu -ksp_view<br>
Mat Object: 1 MPI processes<br>
  type: seqaij<br>
row 0: (0, 1)  (1, 0)  (3, 0)<br>
row 1: (0, 0)  (1, 1)  (2, 0)  (4, 0)<br>
row 2: (1, 0)  (2, 1)  (5, 0)<br>
row 3: (0, -0.219298)  (3, 1)  (4, -0.561404)  (6, -0.219298)<br>
row 4: (1, -0.304878)  (3, -0.097561)  (4, 1)  (5, -0.292683)  (7, -0.304878)<br>
row 5: (2, 0)  (4, 0)  (5, 1)  (8, 0)<br>
row 6: (3, 0)  (6, 1)  (7, 0)<br>
row 7: (4, 0)  (6, 0)  (7, 1)  (8, 0)<br>
row 8: (5, 0)  (7, 0)  (8, 1)<br>
KSP Object: 1 MPI processes<br>
  type: gmres<br>
    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement<br>
    GMRES: happy breakdown tolerance 1e-30<br>
  maximum iterations=10000, initial guess is zero<br>
  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000<br>
  left preconditioning<br>
  using PRECONDITIONED norm type for convergence test<br>
PC Object: 1 MPI processes<br>
  type: ilu<br>
    ILU: out-of-place factorization<br>
    0 levels of fill<br>
    tolerance for zero pivot 2.22045e-14<br>
    using diagonal shift on blocks to prevent zero pivot [INBLOCKS]<br>
    matrix ordering: natural<br>
    factor fill ratio given 1, needed 1<br>
      Factored matrix follows:<br>
        Mat Object:         1 MPI processes<br>
          type: seqaij<br>
          rows=9, cols=9<br>
          package used to perform factorization: petsc<br>
          total: nonzeros=33, allocated nonzeros=33<br>
          total number of mallocs used during MatSetValues calls =0<br>
            not using I-node routines<br>
  linear system matrix = precond matrix:<br>
  Mat Object:   1 MPI processes<br>
    type: seqaij<br>
    rows=9, cols=9<br>
    total: nonzeros=33, allocated nonzeros=33<br>
    total number of mallocs used during MatSetValues calls =0<br>
      not using I-node routines<br>
Number of iterations =   2<br>
  Residual norm < 1.e-12<br>
<div><div><br>
<br>
> On Oct 20, 2014, at 10:02 PM, Sharp Stone <<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@gmail.com</a>> wrote:<br>
><br>
> Dear All,<br>
><br>
> Last week I raised a question about KSP solver with zero pivot problem. Now I downsized the matrix in my problem and still got the zero pivot problem. I looked at the matrix and computed its eigenvalues in matlab, and it seems the matrix is good (not singular, I mean), but petsc still reported zero pivot in LU factorization. What could possibly cause this? Thank you very much in advance!<br>
><br>
> PS: I attached the matrix output in my simplest test.<br>
><br>
> --<br>
> Best regards,<br>
><br>
> Feng<br>
</div></div>> <binaryoutput><br>
<br><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Best regards,</div><div><br></div>Feng</div>
</font></span></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>