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

Definition of a function in complex form

0 votes

Hello
I am trying to simulate a perfectly matched layers (PML) for an elastic wave propagating in a solid. For this purpose I need to define a specific function which is called "stretching function". It is defined in the below form:

enter image description here

a0 is a constant and "fi" is an arbitrary function (in X and Y) directions. The question is:
How can I define the above function? As you can see it is a complex function (with a term multiplied by "i" ). As far as I know FEniCS does not support complex numbers and functions. Does anybody know if it is possible to implement it in FEniCS or not? If it is, how can I define it?
Thanks in advance for your help.

asked Mar 4, 2016 by jafar FEniCS Novice (670 points)

It is possible, but you will have to split anything that is complex into a real and an imaginary part. You can find examples hereof on this site.
That means that you can define two Expressions, one for the real part and one for the imaginary part of your stretching function, and use both of them in the weak form.

...