<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Sep 10, 2017 at 9:15 AM, Praveen C <span dir="ltr"><<a href="mailto:cpraveen@gmail.com" target="_blank">cpraveen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
<br>
</span>You can use SNESSetJacobian, but DMSNESSetJacobianLocal is more<br>
convenient in my opinion.<br>
<span><br>
> I still have some doubt. If<br>
><br>
> da0 --> for residual<br>
> da1 --> for jacobian<br>
><br>
> I still need to call SNESetDM. So here I pass da0 ? But then how will snes<br>
> know about da1 ?<br>
<br>
</span>This should work.<br>
<br>
DMCreateMatrix(da1, &Jpre);<br>
SNESSetDM(snes, da0);<br>
SNESSetJacobian(snes, NULL, Jpre, NULL, NULL);<br>
DMDASNESSetJacobianLocal(da0, func, ctx);<br>
<br><br></blockquote><div>In the last line above, should it not be da1 ?</div></div></div></div></blockquote><div><br></div><div>No, Jed is saying that using a DA with a wider stencil on that Jacobian is alright as long as</div><div>you do not try to input values outside the more restricted sparsity pattern.</div><div><br></div><div> Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Thanks a lot for the examples.</div><div><br></div><div>Best</div><span class="HOEnZb"><font color="#888888"><div>praveen </div></font></span></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br></div></div></div>
</div></div>