[petsc-users] Sorted CSR Matrix and Multigrid PC.
Manuel Valera
mvalera at mail.sdsu.edu
Thu Sep 1 17:42:06 CDT 2016
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)
....
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
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
>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).
Any help will be apreciated,
thanks so much,
Manuel Valera.
Computational Science Reseach Center - SDSU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160901/b64cf44c/attachment.html>
More information about the petsc-users
mailing list