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

Mixed function spaces for complex valued problems in 2016.1.0?

–1 vote

Hello,

I am trying to update an existing code to adhere to the 2016.1.0 FEniCS version. In order to solve a complex valued EM problem in older versions, I created a mixed space for the real and imaginary parts. Both subspaces were the N1curl1 space and in the new version, I get a deprecation warning that leads me to try the following syntax:

Vr = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
Vi = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
Vc = Vr * Vi # for real and imaginary parts
V = FunctionSpace(mesh, Vc)

which produces the following error:

*** Error:   Unable to create function space.
*** Reason:  Illegal argument, not a finite element: <Function space of dimension 48904 (<Mixed element: (<N1curl1 on a tetrahedron>, <N1curl1 on a tetrahedron>)>)>.
*** Where:   This error was encountered inside functionspace.py.

Any suggestions?

asked Jul 15, 2016 by brk888 FEniCS Novice (990 points)

1 Answer

+1 vote
 
Best answer

The second argument to FunctionSpace should be the element. For example,

Er = FiniteElement("Nedelec 1st kind H(curl)", mesh.ufl_cell(), 1)    
Ei = FiniteElement("Nedelec 1st kind H(curl)", mesh.ufl_cell(), 1)
Ec = Er * Ei

V = FunctionSpace(mesh, Ec)
answered Jul 15, 2016 by Magne Nordaas FEniCS Expert (13,820 points)
selected Aug 15, 2016 by johannr

Thank you very much, that did the trick!

...