This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Are there only two allowed orders of degrees of freedom?

+4 votes

Are there only two allowed orders of degrees of freedom, that depend on parameters.reorder_serial_dofs=True/False, in the case of a three-dimensional vector function space?

More precisely, for a three-dimensional vector field m (with components mx1, my1, and mz1 at mesh node 1, components mx2, my2, and mz2 at mesh node 2, etc.) with parameters.reorder_serial_dofs=True, the order of degrees of freedom m.vector().array() is:

[mx1, my1, mz1, mx2, my2, mz2, mx3, my3, mz3, ….],

where vector components at every mesh node are grouped together. On the other hand, if parameters.reorder_serial_dofs=False, the order does not assume that vector components at every node are grouped together, but it becomes:

[mx1, mx2, mx3, … my1, my2, my3, … mz1, mz2, mz3, …]

where values of a single vector component at all mesh nodes are grouped together.

These two orders can be seen by changing the parameters.reorder_serial_dofs=True/False in the following code:

import dolfin as df

df.parameters.reorder_dofs_serial = True

mesh = df.IntervalMesh(4, 1, 5)
fspace = df.VectorFunctionSpace(mesh, 'CG', 1, 3)
expression = df.Expression(['x[0]+0.1', 'x[0]+0.2', 'x[0]+0.3'])
f = df.interpolate(expression, fspace)

print f.vector().array()

The expression in this code is chosen so that the number before the decimal point denotes the mesh node and a number after the decimal point determines the component of a vector field.

For reorder_dofs_serial=True, I get:

[ 5.1 5.2 5.3 4.1 4.2 4.3 3.1 3.2 3.3 2.1 2.2 2.3 1.1 1.2 1.3]

and for reorder_dofs_serial=False, I obtain:

[ 1.1 2.1 3.1 4.1 5.1 1.2 2.2 3.2 4.2 5.2 1.3 2.3 3.3 4.3 5.3]

The question is: Are there any cases with neither of these two orders?

asked Feb 4, 2015 by mb1a15 FEniCS Novice (260 points)

1 Answer

+1 vote

parameters["dof_ordering_library"] can be either one of "Boost", "SCOTCH" or "random". Try it out in combination with parameters["reorder_dofs_serial"]=True.

answered Feb 5, 2015 by mikael-mortensen FEniCS Expert (29,340 points)