<div dir="ltr"><div dir="auto">Thanks Stefano, I will try what you suggest.<div dir="auto"><br></div><div dir="auto"><div class="gmail_default" style="font-size:small">​Matt - my DM is a composite between the redundant field (loading coefficient, which is included in the Newton solve in Riks' method) and the displacements, which are represented by a 3D DA with 3 dof.  I am using finite difference.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Probably my problem comes from confusion over how the composite DM is organized.  I am using FormFunction()​, and within that I call DMCompositeGetLocalVectors(), DMCompositeScatter(), DMDAVecGetArray(), and for the Jacobian, DMCompositeGetLocalISs() and MatGetLocalSubmatrix() to split J into Jbb, Jbh, Jhb, and Jhh, where b is the loading coefficient, and h is the displacements).  The values of each submatrix are set using MatSetValuesLocal().</div><br></div><div dir="auto"><div class="gmail_default" style="">​I'm most suspicious of the part of the Jacobian routine where I calculate the rows of Jhb, the columns of Jbh, and the corresponding values.  I take the DA coordinates and ix,iy,iz, then calculate the row of Jhb <font face="arial, helvetica, sans-serif" style="background-color:rgb(255,255,255)" color="#000000">as <span style="font-variant-ligatures:no-common-ligatures">((((iz-info->gzs)*info->gym + (iy-info->gys))*info->gxm + (ix-info->gxs))*info->dof+c), where info is the DA local info and c is the degree of freedom.  The same calculation is performed for the column of Jbh.  I suspect that the indexing of the DA vector is not so simple, but I don't know for a fact that I'm doing this incorrectly nor how to do this properly.</span></font></div>







<br></div><div class="gmail_default" style="font-size:small">​Thanks for all the help!​</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Nov 9, 2017 8:44 AM, "Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail-m_2470016285204138910quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail-m_2470016285204138910quoted-text"><div class="gmail_quote">On Thu, Nov 9, 2017 at 12:14 AM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:small">Well the saga of my problem continues.  As I described previously in an epic thread, I'm using the SNES to solve problems involving an elastic material on a rectangular grid, subjected to external forces.  In any case, I'm occasionally getting poor convergence using Newton's method with line search.  In troubleshooting by visualizing the residual, I saw that in data sets which had good convergence, the residual was nevertheless significantly larger along the boundary between different processors.  Likewise, in data sets with poor convergence, the residual became very large on the boundary between different processors.  The residual is not significantly larger on the physical boundary, i.e. the global boundary.  When I run on a single process, convergence seems to be good on all data sets.</div><div style="font-size:small"><br></div><div style="font-size:small">Any clues to fix this?</div></div>
</blockquote></div><br></div>It sounds like something is wrong with communication across domains:</div><div class="gmail_extra"><br></div><div class="gmail_extra"> - If this is FEM, it sounds like you are not adding contributions from the other domain to shared vertices/edges/faces</div><div class="gmail_extra"><br></div><div class="gmail_extra"> - If this is FDM/FVM, maybe the ghosts are not updated</div><div class="gmail_extra"><br></div><div class="gmail_extra">What DM are you using? Are you using the Local assembly functions (FormFunctionLocal), or just FormFunction()?</div><div class="gmail_extra"><br></div><div class="gmail_extra">  Thanks,</div><div class="gmail_extra"><br></div><div class="gmail_extra">     Matt<font color="#888888"><br clear="all"><div><br></div>-- <br><div class="gmail-m_2470016285204138910m_-3138981748669768095gmail_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/~k<wbr>nepley/</a><br></div></div></div></div></div>
</font></div></div>
</blockquote></div><br><br></div></div>
</div>