<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 11, 2018 at 1:14 AM, Smith, Barry F. <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>
1) Run the problem with -ksp_view_mat and -ksp_view_rhs and mail <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a> the resulting file produced called binaryoutput<br>
<br>
2) By default PCLU does a reordering to reduce fill that could introduce a zero pivoit, PCILU does not do a reordering by default. You can use -pc_factor_mat_ordering_type none to force no reordering (PCLU does not do numerical pivoting for stability so can fail with zero pivots).<br>
<br>
3) If you need to solve these tiny 7 by 7 systems many times (presumably you are solving these to set up a large algebraic system solved afterwards) then you probably don't want to use KSP to solve them. You can use the low level kernel PetscKernel_A_gets_inverse_A_<wbr>7() that does do pivoting followed by a multiply like<br>
<br>
s1 = v[0]*x1 + v[6]*x2 + v[12]*x3 + v[18]*x4 + v[24]*x5 + v[30]*x6;<br>
s2 = v[1]*x1 + v[7]*x2 + v[13]*x3 + v[19]*x4 + v[25]*x5 + v[31]*x6;<br>
s3 = v[2]*x1 + v[8]*x2 + v[14]*x3 + v[20]*x4 + v[26]*x5 + v[32]*x6;<br>
s4 = v[3]*x1 + v[9]*x2 + v[15]*x3 + v[21]*x4 + v[27]*x5 + v[33]*x6;<br>
s5 = v[4]*x1 + v[10]*x2 + v[16]*x3 + v[22]*x4 + v[28]*x5 + v[34]*x6;<br>
s6 = v[5]*x1 + v[11]*x2 + v[17]*x3 + v[23]*x4 + v[29]*x5 + v[35]*x6;<br>
<br>
where v is the dense 7 by 7 matrix (stored column oriented like Fortran) an the x are the seven values of the right hand side.<br></blockquote><div><br></div><div>Note that PCPBJACOBI will do this automatically.</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">
Barry<br>
<br>
<br>
<br>
<br>
<br>
> On Mar 10, 2018, at 5:22 AM, Ali Berk Kahraman <<a href="mailto:aliberkkahraman@yahoo.com">aliberkkahraman@yahoo.com</a>> wrote:<br>
><br>
> Hello All,<br>
><br>
> I am trying to get the finite difference coefficients for a given irregular grid. For this, I follow the following webpage, which tells me to solve a linear system.<br>
><br>
> <a href="http://web.media.mit.edu/~crtaylor/calculator.html" rel="noreferrer" target="_blank">http://web.media.mit.edu/~<wbr>crtaylor/calculator.html</a><br>
><br>
> I solve a 7 unknown linear system with a 7x7 dense matrix to get the finite difference coefficients. Since I will call this code many many many times in my overall project, I need it to be as fast, yet as exact as possible. So I use PCLU. I make sure that there are no zero diagonals on the matrix, I swap required rows for it. However, PCLU still diverges with the output at the end of this e-mail. It indicates "FACTOR_NUMERIC_ZEROPIVOT" , but as I have written above I make sure there are no zero main diagonal entries on the matrix. When I use PCILU instead, it converges pretty well.<br>
><br>
> So my question is, is PCILU the same thing mathematically as PCLU when applied on a small dense matrix? I need to know if I get the exact solution with PCILU, because my whole project will depend on the accuracy of the finite differences.<br>
><br>
> Best Regards,<br>
><br>
> Ali Berk Kahraman<br>
> M.Sc. Student, Mechanical Engineering Dept.<br>
> Boğaziçi Uni., Istanbul, Turkey<br>
><br>
> Linear solve did not converge due to DIVERGED_PCSETUP_FAILED iterations 0<br>
> PCSETUP_FAILED due to FACTOR_NUMERIC_ZEROPIVOT<br>
> KSP Object: 1 MPI processes<br>
> type: gmres<br>
> restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement<br>
> 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>
> out-of-place factorization<br>
> tolerance for zero pivot 2.22045e-14<br>
> matrix ordering: nd<br>
> factor fill ratio given 5., needed 1.<br>
> Factored matrix follows:<br>
> Mat Object: 1 MPI processes<br>
> type: seqaij<br>
> rows=7, cols=7<br>
> package used to perform factorization: petsc<br>
> total: nonzeros=49, allocated nonzeros=49<br>
> total number of mallocs used during MatSetValues calls =0<br>
> using I-node routines: found 2 nodes, limit used is 5<br>
> linear system matrix = precond matrix:<br>
> Mat Object: 1 MPI processes<br>
> type: seqaij<br>
> rows=7, cols=7<br>
> total: nonzeros=49, allocated nonzeros=49<br>
> total number of mallocs used during MatSetValues calls =0<br>
> using I-node routines: found 2 nodes, limit used is 5<br>
><br>
><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>