Where is the matrix coming from? If it is from a 1, 2 or 3d structured grid then you can use the DMDA plus PCMG to manage almost everything including the generation of the interpolation. If you are not working with a structured grid then you can us PCGAMG which does algebraic multigrid using the matrix you provide.
Barry > On Oct 13, 2015, at 4:53 PM, K. N. Ramachandran <[email protected]> wrote: > > Hello Matt, > > Ah ok. I had tried specifying -pc_mg_levels earlier, but it asks for > interpolation to be setup. I am currently working on using DMDA from examples > 32 and 34, which sets up the interpolation, using DMDASetInterpolationType. > So this is the recommended way to go forward right? > > Since I supply the sparse matrix format and the rhs values to PETSc, does it > make sense to do a DMDACreate1d instead of 3d? I did a sample implementation > using DMDA 1d and when I call KSPSolve and fetch the solution, it comes out > all zeros, with the solver having converged. I am trying to understand what I > am doing wrong there. > > On Mon, Oct 12, 2015 at 10:17 PM, Matthew Knepley <[email protected]> wrote: > On Mon, Oct 12, 2015 at 9:11 PM, K. N. Ramachandran <[email protected]> wrote: > Hello Matt, > > Actually I felt the boundary conditions were having a role to play and set > all the boundary conditions to Dirichlet. In this case, convergence was > almost immediate with the Hypre preconditioner, taking 17 seconds with 3 > iterations. The MG method took about the same time though. > > So I reverted to the Dirichlet, Neumann mix of BCs and Hypre starts to > diverge. Please find attached the output for the Hypre run using Dirichlet > and Neumann for a 21^3 grid (rows), with a max of 7 nonzeros per row. Details > of the options used before running are in the file. The solver used in all > cases is bcgs. > > Also attached is the MG output for 101^3 grid > 1) Dirichlet and Neumann > 2) Dirichlet only > > where it seems to take about the same time. > > Notice that you have no levels of MG here. You need to use -pc_mg_levels <n> > > Matt > > > > > Thanking You, > Ramachandran K.N. > Ph: 814-441-4279
