> On Sep 1, 2016, at 5:42 PM, Manuel Valera <[email protected]> wrote:
> 
> Hello everyone,
> 
> 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. 
> 
> 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. 
> 
> The part of my code where i try to implement multigrid looks like this:
> 
> 
>      call PCSetType(mg,PCJACOBI,ierr)         
>      call PCSetOperators(mg,pmat,pmat,ierr)
> 
> !!trying to implement interpolators from ex42
>      nl = 2     
>      call PetscMalloc(nl,da_list,ierr)
>      da_list = PETSC_NULL_OBJECT
>      call PetscMalloc(nl,daclist,ierr)
>      daclist = PETSC_NULL_OBJECT
> !    ???? not sure what to do here...
> 
> 
>      call PCMGSetLevels(mg,2,PETSC_NULL_OBJECT,ierr) !trying two levels first
>      call PCMGSetType(mg,PC_MG_FULL,ierr)  
>      call PCMGSetGalerkin(mg,PETSC_TRUE,ierr)
>   
>      call PCMGSetCycleType(mg,PC_MG_CYCLE_V,ierr)
>      call PCMGSetNumberSmoothDown(mg,1,ierr)      
>      call PCMGSetNumberSmoothUp(mg,1,ierr)           
> 
>      call PCMGSetInterpolation(mg,1,pmat,ierr)        
>      call PCMGSetRestriction(mg,1,pmat,ierr)          
>      call PCMGSetX(mg,0,xp,ierr)      !Probably and error to set these two
>      call PCMGSetRhs(mg,0,bp,ierr)  
> 
>      call PCSetUp(mg,ierr)
> ....

Don't do the above.

> 
> I also have an alternative setup try, less developed as:
> 
>   call PCCreate(PETSC_COMM_WORLD,mg,ierr) !Create preconditioner context
>   call PCSetType(mg,PCGAMG,ierr)
>    call PCGAMGSetType(mg,PCGAMGAGG,ierr)  !ERROR: 11 SEGV: Segmentation 
> Violation | IS MY PETSC CORRUPTED? gamg.h empty

    This should work ok. Send a complete file we can compile and run that 
crashes like this.

>   call PCGAMGSetNLevels(mg,3,PETSC_NULL_OBJECT,ierr)
>   call PCGAMGSetNSmooths(mg,1,ierr)
>   call PCGAMGSetThreshold(mg,0.0,ierr)
>       
> 
> 
> 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

   Use --download-ml with your ./configure command and send the resulting 
configure.log to [email protected] if it does not work.
> 
> From the code ive sent, can you spot any glaring errors? im sorry my 
> knowledge of multigrid is very small.
> 
> .-.-.-
> 
> Finally, a second question, 
> 
> 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?
> 
>  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).

  PetscSortIntWithScalarArray()

> 
> Any help will be apreciated,
> 
> thanks so much,
> 
> Manuel Valera.
> Computational Science Reseach Center - SDSU
> 
> 
> 
> 
> 

Reply via email to