[petsc-users] Periodic boundary conditions using swarm

MIGUEL MOLINOS PEREZ mmolinos at us.es
Sun Apr 21 09:06:26 CDT 2024


Thank you Matt, I will definitely do that. Thrilled to add a humble contribution to PETSc :-)

Best,
Miguel

On 21 Apr 2024, at 16:01, Matthew Knepley <knepley at gmail.com> wrote:

On Sun, Apr 21, 2024 at 9:38 AM MIGUEL MOLINOS PEREZ <mmolinos at us.es<mailto:mmolinos at us.es>> wrote:
Dear Matt,

Thank you for your answer. In addition to your suggestion I solved a bug in the test (I was not updating the local size integer during the time loop). Indeed if I turn off periodicity it works. Furthermore, if I use instead DM_BOUNDARY_TWIST instead, it works too.

However, if I turn on DM_BOUNDARY_PERIODIC, I got an error in the search algorithm I implemented for the domain decomposition inspired by (https://urldefense.us/v3/__https://petsc.org/main/src/dm/tutorials/swarm_ex3.c.html__;!!G_uCfscf7eWS!djMj0jtH27HHR56cKhjzc0Kd4_HcjA62WBT1w_w1KFs0TfJQOtFQLA2AexxL7g4rS8aelbmYYFAE9n3wQLSIBA$ ). The algorithm is not capable of finding some of the particles at the initial stage of the simulation (without transport).

Looks like the error is on my end, however it is puzzling why it works for DM_BOUNDARY_TWIST but not for DM_BOUNDARY_PERIODIC.

I usually solve these things by making a simple example. We could make another test in Swarm test ex1 that uses periodicity. If you send a draft over that fails, I can help you debug it. It would make a fantastic contribution to PETSc.

   Thanks,

     Matt

Thanks,
Miguel

On 21 Apr 2024, at 14:53, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:

On Thu, Apr 18, 2024 at 8:23 AM MIGUEL MOLINOS PEREZ <mmolinos at us.es<mailto:mmolinos at us.es>> wrote:
 Dear all, I am working on the implementation of periodic bcc using a discretisation (PIC-style). I am working with a test case which consists on solving the advection of a set of particles inside of a box (DMDA mesh) with periodic bcc on
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd

Dear all,

I am working on the implementation of periodic bcc using a discretisation (PIC-style). I am working with a test case which consists on solving the advection of a set of particles inside of a box (DMDA mesh) with periodic bcc on the x axis.

My implementation updates the position of each particle with a velocity field, afterwards I check if the particle is inside, or not, the supercell (periodic box). If not, I correct the position using bcc conditions. Once this step is done, I call Dmswarmmigrate.

It works in serial, but crashes in parallel with MPI (see attached nohup file). I have checked some of the Dmswarmmigrate examples, and they looks similar to my implementation. However they do not use periodic bcc.

I am missing any step in addition to Dmswarmmigrate?

It does not sound like it. We do have parallel examples of periodic migration, such as Swarm ex9.

What happens if you turn off periodicity and just let particles fall out of the box? Does it still crash?

  Thanks,

    Matt

Best regards
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!djMj0jtH27HHR56cKhjzc0Kd4_HcjA62WBT1w_w1KFs0TfJQOtFQLA2AexxL7g4rS8aelbmYYFAE9n32M1rp2g$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!djMj0jtH27HHR56cKhjzc0Kd4_HcjA62WBT1w_w1KFs0TfJQOtFQLA2AexxL7g4rS8aelbmYYFAE9n05B_V0QA$ >



--
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!djMj0jtH27HHR56cKhjzc0Kd4_HcjA62WBT1w_w1KFs0TfJQOtFQLA2AexxL7g4rS8aelbmYYFAE9n32M1rp2g$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!djMj0jtH27HHR56cKhjzc0Kd4_HcjA62WBT1w_w1KFs0TfJQOtFQLA2AexxL7g4rS8aelbmYYFAE9n05B_V0QA$ >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240421/3554aeb9/attachment.html>


More information about the petsc-users mailing list