<div dir="ltr"><div dir="ltr">On Tue, Mar 17, 2026 at 11:22 AM Miguel Molinos <<a href="mailto:m.molinos@upm.es">m.molinos@upm.es</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><p>Hi Matt and Mark,</p><p>Thank you for the feedback.</p></div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><div>A disadvantage is that you have to work harder to get structured variable access, which DMDA has</div><div>automatically. Depending on your discretization on this grid, this can be restored, but it is some work.</div></div></div></blockquote><br></div><div>I’ve been trying to avoid DMPlex because I find harder to create ghost particles (define padding regions) using an unstructured mesh.</div></div></blockquote><div><br></div><div>Oh, you can make DMPlex be geometrically structured very easily. So this should not be a problem.</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> Regarding variable access, this is not a limitation since I use the background mesh for domain decomposition purposes. The particles carry al the information. </div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote">What does the algorithm look like?</div></div></blockquote></div><div><br></div><div>My code reproduces interaction between atoms (some sort of MD). The purposes of the mesh are:</div><div>- Create a domain decomposition</div><div>- Particle migration</div><div>- Definition of boundary conditions (it can works like a supercell)</div></div></blockquote><div><br></div><div>Oh, cool. DMPlex should be very easy then. You just create a BoxMesh (I ould probably do it from the command line), and then have it load balanced exactly as Mark said. I can help you if anything does not make sense.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt </div><div><br></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>Thanks,</div>Miguel<br id="m_860318695598450246lineBreakAtBeginningOfMessage">
<div><br><blockquote type="cite"><div>On 17 Mar 2026, at 15:11, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><div dir="ltr">On Tue, Mar 17, 2026 at 8:53 AM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:</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">This tool works at the Mat level so it does not matter, but you need to work at the DM level anyway.<div><br></div><div>I don't know of DM tools for this. Let Matt chime in.</div></div></blockquote><div><br></div><div>Hi Miguel,</div><div><br></div><div>DMPlex can definitely do point location and load balancing, which is an advantage.</div><div><br></div><div>A disadvantage is that you have to work harder to get structured variable access, which DMDA has</div><div>automatically. Depending on your discretization on this grid, this can be restored, but it is some work.</div><div><br></div><div>What does the algorithm look like?</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 class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 17, 2026 at 7:54 AM Miguel Molinos <<a href="mailto:m.molinos@upm.es" target="_blank">m.molinos@upm.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Thank you Mark. Indeed my question was oriented towards the tools PETSc can offer to address this problem. Currently I’m using DMDA, perhaps DMPlex is more suited?<div><br></div><div>Thanks,</div><div>Miguel <br id="m_860318695598450246m_-4370459482160046613m_-5834073221460845857lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 17 Mar 2026, at 12:17, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:</div><br><div><div dir="ltr">Hi Miguel,<div><br></div><div>This is a common problem. To my knowledge you need to deal with it on your side, but PETSc does have tools to help.</div><div>I would look in the literature to get ideas and acclimate yourself to the problem.</div><div><br></div><div>The tool that PETSc has is you can repartition your mesh. Create a dual graph (any petsc examples?) put weights on the "vertice" (now elements, use particle count) and repartition.</div><div>I am not sure of the best way to proceed from here ... you could create a new DMSwarm with this new "cell" DM and add particles from the old to the new, delete the old, call DMMigrate on the new DMSwarm and that will do the moving that we want.</div><div><br></div><div>Others will probably be able to add to this.</div><div><br></div><div>Thanks,</div><div>Mark</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 17, 2026 at 4:49 AM Miguel Molinos <<a href="mailto:m.molinos@upm.es" target="_blank">m.molinos@upm.es</a>> wrote:<br></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><br></div><p>Dear all,</p><p>I am currently running a PIC-like implementation based on DMSwarm and DMDA. In my setup, a particle (DMSwarm) discretization represents, for example, a sphere placed at the center of a box-shaped domain discretized with a regular mesh (DMDA).</p><p>The implementation uses both MPI and OpenMP to accelerate the computations. The domain decomposition of the sphere follows a PIC-like approach: each particle is assigned to a rank based on the mesh element it belongs to, and thus inherits the rank that “owns” that element. This is essentially the same strategy used in one of the PETSc examples.</p><p>However, I have observed that, for certain configurations, some ranks end up with very few or even no particles, which leads to load imbalance.</p><p>Has anyone experienced a similar issue?</p><p>Thanks,<br>Miguel</p></div></blockquote></div></div></blockquote></div><br></div></div></blockquote></div></blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">--<span> </span></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="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!D9dNQwwGXtA!XQaHU8QofqUHo3OrZh_T1a_rkDNzGmL18ailuPFZfek-dHvrLo4HiFJ8XH3WdyrAEaDXZ3jXldET3SA$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a></div></div></div></div></div></div></div></div></div></blockquote></div><br></div></blockquote></div><div><br clear="all"></div><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="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!fxCuWHIJfQQ5W0v9jYacL1OPdsqwr4qqwdne4wySjXMGM-MKEwlo8jFf1PUQEmKP9bG9bzY3RLxoCMIkYhLt$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>