[petsc-dev] Problem with SNES and FieldSplit

Matthew Knepley knepley at gmail.com
Tue Mar 15 15:51:44 CDT 2011


On Tue, Mar 15, 2011 at 3:46 PM, Jed Brown <jed at 59a2.org> wrote:

> 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.
>

Really? That seems perverse. I have to build some global PC matrix, with
pieces I do not even have. How is that going to happen? Is
this really how we want to handle it? Also, I really need this to work now.
So baring some other idea, I am going to put something in
PETSc that lets me set this operator during the SNES loop.

   Matt

-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110315/11835b8d/attachment.html>


More information about the petsc-dev mailing list