[petsc-users] DMSwarm

Mark Adams mfadams at lbl.gov
Wed Mar 23 12:51:40 CDT 2022


On Fri, Mar 18, 2022 at 11:03 AM Joauma Marichal <
joauma.marichal at uclouvain.be> wrote:

> Hello,
>
> I am writing to you as I am trying to implement a Lagrangian Particle
> Tracking method to my eulerian solver that relies on a 3D collocated DMDA.
>
> I have been using examples to develop a first basic code. The latter
> creates particles on rank 0 with random coordinates on the whole domain and
> then migrates them to the rank corresponding to these coordinates.
> Unfortunately, as I migrate I am loosing some particles. I came to
> understand that when I create a DMDA with 6 grid points in each 3
> directions and then set coordinates in between 0 and 1 using
> ,DMDASetUniformCoordinates and running on 2 processors, I obtain the
> following coordinates values on each proc:
> [Proc 0] X = 0.000000 0.200000 0.400000 0.600000 0.800000 1.000000
> [Proc 0] Y = 0.000000 0.200000 0.400000 0.600000 0.800000 1.000000
> [Proc 0] Z = 0.000000 0.200000 0.400000
> [Proc 1] X = 0.000000 0.200000 0.400000 0.600000 0.800000 1.000000
> [Proc 1] Y = 0.000000 0.200000 0.400000 0.600000 0.800000 1.000000
> [Proc 1] Z = 0.600000 0.800000 1.000000 .
>

I am not super familiar with DAs, but it looks like you have a
non-overlapping set of points and Swarm is cell centered and it is getting
confused.


> Furthermore, it appears that the particles that I am losing are (in the
> case of 2 processors) located in between z = 0.4 and z = 0.6. How can this
> be avoided?
>

Yea, I can see that.

Swarm is only tested with Plex meshes. It looks like the abstraction for
DAs does not work.
Swarm has been adding support for regular grids in Plex (not DA) and that
is the direction being developed
You should start with one of the Swarm
examples. src/dm/impls/swarm/tutorials/ex1.c is probably as good a place to
start.
We recommend using command line arguments for specifying the grid size. See
the example tests in the comment at the end of the test file.
(you can do this with code but it is cumbersome and we are moving toward
command line arguments. If you really need to you can add the command line
args to the database in the code.)

Sorry for the delay,
Mark


>
> I attach my code to this email (I run it using mpirun -np 2 ./cobpor).
>
> Furthermore, my actual code relies on a collocated 3D DMDA, however the
> DMDASetUniformCoordinates seems to be working for staggered grids only...
> How would you advice to deal with particles in this case?
>
> Thanks a lot for your help.
>
> Best regards,
> Joauma
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220323/a28fc5f3/attachment.html>


More information about the petsc-users mailing list