<div dir="ltr">Hello everyone,<div><br></div><div>As my first intervention in this list i want to congratulate the PETSc devs, since ive been working with the library for a couple months and i am very impressed with it. </div><div><br></div><div>Up until now, ive been developing a module to solve a big laplacian CSR matrix by multigrid pc and GCR ksp, i think i have a basic understanding of whats happening, but i cannot seem to find a good multigrid implementation for my case. I need to use some kind of automatic coarsener/interpolator and so far turning galerkin on does not seem to be working. </div><div><br></div><div>The part of my code where i try to implement multigrid looks like this:</div><div><br></div><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">     call PCSetType(mg,PCJACOBI,ierr)<span class="gmail-Apple-tab-span" style="white-space:pre">             </span></font></div><div><font face="monospace, monospace">     call PCSetOperators(mg,pmat,pmat,ierr)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">!!trying to implement interpolators from ex42<br></font></div><div><font face="monospace, monospace">     nl = 2     </font></div><div><font face="monospace, monospace">     call PetscMalloc(nl,da_list,ierr)</font></div><div><font face="monospace, monospace">     da_list = PETSC_NULL_OBJECT</font></div><div><font face="monospace, monospace">     call PetscMalloc(nl,daclist,ierr)</font></div><div><font face="monospace, monospace">     daclist = PETSC_NULL_OBJECT</font></div><div><font face="monospace, monospace">!    ???? not sure what to do here...</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">     call PCMGSetLevels(mg,2,PETSC_NULL_OBJECT,ierr) !trying two levels first</font></div><div><font face="monospace, monospace">     call PCMGSetType(mg,PC_MG_FULL,ierr)  </font></div><div><font face="monospace, monospace">     call PCMGSetGalerkin(mg,PETSC_TRUE,ierr)</font></div><div><font face="monospace, monospace">  </font></div><div><font face="monospace, monospace">     call PCMGSetCycleType(mg,PC_MG_CYCLE_V,ierr)</font></div><div><font face="monospace, monospace">     call PCMGSetNumberSmoothDown(mg,1,ierr)      </font></div><div><font face="monospace, monospace"><span style="white-space:pre">    </span> call PCMGSetNumberSmoothUp(mg,1,ierr)           </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">     call PCMGSetInterpolation(mg,1,pmat,ierr) <span class="gmail-Apple-tab-span" style="white-space:pre">    </span></font></div><div><font face="monospace, monospace"><span style="white-space:pre">     </span>call PCMGSetRestriction(mg,1,pmat,ierr)<span class="gmail-Apple-tab-span" style="white-space:pre">                </span></font></div><div><font face="monospace, monospace">     call PCMGSetX(mg,0,xp,ierr)<span class="gmail-Apple-tab-span" style="white-space:pre">     </span>!Probably and error to set these two</font></div><div><font face="monospace, monospace">     call PCMGSetRhs(mg,0,bp,ierr)  </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">     call PCSetUp(mg,ierr)</font></div></div><div><font face="monospace, monospace">....</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">I also have an alternative setup try, less developed as:</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">  call PCCreate(PETSC_COMM_WORLD,mg,ierr) !Create preconditioner context<br></font></div><div><font face="monospace, monospace">  call PCSetType(mg,PCGAMG,ierr)</font></div><div><font face="monospace, monospace">   call PCGAMGSetType(mg,PCGAMGAGG,ierr)  !ERROR: 11 SEGV: Segmentation Violation | IS MY PETSC CORRUPTED? gamg.h empty</font></div><div><font face="monospace, monospace">  call PCGAMGSetNLevels(mg,3,PETSC_NULL_OBJECT,ierr)</font></div><div><font face="monospace, monospace">  call PCGAMGSetNSmooths(mg,1,ierr)</font></div><div><font face="monospace, monospace">  call PCGAMGSetThreshold(mg,0.0,ierr)</font></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span></div></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">So far i've also read ML/trilinos multigrid solver is probably easier to implement, but i cant seem to configure petsc correctly to download and install it</span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div>From the code ive sent, can you spot any glaring errors? im sorry my knowledge of multigrid is very small.</div><div><br></div><div>.-.-.-</div><div><br></div><div>Finally, a second question, </div><div><br></div><div>My CSR Column identifier (JA) array is not sorted for each row, can you give me an idea on how to sort it with PetscSortInt() for each row, as suggested in previous mails from this list?</div><div><br></div><div> so far ive figured that i can loop over the row chunk using the spacing give by the row pointer array (IA) but i still don't know how to sort the row chunk in JA along with the real matrix values array (App).</div><div><br></div><div>Any help will be apreciated,</div><div><br></div><div>thanks so much,</div><div><br></div><div>Manuel Valera.</div><div>Computational Science Reseach Center - SDSU</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><br></div></div>