<div dir="ltr"><div dir="ltr">On Mon, Oct 30, 2023 at 5:37 AM onur.notonur via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</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 style="font-family:Arial,sans-serif;font-size:14px"></div><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:Arial,sans-serif;font-size:14px;line-height:normal;font-weight:400"></span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">Hi,</span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">I hope this message finds you all in good health and high spirits.</span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">I wanted to discuss an approach problem input file reading/processing in a solver which is using PETSc DMPlex. In our team we have a range of solvers, they are not built on PETSc except this one, but they all share a common problem input format. This format includes essential data such as node coordinates, element connectivity, boundary conditions based on elements, and specific metadata related to the problem. </span><span style="font-family:"Trebuchet MS",sans-serif">I create an array for boundary points on each rank and utilize them in our computations, I am doing it hardcoded currently but I need to start reading those input files, But I am not sure about the approach. </span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif">Here's what I have in mind:</span></p><ol style="border:0px solid rgb(217,217,227);box-sizing:border-box;list-style:none;margin:1.25em 0px;display:flex"><li style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin-bottom:0px;margin-top:0px;padding-left:0.375em;display:block;min-height:28px;font-family:"Trebuchet MS",sans-serif;font-size:14px;font-weight:400"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">- Begin by reading the node coordinates and connectivity on a single core.</span><div style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin-bottom:0px;margin-top:0px;padding-left:0.375em;min-height:28px;font-family:"Trebuchet MS",sans-serif;font-size:14px;font-weight:400"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">- Utilize the DMPlexCreateFromCellListPetsc() function to construct the DMPlex.</span></div><div style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin-bottom:0px;margin-top:0px;padding-left:0.375em;min-height:28px;font-family:"Trebuchet MS",sans-serif;font-size:14px;font-weight:400"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">- Distribute the mesh across processors.</span></div><div style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin-bottom:0px;margin-top:0px;padding-left:0.375em;min-height:28px;font-family:"Trebuchet MS",sans-serif;font-size:14px;font-weight:400"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">- Proceed to read and process the boundary conditions on each processor. If the global index of the boundary element corresponds to that processor, we process it; otherwise, we pass.</span></div></li></ol><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">Additionally, maybe I need to reorder the mesh. In that case I think I can use the point permutation IS obtained from the DMPlexGetOrdering() function while processing boundary conditions.</span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">Also I have another approach in my mind but I don't know if it's possible: Read/construct DMPlex on single core including boundary conditions. Store BC related data in Vec or another appropriate data structure. Then distribute this BC holding data structure too as well as DMPlex. </span></p></blockquote><div>This is by far the easier approach. If you do not have meshes that are too big to load in serial, I would do</div><div>this. Here is what you do:</div><div><br></div><div> - Read in the mesh onto 1 process</div><div> - Mark the boundary conditions, probably with a DMLabel</div><div> - Make a Section over the mesh indicating what data you have for BC</div><div> - Create a Vec from this Section and fill it with boundary values (DMCreateGlobalVector)</div><div> - Distribute the mesh, and keep the point SF (DMPlexDIstribute)</div><div> - Create a BC SF from the points SF (PetscSFCreateSectionSF)</div><div> - DIstribute the BC values using the BC SF (PetscSFBcast)</div><div> </div><div> Thanks,</div><div><br></div><div> Matt</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif">I would greatly appreciate your thoughts and any suggestions you might have regarding this approach. </span><span style="font-family:"Trebuchet MS",sans-serif">Looking forward to hearing your insights.</span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif;font-size:14px;line-height:normal;font-weight:400">Best regards,</span></p><p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px"><span style="font-family:"Trebuchet MS",sans-serif">Onur</span></p><div><div><span style="font-family:Arial,sans-serif;font-size:14px;line-height:normal;font-weight:400"></span>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><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>