[petsc-dev] Preconditioner for Schur complement (pcfieldsplit)
Thomas Witkowski
thomas.witkowski at tu-dresden.de
Tue Apr 5 04:28:51 CDT 2011
Jed Brown wrote:
> On Tue, Mar 29, 2011 at 15:29, Thomas Witkowski
> <thomas.witkowski at tu-dresden.de
> <mailto:thomas.witkowski at tu-dresden.de>> wrote:
>
> Is there any example which makes use of it?
>
>
> src/snes/examples/tutorials/ex28.c is a (contrived) multi-physics
> prototype that uses MatNest tranparently if you run with
> -pack_dm_mat_type nest (currently, you should add -pc_type fieldsplit
> -pc_fieldsplit_type additive because off-diagonal blocks are not
> automatically preallocated).
>
> There are also two tests that use the low-level API:
>
> $ grep -l MatNest src/**/tests/*.c
> src/ksp/ksp/examples/tests/ex22.c
> src/snes/examples/tests/ex17.c
So, I reimplemented my code to assemble the matrices to a MatNest
matrix. This seems to work fine. But how to define the FieldSplits? I
did it in the following way:
KSP solver;
PC pc;
KSPCreate(PETSC_COMM_WORLD, &solver);
KSPGetPC(solver, &pc);
const PetscInt interiorField[1] = {0};
const PetscInt boundaryField[1] = {1};
PCFieldSplitSetFields(pc, "interior", 1, interiorField);
PCFieldSplitSetFields(pc, "boundary", 1, boundaryField);
When I run my code with the options "-ksp_type preonly -pc_type
fieldsplit -pc_fieldsplit_type schur", I get the following errors in
KSPSolve:
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Petsc has generated inconsistent data!
[0]PETSC ERROR: Unhandled case, must have at least two fields!
Is the creation of the split wrong? If not, what is a good way to figure
out the problem?
Thomas
More information about the petsc-dev
mailing list