Hi,
I encountered (what I think is) a weird behaviour regarding the numeration of dofs in the subspaces of a vector space. Running the code below
import dolfinx
import basix
from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
cell_type = dolfinx.mesh.CellType.quadrilateral
mesh = dolfinx.mesh.create_unit_square(comm=comm, nx=2, ny=2, cell_type=cell_type)
e = basix.ufl.element(family="P", cell=mesh.basix_cell(), degree=1)
elem = basix.ufl.mixed_element([e,] * 2)
V = dolfinx.fem.FunctionSpace(mesh, elem)
_, new_to_old_0 = V.sub(0).collapse()
_, new_to_old_1 = V.sub(1).collapse()
print(f"MPI rank: {comm.rank}\n",
f"New to old 0: {new_to_old_0}\n"
f"New to old 1: {new_to_old_1}\n"
)
with 2 MPI processes I get that the degrees of freedom of every subspace are
MPI rank: 0
New to old 0: [0, 1, 2, 6, 8, 10, 12, 13, 16]
New to old 1: [3, 4, 5, 7, 9, 11, 14, 15, 17]
MPI rank: 1
New to old 0: [0, 1, 2, 6, 7, 10, 12, 13, 16]
New to old 1: [3, 4, 5, 8, 9, 11, 14, 15, 17]
For the MPI process 0, the dof 8 corresponds to the first subspace, and the dof 7 to the second subspace.
However, for the MPI process 1 is the opposite. How can it be?
However, if I define the element as a vector element instead of a mixed one, i.e.,
elem = basix.ufl.element(family="P", cell=mesh.basix_cell(), degree=1,
shape=(2,))
the output is
MPI rank: 0
New to old 0: [0, 2, 4, 6, 8, 10, 12, 14, 16]
New to old 1: [1, 3, 5, 7, 9, 11, 13, 15, 17]
MPI rank: 1
New to old 0: [0, 2, 4, 6, 8, 10, 12, 14, 16]
New to old 1: [1, 3, 5, 7, 9, 11, 13, 15, 17]
that makes perfect sense and is analogous to what I get in serial (with either element definition).
Any ideas?
Thanks!
Pablo