In the context of a Navier-Stokes problem consider a mixed function space
mesh = UnitSquareMesh(3, 3)
V2 = VectorElement('P', mesh.ufl_cell(), 2)
P1 = FiniteElement('P', mesh.ufl_cell(), 1)
W = FunctionSpace(mesh, V2 * P1)
and for simplicity
u, _ = TrialFunctions(W)
v, _ = TestFunctions(W)
a = dot(u, v)*dx
A = assemble(a)
I'd like to know if the DOF ordering of the velocity component sub spaces W.sub(0).sub(i)
is known apriori or predicable.
Is there a relationship between the orderings of each velocity component subspace?
For example, with dofs = [W.sub(0).sub(i).dofmap().dofs() for i in range(2)]
I get
dofmap[0] = [0, 1, 4, 5, 9, 10, 15, ...]
dofmap[1] = [2, 6, 7, 11, 12, 13, 16, ...]
In the system matrix $A$ I find in the rows 0, 1, 4, .. the correct entries for the first component of $u$, and of course the rows 2, 6, 7, ... belong to the second component. However, the order is different, i.e., rows 0--2, 1--6, etc, don't match. The ordering of component 1 is identical to dofmap[0], but the ordering of component 2 seems to be: [11, 2, 6, 7, ..]
If I knew the ordering of the dofs w.r.t. $A$ beforehand, I could assemble a scalar sub problem and construct the system matrix by copying the entries of the sub matrix into the correct locations in the system matrix.
Thanks!