<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I’d like to do mesh adaptation in a Newton loop.<div class="">I’m using a SNES with SNESSetFunction and SNESSetJacobian.</div><div class="">My first question is: may the dimension of the linear systems change throughout the nonlinear iterations?</div><div class="">If so, what are the proper things to do? I tried to do as Stefano in MFEM and use MatHeaderReplace <a href="https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3833" class="">https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3833</a> 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?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre</div></div></body></html>