<div dir="ltr"><div dir="ltr">On Fri, Dec 9, 2022 at 10:51 AM Hongrui Yu <<a href="mailto:yuhongrui@utexas.edu" target="_blank">yuhongrui@utexas.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr"></div><div dir="ltr"><div dir="ltr">Thank you for your reply! Unfortunately yes.. I’ll need to modify stiffness between nodes on the boundary so most of them are going to be in completely general location. </div></div></div></blockquote><div><br></div><div>Hmm, there is usually a better way to do this. This is a mesh and discretization dependent way to impose boundary conditions. However, it is possible.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr"><div dir="ltr">I can create an IS after distribution using DMPlexCreatePointNumbering() but they are Global numbering. Is there a way to get a map from Natural numbering to Global numbering? I assume this is used somewhere in DMPlexNaturalToGlobal()? This way I can find the correct entry to modify. </div></div></div></blockquote><div><br></div><div>You can get the SF that maps global vectors to natural vectors:</div><div><br></div><div>  <a href="https://petsc.org/main/docs/manualpages/DM/DMGetNaturalSF/" target="_blank">https://petsc.org/main/docs/manualpages/DM/DMGetNaturalSF/</a></div><div><br></div><div>and pull out the information</div><div><br></div><div>  <a href="https://petsc.org/main/docs/manualpages/PetscSF/PetscSFGetGraph/" target="_blank">https://petsc.org/main/docs/manualpages/PetscSF/PetscSFGetGraph/</a></div><div><br></div><div>The roots should be global dofs and the leaves should be natural dofs. So you look through the ilocal leaves</div><div>for your natural dof and the corresponding remote will be your global dof (but the local number, so you would</div><div>have to add the rStart to make it a true global dof).</div><div><br></div><div>  Thanks,</div><div><br></div><div>     MAtt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr"><div dir="ltr">Thanks,</div><div dir="ltr">Kevin</div></div><div dir="ltr"><br><blockquote type="cite">On Dec 9, 2022, at 09:10, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Thu, Dec 8, 2022 at 6:06 PM Hongrui Yu <<a href="mailto:yuhongrui@utexas.edu" target="_blank">yuhongrui@utexas.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="EN-US"><div><p class="MsoNormal">Hello! I’m trying to adapt a serial Finite Element code using PETSc. In this code it reads in special stiffness terms between the boundary DoFs from an input file, and add them to corresponding locations in the global Jacobian matrix.</p></div></div></div></blockquote><div><br></div><div>Hmm, so in completely general locations, or on the diagonal?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="EN-US"><div><p class="MsoNormal"> I currently use a DM Plex object to store the mesh information. My understanding is that once the DM is distributed its points are renumbered across different ranks.</p></div></div></div></blockquote><div><br></div><div>That is true.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="EN-US"><div><p class="MsoNormal"> I wonder if there is a good way to find the corresponding entries that needs to be modified in the global Jacobian matrix? <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">For Vectors I’m currently creating a Natural Vector and simply do DMPlexNaturalToGlobal. Is there a way to create a “Natural Mat” just like “Natural Vector” and then do some sort of NaturalToGlobal for this Mat? <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Any help would be highly appreciated!</p></div></div></div></blockquote><div><br></div><div>If it is completely general, this will take some coding.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div lang="EN-US"><div><p class="MsoNormal">Kevin<u></u><u></u></p></div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><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.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</div></blockquote></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><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.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>