Here is the scenario. I have a FieldSplit solve with 4 splits. For the 4th split, I have<div>a good preconditioner matrix. In the linear case, KSP, I am just doing this:</div><div><br></div><div><div> err = KSPSetUp(_ksp);</div>
<div> err = KSPGetPC(_ksp, &pc);</div><div> err = PCFieldSplitGetSubKSP(pc, &num, &ksps);</div><div><br></div><div> MatStructure flag;</div><div> err = KSPGetOperators(ksps[num-1], &A, PETSC_NULL, &flag);</div>
<div> err = PetscObjectReference((PetscObject) A);</div><div> err = KSPSetOperators(ksps[num-1], A, _precondMatrix, flag);</div><div> err = PetscFree(ksps);</div><div><br></div>which works fine. However, if we embed this in a nonlinear solve, so that I now call</div>
<div><br></div><div><div> err = SNESGetKSP(_snes, &ksp);</div><div> <same code></div><div><br></div><div>then the PC matrix for the 4th split is ignored. This happens because SNESSolve_LS()</div><div>calls KSPSetOperators() right before the solve. This causes FS to pull out the same</div>
<div>matrices again and overwrite my special PC matrix.</div><div><br></div><div>What is our idea for customizing parts of FS in a nonlinear iteration?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div>
<div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>
</div>