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

UFL files with complex variables.

+2 votes

Hallo
I have todeal with a three dimensional problem of fluid dynamic stability. To simplify its solution I have applyed a spatial Fourier transform along one of coordinates. With this approach my variables, Fourier coefficients, are complex numbers. Since there are nonlinear terms and multiplications with the imaginary unit, splitting the variables in their real and imaginary parts would make my formulation very complicated.

My question is if there are embedded tools in UFL to deal with complex variables or I necessarily have to split my variables into their real and imaginary parts and deal with them separately. I didn't find about this issue in the UFL manual.

Thanks in advance for any suggestion.
Stefano

asked Nov 7, 2015 by Stefano FEniCS Novice (460 points)

1 Answer

+1 vote

No, at present UFL is limited to real numbers. It will be a significant project to implement complex numvers fully throughout fenics.

answered Nov 9, 2015 by chris_richardson FEniCS Expert (31,740 points)

Hallo
Thanks for your answer. It would be a very useful feature.
hallo
Stefano

Just out of curiosity, which parts of FEniCS need major rewriting to support complex numbers? I would naively say that just like VectorFunctionSpace one could implement ComplexFunctionSpace which is just a shortcut for a mixed functionspace. UFL needs to be made aware of the imaginary i, but the rest of FEniCS would stay the same, I would (wrongly) say.

...