Thanks a lot, it works. On Mon, Jan 19, 2026 at 2:34 PM Barry Smith <[email protected]> wrote:
> > Apparently. Just call ISSort() on the IS after forming it. > > On Jan 19, 2026, at 1:31 PM, neil liu <[email protected]> wrote: > > Dear Petsc developers and users, > > I am exploring Schur complement to reuse the inverse of A, for a block > matrix [ A B; C D]. > Here A's size is much bigger than D. Therefore it is desirable to reuse > the inverse of A. The code is listed below. It works well for 10k > tetrahedra elements on 4 ranks . But it shows some error for a coarse mesh > (260 tetrahedra cells) on 4 ranks. > Do i have to sort *isNonPort and isPort? * > Thanks a lot, > Xiaodong > > *MatCreateSubMatrix(A, isNonPort, isNonPort, MAT_INITIAL_MATRIX, &A11);* > > *MatCreateSubMatrix(A, isNonPort, isPorts, MAT_INITIAL_MATRIX, &A12);* > > * MatCreateSubMatrix(A, isPorts, isNonPort, MAT_INITIAL_MATRIX, &A21); * > > * MatCreateSubMatrix(A, isPorts, isPorts, MAT_INITIAL_MATRIX, &A22);* > > * Mat S; * > > * MatCreateSchurComplement(A11, A11, A12, A21, A22, &S); * > > * MatSchurComplementSetKSP(S, kspA11);* > > * Mat Sdense; * > > *MatSchurComplementComputeExplicitOperator(S, &Sdense); * > > * MatAssemblyBegin(Sdense, MAT_FINAL_ASSEMBLY); * > > * MatAssemblyEnd(Sdense, MAT_FINAL_ASSEMBLY);* > [1]PETSC ERROR: Argument out of range > [1]PETSC ERROR: Column entry number 2 (actual column 0) in row 74 is not > sorted > [1]PETSC ERROR: See > https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!fevDf1_FSrxchHFOB2OyR662Jc32SOxgbUK8NZB-aekRvxw9KZRaAmfsQcGnrmPlP-GpdDJGrsvpzTD_mHJHSA$ > > <https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!az-Ao1BxQdotvJlqia0i_iZ5sCx1AZNlDZwT2d1YUzJ4TE_esLV_bwZ-lyIBrsVlK3JJu36cOohpqoohAStoSQ$> > for > trouble shooting. > [1]PETSC ERROR: PETSc Release Version 3.23.3, May 30, 2025 > [1]PETSC ERROR: ./app with 4 MPI process(es) and PETSC_ARCH > arch-linux-c-debug > [1]PETSC ERROR: Configure options: -with-cc=gcc --with-fc=gfortran > --with-cxx=g++ --download-fblaslapack --download-mpich > --with-scalar-type=complex --with-debugging=yes --download-parmetis > --download-metis --download-hdf5 --download-scalapack --download-mumps - > [1]PETSC ERROR: #1 MatCreateSeqAIJWithArrays() at > /Documents/petsc-3.23.3/src/mat/impls/aij/seq/aij.c:5275 > [1]PETSC ERROR: #2 MatMPIAIJGetLocalMat() at > /Documents/petsc-3.23.3/src/mat/impls/aij/mpi/mpiaij.c:5246 > [1]PETSC ERROR: #3 MatConvert_MPIAIJ_MPIDense() at > /Documents/petsc-3.23.3/src/mat/impls/dense/mpi/mpidense.c:1393 > [1]PETSC ERROR: #4 MatConvert() at > /Documents/petsc-3.23.3/src/mat/interface/matrix.c:4485 > [1]PETSC ERROR: #5 MatSchurComplementComputeExplicitOperator() at > /Documents/petsc-3.23.3/src/ksp/ksp/utils/schurm/schurm.c:518 > > > > >
