[petsc-dev] Problem with SNES and FieldSplit

Jed Brown jed at 59A2.org
Tue Mar 15 15:46:39 CDT 2011


On Tue, Mar 15, 2011 at 21:39, Matthew Knepley <knepley at gmail.com> wrote:

> Here is the scenario. I have a FieldSplit solve with 4 splits. For the 4th
> split, I have
> a good preconditioner matrix. In the linear case, KSP, I am just doing
> this:
>
>     err = KSPSetUp(_ksp);
>     err = KSPGetPC(_ksp, &pc);
>     err = PCFieldSplitGetSubKSP(pc, &num, &ksps);
>
>     MatStructure flag;
>     err = KSPGetOperators(ksps[num-1], &A, PETSC_NULL, &flag);
>     err = PetscObjectReference((PetscObject) A);
>     err = KSPSetOperators(ksps[num-1], A, _precondMatrix, flag);
>     err = PetscFree(ksps);
>

Yuck.


> which works fine. However, if we embed this in a nonlinear solve, so that I
> now call
>
>     err = SNESGetKSP(_snes, &ksp);
>    <same code>
>
> then the PC matrix for the 4th split is ignored. This happens because
> SNESSolve_LS()
> calls KSPSetOperators() right before the solve. This causes FS to pull out
> the same
> matrices again and overwrite my special PC matrix.
>

The preconditioning matrix for this piece should be put into the global
preconditioning matrix, perhaps stored as a MatNest. Fieldsplit should take
that matrix apart for preconditioning and it'll find the preconditioning
matrix for this part. More tricky is dealing with auxiliary operators such
as appear in approximate-commutator Schur complement preconditioners. The
current method is punting, you PetscObjectCompose the auxiliary matrix.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110315/c62c27a6/attachment.html>


More information about the petsc-dev mailing list