[petsc-users] MG on fieldsplit
Jed Brown
jedbrown at mcs.anl.gov
Wed Feb 1 09:32:20 CST 2012
On Wed, Feb 1, 2012 at 04:47, gouarin <loic.gouarin at math.u-psud.fr> wrote:
> Hi,
>
> I sent some email on Stokes solver using DMComposite grid (one for the
> velocity and an other one for the pressure).
>
> Now, I try to use PCMG to precondition the velocity part with fieldsplit
> and PETSc command line options only.
>
> This is an example of my options:
>
> ./test -stokes_ksp_type fgmres
> -stokes_pc_type fieldsplit
> -stokes_fieldsplit_0_ksp_type preonly
> -stokes_fieldsplit_0_pc_type mg
> -stokes_fieldsplit_0_pc_mg_**levels 2
> -stokes_fieldsplit_0_pc_mg_**galerkin
> ...
> -stokes_fieldsplit_1_ksp_type preonly
> -stokes_fieldsplit_1_pc_type jacobi
>
> It doesn't work because we need to call PCFieldSplitGetSubKSP to get the
> subpc[0] to create the interpolation matrices. So, we have to call
> KSPSetUp before PCFieldSplitGetSubKSP. But, if we call KSPSetUp, we have an
> error because the interpolation matrices are not created !
>
The interpolation matrices for PCMG? Those should be constructed by the DM.
It looks from your code like you have a DMComposite, in which case you
shouldn't have to do anything special.
Try "make runex28_4". (It's broken with a change that went into petsc-dev a
few days ago. I'll be able to push the fix whenever I find a wireless
network in this airport that doesn't block ssh.)
>
> But If I do:
>
> ------
> PCSetDM(pc, dom->get_pack());
> PCSetType(pc, PCFIELDSPLIT);
> KSPSetUp(solver);
> PCFieldSplitGetSubKSP(pc, &nsplits, &subksp);
> PetscMalloc(sizeof(PC)***nsplits, &subpc);
>
> KSPSetType(subksp[0], KSPPREONLY);
> KSPGetPC(subksp[0], &subpc[0]);
> PCSetType(subpc[0], PCMG);
>
> create the interpolation matrices
>
> KSPSetFromOptions(solver);
> ------
>
> It works but we can't set the mg_levels with the command line options
> anymore. Moreover, I have some warning of this type:
>
> Option left: name:-stokes_fieldsplit_0_pc_**mg_multiplicative_cycles
> value: 3
>
> Is there a way to do that only with the command line option ?
>
> Thanks,
> Loic
>
> --
> Loic Gouarin
> Laboratoire de Mathématiques
> Université Paris-Sud
> Bâtiment 425
> 91405 Orsay Cedex
> France
> Tel: (+33) 1 69 15 60 14
> Fax: (+33) 1 69 15 67 18
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120201/94839de6/attachment.htm>
More information about the petsc-users
mailing list