Preconditioners for Maxwells Equation


I am using NGSolve to solve Maxwell’s equations in time-harmonic form.
The problem that I work on is B=curl(u) * curl(v)+betauv. I use the first order Nedelec space V for the approximate solution and use an auxiliary subspace W of the Nedelec space (W =span {second order face basis+third order volume basis) for computing the error function ‘’ e’’.

I print the condition numbers of the stiffness matrices on V and W. The code produce results for beta>0 and for small negative values of beta, e.g. {-10^(-4), -10^(-2) ,-10}, but with big negative values of beta like -10^(2) or -10^(4) the code gives the error

Eigensystem: Preconditioner negative
Traceback (most recent call last):
File “”, line 195, in
File “”, line 127, in SolveBVP
ValueError: max() arg is an empty sequence

I am not quite familiar with using Preconditioners, I tried using different types of them but still have the same error. I am not sure which type of them work fine with my problem.

I am grateful for any explanation or help.



Here is my python script.


Hello Ahmed,

The function “Eigenvalues_Preconditioner” computes Eigenvalues of the the generalized EVP
A x = \lambda C x
For SPD (or hermitian) matrices A and C.

When beta is positive (or not too negative), your matrix is SPD. When it is not, it also has negative eigenvalues, and Eigenvalues_Preconditioner does not work. This does not say anything about how good those preconditioners are, just that you cannot use Eigenvalues_Preconditioner to get the Eigenvalues.

NGSolve has the “ArnoldiSolver” to solve such problems, but afaik both matrices A and C have to be given as sparse matrices, which is not the case if C is (the inverse of) a preconditioner. Besides that I do not know if there is a built-in solver that can compute these Eigenvalues.

For large, negative lambda, I am not sure which preconditioners work well.

I believe “bddc” works if your mesh is fine enough, but will have to invert a relatively large problem directly.

“multigrid” should work as long as the coarsest mesh is fine enough, in which case it also requires you to solve a relatively large problem directly.