Mixed Finite element ValueError too many values to unpack


I have a question regarding the Mixed Function spaces. I’ve tried the following code and I got this error.

ValueError: too many values to unpack (expected 2)
import ufl
from dolfinx import fem, io, mesh
from mpi4py import MPI

msh = mesh.create_rectangle(comm=MPI.COMM_WORLD,
                            points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),

W = ufl.FiniteElement("N1curl", msh.ufl_cell(), 1)
V = ufl.FiniteElement("CG", msh.ufl_cell(), 1)
V = fem.FunctionSpace(msh, ufl.MixedElement([W, V]))

(u1,u2) = ufl.TestFunction(V)

and if I use:

u = ufl.TestFunction(V)

I can see the shape is (3, ) but it cannot split it.

In the previous version of Dolfin, I could easily do this and the program worked fine, but here I am getting this error. I would appreciate it if you could give me some tips to solve this problem.


First of all, you code has several typos, as VV and WW is not defined.
Secondly, you need to use ufl.TestFunctions with an s at the end to use the split command that you are suggesting.

Thank you. You are correct about WW and VV. My apologies for that. I edited the text.