kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
512 stars 80 forks source link

Free Electron Galerkin FEM in scikitfem #644

Closed nikosmatsa closed 3 years ago

nikosmatsa commented 3 years ago

I have the following problem.But I don't know if it is applicable in your module

https://github.com/nikosmatsa/Finite-Differences-Methods-for-PDE-/blob/main/Free%20Electron%20Galerkin%20FEM%20.ipynb

kinnala commented 3 years ago

One comment: support for complex forms was added very recently, you need to pass dtype to BilinearForm. I think there is no example but there is a test somewhere. See https://github.com/kinnala/scikit-fem/blob/master/skfem/assembly/form/form.py#L26 for the implementation.

gdmcbain commented 3 years ago

But is a complex form required here? I see that the bilinear form a contains the imaginary factor κ but only as a simple factor. The bilinear form could be redefined without it as real and then the real assembled matrix multiplied by κ.

This is how it was done for the primitive Orr–Sommerfeld equation in ex29—a complex equation but only essentially involving real forms multiplied by complex coefficients.

https://github.com/kinnala/scikit-fem/blob/91c6c5b90a0cbf1f4d26213a13f0145aa3d90980/docs/examples/ex29.py#L97-L111

I imagine that intrinsically complex forms are possible but I can't think of an example. Do you have one?

kinnala commented 3 years ago

I'm not sure but probably something where you have a complex-valued nonhomogeneous material parameter such as in this example: https://doc.freefem.org/tutorials/complexNumbers.html