Can not multiply FunctionSpaces in current version

Hi all!

I have tried to run my old example with current Anaconda version and it has stopped with error:
“unsupported operand(s) type” for operator *

My MWE is:
from dolfin import *
mesh = IntervalMesh(99,0,1.)
V = FunctionSpace(mesh, “CG”, 1)
ME = V*V

What should I use now for it?

In the current stable version, mixed spaces are constructed at the element level:

from dolfin import *
mesh = IntervalMesh(99,0,1.)

# Old:
#V = FunctionSpace(mesh, "CG", 1)
#M = V*V

# Current equivalent:
VE = FiniteElement("CG",mesh.ufl_cell(),1)
ME = MixedElement([VE,VE])

# Alternative to calling MixedElement constructor:
#ME = VE*VE

M = FunctionSpace(mesh,ME)
3 Likes