Problems when using tabulate_dof_coordinates() in parallel computing

When I try the following code for parallel computing with mpirun. I get the error message like “ValueError: cannot reshape array of size 13677 into shape (9261,3)” for the last line of the code. It works fine when parallel computing is not used, but it seems tabulate_dof_coordinates() gives wrong output for parallel computing.

mesh = BoxMesh(Point(0.0,0.0,0.0), Point(0.002,0.002,0.002),20,20,20)
V = VectorElement(“CG”, mesh.ufl_cell(), 1)
Q = FiniteElement(“CG”, mesh.ufl_cell(), 1)

W=FunctionSpace(mesh, V* Q)
T = FunctionSpace(mesh, ‘CG’, 1)
dof_x = T.tabulate_dof_coordinates().reshape(T.dim(),mesh.geometry().dim())

The output is as expected, as the degrees of freedom are distributed on different processors, and therefore you can’t use the global mesh dimension. Why do you need to reshape the dofs?

Thanks. I think I may not be familiar with parallel computing in Fenics. Is there any tutorial I can start with? I cannot find examples online

Most things in dolfin work naturally in parallel. It depends on what you want to do with the dog coordinates. In general, you can use MPI4PY to scatter and gather data.