On Sat, Oct 10, 2015 at 7:51 PM, K. N. Ramachandran <[email protected]> wrote:
> Hello all, > > 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. > > 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. > > 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. > > I tried the methods outlined here > <http://scicomp.stackexchange.com/questions/513/why-is-my-iterative-linear-solver-not-converging?rq=1> > and here > <http://scicomp.stackexchange.com/questions/34/how-can-i-estimate-the-condition-number-of-a-large-sparse-matrix-using-petsc>. > Reverting to a 41^3 grid, I got the approximate condition number (using > -ksp_monitor_singular_value > -ksp_type gmres -ksp_gmres_restart 1000 -pc_type none) as ~9072, which > seems pretty large. Higher matrix sizes give a larger condition number. > > 1) My best performing solver + preconditioner is bcgs+ilu(0) (on 1e6 > grid) which solves in around 32 seconds, 196 iterations. How do I get a > fix for what the lower bound on the running time could be? > Unfortunately, that is really slow. You can look at this Tutorial ( http://www.mcs.anl.gov/petsc/documentation/tutorials/ParisTutorial.pdf) slides 125-126 where I solve elliptic systems using MG for systems with > 1M unknowns in that amount of time. You need to use Multigrid. Its the only solver that should be used for this problem. Anything else is a waste of time. > 2) Initially -pc_type hypre just Diverged and I was never able to use it. > Looking at this thread > <http://lists.mcs.anl.gov/pipermail/petsc-users/2013-October/019127.html>, > I had tried the options and it no longer diverges, but the residuals reduce > and hover around a constant value. How do I work with hypre to get a > useful preconditioner? > 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). > 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. > No, the Laplacian has a condition number that grows like h^{-2}. See earlier slides in that tutorial. Thanks, Matt > Hope this helps. Please let me know if you might need more information. > > Thanking You, > K.N.Ramachandran > Ph: 814-441-4279 > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
