The error is in PCFieldSplitSetDefaults() so it is seemingly ignoring your calls to PCFieldSplitSetIS() make sure those calls come AFTER your call to KSPSetFromOptions() in your code.
Barry > On Mar 6, 2017, at 5:05 PM, Lucas Clemente Vella <[email protected]> wrote: > > I tried to split my matrix (attached drawing of the non-null elements) by > calling PCFieldSplitSetIS() twice: > > PCFieldSplitSetIS(pc, "p", zero_to_n); > PCFieldSplitSetIS(pc, "u", n_to_m); > > But upon running with options: > > -ksp_type preonly -pc_type fieldsplit > > I get the following error: > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Petsc has generated inconsistent data > [0]PETSC ERROR: Unhandled case, must have at least two fields, not 1 > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for > trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.7.3, Jul, 24, 2016 > [0]PETSC ERROR: > /home/lvella/src/higtree/examples/read-amr-solve-ns-cfl-example-2d on a > x86_64-linux-gnu-real named lvella-workstation by lvella Mon Mar 6 20:01:47 > 2017 > [0]PETSC ERROR: Configure options --build=x86_64-linux-gnu --prefix=/usr > --includedir=${prefix}/include --mandir=${prefix}/share/man > --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var > --with-silent-rules=0 --libdir=${prefix}/lib/x86_64-linux-gnu > --libexecdir=${prefix}/lib/x86_64-linux-gnu --with-maintainer-mode=0 > --with-dependency-tracking=0 --with-debugging=0 > --shared-library-extension=_real --with-hypre=1 --with-hypre-dir=/usr > --with-clanguage=C++ --with-shared-libraries --with-pic=1 --useThreads=0 > --with-fortran-interfaces=1 --with-mpi-dir=/usr/lib/openmpi > --with-blas-lib=-lblas --with-lapack-lib=-llapack --with-blacs=1 > --with-blacs-lib="-lblacsCinit-openmpi -lblacs-openmpi" --with-scalapack=1 > --with-scalapack-lib=-lscalapack-openmpi --with-mumps=1 > --with-mumps-include="[]" --with-mumps-lib="-ldmumps -lzmumps -lsmumps > -lcmumps -lmumps_common -lpord" --with-suitesparse=1 > --with-suitesparse-include=/usr/include/suitesparse > --with-suitesparse-lib="-lumfpack -lamd -lcholmod -lklu" --with-spooles=1 > --with-spooles-include=/usr/include/spooles --with-spooles-lib=-lspooles > --with-ptscotch=1 --with-ptscotch-include=/usr/include/scotch > --with-ptscotch-lib="-lptesmumps -lptscotch -lptscotcherr" --with-fftw=1 > --with-fftw-include="[]" --with-fftw-lib="-lfftw3 -lfftw3_mpi" > --with-superlu=0 --CXX_LINKER_FLAGS=-Wl,--no-as-needed > --prefix=/usr/lib/petscdir/3.7.3/x86_64-linux-gnu-real > PETSC_DIR=/build/petsc-fA70UI/petsc-3.7.3.dfsg1 > --PETSC_ARCH=x86_64-linux-gnu-real CFLAGS="-g -O2 > -fdebug-prefix-map=/build/petsc-fA70UI/petsc-3.7.3.dfsg1=. > -fstack-protector-strong -Wformat -Werror=format-security -fPIC" CXXFLAGS="-g > -O2 -fdebug-prefix-map=/build/petsc-fA70UI/petsc-3.7.3.dfsg1=. > -fstack-protector-strong -Wformat -Werror=format-security -fPIC" FCFLAGS="-g > -O2 -fdebug-prefix-map=/build/petsc-fA70UI/petsc-3.7.3.dfsg1=. > -fstack-protector-strong -fPIC" FFLAGS="-g -O2 > -fdebug-prefix-map=/build/petsc-fA70UI/petsc-3.7.3.dfsg1=. > -fstack-protector-strong -fPIC" CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2" > LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -fPIC" MAKEFLAGS=w > [0]PETSC ERROR: #1 PCFieldSplitSetDefaults() line 474 in > /build/petsc-fA70UI/petsc-3.7.3.dfsg1/src/ksp/pc/impls/fieldsplit/fieldsplit.c > [0]PETSC ERROR: #2 PCSetUp_FieldSplit() line 491 in > /build/petsc-fA70UI/petsc-3.7.3.dfsg1/src/ksp/pc/impls/fieldsplit/fieldsplit.c > [0]PETSC ERROR: #3 PCSetUp() line 968 in > /build/petsc-fA70UI/petsc-3.7.3.dfsg1/src/ksp/pc/interface/precon.c > [0]PETSC ERROR: #4 KSPSetUp() line 390 in > /build/petsc-fA70UI/petsc-3.7.3.dfsg1/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: #5 KSPSolve() line 599 in > /build/petsc-fA70UI/petsc-3.7.3.dfsg1/src/ksp/ksp/interface/itfunc.c > > What is the proper way to setup PCFIELDSPLIT in this case? > > > 2017-03-01 16:26 GMT-03:00 Barry Smith <[email protected]>: > > > On Mar 1, 2017, at 12:59 PM, Lucas Clemente Vella <[email protected]> wrote: > > > > I have a parallel AIJ matrix and I know exactly which element belongs to > > each one of the 4 submatrices blocks I want to use to solve the linear > > system. The blocks are not strided, because they have different number of > > elements. > > > > I understand that I must use PCFieldSplitSetIS(), since > > PCFieldSplitSetFields() is only for strided blocks. What I don't understand > > is how to create the IS structure I must pass to it. > > > > Each matrix coefficient is identified by a pair (i, j), but on IS creation > > functions, like ISCreateGeneral() and ISCreateBlock(), I am supposed to > > provide a one dimension set of indices. How does these indices relates to > > the matrix coefficients? > > PCFieldSplitSetIS() always indicates SQUARE blocks along the diagonal of > the original matrix. Hence you need only one IS to define a block, you don't > need one for the columns and one for the rows. The IS is telling what rows > AND columns you want in the block. > > > > Also, ISCreateGeneral() seems to create a single block, and ISCreateBlock() > > seems to create multiple blocks of the same size. > > ISCreateBlock() does not create multi blocks, it creates a single IS that > has "block structure", for example 0,1, 3, 4, 6, 7, 9,10, .... > > How to create multiple blocks with different sizes? > > ISCreateGeneral(). > > > > > > Thanks. > > > > -- > > Lucas Clemente Vella > > [email protected] > > > > > -- > Lucas Clemente Vella > [email protected] > <matrix.png>
