<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 gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Mar 17, 2026 at 4:49 AM Miguel Molinos <<a href="mailto:m.molinos@upm.es">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><p></p><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>