Hi all,
in dolfinx, will all collapsed subspaces of a VectorFunctionSpace
have the same DOF ordering in parallel?
Context: I have a vectorial PDE where, if written component-wise, all vector components have the same LHS matrix. For efficiency, I want to solve for the components separately, i.e., solve d small N\times N problems with the same linear operator (edited for clarity) instead of one expensive Nd\times Nd solve
A simple example seems to assert that this is the case, but am I safe to assume generality here?
from dolfinx import mesh, fem
from mpi4py import MPI
import numpy as np
N = 16
mesh = mesh.create_unit_cube(MPI.COMM_WORLD, N, N, N)
V = fem.VectorFunctionSpace(mesh, ("CG", 1))
spaces = []
for i in range(V.num_sub_spaces):
space_i, _ = V.sub(i).collapse()
spaces.append(space_i)
# "scalar" function space
Vc = fem.FunctionSpace(mesh, ("CG", 1))
# check if DOF ordering looks the same...
assert np.allclose(
spaces[0].tabulate_dof_coordinates(), spaces[1].tabulate_dof_coordinates()
)
assert np.allclose(
spaces[0].tabulate_dof_coordinates(), spaces[2].tabulate_dof_coordinates()
)
assert np.allclose(spaces[0].tabulate_dof_coordinates(), Vc.tabulate_dof_coordinates())
assert spaces[0].dofmap.list == spaces[1].dofmap.list == spaces[2].dofmap.list
assert spaces[0].dofmap.list == Vc.dofmap.list
A similar question was asked here but for legacy fenics: Dof ordering: VectorFunctionSpace sub(0) vs. FunctionSpace
Thanks!