[petsc-users] Inquiry about the setup for multigrid as a preconditioner in Petsc.
Dave May
dave.mayhem23 at gmail.com
Thu Mar 12 16:22:06 CDT 2020
You want to look at the bottom of each of these web pages
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMCreateInjection.html
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMCreateInterpolation.html
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMDA/DMCreateInterpolationScale.html
At the bottom you will see URLs to the current set of DM implementations
which implement Injection, Interpolation.
Thanks
Dave
On Thu, 12 Mar 2020 at 21:14, Xiaodong Liu <xliu29 at ncsu.edu> wrote:
> Hi, all,
>
> I am practising multigrid as a preconditioner in Petsc. From the previous
> resource, there are 2 main ways to set up the multigrid preconditioner,
>
> 1). For general cae,
> KSPCreate(MPI Comm comm,KSP *ksp);
> KSPGetPC(KSP ksp,PC *pc);
> PCSetType(PC pc,PCMG);
> PCMGSetLevels(pc,int levels,MPI Comm *comms);
> PCMGSetType(PC pc,PCMGType mode);
> PCMGSetCycleType(PC pc,PCMGCycleType ctype);
> ...
> PCMGSetInterpolation(PC pc,int level,Mat P);
> PCMGSetRestriction(PC pc,int level,Mat R);
>
> The above means that I need to specify a lot details, e.g., cycletype.
> interpolation and restriction matrix, coarse solver, etc.
>
> 2) For the case of structured mesh, (DMDA is enough)
> Taking the following case as an example,
>
> https://www.mcs.anl.gov/petsc/petsc-3.6/src/ksp/ksp/examples/tutorials/ex25.c.html
>
> 50: KSPCreate(PETSC_COMM_WORLD,&ksp);
> 51: DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE,-3,1,1,0,&da);
> 52: KSPSetDM(ksp,da);
> 53: KSPSetComputeRHS(ksp,ComputeRHS,&user);
> 54: KSPSetComputeOperators(ksp,ComputeMatrix,&user);
> 55: KSPSetFromOptions(ksp);
> 56: KSPSolve(ksp,NULL,NULL);
>
> DMDA handles all the multigrid setting automatically, e.g., interpolation
> and restriction matrix.
> If my understanding is right, *my question is where to find these source
> file to define these default interpolation and restriction matrix. *
>
> Thanks,S
> Xiaodong Liu, PhD
> X: Computational Physics Division
> Los Alamos National Laboratory
> P.O. Box 1663,
> Los Alamos, NM 87544
> 505-709-0534
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200312/ec5bf92d/attachment.html>
More information about the petsc-users
mailing list