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?

Thanks,
Pierre

Reply via email to