On Tue, Apr 5, 2011 at 4:28 AM, Thomas Witkowski <thomas.witkowski@tu-dresden.de> wrote:
Jed Brown wrote:
On Tue, Mar 29, 2011 at 15:29, Thomas Witkowski <thomas.witkowski@tu-dresden.de <mailto:thomas.witkowski@tu-dresden.de>> wrote: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:
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
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