[petsc-users] DMSWARM particle coordinates per rank

Matthew Knepley knepley at gmail.com
Fri May 12 09:42:21 CDT 2023


On Fri, May 12, 2023 at 10:34 AM Matthew Young <
myoung.space.science at gmail.com> wrote:

> Okay, cool.
> Should I do that by explicitly setting each particle's DMSwarmField_rank
> when I assign its position?
> What role does DMSwarmMigrate play in all of this?
>

If you are using a DMDA or a DMPlex, then PETSc now how to do parallel
point location (at least for neighbors). So if you add particles on the
process which owns that part of the grid, and then call
DMSwarmMigrate(), it will locate every particle, and set the 'rank' and
'cellid' correctly. Then if you move
the particles (change the coordinates) and call DMSwarmMigrate(), it will
move them to the correct process
and reset those entries.

  Thanks,

     Matt


> --Matt
> ==========================
> Matthew Young, PhD (he/him)
> Research Scientist II
> Space Science Center
> University of New Hampshire
> Matthew.Young at unh.edu
> ==========================
>
>
> On Fri, May 12, 2023 at 10:05 AM Matthew Knepley <knepley at gmail.com>
> wrote:
>
>> On Fri, May 12, 2023 at 9:40 AM Matthew Young <
>> myoung.space.science at gmail.com> wrote:
>>
>>> Got it.
>>>
>>> I'm specifically thinking about this in terms of the gather stage of my
>>> PIC code, where I loop over local particles to fill local density and flux
>>> arrays by linearly interpolating particle positions to the grid. The gather
>>> function currently assumes that the coordinates (i.e., the array
>>> representation of DMSwarmPICField_coor) of all particles on a given rank
>>> would correspond to only the global indices owned by that rank, via the
>>> relationship between indices and coordinates in the associated cell DM.
>>> Based on what you described, it sounds like I need to make sure that I
>>> initially lay down the particles so that their rank matches their
>>> coordinates.
>>>
>>
>> Right now, yes. I will fix that before August.
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>> --Matt
>>> ==========================
>>> Matthew Young, PhD (he/him)
>>> Research Scientist II
>>> Space Science Center
>>> University of New Hampshire
>>> Matthew.Young at unh.edu
>>> ==========================
>>>
>>>
>>> On Fri, May 12, 2023 at 5:15 AM Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Thu, May 11, 2023 at 9:15 PM Matthew Young <
>>>> myoung.space.science at gmail.com> wrote:
>>>>
>>>>> Does setting up a PIC-type DMSWARM with an associated cell DM
>>>>> guarantee that each MPI rank will own the particles with coordinates inside
>>>>> the bounds of the portion of the grid it owns?
>>>>>
>>>>
>>>> There is a caveat that we are currently fixing. Swarm communication is
>>>> setup to be nearest neighbor (since there is no coarse grid of
>>>> bounding boxes). So if your particles are initially in the right place, and
>>>> only move nearest neighbor, everything is fine. We are adding a hierarchy
>>>> of bounding boxes so that we can communicate anywhere.
>>>>
>>>>   Thanks,
>>>>
>>>>       Matt
>>>>
>>>>
>>>>> --Matt
>>>>> ==========================
>>>>> Matthew Young, PhD (he/him)
>>>>> Research Scientist II
>>>>> Space Science Center
>>>>> University of New Hampshire
>>>>> Matthew.Young at unh.edu
>>>>> ==========================
>>>>>
>>>>
>>>>
>>>> --
>>>> 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://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>
>> --
>> 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://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
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://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230512/f394bea4/attachment-0001.html>


More information about the petsc-users mailing list