Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix create_submesh by generalising sub index map creation #2890

Merged
merged 110 commits into from
Jan 2, 2024

Conversation

jpdean
Copy link
Member

@jpdean jpdean commented Nov 14, 2023

This PR fixes a problem where sub-meshes can have vertices that are not connected to a cell on the owning process in parallel.

To illustrate, consider the following mesh, which is partitioned across two processes. Blue shading indicates owned entities. Red shading indicates ghost entities. Gray shading indicates entities that are not present on that process. The vertex numbering is local to each process.

mesh

Creating an L-shaped sub-mesh yields the following on main:

main

Note that there is a lone vertex that is not connected to a cell on the process that owns it. This is problematic because we usually perform operations cellwise, and having vertices that are not connected to a cell can yield unexpected results. For example, if a function were to be interpolated on the sub-mesh, any degrees-of-freedom associated with the lone vertex would not be assigned a value on process 0. On process 1, a value would be assigned, but this would be overwritten with a forwards scatter.

This PR changes the submap owners of problematic vertices to avoid this issue, yielding:

pr

The problematic vertex is now owned by process 1 in the submap and has been removed from process 0.

@jpdean
Copy link
Member Author

jpdean commented Nov 14, 2023

I'm not really sure where the best place (or what the best name) is for the new function for creating sub index maps. I've put it in the index map class for the moment, but since it is really only needed for sub-mesh creation, maybe it's better in mesh? Any thoughts would be much appreciated.

@garth-wells garth-wells added this pull request to the merge queue Jan 2, 2024
Merged via the queue into main with commit d89545a Jan 2, 2024
19 checks passed
@garth-wells garth-wells deleted the jpdean/fix_submesh branch January 2, 2024 14:11
jorgensd added a commit to jorgensd/dolfinx_mpc that referenced this pull request Jan 4, 2024
FEniCS/dolfinx#2890
Currently need to rewrite distribute_ghost_data, as it needs all blocks to create the compressed map.
Plan is to add it as extra input
jorgensd added a commit to jorgensd/dolfinx_mpc that referenced this pull request Jan 8, 2024
* Fixes related to
FEniCS/dolfinx#2890
Currently need to rewrite distribute_ghost_data, as it needs all blocks to create the compressed map.
Plan is to add it as extra input

* Resolve issues with global_to_local. See: FEniCS/dolfinx#2963

* Fix option name

* Revert branches

* API changes from: FEniCS/dolfinx#2954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants