Hi all,
please consider the following code:
import dolfinx
import ufl
mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 1, 1, dolfinx.mesh.CellType.quadrilateral)
V = dolfinx.fem.VectorFunctionSpace(mesh, ("CG", 1))
print(V.dofmap.list)
print(V.sub(0).dofmap.list)
print(V.sub(1).dofmap.list)
fe = ufl.FiniteElement("CG", ufl.quadrilateral, 1)
element = ufl.MixedElement([fe, fe])
W = dolfinx.fem.FunctionSpace(mesh, element)
print(W.dofmap.list)
print(W.sub(0).dofmap.list)
print(W.sub(1).dofmap.list)
The output is (copied from interactive session)
In [49]: V.dofmap.list
Out[49]:
<AdjacencyList> with 1 nodes
0: [0 1 2 3 ]
In [50]: V.sub(0).dofmap.list
Out[50]:
<AdjacencyList> with 1 nodes
0: [0 2 4 6 ]
In [51]: V.sub(1).dofmap.list
Out[51]:
<AdjacencyList> with 1 nodes
0: [1 3 5 7 ]
In [52]: W.dofmap.list
Out[52]:
<AdjacencyList> with 1 nodes
0: [0 1 2 3 4 5 6 7 ]
In [53]: W.sub(0).dofmap.list
Out[53]:
<AdjacencyList> with 1 nodes
0: [0 1 2 3 ]
In [54]: W.sub(1).dofmap.list
Out[54]:
<AdjacencyList> with 1 nodes
0: [4 5 6 7 ]
Remarks/Questions:
- I would have expected an array of length 8 for both
V.dofmap.listandW.dofmap.list - I would have expected the same (local) layout of the dofs for
V.sub(0).dofmap.listandW.sub(0).dofmap.list - Under the hood
basixdefines the finite element and layout of the dofs independent of how the space is constructed? (or does the local ordering of dofs come fromuflin the case of the spaceW?) - Could someone please explain the above findings?
Thanks,
Philipp
PS: I have fenicsx installed via conda-forge:
fenics-basix 0.5.0 py310hbf28c38_0 conda-forge
fenics-dolfinx 0.5.1 py310h117620d_100 conda-forge
fenics-ffcx 0.5.0 pyhb871ab6_1 conda-forge
fenics-libbasix 0.5.0 heb3b609_0 conda-forge
fenics-libdolfinx 0.5.1 hcde13a9_100 conda-forge
fenics-ufcx 0.5.0 hb871ab6_1 conda-forge
fenics-ufl 2022.2.0 pyhd8ed1ab_0 conda-forge