<p dir="ltr">I'll open a pull request</p>
<div class="gmail_quote">Il 01/ott/2015 10:28 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> ha scritto:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  Matt is at least partially right, having this as a SNESType is questionable. It is actually a specific nonlinear preconditioner PLUS a specific set of options for the NewtonLS SNES method. I also understand why Peter did it this way because there is no clean "other way" to provide this functionality that is not ad hoc.<br>
<br>
  I think the correct short term fix is to add a SNESDestroy_ASPIN() that does delete the npc and then calls the SNESDestroy_NewtonLS()<br>
<br>
  Stefano,<br>
<br>
    Are you willing to make a pull request or patch to do this?<br>
<br>
   Thanks for letting us know about this problem<br>
<br>
  Barry<br>
<br>
<br>
> On Oct 1, 2015, at 12:43 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
><br>
> On Thu, Oct 1, 2015 at 7:42 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br>
> I just noticed that the behaviour of a code like this<br>
><br>
> SNESSetType(snes,SNESASPIN)<br>
> SNESSetFromOptions(snes)<br>
><br>
> is not the same as<br>
><br>
> SNESSetType(snes,SNESNEWTONLS)<br>
> SNESSetFromOptions(snes)<br>
><br>
> when -snes_type newtonls is specified at command line. In both cases, the snes will be of type SNESNEWTONLS, but in the first case, the snes object will also have a nonlinear preconditioner embedded in, since SNESASPIN creates snes->pc, and there's no SNESDestroy_ASPIN.<br>
><br>
> What is the correct approach to fix this? Should the nonlinear preconditioner be destroyed by the SNESSetType interface or by the specific implementation of ASPIN?<br>
><br>
> I wish Peter had not done it this way. His reason was that a special Jacobian action can be defined for<br>
> Newton -L NASM, but we should just do this with a flag rather than a new SNES type.<br>
><br>
>    Matt<br>
><br>
><br>
> --<br>
> Stefano<br>
><br>
><br>
><br>
> --<br>
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
> -- Norbert Wiener<br>
<br>
</blockquote></div>