[petsc-dev] FieldSplit with different nonzero pattern

Pierre Jolivet pierre.jolivet at enseeiht.fr
Thu May 3 01:25:38 CDT 2018


Hello,
I’m trying something like:
1) create a Mat
2) setup a KSP and PCFIELDSPLIT
3) change the sparsity pattern of the Mat for one of the field
4) do a KSPSolve
I cannot change this calling sequence, because I’d like to nest 3) and 4) inside a loop.
However, I end up with this error during 4):
[0]PETSC ERROR: Nonconforming object sizes
[0]PETSC ERROR: Cannot reuse matrix. wrong no of nonzeros
[0]PETSC ERROR: Petsc Development GIT revision: v3.9-13-g05d412bc58  GIT Date: 2018-04-09 08:39:52 -0500

[0]PETSC ERROR: #1 MatCreateSubMatrix_SeqAIJ() line 2330 in /Users/jolivet/Documents/repositories/petsc/src/mat/impls/aij/seq/aij.c
[0]PETSC ERROR: #2 MatCreateSubMatrix_MPIAIJ_SameRowColDist() line 3184 in /Users/jolivet/Documents/repositories/petsc/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #3 MatCreateSubMatrix_MPIAIJ() line 3310 in /Users/jolivet/Documents/repositories/petsc/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #4 MatCreateSubMatrix() line 7813 in /Users/jolivet/Documents/repositories/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: #5 PCSetUp_FieldSplit() line 564 in /Users/jolivet/Documents/repositories/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c
[0]PETSC ERROR: #6 PCSetUp() line 923 in /Users/jolivet/Documents/repositories/petsc/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: #7 PCApply() line 453 in /Users/jolivet/Documents/repositories/petsc/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: #8 KSP_PCApply() line 276 in /Users/jolivet/repo/petsc/include/petsc/private/kspimpl.h
[0]PETSC ERROR: #9 KSPFGMRESCycle() line 166 in /Users/jolivet/Documents/repositories/petsc/src/ksp/ksp/impls/gmres/fgmres/fgmres.c
[0]PETSC ERROR: #10 KSPSolve_FGMRES() line 291 in /Users/jolivet/Documents/repositories/petsc/src/ksp/ksp/impls/gmres/fgmres/fgmres.c
[0]PETSC ERROR: #11 KSPSolve() line 669 in /Users/jolivet/Documents/repositories/petsc/src/ksp/ksp/interface/itfunc.c

Is this the expected behaviour? Would you need a MWE?
What I find funny is that if I turn -info on, then just before the error, I get:
[0] PCSetUp(): Setting up PC with different nonzero pattern
So why is it trying to reuse the matrix? I am missing a call to some function?

Thanks in advance,
Pierre


More information about the petsc-dev mailing list