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

Complex valued problem

+1 vote

I'm working on the implementation of a complex valued problem and found the following topic of high value:
https://fenicsproject.org/qa/8647/solving-a-complex-eigenvalue-problem?show=8647#q8647

Here maartent post the following code snippet which is exactly what I'm looking for.

V = FunctionSpace(mesh, 'CG' 1)
Vcomplex = V * V
ureal, uimag = TrialFunction(Vcomplex)
vreal, vimag = TestFunction(Vcomplex)

Is that syntax still correct in the latest stable version, i.e.

docker pull quay.io/fenicsproject/stable:latest

since it returns the following error:

Vcomplex = V * V
TypeError: unsupported operand type(s) for *: 'FunctionSpace' and 'FunctionSpace'

Or is the problem most likely elsewhere?

asked Dec 9, 2016 by steynw FEniCS Novice (190 points)

1 Answer

+2 votes

Hi, I got the same problem and I think it is due to the latest update. Check change logs for more information:
https://bitbucket.org/fenics-project/dolfin/src/0f003bc07ee5fd583fb956245016d5972b80fea1/ChangeLog.rst?fileviewer=file-view-default

Maybe try this way:

P1r = FiniteElement('P', tetrahedron, 1)
P1i = FiniteElement('P', tetrahedron, 1)
TH= P1r * P1i
Vcomplex = FunctionSpace(mesh, TH) # Vcomplex = V * V
ureal, uimag= TrialFunction(Vcomplex)
vreal, vimag = TestFunction(Vcomplex)

answered Dec 9, 2016 by custache FEniCS Novice (320 points)

Thanks a lot for this suggestion! Personally I don't see any specific mentions in the change log (for the latest issue) the issue might be related to.

...