Dear folks!
In a complex problem, the inner product becomes something along the line of
$$ \left\langle u, v \right\rangle = \int\limits_\Omega u \cdot v^* \, dx, $$
right?
If I express this in terms of the real and imaginary parts of u and v $u_r, u_i, ...$, I end up with this:
$$ \left\langle u_r+j u_i, \; v_r + j v_i \right\rangle = \int\limits_\Omega u_r \cdot v_r\, dx + \int\limits_\Omega u_i \cdot v_i \, dx + j \int\limits_\Omega u_i v_r - u_r v_i \, dx. $$
where $j = \sqrt{-1}$.
Now, I'm trying to keep my UFL forms readible, so I defined a function
def dot_c(u_r, u_i, v_r, v_i):
r_r = dot( u_r, v_r ) + dot( u_i, v_i )
r_i = dot( u_i, v_r ) - dot( u_r, v_i )
return ???
How do I return the result? I need to make sure the imaginary part is associated with the function spaces that represent imaginary parts...
return r_r + r_i
or rather
return as_vector( [r_r, r_i] )
or rather something completely different?