Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Non-homogeneous Maxwell's Equations

More
3 years 7 months ago #3157 by heitzmann
I've been trying to implement solvers for Maxwell's equations (both scattering and eigenvalue problems) in 2 and 3 dimensions. Everything worked fine in 2D (including complex domains, eigenvector sources and PML).
However, in 3D, even small problems seem to take much longer to solve than I would expect. I'm guessing I'm doing something wrong.

I attached a simple example:

File Attachment:

File Name: test3d.py
File Size:2 KB
(no PML and only 2 materials) to show what I'm doing. Should I be using a different solver or preconditioner?

Any help is appreciated!
Attachments:
More
3 years 7 months ago #3163 by joachim
Hello,

one big difference is that in 3D you have "many" negative eigenvalues, evaluating the biform with any gradient field leads to the negative sign.

A simple method is the "shifted Laplacian" preconditioning: Setup a second, artificial biform with volume damping, build the preconditioner for the artificial problem, and use it to solve the original equation:
Code:
apre = ngsolve.BilinearForm(fes) apre += p * (ngsolve.curl(u) * ngsolve.curl(w)) * ngsolve.dx apre += -(1+1j)*(k0 ** 2) * q * (u * w) * ngsolve.dx pre = ngsolve.Preconditioner(apre, "bddc")

Be careful to choose the sign of the imaginary part of the L2-coefficient according to damping, when you have also physical damping.

It still takes many iterations, and you may have to play with the damping coefficient.

Some references are: Erlangga, Vuik and Oosterlee
www.sciencedirect.com/science/article/abs/pii/S0168927404000091
or
link.springer.com/content/pdf/10.1007/s11831-007-9013-7.pdf


Best, Joachim
Attachments:
More
3 years 7 months ago #3165 by heitzmann
Thanks for the input, Joachim! I'll go thru the references you indicated and see whether I can improve the code. Our use case is for topological optimization, so any gains in a single run is a big advantage. We currently use COMSOL, but we'd love to use an open-source alternative!
Time to create page: 0.166 seconds