[petsc-users] DMSwarm
Dave May
dave.mayhem23 at gmail.com
Fri Mar 25 07:23:01 CDT 2022
Hi,
On Wed 23. Mar 2022 at 18:52, Matthew Knepley <knepley at gmail.com> wrote:
> On Wed, Mar 23, 2022 at 11:09 AM Joauma Marichal <
> joauma.marichal at uclouvain.be> wrote:
>
>> Hello,
>>
>> I sent an email last week about an issue I had with DMSwarm but did not
>> get an answer yet. If there is any other information needed or anything I
>> could try to solve it, I would be happy to do them...
>>
>
> I got a chance to run the code. I believe this undercovered a bug in our
> implementation of point location with DMDA. I will make an Issue.
>
> Your example runs correctly for me if you replace DM_BOUNDARY_GHOSTED with
> DM_BOUNDARY_NONE in the DMDACreate3d.
> Can you try that?
>
The PIC support in place between DMSwarm and DMDA only works when the DA
points define the vertices of a set of quads / hexes AND if the mesh is
uniform, ie you defined the coordinates using SetUniformCoordinates. The
point location routine is very simple.
There is no way for the DA infrastructure to know what the points in the DA
physically represent (Ie vertices, cell centroid or face centroids). The DA
just defines a set of logically order points which can be indexed in an
i,j,k manner.
So if you are using the DA to represent cell centered data then the point
location routine will give incorrect results. Also, the coordinates from
SetUniformCoordinates won’t give you what you expect either if the x0,x1
you provide define the start,end coordinates of the physical boundary, but
you interpret the DA points to be cell centers.
There are several options you can pursue.
1/ Make an independent DMDA which represents the vertices of your mesh. Use
this DA with your DMSwarm.
2/ Provide your own point location routine for your collocated DA
representation.
Thanks,
Dave
> Thanks,
>
> Matt
>
>
>> Thanks a lot for your help.
>>
>> Best regards,
>> Joauma
>>
>> ------------------------------
>> *From:* Joauma Marichal
>> *Sent:* Friday, March 18, 2022 4:02 PM
>> *To:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
>> *Subject:* DMSwarm
>>
>> 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 .
>> 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?
>> 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
>>
>>
>>
>>
>
> --
> 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/20220325/992113b8/attachment.html>
More information about the petsc-users
mailing list