On Wed, Sep 30, 2026 at 8:31 PM Noam T. via petsc-users <
[email protected]> wrote:
> Hello,
>
> I'm running into the issue of not being able to handle boundary conditions
> properly in a distributed DM(Plex).
>
> The DMPlex is built from a mesh file and distributed:
>
> DMCreate(PETSC_COMM_WORLD, &dm)
> DMSetType(&dm, DMPLEX)
> DMSetFromOptinos(...)
> ...
> DMPlexDistribute(dm, 0, NULL, %dm_d)
> ...
>
> This DM also contains some user-defined labels, used for applying BC.
> These labels are also distributed, so they exist in some rank(s) but not in
> other(s).
>
> Then a section is created with DMPlexCreateSection, where the IS input
> arguments bcComps, bcPoints are built with ISCreateGeneral(PETSC_COMM_SELF,
> ...), somewhat following the tutorial plex/tutorials/ex1f90.F90.
>
> Finally boundary condition values are written to different Vecs by getting
> an array VecGetArray() and writing into the appropriate entry (DoF) which
> is computed based on the DoFs and offsets (PetscSectionGetFieldDof(),
> PetscSectionGetFieldOffset()):
>
> loop through labels
> loop through points in labels
> compute entry with dof/offset
> write value
>
> A vertex belonging to more than one MPI rank gets, from the loop above,
> the right BC value from some rank(s), but not other(s); understandably, I
> believe, given that the labels and sections are local.
>
I might need another round of explanation to understand the problem.
However, this sounds like a pattern I use
everywhere in the examples. In fact, you can see it by running a parallel
test from SNES ex12 or ex13. The boundary
is marked using the label "marker". Vertices are indeed shared between
ranks. When distributed, the marker label marks the vertex on all processes.
Oh, I think I know what is going on. When automatically distributing
labels, I want all processes to possess each label, even if it is empty.
This prevents a lot of communication to establish who owns which label.
Does this fix it?
Thanks,
Matt
> Is there a way to address this issue?
>
>
> - Build the sections differently? ISCreateGeneral does not work with
> PETSC_COMM_WORLD.
>
>
> - Perform some rank communication after setting up each rank's section?
>
>
> - Distribute labels to all ranks? Seems redundant, various ranks
> building the same Vec entries; but it could be a solution.
>
>
> - Update Vecs after building from the loop above (LocalToGlobal or
> similar)? Cannot use ADD_VALUES (vertex can belong to more than one rank);
> does INSERT_VALUES work when ranks have different values?
>
>
>
> Thank you,
>
> ---
> N.
>
--
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!dHU8ZT5vtHdIeWMRorr_zWctn7k4Wj_mD5RX31x9w_iF9E4xqaJ7aHm2Kt_79JT4N4Bkh7dVMwLPij1VZ3Nx$
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!dHU8ZT5vtHdIeWMRorr_zWctn7k4Wj_mD5RX31x9w_iF9E4xqaJ7aHm2Kt_79JT4N4Bkh7dVMwLPik7aGW0w$
>