[petsc-dev] Block system
Lawrence Mitchell
wence at gmx.li
Mon Feb 13 10:19:01 CST 2017
> On 13 Feb 2017, at 15:46, Pierre Jolivet <Pierre.Jolivet at enseeiht.fr> wrote:
>
> $ mpirun -np 4 ./a.out -f almost_full_jolivet -pc_type fieldsplit -pc_fieldsplit_type additive -fieldsplit_ksp_type preonly -fieldsplit_pc_type lu -fieldsplit_pc_factor_mat_solver_package mumps
> It fails during setup:
> [0]PETSC ERROR: Petsc has generated inconsistent data
> [0]PETSC ERROR: Unhandled case, must have at least two fields, not 1
>
> I would appreciate any feedback and/or fix for this.
You call:
ierr = KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
ierr = KSPSetOperators(ksp,A,A);CHKERRQ(ierr);
PC pc;
KSPGetPC(ksp, &pc);
for(int j = 0; j < 2; ++j) {
...
ierr = PCFieldSplitSetIS(pc, NULL, is[j]);CHKERRQ(ierr);
}
ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
So the pc is not SetFromOptions at the time you call SetIS. PCFieldSplitSetIS does nothing if the PC type is not of type fieldsplit.
You need to call KSPSetFromOptions before the loop you have to set the ISes.
Lawrence
More information about the petsc-dev
mailing list