Reproducing Stable and unstable finite elements for the Maxwell eigenvalue problem in Fenicsx

As far as I know, setWhichEigenpairs and setTarget are useful when using spectral transformation in SLEPc, which you are not using here. To do that, add the following lines to your code:

solver = SLEPc.EPS()
solver.create()
solver.setOperators(A, B)

# Add this #
solver.setType(SLEPc.EPS.Type.KRYLOVSCHUR)
st = solver.getST()
st.setType(SLEPc.ST.Type.SINVERT)
############

solver.setProblemType(SLEPc.EPS.ProblemType.GHEP)
solver.setWhichEigenpairs(SLEPc.EPS.Which.TARGET_MAGNITUDE)
solver.setTarget(5.5)
neigs = 12
solver.setDimensions(nev=neigs, ncv=2*neigs)
solver.setFromOptions()

Also, this post may be useful:

1 Like