[petsc-users] MG on fieldsplit
gouarin
loic.gouarin at math.u-psud.fr
Thu Feb 2 05:03:36 CST 2012
Hi Jed,
thanks for your reply.
On 01/02/2012 16:32, Jed Brown wrote:
> On Wed, Feb 1, 2012 at 04:47, gouarin <loic.gouarin at math.u-psud.fr
> <mailto: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.)
It seems that I have forgotten to initialize DMSetInitialGuess,
DMSetFunction, DMSetJacobian.
I don't understand what is the best way to use 4Q1-Q1 elements for the
Stokes problem:
- Construct the matrices for each DM in the DMComposite
- Construct the global matrix and the global preconditioner
- Use MatNest
There are a lot of possibilities with PETSc with new add-ons and it is
difficult to find our way with only the documentation.
Best regards,
Loic
>
> 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 <tel:%28%2B33%29%201%2069%2015%2060%2014>
> Fax: (+33) 1 69 15 67 18 <tel:%28%2B33%29%201%2069%2015%2067%2018>
>
>
--
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/20120202/cb12b22d/attachment.htm>
More information about the petsc-users
mailing list