<div><div dir="auto"> I agree that you want to adapt around a  converged  solution. I have code that runs time step(s), adapts, Transfers solutions and state,  creates a new TS & SNES, if you want to  clone  that.  It works with PForest, but Toby and Matt are working on  these abstractions so it might not be the most up to date. If there are more up-to-date examples I would like to know about it also.</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 3:47 PM Jed Brown via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov">petsc-dev@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pierre Jolivet via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>> writes:<br>
<br>
> I am just adapting the mesh depending on the solution from the previous SNESSolve.<br>
> At first, I wanted to avoid writing an outer loop around the SNESSolve, so I thought, let’s put the adaptation in the SNESSetJacobian.<br>
> It would have been preferable because it would have required fewer lines of code (as I had imagined this to work), that’s the main reason. I understand this is too much to ask of PETSc to continue working without any further information from the application.<br>
<br>
SNES wants to be able to connect norms and differences between vectors<br>
at different iterations (e.g., rtol and stol).  I would just loop around<br>
SNESSolve for what you want.  Note that it may be fragile to adapt in<br>
early Newton iterations if globalization is a challenge for your<br>
problem.<br>
</blockquote></div></div>