[petsc-users] MG on fieldsplit
gouarin
loic.gouarin at math.u-psud.fr
Wed Feb 1 04:47:01 CST 2012
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 !
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
More information about the petsc-users
mailing list