[petsc-users] Can you provide a basic example of using PCMG for multigrid applications?

Travis Austin austin at txcorp.com
Tue May 17 17:31:04 CDT 2011


You would most likely want to use an Algebraic Multigrid method.  See HYPRE's Boomeramg or ML.  Both can be downloaded 
through the configure line when you configure PETSc.  Of course the performance is going to depend on what type of equations
you are solving.


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Travis Austin, Ph.D.
Tech-X Corporation
5621 Arapahoe Ave, Suite A
Boulder, CO 80303
austin at txcorp.com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


On May 17, 2011, at 3:26 PM, Shiyuan wrote:

> Is there any support in PETSC (with other packages) for finite element multigrid on unstructured meshes? Any recommended way to do that? Any tutorial or examples? Thanks. 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 16 May 2011 14:08:12 -0500
> From: Barry Smith <bsmith at mcs.anl.gov>
> Subject: Re: [petsc-users] Can you provide a basic example of using
>        PCMG for        multigrid applications?
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Message-ID: <E727136F-395E-4E88-9D0A-6C8E07177DD4 at mcs.anl.gov>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> On May 16, 2011, at 1:36 AM, Li, Zhisong (lizs) wrote:
> 
> >  Hi, Petsc Team,
> >
> > In my knowledge of Petsc, the PCMG object is the main tool for general multigrid calculations, as DMMG only works for simple constant matrix and RHS.
> 
>   This is not correct. DMMG can be used for non-constant matrix. DMMG is restricted to structured grids only. But if your problem is on a two or three dimensional structured grid you can use it and it is much easier than coding the pieces directly.
> 
> 
> 
> >  But it's difficult to find any example code for using PCMG.  I checked out the petsc-user mail archive on this topic but still not find a good description on it.  I encounter similar errors in the practice as some previous question-raisers did.
> >
> > Here is my simple code implementing the PCMG based on my understanding from the user manual and tutorial.  It is supposed to have multigrid of only two levels (finest and coarsest grid).  The error message indicates SEGV segmentation violation because of this part of code.  Anything wrong with this implementation?
> >
> 
>    This code looks more or less correct. You need to run with -start_in_debugger to track down what is trigger the SEGV
> 
>    src/ksp/ksp/examples/
> tutorials/ex19.c is a simple example that runs on two levels.
> 
> 
>   Barry
> 
> 
> >
> >   DAGetMatrix(da, MATAIJ, &M);
> >
> >   KSPCreate(PETSC_COMM_WORLD, &ksp);
> >   KSPSetType(ksp, KSPGMRES);
> >   KSPGetPC(ksp, &pcmg);
> >   PCSetType(pcmg, PCMG);
> >
> >   PCMGSetLevels(pcmg, 2, &PETSC_COMM_WORLD);
> >   PCMGSetType(pcmg, PC_MG_MULTIPLICATIVE);
> >   PCMGSetCycleType(pcmg, PC_MG_CYCLE_W);
> >   PCMGSetCyclesOnLevel(pcmg, 0, 1);
> >   PCMGSetCyclesOnLevel(pcmg, 1, 1);
> >
> >   PCMGGetCoarseSolve(pcmg, &ksp);
> >
> >   PCMGGetSmoother(pcmg, 0, &ksp);
> >   PCMGGetSmoother(pcmg, 1, &ksp);
> >   PCMGSetInterpolation(pcmg, 1, M);
> >   PCMGSetRestriction(pcmg, 1, M);
> >
> >   PCMGSetResidual(pcmg, 0, PCMGDefaultResidual, M);
> >   PCMGSetResidual(pcmg, 1, PCMGDefaultResidual, M);
> >
> >
> >  The mandatory remaining PCMGSetRhs( ), PCMGSetX( ) and PCMGSetR( ) functions should be generated by Petsc automatically.
> >
> > It is tough to learn some Petsc functions when no detailed example and few guidance is provided.  I wish you can add some tutorials codes on PCMG usage in the future version of Petsc.
> >
> >
> > Thank you very much.
> >
> >
> > Zhisong Li
> >
> >
> >
> 
> 
> 
> ------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110517/cea4e1ca/attachment.htm>


More information about the petsc-users mailing list