<div dir="ltr"><div class="gmail_default" style="font-size:small">You were right, of course. I fixed the problem with the function evaluation and the code seems to be working now, at least on small test problems.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Is there a way to setup preallocation of the Jacobian matrix, with the entire first row and column non-zero? I set the preallocation error flag to false, as you suggested several messages ago, and this was great for testing, but now the first assembly of the Jacobian is terribly slow due to allocating on the fly.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 29, 2017 at 7:07 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@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"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Sun, Oct 29, 2017 at 5:15 PM, zakaryah . <span dir="ltr"><<a href="mailto:zakaryah@gmail.com" target="_blank">zakaryah@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"><div style="font-size:small">Good point, Jed - I feel silly for missing this.</div><div style="font-size:small"><br></div><div style="font-size:small">Can I use -snes_type test -snes_test_display with the Jacobian generated from a DMComposite? When I try, it looks like the finite difference Jacobian is missing all the elements in the row corresponding to the redundant variable, except the diagonal, which is wrong.</div></div></blockquote><div><br></div></span><div>Well, this leads me to believe the residual function is wrong. What the FD Jacobian does is just call the residual</div><div>twice with different solutions. Thus if the residual is different when you perturb the redundant variable, you should</div><div>have Jacobian entries there.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-size:small">I'm not sure my code for setting the submatrices is correct. I'm especially uncertain about the submatrix J_bh, where b is the redundant variable and h is the displacements. This submatrix has only one row, and all of its columns are non-zero. Can its values be set with MatSetValuesLocal, on all processors?</div><div style="font-size:small"><br></div><div style="font-size:small">Is there an example of manually coding a Jacobian with a DMRedundant?</div></div>
</blockquote></span></div><br>I don't think so. We welcome contributions.</div><div class="gmail_extra"><br></div><div class="gmail_extra"> Matt<span class=""><br clear="all"><div><br></div>-- <br><div class="m_-8548016779575546676gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><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">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br></div></div></div></div></div>
</span></div></div>
</blockquote></div><br></div>