Quadratic Runtime for Creating VectorFunctionSpace( mesh, "DG", 0 )

Asked by Heinz Zorn

I have noticed that the creation of a VectorFunctionSpace with piecewise constant functions takes quite long - much longer than a piecewise linear continuous VectorFunctinSpace for the same mesh.

Doing some tests on this I received the impression that there is a quadratic runtime with respect to the meshsize.

Can anybody tell me where the different VectorFunctionSpaces are implemented? I would like to try to check if there is any hopefully unnecessary quadratic loop.

You can run the following code to see the effect:

import timeit
from dolfin import *

fileCG1 = open( "cg1.txt", "w" )
fileDG0 = open( "dg0.txt", "w" )

for i in range(1,31):
 mesh = UnitCubeMesh( 10*i,10,10 )

 print "meshsize", 10*i
 print "CG 1"
 tic = timeit.default_timer()
 V1 = VectorFunctionSpace( mesh, "CG", 1 )
 toc = timeit.default_timer()
 time = toc - tic
 fileCG1.write( str(time) + " " )
 print "done in ", time

 print "DG 0"
 tic = timeit.default_timer()
 V1 = VectorFunctionSpace( mesh, "DG", 0 )
 toc = timeit.default_timer()
 time = toc - tic
 fileDG0.write( str(time) + " " )
 print "done in ", time
 print "\n\n"


Question information

English Edit question
FEniCS Project Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :

FEniCS no longer uses Launchpad for Questions & Answers. Please consult the documentation on the FEniCS web page for where and how to (re)post your question: http://fenicsproject.org/support/

Can you help with this problem?

Provide an answer of your own, or ask Heinz Zorn for more information if necessary.

To post a message you must log in.