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

TensorFunctionSpace unreasonably slow

+1 vote

I have produced

from dolfin import *
mesh = RectangleMesh(0,0,1,1,160,160)
t0 = Timer("CG1 FunctionSpace definition")
V1 = FunctionSpace(mesh,'CG',1); 
t0.stop()
t0 = Timer("CG2 FunctionSpace definition")
V2 = FunctionSpace(mesh,'CG',2)
t0.stop()
t0 = Timer("DG0 FunctionSpace definition")
S = FunctionSpace(mesh,'DG',0)
t0.stop()
t0 = Timer("DG0 TensorFunctionSpace definition")
St = TensorFunctionSpace(mesh,'DG',0)
t0.stop()
list_timings()

The code times the generation of

#1 scalar CG1 functionspace
#2 scalar CG2 functionspace
#3 scalar DG0 functionspace
#4 tensor DG0 functionspace

I get (seconds)
#1 0.056
#2 0.195
#3 0.023
#4 13.95

There is a factor of four difference in the number of DOF for #1 and #2, so this is completely reasonable. DG0 is faster than CG1 despite having twice the number of DOF, but what really strikes me is #4. I would expect this to take less than 0.1 (>4*0.023) seconds, but it takes 100 times longer !?

asked Dec 6, 2013 by KristianE FEniCS Expert (12,900 points)

My timings:

CG1 FunctionSpace definition        |      0.044694    0.044694     1
CG2 FunctionSpace definition        |       0.22218     0.22218     1
DG0 FunctionSpace definition        |      0.018042    0.018042     1
DG0 TensorFunctionSpace definition  |      0.041208    0.041208     1

OK, are you using the development version?

Yes, development version.

1 Answer

0 votes

I guess the solution is to use the development version (or wait).

answered Dec 6, 2013 by KristianE FEniCS Expert (12,900 points)
...