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

Generalised topology construction (#2306) yields invalid partitioning for simple mesh #2374

Open
anzil opened this issue Sep 24, 2022 · 2 comments
Labels
bug Something isn't working high-priority

Comments

@anzil
Copy link
Contributor

anzil commented Sep 24, 2022

For a simple mesh (4 nodes, 3 cells, gdim=3, tdim=1) the partitioning using #2306 results in

  • an invalid global size of the index map for selected topological dimensions,
  • incorrect global indices in the index map for selected topological dimensions

as demonstrated in the minimal example below.

import dolfinx
import ufl
import numpy as np
from mpi4py import MPI

comm = MPI.COMM_WORLD

#         (3)
#          |
#          |[2]
#          |
# (1)-----(0)-----(2)
#     [0]     [1]

if comm.rank == 0:
	coord = np.array([[0.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [+1.0, 0.0, 0.0], [0.0, +1.0, 0.0]])
	cells = np.array([[0, 1], [0, 2], [0, 3]])
else:
	coord = np.ndarray((0, 3))
	cells = np.ndarray((0, 2))

ufl_cell = ufl.Cell("interval", geometric_dimension=3)
ufl_elem = ufl.FiniteElement("Lagrange", ufl_cell, 1)
ufl_mesh = ufl.Mesh(ufl.VectorElement(ufl_elem))

mesh = dolfinx.mesh.create_mesh(comm, cells, coord, ufl_mesh)

for tdim in range(mesh.topology.dim + 1):
	imap = mesh.topology.index_map(tdim)
	lidx = np.arange(imap.size_local, dtype=np.int32)
	size = imap.size_global
	gidx = imap.local_to_global(lidx)
	print(f"(tdim={tdim}, rank={comm.rank}): size_global = {size}, global_indices = {gidx}")

Before the changes in #2306:

dolfinx@136aa0acdeeb7e29b336949ad9ed8537237f5f88# mpirun -n 2 python3 mfe.py 
(tdim=0, rank=0): size_global = 4, global_indices = [0]
(tdim=1, rank=0): size_global = 3, global_indices = [0]
(tdim=0, rank=1): size_global = 4, global_indices = [1 2 3]
(tdim=1, rank=1): size_global = 3, global_indices = [1 2]

After the changes in #2306:

dolfinx@dfbcb44ad7e109a3367f8e7c0f973487f58eafbe# mpirun -n 2 python3 mfe.py 
(tdim=0, rank=0): size_global = 5, global_indices = [0 1]
(tdim=1, rank=0): size_global = 3, global_indices = [0]
(tdim=0, rank=1): size_global = 5, global_indices = [2 3 4]
(tdim=1, rank=1): size_global = 3, global_indices = [1 2]

For tdim=0 (nodes) size_global is wrong (5!=4) and global indices contain invalid entries.

@michalhabera michalhabera added bug Something isn't working high-priority labels Oct 4, 2022
@garth-wells
Copy link
Member

@chrisrichardson do you have a fix for this?

@jorgensd
Copy link
Sponsor Member

A suggested fix for this issue has been outlined in: #3063 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants