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

Asked by Heinz Zorn on 2013-07-30

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"

fileCG1.close()
fileDG0.close()

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
2013-07-30
Last reply:
2013-07-31
Johannes Ring (johannr) said : #1

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.