<div dir="ltr"> Have you tried other solvers, e.g., PETSc default gmres/ilu, bcgs/ilu etc.<div>The matrix is small. If it is ill-conditioned, then pc_type lu would work the best.</div><div><br></div><div>Hong<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 9:34 AM, Sun, Hui <span dir="ltr"><<a href="mailto:hus003@ucsd.edu" target="_blank">hus003@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">With options: 
<div><span style="font-family:Menlo;font-size:11px"><br>
</span></div>
<div><span style="font-family:Menlo;font-size:11px">-pc_type hypre -pc_hypre_type pilut -pc_hypre_pilut_maxiter 1000 -pc_hypre_pilut_tol 1e-3 -ksp_type b</span><span style="font-family:Menlo;font-size:11px">cgs -ksp_rtol 1e-10 -ksp_max_it 10 -ksp_monitor_short
 -ksp_converged_reason -ksp_view</span>
<div><br>
</div>
<div>Here is the full output:</div>
<div><br>
</div>
<div><span>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  0 KSP Residual norm 1404.62 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  1 KSP Residual norm 88.9068 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  2 KSP Residual norm 64.73 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  3 KSP Residual norm 71.0224 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  4 KSP Residual norm 69.5044 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  5 KSP Residual norm 455.458 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  6 KSP Residual norm 174.876 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  7 KSP Residual norm 183.031 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  8 KSP Residual norm 650.675 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  9 KSP Residual norm 79.2441 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
 10 KSP Residual norm 84.1985 </p>
</span><p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
Linear solve did not converge due to DIVERGED_ITS iterations 10</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
KSP Object: 1 MPI processes</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  type: bcgs</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  maximum iterations=10, initial guess is zero</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  tolerances:  relative=1e-10, absolute=1e-50, divergence=10000</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  left preconditioning</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  using PRECONDITIONED norm type for convergence test</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
PC Object: 1 MPI processes</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  type: hypre</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    HYPRE Pilut preconditioning</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    HYPRE Pilut: maximum number of iterations 1000</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    HYPRE Pilut: drop tolerance 0.001</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    HYPRE Pilut: default factor row size </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  linear system matrix = precond matrix:</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
  Mat Object:   1 MPI processes</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    type: seqaij</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    rows=62500, cols=62500</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    total: nonzeros=473355, allocated nonzeros=7.8125e+06</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
    total number of mallocs used during MatSetValues calls =0</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
      not using I-node routines</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
Time cost: 0.756198,  0.662984,  0.105672 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
<br>
</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">
<br>
</p>
</div>
<div><br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Matthew Knepley [<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>]<br>
<b>Sent:</b> Wednesday, February 18, 2015 3:30 AM<br>
<b>To:</b> Sun, Hui<br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] Question concerning ilu and bcgs<br>
</font><br>
</div><div><div>
<div></div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, Feb 18, 2015 at 12:33 AM, Sun, Hui <span dir="ltr">
<<a href="mailto:hus003@ucsd.edu" target="_blank">hus003@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">I have a matrix system Ax = b, A is of type MatSeqAIJ or MatMPIAIJ, depending on the number of cores. 
<div><br>
</div>
<div>I try to solve this problem by pc_type ilu and ksp_type bcgs, it does not converge. The options I specify are:</div>
<div>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">-pc_type hypre -pc_hypre_type pilut -pc_hypre_pilut_maxiter 1000 -pc_hypre_pilut_tol 1e-3 -ksp_type b\</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">cgs -ksp_rtol 1e-10 -ksp_max_it 1000 -ksp_monitor_short -ksp_converged_reason</p>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>1) Run with -ksp_view, so we can see exactly what was used</div>
<div><br>
</div>
<div>2) ILUT is unfortunately not a well-defined algorithm, and I believe the parallel version makes different decisions</div>
<div>    than the serial version.</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>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div>
<p style="margin-right:0px;margin-left:0px"><font>The first a few lines of the output are:</font></p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  0 KSP Residual norm 1404.62 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  1 KSP Residual norm 88.9068 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  2 KSP Residual norm 64.73 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  3 KSP Residual norm 71.0224 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  4 KSP Residual norm 69.5044 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  5 KSP Residual norm 455.458 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  6 KSP Residual norm 174.876 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  7 KSP Residual norm 183.031 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  8 KSP Residual norm 650.675 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo">  9 KSP Residual norm 79.2441 </p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo"> 10 KSP Residual norm 84.1985</p>
<p style="margin-right:0px;margin-left:0px;font-size:11px;font-family:Menlo"><br>
</p>
<p style="margin-right:0px;margin-left:0px"><font>This clearly indicates non-convergence. However, I output the sparse matrix A and vector b to MATLAB, and run the following command:</font></p>
<p style="margin-right:0px;margin-left:0px">[L,U] = ilu(A,struct('type','ilutp','droptol',1e-3));</p>
<p style="margin-right:0px;margin-left:0px">[ux1,fl1,rr1,it1,rv1] = bicgstab(A,b,1e-10,1000,L,U);</p>
<p style="margin-right:0px;margin-left:0px"><br>
</p>
<p style="margin-right:0px;margin-left:0px">And it converges in MATLAB, with flag fl1=0, relative residue rr1=8.2725e-11, and iteration it1=89.5. I'm wondering how can I figure out what's wrong. </p>
<p style="margin-right:0px;margin-left:0px"><br>
</p>
<p style="margin-right:0px;margin-left:0px">Best, </p>
<span><font color="#888888">
<p style="margin-right:0px;margin-left:0px">Hui</p>
</font></span></div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>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>
</div>
</div>
</div></div></div>
</div>
</div>
</div>
</div>

</blockquote></div><br></div></div></div>