ngs-petsc with complex numbers

More
4 years 9 months ago #2349 by JuliusZ
Dear NGSolve / ngs-petsc developers,

I managed to compile ngs-petsc using petsc with real numbers. However, I would like to also use complex numbers. When I tried to compile ngs-petsc with petsc using complex numbers, the compilation failed.
Am I right that this interface is currently not implemented? Are there any plans to implement this or is there anything speaking against this?

Thank you for your reply!

Best,
Julius
More
4 years 9 months ago #2352 by lkogler
You are right, I have not touched the complex case at all yet.

In principle, I do not think it would be hard to handle the complex case. I have not done it yet mostly because I do not know how to make the complex and the real interface work at the same time.

I will try it out sometime this week or next, if I do not run into troubles it should be available in the GitHub at some point.

Best,
Lukas
The following user(s) said Thank You: JuliusZ
More
4 years 9 months ago #2353 by JuliusZ
That's great to hear! Thank you very much!
Please let me know if I can somehow contribute to this (with an example or even to the code basis).

Best,
Julius
More
4 years 9 months ago #2358 by lkogler
I have push a new branch, "complex", to the github repo.

You must set -DPETSC_COMPLEX=ON, and the complex version of the interface will be built.
(Compiling will throw an error when it tries to compile against a real PETSc installation when this is turned on, or if it finds a complex one when it is turned off)

You can have the real and complex interfaces installed at the same time, one will be called "ngs_petsc" and the other "ngs_petsc_complex".

Unfortunately:
1) You cannot load both at the same time
2) When you a complex and a real PETSc installation at the same time, you have to be careful with your LD_LIBRARY_PATH/PETSC_ARCH/PETSC_DIR environment variables! For me, loading ngs_petsc when the complex libraries take priority will not produce an error but garbage output!


Best, Lukas
More
4 years 9 months ago #2360 by JuliusZ
That's awesome! I could compile and run the example. I will now try to implement my own examples. Thank you very much!

Best,
Julius
More
4 years 9 months ago #2430 by gcdiwan
Hi Lukas
I think i am missing something when you say the complex petsc interface should get built automatically. I have the option DPETSC_COMPLEX=ON but cmake warns it's not being used. Do i have to specify where the ngsolve-petsc is located?
Time to create page: 0.128 seconds