Very sorry for wasting so much of your time. The PCFIELDSPLIT generally will not work with BAIJ matrices because the MatCreateSubMatrix() for BAIJ requires indexing by block in the matrix. Your code should work if you use MPIAIJ matrices. Note you can still use MatSetValuesBlocked() with MPAIJ matrices.
Barry > On Nov 10, 2022, at 5:24 PM, Edoardo alinovi <edoardo.alin...@gmail.com> > wrote: > > True, > > Maybe somebody merged it already? I have attached my silly example. > > To compile: > mpifort -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -fdefault-real-8 -o test > test.F90 -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include > > Do you need the petsc code MAtt did? > <test.F90>