<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 10, 2015 at 7:51 PM, K. N. Ramachandran <span dir="ltr"><<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hello all,<br><br></div>I am a graduate student pursuing my Master's and I am trying to benchmark a previous work by using PETSc for solving Poisson's Equation.<br><br></div>I am starting off with a serial code and I am trying to keep my code modular, i.e. I generate the sparse matrix format and send it to PETSc or any other solver. So I haven't built my code from the ground up using PETSc's native data structures.<br><br></div>I am having trouble understanding the behavior of the solver and would like your thoughts or inputs on what I can do better. I have both Dirichlet and Neumann boundary conditions and my matrix size (number of rows) is around a million but very sparse (~7 nonzeros per row), as can be expected from a finite difference discretization of Poisson's equation.<br><br></div>I tried the methods outlined <a href="http://scicomp.stackexchange.com/questions/513/why-is-my-iterative-linear-solver-not-converging?rq=1" target="_blank">here</a> and <a href="http://scicomp.stackexchange.com/questions/34/how-can-i-estimate-the-condition-number-of-a-large-sparse-matrix-using-petsc" target="_blank">here</a>. Reverting to a 41^3 grid, I got the approximate condition number (using  <code>-ksp_monitor_singular_value -ksp_type gmres -ksp_gmres_restart 1000 -pc_type none) <font face="arial,helvetica,sans-serif">as ~9072, which seems pretty large. Higher matrix sizes give a larger condition number.</font><br><br></code></div><code><font face="arial,helvetica,sans-serif">1) </font></code><code><font face="arial,helvetica,sans-serif"><code><font face="arial,helvetica,sans-serif">My best performing solver + preconditioner is bcgs+ilu(0) (on 1e6 grid) which solves in around 32 seconds, 196 iterations</font>.<font face="arial,helvetica,sans-serif"> </font></code>How do I get a fix for what the lower bound on the running time could be?<br></font></code></div></div></blockquote><div><br></div><div>Unfortunately, that is really slow. You can look at this Tutorial (<a href="http://www.mcs.anl.gov/petsc/documentation/tutorials/ParisTutorial.pdf">http://www.mcs.anl.gov/petsc/documentation/tutorials/ParisTutorial.pdf</a>) slides 125-126 where</div><div>I solve elliptic systems using MG for systems with > 1M unknowns in that amount of time.</div><div><br></div><div>You need to use Multigrid. Its the only solver that should be used for this problem. Anything else is a waste of time.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><code><font face="arial,helvetica,sans-serif"></font></code></div><code><font face="arial,helvetica,sans-serif">2) Initially <span style="font-family:monospace,monospace">-pc_type hypre</span> just Diverged and I was never able to use it. Looking at <a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2013-October/019127.html" target="_blank">this thread</a>, I had tried the options and it no longer diverges, but the residuals reduce and hover around a constant value.</font></code> How do I work with hypre to get a useful preconditioner?</div></blockquote><div><br></div><div>Something is wrong with your setup. Hypre is a fantastic solver for these problems. Send the convergence output (-ksp_monitor_true_residual -ksp_converged_reason -ksp_view).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Initially I solve Laplace's equation, so the mesh grid size has no effect and even when I solve Poisson's equation, the spacing is carried over to the RHS, so I am pretty sure the spacing is not affecting the condition number calculation.<br></div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>No, the Laplacian has a condition number that grows like h^{-2}. See earlier slides in that tutorial.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div></div><div>Hope this helps. Please let me know if you might need more information.<br clear="all"></div><div><br></div><div>Thanking You,<br></div><div><div><div dir="ltr">K.N.Ramachandran<br><div>Ph: <a href="tel:814-441-4279" value="+18144414279" target="_blank">814-441-4279</a></div></div></div>
</div></div></div></div></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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>