[petsc-users] DMSwarm Initialization on a DMPlex (PIC scheme)
Matthew Knepley
knepley at gmail.com
Sun Mar 29 19:50:42 CDT 2026
On Sun, Mar 29, 2026 at 6:25 PM Miguel Molinos <m.molinos at upm.es> wrote:
> Dear all,
>
> I am experiencing an issue where particles created with DMSwarm are being
> increased across MPI ranks when initializing a DMSwarm over a periodic
> DMPlex. I follow this procedure on every rank:
>
> 1.
>
> Create a sequential vector with the global coordinates of all
> particles (18,000 atoms).
> 2.
>
> Call DMLocatePoints(FE_Mesh, coordinates, DM_POINTLOCATION_NONE,
> &cellSF) to find which particles belong to the local DMPlex partition. Then
> call PetscSFGetGraph.
> 3.
>
> Iterate through the results and add any particle with a valid cell
> index (index != DMLOCATEPOINT_POINT_NOT_FOUND) to the local DMSwarm.
>
> The sum of n_atoms_local across all ranks gives 18,740 instead of the
> expected 18,000. It seems that particles located exactly on periodic
> boundaries or MPI interfaces are being identified as "found" by multiple
> ranks simultaneously. Does DMLocatePoints return points found in ghost/halo
> cells by default when the DMPlex is periodic or distributed with overlap?
>
I do not think this should happen at periodic boundaries, but definitely if
you have cell overlap it will happen. It iterates over all local cells to
check particle location. You could discard those points by checking if the
cell is in the point SF in Step 3.
Thanks,
Matt
> Thanks,
>
> Miguel
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!asSid27diNY8deyJIRO7sClJg5Rp59NAjfq_99WjlYxUYDas8kx6pf9AEu-ySF2VTzFf-cbhEjrxpQSaC54Y$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!asSid27diNY8deyJIRO7sClJg5Rp59NAjfq_99WjlYxUYDas8kx6pf9AEu-ySF2VTzFf-cbhEjrxpX1DgF2Y$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260329/a4c798fd/attachment.html>
More information about the petsc-users
mailing list