[petsc-dev] SNESSolve and changing dimensions

Pierre Jolivet pierre.jolivet at enseeiht.fr
Wed Apr 3 04:43:33 CDT 2019

I’d like to do mesh adaptation in a Newton loop.
I’m using a SNES with SNESSetFunction and SNESSetJacobian.
My first question is: may the dimension of the linear systems change throughout the nonlinear iterations?
If so, what are the proper things to do? I tried to do as Stefano in MFEM and use MatHeaderReplace https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3833 <https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3833> inside the function supplied to SNESSetJacobian, but I end up with a [0]PETSC ERROR: PCApply() line 455 in petsc/src/ksp/pc/interface/precon.c Preconditioner number of local rows 6561 does not equal resulting vector number of rows 1681 further down the road. Should I also call something like VecHeaderReplace (which apparently does not exist) on the residual Vec?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190403/363d725e/attachment.html>

More information about the petsc-dev mailing list