<div dir="ltr"><div>Hi all, </div><div><br></div>I've been having some trouble with what should be a relatively simple update to an immersed boundary CFD solver from PETSc 3.5.4 to 3.6.1<div><br></div><div>I'm getting indefinite PC errors for a simple lid-driven cavity test problem, 32x32 at Re 100</div><div><br></div><div>Under PETSc 3.5.4 using KSPSetNullSpace we used the following to set the null space.  This is for a 2D Poisson system with no immersed boundary and so the null space is the constant vector.<br><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div>  MatNullSpace nsp;</div></div></div><div><div><span style="white-space:pre-wrap">  </span>ierr = MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, NULL, &nsp); CHKERRQ(ierr);</div></div><div><div><span style="white-space:pre-wrap">  </span>ierr = KSPSetNullSpace(ksp2, nsp); CHKERRQ(ierr);</div></div><div><div>  ierr = MatNullSpaceDestroy(&nsp); CHKERRQ(ierr);</div></div></blockquote><div><div><br></div></div><div>And then setup the KSP with</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>  ierr = KSPCreate(PETSC_COMM_WORLD, &ksp2); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetOptionsPrefix(ksp2, "poisson_"); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetOperators(ksp2, QTBNQ, QTBNQ); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetInitialGuessNonzero(ksp2, PETSC_TRUE); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetType(ksp2, KSPCG); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetReusePreconditioner(ksp2, PETSC_TRUE); CHKERRQ(ierr);</div></div><div><div>  ierr = KSPSetFromOptions(ksp2); CHKERRQ(ierr);</div></div></blockquote><div><br></div>The matrix QTBNQ does not change, only the rhs of the system is updated.<br><div><br></div><div>We run this with `-pc_type gamg -pc_gamg_type agg -pc_gamg_agg_nsmooths 1` and everything seems to work as expected.  </div><div><br></div><div>Under PETSc 3.6.1, we change only the KSPSetNullSpace line, to</div><div><br></div><div>  ierr = MatSetNullSpace(QTBNQ, nsp); CHKERRQ(ierr);</div><div><br></div><div>and the same code diverges after 1 timestep and returns a -8 KSP_DIVERGED_INDEFINITE_PC</div><div><br></div><div>This is weird, especially because if we change nsmooths to 2, it runs for 264 timesteps and the returns the same error.  But we have explicitly set KSPSetReusePreconditioner so it should be using the same PC, right?</div><div><br></div><div>Change nsmooths to 3 and it again diverges after 1 timestep.  </div><div><br></div><div>Change nsmooths to 4 and it runs to completion.  </div><div><br></div><div>It seems like either gamg's behavior has changed, or that KSPSetNullSpace was doing something implicitly that we now need to do explicitly in addition to MatSetNullSpace?  </div><div><br></div><div>Thanks, </div><div>Gil Forsyth</div></div>