[petsc-dev] PC fieldsplit / schur issues / questions

Kai Germaschewski kai.germaschewski at unh.edu
Wed Nov 6 15:34:15 CST 2013


Hi,

we've been looking at using the built-in Schur complement capabilities in
PETSc, and encountered some issues which I think are bugs, though maybe I
just can't figure out how to use things properly.

Attached is a somewhat boiled down test program. It's based on
Crank-Nicolson TS, which uses SNES, which uses KSP, which has a PC that's
set to type fieldsplit. We'd like to have the KSP solver for the actual
Schur complement to use multigrid as PC, eventually.

One, kinda minor issue: when ComputeJacobian is called, we have to use
MatZeroEntries and recompute the Jacobian (of course, that's not really
needed for the simple problem we're solving right now because it's actually
linear). The reason for that is that, I think, the TS CN has shifted /
added a diagonal to the Jacobian matrix, as needed for CN. For this, I'm
just wondering if that's expected behavior (it's not obvious that one
wouldn't be passed the same matrix that was calculated the previous time).

Secondly, running the code with "-ts_view_pre" crashes, because the TS
isn't fully set up (in particular, the fieldsplit PC doesn't seem to have
properly created its sub-KSPs yet). I'm pretty sure it shouldn't crash
because of that. But maybe more importantly, the way things are set up
doesn't seem quite right. In particular, even after calling TSSetUp(), the
sub objects in the TS aren't properly set up yet -- that only seems to
happen in the first call to TSSolve() (or TSStep()). Trying to set up the
SNES inside the TS explicitly by calling SNESSetUp() doesn't work, either.
During TSStep, SNESSolve() is called with explicit vectors for b, x, it
appears only then TSSetUp() will actually work without errors.

I'm not sure when the fieldsplit PC should be set up to have its proper
sub-KSP, I suppose at least at TSSetUp() time, if not earlier. For us,
since we want to change the sub-KSPs, we need some way to do that before
the actual solve, but at that point, PCFieldSplitGetSubKSP() will fail --
this part of the code is #if 0'd out right now.

I believe that all of this works properly when using SNES directly, but we
can't get it to work inside the TS, so any help would be appreciated.

This is on the "maint" branch from petsc's git repo, from a couple of days
ago.

Thanks,
--Kai


-- 
Kai Germaschewski
Assistant Professor, Dept of Physics / Space Science Center
University of New Hampshire, Durham, NH 03824
office: Morse Hall 245E
phone:  +1-603-862-2912
fax: +1-603-862-2771
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131106/f1798500/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mgtest.c
Type: text/x-csrc
Size: 6984 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131106/f1798500/attachment.bin>


More information about the petsc-dev mailing list