[petsc-dev] SNESSolve and changing dimensions

Matthew Knepley knepley at gmail.com
Wed Apr 3 06:51:29 CDT 2019

On Wed, Apr 3, 2019 at 5:43 AM Pierre Jolivet via petsc-dev <
petsc-dev at mcs.anl.gov> wrote:

> 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?

No. Everything we do is algebraic right now. You would have to reformulate
Newton in
some Banach space, and make sure all the measures you were using were
independent. Then you could allow the underlying linear algebra to change,
but you would
need operations for projecting the the new space, making BC in the new
space, etc. There
is a lot of machinery in the continuous space that PETSc does not have.

It sounds like it should be setup as an FAS.



> 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 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

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190403/391d061a/attachment.html>

More information about the petsc-dev mailing list