# Speed up DG FunctionSpace evalutation [closed]

today I tried some evaluation on a DG function space (Fenics 1.2.0). In my calculations I need to use meshes with a large number of cells (~10mio). At the moment it takes a very long time to create a DG function space (in my distinct case a vector function space) for meshes which contains many cells. For example:

from dolfin import *
set_log_level(DEBUG)
mesh = UnitCubeMesh(100,100,100)
H13 = VectorFunctionSpace(mesh, "DG", 1)


A CG function space takes around about 20 seconds for creation. For DG I aborted the job after 10 minutes. For another mesh I waited more than one hour without termination. Is there a way to speed up the DG function space creation.

• I believe this is a bug in 1.2.0, and I have experienced the same thing myself. I believe the bug has been fixed, and that if you upgrade to a more recent version (using e.g. dorsal), this will no longer be an issue. – Øyvind Evju May 29 '13 at 12:48
• Welcome to SciComp.SE! While FEniCS-related questions are on topic here, they are expected to have some concrete scientific background. This is really a (potential) bug report, and should be posted on the Dolfin issues tracker. (For what it's worth, I can replicate the issue with next on bitbucket.) I'm voting to close this question, but feel free to come back if you have problems with the computational science side of things. – Christian Clason May 29 '13 at 13:06
• Thanks for your fast help. Yes, it seems to be a bug and I will visit the bitbucket for more information. – Sebastian May 29 '13 at 13:28

Some code in DofMapBuilder::reorder_local may scale poorly (see Anders' answer). As a workaround you may disable reordering dofs

parameters['reorder_dofs_serial'] = False
H13 = VectorFunctionSpace(mesh, "DG", 1)

• Thanks, I will try your workaround. Is reordering only needed for parallel runs or are there other reasons why this step is required? – Sebastian May 29 '13 at 15:12
• Only for performance reasons I think. There should be no assumptions on dof ordering in DOLFIN. – Jan Blechta May 29 '13 at 15:24

The DG space in this case has 72,000,000 dofs while the dimension of the CG space is only 3,090,903. So expect it to take quite some time longer to create the DG space, especially if the dofs are reordered (which is the default behavior).