[petsc-dev] Problem with SNES and FieldSplit

Matthew Knepley knepley at gmail.com
Tue Mar 15 15:39:10 CDT 2011


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);

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.

What is our idea for customizing parts of FS in a nonlinear iteration?

   Thanks,

     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/790787d1/attachment.html>


More information about the petsc-dev mailing list