<div dir="ltr"><div dir="ltr">On Wed, Jun 8, 2022 at 12:15 AM Mike Michell <<a href="mailto:mi.mike1021@gmail.com">mi.mike1021@gmail.com</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="ltr">Dear PETSc developer team,<br><br>I am a user of PETSc DMPlex for a finite-volume solver. So far, I have loaded a mesh file made by Gmsh as a DMPlex object without pre-computed solution field. <div>But what if I need to load the mesh as well as solution fields that are computed by other codes sharing the same physical domain, what is a smart way to do that? In other words, how can I load a DM object from a mesh file along with a defined solution field? </div><div>I can think of that; load mesh to a DM object first, then declare a local (or global) vector to read & map the external solution field onto the PETSc data structure. But I can feel that this might not be the best way.<br></div></div></blockquote><div><br></div><div>Here was my idea for this. PetscSection is an abstraction for laying out data over a DMPlex. In parallel, each local Section lays out local data, and a PetscSF points "ghost" mesh points at the owner. From this we can make a _global_ Section automatically that lays out globally consistent data. Thus, in order to match an external layout, you need to:</div><div><br></div><div>1) Match the mesh topology with DMPlex</div><div><br></div><div>2) Match the mesh parallel layout with a PetscSF</div><div><br></div><div>3) Match the local data layout with a PetscSection (might require specifying a permutation of the mesh points to the section)</div><div><br></div><div>Then you should be able to load your data with VecLoad(). Let me know if this is unclear or does not work for you.</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="ltr"><div>Thanks,<br>Mike<br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><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>