[2019.1.0] Mixed real function space?

Hello,

I am trying to create a mixed function space consists of multiple real function space (basically I need a collection of many 1-global-dof function spaces). For the MWE code here I am trying to just mix 2 of them.

import fenics as fe
mesh = fe.UnitSquareMesh(5,5)
foo=fe.FiniteElement("R")
ME  = fe.FunctionSpace(mesh, fe.MixedElement([foo,foo]))

r = fe.Function(ME)
r.interpolate( fe.Constant((2,3))  )

the above code gives me this error on line 3: ufl.log.UFLException: Non-matching cell of finite element and domain.

However if I change the element type to our usual CG1 the code works just fine:

import fenics as fe
mesh = fe.UnitSquareMesh(5,5)
foo=fe.FiniteElement("Lagrange", "triangle", 1)
ME  = fe.FunctionSpace(mesh, fe.MixedElement([foo,foo]))

r = fe.Function(ME)
r.interpolate( fe.Constant((2,3))  )

Is there any particular way to mix real function spaces ?

Can’t try it right now, but have you tried with fe.VectorElement?

Oh duh! I forgot about that! It works as I needed it to!