A complex diffusion coefficient in a complex element space

I am trying to simulate the complex ginzburg landau equation using a complex element. The PDE is a diffusion equation of a complex field with a complex diffusion equation and a non-linear term. I succeeded in simulating the system using two real fields (one for real part and the other for the complex part) but my simulation with a complex element didn’t agree with the simulation using two real spaces. The simulation uses a Laplacian and a non-linear operator which are here:

fes = ngsolve.H1(mesh, order=3, complex=True)  
u, v = fes.TnT() 
D_u  = (1 + 1.j*alpha)   # complex!
a = ngsolve.BilinearForm(fes, symmetric=True)  
a += D_u*ngsolve.grad(u)*ngsolve.grad(v)*ngsolve.dx 
# This is laplacian with a complex diffusion coef 

# For the nonlinear part of the PDE, the function:
def mkgfun(fes,b_3):
    gfun = ngsolve.BilinearForm(fes,nonassemble=True)   
   # don't assemble so nonlinear part can be updated!
    gfun += u*v*ngsolve.dx 
    gfun += -1*(b_3 - 1.0j)*ngsolve.InnerProduct(ngsolve.Conj(u),u)*u*v*ngsolve.dx  # Chate's form 
    return gfun

I assemble the non-linear operator gfun while doing the integration. The scheme for update is Crank Nicolson and then I add on the non-linear part by hand with first order explicit Eulerian op split. I am curious whether the multiplication with complex numbers is ok. Thank you!

Can you post a full minimal example?

Chris,

Here is a notebook using a complex element that I think is not solving the PDE properly https://github.com/aquillen/Pattern_formation_FEM_NGsolve/blob/main/complex_ginzburg_landau_v00.ipynb

Here is a notebook where I used two real fields to create the element instead and I think the PDE is integrating properly https://github.com/aquillen/Pattern_formation_FEM_NGsolve/blob/main/complex_ginzburg_landau_v01.ipynb

Last year I solved the same pattern formation model on a different fem platform (skfem) here https://github.com/aquillen/Pattern_Formation_FEM/blob/main/fem_complex_ginzburg_landau.ipynb but using a complex element.

So it should be possible to solve this nonlinear PDE in ngsolve using a complex element!

If you take a look: very much appreciated + Thank-you!

AssembleLinearization assumes that the bilinear-from is differentiable, in this case it means complex differentiable, which is a quite strong requirement.

For example, taking the complex conjugate is not complex differentiable. This is a possible explanation why the real system is working, but not the complex formulation (consider Cauchy-Riemann equations)

You can define a BilinearForm manually which provides the matrix of some Newton-like method.

Joachim

Joachim,
That explains it! I was wondering what was off!
Thanks!